diff --git a/flutter_apns/CHANGELOG.md b/flutter_apns/CHANGELOG.md index b4632f5..159c073 100644 --- a/flutter_apns/CHANGELOG.md +++ b/flutter_apns/CHANGELOG.md @@ -1,13 +1,20 @@ +### 1.6.1 +* (#102, #31) resolved invoking onResume twice + ### 1.6.0 * (#97) updated dependencies * enhanced example app + ### 1.5.4 * explicitly mentioned supported platforms in pubspec.yaml + ### 1.5.3 * update firebase dependencies * Add readme: how to run example app in iOS + ### 1.5.1 * (#58) fix unable to build android (update firebase dependencies) + ### 1.5.0-dev.1 * (#51) Update firebase push connector to support the firebase_messaging 9.0.0. API * (#43) Fix onLaunch not working with closed app diff --git a/flutter_apns/pubspec.yaml b/flutter_apns/pubspec.yaml index 5f998d2..d7c1d8d 100644 --- a/flutter_apns/pubspec.yaml +++ b/flutter_apns/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_apns description: APNS push notification plugin. Uses firebase_messaging on Android, but replaces it on iOS with custom implementation. -version: 1.6.0 +version: 1.6.1 homepage: https://github.com/mwaylabs/flutter-apns plugin: @@ -19,7 +19,7 @@ dependencies: sdk: flutter firebase_core: ^2.1.1 firebase_messaging: ^14.0.3 - flutter_apns_only: ^1.5.2 + flutter_apns_only: ^1.6.1 dev_dependencies: flutter_test: diff --git a/flutter_apns_only/CHANGELOG.md b/flutter_apns_only/CHANGELOG.md index ffda3e1..6bc928c 100644 --- a/flutter_apns_only/CHANGELOG.md +++ b/flutter_apns_only/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.6.1 +* resolved invoking onResume twice + ## 1.6.0 * upgraded together with flutter_apns main package * unify version number diff --git a/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift b/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift index 6b4c401..e60f157 100644 --- a/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift +++ b/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift @@ -182,19 +182,17 @@ func getFlutterError(_ error: Error) -> FlutterError { public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { channel.invokeMethod("onToken", arguments: deviceToken.hexString) } - - - public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) -> Bool { - let userInfo = FlutterApnsSerialization.remoteMessageUserInfo(toDict: userInfo) - - if resumingFromBackground { - onResume(userInfo: userInfo) - } else { - channel.invokeMethod("onMessage", arguments: userInfo) - } - - completionHandler(.noData) - return true + + public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) -> Bool { + let userInfo = FlutterApnsSerialization.remoteMessageUserInfo(toDict: userInfo) + + if resumingFromBackground { + } else { + channel.invokeMethod("onMessage", arguments: userInfo) + } + + completionHandler(.noData) + return true } public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { @@ -212,8 +210,8 @@ func getFlutterError(_ error: Error) -> FlutterError { completionHandler([.alert, .sound]) } else { completionHandler([]) - let userInfo = FlutterApnsSerialization.remoteMessageUserInfo(toDict: userInfo) - self.channel.invokeMethod("onMessage", arguments: userInfo) + let dict = FlutterApnsSerialization.remoteMessageUserInfo(toDict: userInfo) + self.channel.invokeMethod("onMessage", arguments: dict) } } } @@ -232,13 +230,9 @@ func getFlutterError(_ error: Error) -> FlutterError { return } - onResume(userInfo: dict) + channel.invokeMethod("onResume", arguments: dict) completionHandler() } - - func onResume(userInfo: [AnyHashable: Any]) { - channel.invokeMethod("onResume", arguments: userInfo) - } } extension UNNotificationCategoryOptions { diff --git a/flutter_apns_only/pubspec.yaml b/flutter_apns_only/pubspec.yaml index b3e5eb9..a813dd8 100644 --- a/flutter_apns_only/pubspec.yaml +++ b/flutter_apns_only/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_apns_only description: APNS push notification plugin. Works only on iOS. See flutter_apns for apns & firebase combo -version: 1.6.0 +version: 1.6.1 homepage: https://github.com/mwaylabs/flutter-apns environment: