Skip to content

Commit

Permalink
fix(messaging, ios): register app delegate with google utilities for …
Browse files Browse the repository at this point in the history
…swizzling (#13525)
  • Loading branch information
russellwheatley authored Oct 23, 2024
1 parent 7376043 commit 8ff0f88
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ firebase-debug.log
firestore-debug.log
database-debug.log
ui-debug.log

**/.build/**/*
**/.build/**/*
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ API_AVAILABLE(ios(10.0))
@interface FLTFirebaseMessagingPlugin : FLTFirebasePlugin <FlutterPlugin,
FLTFirebasePlugin,
FIRMessagingDelegate,
UIApplicationDelegate,
UNUserNotificationCenterDelegate>
#else
@interface FLTFirebaseMessagingPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n
_initialNotificationGathered = YES;
[self initialNotificationCallback];

#if TARGET_OS_OSX
// For macOS we use swizzling to intercept as addApplicationDelegate does not exist on the macOS
// registrar Flutter implementation.
[GULAppDelegateSwizzler registerAppDelegateInterceptor:self];
[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods];

Expand All @@ -246,7 +243,11 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n
didReceiveRemoteNotificationWithCompletionSEL,
method_getImplementation(donorMethod), method_getTypeEncoding(donorMethod));
}
#else
#if !TARGET_OS_OSX
// `[_registrar addApplicationDelegate:self];` alone doesn't work for notifications to be received
// without the above swizzling This commit:
// https://github.com/google/GoogleUtilities/pull/162/files#diff-6bb6d1c46632fc66405a524071cc4baca5fc6a1a6c0eefef81d8c3e2c89cbc13L520-L533
// broke notifications which was released with firebase-ios-sdk v11.0.0
[_registrar addApplicationDelegate:self];
#endif

Expand Down

0 comments on commit 8ff0f88

Please sign in to comment.