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

Hide/show iOS banner push in open app #100

Open
youstartlabs opened this issue Apr 22, 2017 · 2 comments
Open

Hide/show iOS banner push in open app #100

youstartlabs opened this issue Apr 22, 2017 · 2 comments

Comments

@youstartlabs
Copy link

Hi,
Thanks for the great plugin. I am using the latest release of the plugin V1.0.7 . I am developing on iOS 10.2 .
My issue is related to banner push in iOS. When my app is open, I receive notifications properly, but each time a notification drops from above, similar to what happens when the app is closed. This becomes a trouble when I am sending and receiving push for a chat. Every message drops a notification from top and it takes time for it to disappear.
I am wondering if there is any setting available in the plugin to control hiding/showing of the banner notification when the app is open. If not in plugin, is there any iOS native setting I can change in a file or Xcode which allows control over the banner push.
This SO issue relates to similar, but opposite problem, where they want to show the banner push.

@magickaito
Copy link

Did you find a solution in the end? I am facing a similar problem, I do not want the notification banner when the app is opened.

@magickaito
Copy link

magickaito commented Jul 19, 2017

In case anyone facing same problem, I manage to hide the notification by editing
userNotificationCenter:willPresentNotification method in ParsePushPlugin.m:

-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:
(UNNotification *)notification withCompletionHandler:(void (^)
(UNNotificationPresentationOptions))completionHandler {
NSLog(@"User info %@", notification.request.content.userInfo);

UIApplication *application = [UIApplication sharedApplication];
[self jsCallback:notification.request.content.userInfo withAction:(application.applicationState == UIApplicationStateActive) ? @"RECEIVE" : @"OPEN"];

//added this line to hide the notification
completionHandler(UNNotificationPresentationOptionNone);

//commented out this line to hide the notification
//completionHandler(UNNotificationPresentationOptionAlert);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants