@@ -183,20 +183,6 @@ func getFlutterError(_ error: Error) -> FlutterError {
183
183
channel. invokeMethod ( " onToken " , arguments: deviceToken. hexString)
184
184
}
185
185
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
-
200
186
public func userNotificationCenter( _ center: UNUserNotificationCenter , willPresent notification: UNNotification , withCompletionHandler completionHandler: @escaping ( UNNotificationPresentationOptions ) -> Void ) {
201
187
let userInfo = notification. request. content. userInfo
202
188
@@ -212,8 +198,8 @@ func getFlutterError(_ error: Error) -> FlutterError {
212
198
completionHandler ( [ . alert, . sound] )
213
199
} else {
214
200
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 )
217
203
}
218
204
}
219
205
}
@@ -239,6 +225,10 @@ func getFlutterError(_ error: Error) -> FlutterError {
239
225
func onResume( userInfo: [ AnyHashable : Any ] ) {
240
226
channel. invokeMethod ( " onResume " , arguments: userInfo)
241
227
}
228
+
229
+ func onMessage( userInfo: [ AnyHashable : Any ] ) {
230
+ channel. invokeMethod ( " onMessage " , arguments: userInfo)
231
+ }
242
232
}
243
233
244
234
extension UNNotificationCategoryOptions {
0 commit comments