Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(messaging, ios): fixed isHeadless for react-native-navigation #7868

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Changes from 2 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 @@ -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];
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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 &&
Expand All @@ -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)]);
Expand Down
Loading