Skip to content

Commit e4090f9

Browse files
Update
No need to check for Active; that would prevent local foreground notifications being actionable when the app has gone back to background
1 parent 73e75fa commit e4090f9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,12 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot
418418

419419
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
420420
#ifdef CN1_INCLUDE_NOTIFICATIONS
421-
UIApplicationState state = [[UIApplication sharedApplication] applicationState];
422-
if(state == UIApplicationStateActive)
421+
if( [response.notification.request.content.userInfo valueForKey:@"__ios_id__"] != NULL)
423422
{
424-
if( [response.notification.request.content.userInfo valueForKey:@"__ios_id__"] != NULL)
425-
{
426-
CN1Log(@"Received local notification while running: %@", response.notification);
427-
428-
NSString* alertValue = [response.notification.request.content.userInfo valueForKey:@"__ios_id__"];
429-
if ([response.notification.request.content.userInfo valueForKey:@"foreground"] != NULL)
430-
com_codename1_impl_ios_IOSImplementation_localNotificationReceived___java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG fromNSString(CN1_THREAD_GET_STATE_PASS_ARG alertValue));
431-
}
423+
CN1Log(@"Received local notification while running: %@", response.notification);
424+
NSString* alertValue = [response.notification.request.content.userInfo valueForKey:@"__ios_id__"];
425+
if ([response.notification.request.content.userInfo valueForKey:@"foreground"] != NULL)
426+
com_codename1_impl_ios_IOSImplementation_localNotificationReceived___java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG fromNSString(CN1_THREAD_GET_STATE_PASS_ARG alertValue));
432427
}
433428
#endif
434429
#ifdef INCLUDE_CN1_PUSH

0 commit comments

Comments
 (0)