From ee0c6fe4eade4a36fc03d2961ccc07f52a8d52f1 Mon Sep 17 00:00:00 2001 From: Thorn Chorn Date: Mon, 27 Apr 2026 11:05:04 +0700 Subject: [PATCH] Update telegram_login package to version 1.2.1, addressing iOS compilation issues for older Flutter SDK versions by removing unsupported APIs. Adjust documentation and dependencies accordingly. --- telegram_login/CHANGELOG.md | 7 +++ telegram_login/README.md | 2 +- .../ios/Classes/TelegramLoginPlugin.swift | 59 +------------------ telegram_login/ios/telegram_login.podspec | 2 +- telegram_login/pubspec.yaml | 2 +- 5 files changed, 13 insertions(+), 59 deletions(-) diff --git a/telegram_login/CHANGELOG.md b/telegram_login/CHANGELOG.md index 56a3ac2..1fd2a0c 100644 --- a/telegram_login/CHANGELOG.md +++ b/telegram_login/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.2.1 + +- Fix iOS compilation error for consumers on older Flutter SDK versions + - Removed `FlutterSceneLifeCycleDelegate` conformance and `addSceneDelegate` call + - These APIs are not available on Flutter versions below 3.16+ + - `addApplicationDelegate` alone is sufficient; Flutter's engine forwards scene delegate URL events to registered application delegates automatically + ## 1.2.0 - iOS implementation is now self-contained and no longer depends on the external `telegram-login-ios` Swift package diff --git a/telegram_login/README.md b/telegram_login/README.md index b3c21c0..c6b9466 100644 --- a/telegram_login/README.md +++ b/telegram_login/README.md @@ -27,7 +27,7 @@ Add the package to your app's `pubspec.yaml`: ```yaml dependencies: - telegram_login: ^1.2.0 + telegram_login: ^1.2.1 ``` Then run `flutter pub get`. diff --git a/telegram_login/ios/Classes/TelegramLoginPlugin.swift b/telegram_login/ios/Classes/TelegramLoginPlugin.swift index c983624..853567d 100644 --- a/telegram_login/ios/Classes/TelegramLoginPlugin.swift +++ b/telegram_login/ios/Classes/TelegramLoginPlugin.swift @@ -10,9 +10,8 @@ import UIKit /// - Receiving and processing callback URLs from Telegram /// - Delivering login results or errors back to Dart /// -/// The plugin supports both classic `UIApplicationDelegate` apps and modern -/// scene-based apps (iOS 13+). URL callbacks are automatically forwarded to -/// the Telegram SDK for processing. +/// URL callbacks from the app delegate are automatically forwarded to the +/// Telegram SDK for processing. public class TelegramLoginPlugin: NSObject, FlutterPlugin { /// Indicates whether the Telegram Login SDK has been configured with @@ -27,7 +26,7 @@ public class TelegramLoginPlugin: NSObject, FlutterPlugin { /// Registers the plugin with the Flutter engine. /// /// Creates the method channel, initializes the plugin instance, and - /// registers for application/scene delegate callbacks to handle URL opens. + /// registers for application delegate callbacks to handle URL opens. /// /// - Parameter registrar: The Flutter plugin registrar for registering /// method channels and application delegates. @@ -39,9 +38,6 @@ public class TelegramLoginPlugin: NSObject, FlutterPlugin { let instance = TelegramLoginPlugin() registrar.addMethodCallDelegate(instance, channel: channel) registrar.addApplicationDelegate(instance) - if #available(iOS 13.0, *) { - registrar.addSceneDelegate(instance) - } } /// Handles incoming method calls from the Dart side. @@ -326,52 +322,3 @@ public class TelegramLoginPlugin: NSObject, FlutterPlugin { return true } } - -// MARK: - FlutterSceneLifeCycleDelegate (scene-based apps, iOS 13+) -// -// These methods are called by Flutter for apps using the UIScene lifecycle -// (iOS 13+). They handle URL callbacks in modern scene-based apps. - -@available(iOS 13.0, *) -extension TelegramLoginPlugin: FlutterSceneLifeCycleDelegate { - - /// Handles URL open requests in a scene-based app. - /// - /// Called when the app receives a URL through a custom scheme - /// (e.g., `tglogin://callback`). Extracts the first URL from the - /// context set and forwards it to the Telegram SDK. - /// - /// - Parameters: - /// - scene: The UIScene that received the URL - /// - URLContexts: A set of UIOpenURLContext objects containing URLs - /// - Returns: `true` if a URL was handled, `false` otherwise - public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { - guard let url = URLContexts.first?.url else { return false } - DispatchQueue.main.async { [weak self] in - self?.forwardUrl(url) - } - return true - } - - /// Handles universal link continuations in a scene-based app. - /// - /// Called when the app is opened via a universal link during a scene - /// transition. Checks if the activity is a web browsing activity and - /// forwards the URL to the Telegram SDK for OAuth callback processing. - /// - /// - Parameters: - /// - scene: The UIScene that received the activity - /// - userActivity: The NSUserActivity containing the web URL - /// - Returns: `true` if the URL was handled (was a web browsing URL), - /// `false` otherwise - public func scene(_ scene: UIScene, continue userActivity: NSUserActivity) -> Bool { - guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, - let url = userActivity.webpageURL else { - return false - } - DispatchQueue.main.async { [weak self] in - self?.forwardUrl(url) - } - return true - } -} diff --git a/telegram_login/ios/telegram_login.podspec b/telegram_login/ios/telegram_login.podspec index 62fd58d..6756717 100644 --- a/telegram_login/ios/telegram_login.podspec +++ b/telegram_login/ios/telegram_login.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'telegram_login' - s.version = '1.2.0' + s.version = '1.2.1' s.summary = 'Telegram Login SDK for Flutter (iOS)' s.description = <<-DESC A Flutter plugin that provides Telegram Login functionality on iOS using ASWebAuthenticationSession and CryptoKit. diff --git a/telegram_login/pubspec.yaml b/telegram_login/pubspec.yaml index d71a86f..9bd2811 100644 --- a/telegram_login/pubspec.yaml +++ b/telegram_login/pubspec.yaml @@ -1,6 +1,6 @@ name: telegram_login description: "Flutter plugin for Telegram Login, enabling passwordless OAuth authentication with native SDK integration for iOS and Android." -version: 1.2.0 +version: 1.2.1 homepage: https://github.com/khode-io/telegram-login-flutter environment: