@@ -183,20 +183,6 @@ func getFlutterError(_ error: Error) -> FlutterError {
183183 channel. invokeMethod ( " onToken " , arguments: deviceToken. hexString)
184184 }
185185
186-
187- public func application( _ application: UIApplication , didReceiveRemoteNotification userInfo: [ AnyHashable : Any ] , fetchCompletionHandler completionHandler: @escaping ( UIBackgroundFetchResult ) -> Void ) -> Bool {
188- let userInfo = FlutterApnsSerialization . remoteMessageUserInfo ( toDict: userInfo)
189-
190- if resumingFromBackground {
191- onResume ( userInfo: userInfo)
192- } else {
193- channel. invokeMethod ( " onMessage " , arguments: userInfo)
194- }
195-
196- completionHandler ( . noData)
197- return true
198- }
199-
200186 public func userNotificationCenter( _ center: UNUserNotificationCenter , willPresent notification: UNNotification , withCompletionHandler completionHandler: @escaping ( UNNotificationPresentationOptions ) -> Void ) {
201187 let userInfo = notification. request. content. userInfo
202188
@@ -212,8 +198,8 @@ func getFlutterError(_ error: Error) -> FlutterError {
212198 completionHandler ( [ . alert, . sound] )
213199 } else {
214200 completionHandler ( [ ] )
215- let userInfo = FlutterApnsSerialization . remoteMessageUserInfo ( toDict: userInfo)
216- self . channel . invokeMethod ( " onMessage " , arguments : userInfo )
201+ let dict = FlutterApnsSerialization . remoteMessageUserInfo ( toDict: userInfo)
202+ self . onMessage ( userInfo : dict )
217203 }
218204 }
219205 }
@@ -239,6 +225,10 @@ func getFlutterError(_ error: Error) -> FlutterError {
239225 func onResume( userInfo: [ AnyHashable : Any ] ) {
240226 channel. invokeMethod ( " onResume " , arguments: userInfo)
241227 }
228+
229+ func onMessage( userInfo: [ AnyHashable : Any ] ) {
230+ channel. invokeMethod ( " onMessage " , arguments: userInfo)
231+ }
242232}
243233
244234extension UNNotificationCategoryOptions {
0 commit comments