Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
[registrar addMethodCallDelegate:instance channel:channel];
#if !TARGET_OS_OSX
[registrar publish:instance]; // iOS only supported
if (@available(iOS 13.0, *)) {
if ([registrar respondsToSelector:@selector(addSceneDelegate:)]) {
[registrar performSelector:@selector(addSceneDelegate:) withObject:instance];
}
}
#endif
}

Expand Down Expand Up @@ -530,6 +535,30 @@ - (BOOL)application:(UIApplication *)application
} // didReceiveRemoteNotification
#endif

#pragma mark - SceneDelegate Methods

#if !TARGET_OS_OSX
- (BOOL)scene:(UIScene *)scene
willConnectToSession:(UISceneSession *)session
options:(UISceneConnectionOptions *)connectionOptions {
// Handle launch notification if present
NSDictionary *remoteNotification =
connectionOptions.notificationResponse.notification.request.content.userInfo;
if (remoteNotification != nil) {
// If remoteNotification exists, it is the notification that opened the app.
_initialNotification =
[FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification];
_initialNotificationID = remoteNotification[@"gcm.message_id"];
}

// Register for remote notifications in scene delegate
// This is critical for getting APNS token when using UISceneDelegate
[[UIApplication sharedApplication] registerForRemoteNotifications];

return YES;
}
#endif

#pragma mark - Firebase Messaging API

- (void)messagingUnsubscribeFromTopic:(id)arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
// Suppress warning - use can add the Flutter plugin for Firebase Analytics.
#define FIREBASE_ANALYTICS_SUPPRESS_WARNING

// Forward declaration for FlutterSceneLifeCycleDelegate if not available
#if !TARGET_OS_OSX
@protocol FlutterSceneLifeCycleDelegate;
#endif

#if TARGET_OS_OSX
#ifdef __FF_NOTIFICATIONS_SUPPORTED_PLATFORM
@interface FLTFirebaseMessagingPlugin : FLTFirebasePlugin <FlutterPlugin,
Expand All @@ -48,11 +53,21 @@ API_AVAILABLE(ios(10.0))
@interface FLTFirebaseMessagingPlugin : FLTFirebasePlugin <FlutterPlugin,
FLTFirebasePlugin,
FIRMessagingDelegate,
UIApplicationDelegate,
UNUserNotificationCenterDelegate>
UIApplicationDelegate
#if __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>) || defined(FlutterSceneLifeCycleDelegate)
,
FlutterSceneLifeCycleDelegate
#endif
>
#else
@interface FLTFirebaseMessagingPlugin
: FLTFirebasePlugin <FlutterPlugin, FLTFirebasePlugin, FIRMessagingDelegate>
@interface FLTFirebaseMessagingPlugin : FLTFirebasePlugin <FlutterPlugin,
FLTFirebasePlugin,
FIRMessagingDelegate
#if __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>) || defined(FlutterSceneLifeCycleDelegate)
,
FlutterSceneLifeCycleDelegate
#endif
>
#endif
#endif
@end
@end
Loading