Skip to content
Open
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
13 changes: 9 additions & 4 deletions Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot
{
CN1Log(@"Received local notification while running: %@", notification);

NSString* alertValue = [notification.request.content.userInfo valueForKey:@"__ios_id__"];
com_codename1_impl_ios_IOSImplementation_localNotificationReceived___java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG fromNSString(CN1_THREAD_GET_STATE_PASS_ARG alertValue));
if (completionHandler != nil) {
if ([notification.request.content.userInfo valueForKey:@"foreground"] != NULL) {
completionHandler(UNNotificationPresentationOptionAlert);
Expand All @@ -419,8 +417,15 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot


- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {


#ifdef CN1_INCLUDE_NOTIFICATIONS
if( [response.notification.request.content.userInfo valueForKey:@"__ios_id__"] != NULL)
{
CN1Log(@"Tapped on locally initiated notification: %@", response.notification);
NSString* alertValue = [response.notification.request.content.userInfo valueForKey:@"__ios_id__"];
if ([response.notification.request.content.userInfo valueForKey:@"foreground"] != NULL)
com_codename1_impl_ios_IOSImplementation_localNotificationReceived___java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG fromNSString(CN1_THREAD_GET_STATE_PASS_ARG alertValue));
}
#endif
#ifdef INCLUDE_CN1_PUSH
NSLog( @"Handle push from background or closed" );
// if you set a member variable in didReceiveRemoteNotification, you will know if this is from closed or background
Expand Down