From bbf939f82d37803b8f36c2a2d00d2ceb0e9a9469 Mon Sep 17 00:00:00 2001 From: Beat YT <66485277+Beat-YT@users.noreply.github.com> Date: Sun, 30 Jun 2024 23:49:18 -0400 Subject: [PATCH 1/2] fix(messaging, ios): fixed isHeadless for react-native-navigation --- .../RNFBMessaging/RNFBMessaging+NSNotificationCenter.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m index 67e27dbc93..ba42c67a81 100644 --- a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m +++ b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m @@ -96,8 +96,9 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n if (notification.userInfo[UIApplicationLaunchOptionsRemoteNotificationKey]) { if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { + isHeadless = YES; if (rctRootView != nil) { - isHeadless = YES; + NSMutableDictionary *appPropertiesDict = rctRootView.appProperties != nil ? [rctRootView.appProperties mutableCopy] : [NSMutableDictionary dictionary]; @@ -120,8 +121,8 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n [[UIApplication sharedApplication] registerForRemoteNotifications]; // #endif } else { + isHeadless = NO; if (rctRootView != nil) { - isHeadless = NO; NSMutableDictionary *appPropertiesDict = rctRootView.appProperties != nil ? [rctRootView.appProperties mutableCopy] : [NSMutableDictionary dictionary]; @@ -133,8 +134,8 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n } } } else { + isHeadless = NO; if (rctRootView != nil) { - isHeadless = NO; NSMutableDictionary *appPropertiesDict = rctRootView.appProperties != nil ? [rctRootView.appProperties mutableCopy] : [NSMutableDictionary dictionary]; @@ -148,6 +149,7 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n } - (void)application_onDidEnterForeground { + isHeadless = NO; if ([UIApplication sharedApplication].delegate != nil && [UIApplication sharedApplication].delegate.window != nil && [UIApplication sharedApplication].delegate.window.rootViewController != nil && @@ -160,7 +162,6 @@ - (void)application_onDidEnterForeground { if (rctRootView.appProperties != nil && [rctRootView.appProperties[@"isHeadless"] isEqual:@(YES)]) { NSMutableDictionary *appPropertiesDict = [rctRootView.appProperties mutableCopy]; - isHeadless = NO; if ([appPropertiesDict objectForKey:@"isHeadless"] != nil && [appPropertiesDict[@"isHeadless"] isEqual:@([RCTConvert BOOL:@(YES)])]) { appPropertiesDict[@"isHeadless"] = @([RCTConvert BOOL:@(isHeadless)]); From 81be1e1c3c7c2f6bf282c330109f7806c637040e Mon Sep 17 00:00:00 2001 From: Beat YT <66485277+Beat-YT@users.noreply.github.com> Date: Sat, 17 Aug 2024 19:39:12 -0400 Subject: [PATCH 2/2] Update RNFBMessaging+NSNotificationCenter.m --- .../ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m index ba42c67a81..1867f14a40 100644 --- a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m +++ b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m @@ -98,7 +98,6 @@ - (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)n if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { isHeadless = YES; if (rctRootView != nil) { - NSMutableDictionary *appPropertiesDict = rctRootView.appProperties != nil ? [rctRootView.appProperties mutableCopy] : [NSMutableDictionary dictionary];