提交 46190cff authored 作者: 史晓晨's avatar 史晓晨

feat:iOS通知设置-App处于前台时是否展示

上级 ec32b09b
...@@ -233,17 +233,18 @@ userInfo fetchCompletionHandler ...@@ -233,17 +233,18 @@ userInfo fetchCompletionHandler
*/ */
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)( - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(
UNNotificationPresentationOptions))completionHandler { UNNotificationPresentationOptions))completionHandler {
// if(_showNoticeWhenForeground) { if (_showNoticeWhenForeground) {
// } else {
// 处理iOS 10通知,并上报通知打开回执 // 处理iOS 10通知,并上报通知打开回执
[self handleiOS10Notification:notification isSendAck:YES]; [self handleiOS10Notification:notification isSendAck:YES];
// 通知不弹出
// completionHandler(UNNotificationPresentationOptionNone);
// 通知弹出,且带有声音、内容和角标 // 通知弹出,且带有声音、内容和角标
completionHandler( completionHandler(
UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert |
UNNotificationPresentationOptionBadge); UNNotificationPresentationOptionBadge);
// } } else {
PushLogD(@"Push notification not display when foreground, _showNoticeWhenForeground: %d.", _showNoticeWhenForeground);
// 通知不弹出
completionHandler(UNNotificationPresentationOptionNone);
}
} }
/** /**
...@@ -256,7 +257,6 @@ userInfo fetchCompletionHandler ...@@ -256,7 +257,6 @@ userInfo fetchCompletionHandler
if ([userAction isEqualToString:UNNotificationDefaultActionIdentifier]) { if ([userAction isEqualToString:UNNotificationDefaultActionIdentifier]) {
// 处理通知 // 处理通知
[self handleiOS10Notification:response.notification isSendAck:NO]; [self handleiOS10Notification:response.notification isSendAck:NO];
// [self.channel invokeMethod:@"onNotificationOpened" arguments:response.notification.request.content.userInfo];
} }
// 通知dismiss,category创建时传入UNNotificationCategoryOptionCustomDismissAction才可以触发 // 通知dismiss,category创建时传入UNNotificationCategoryOptionCustomDismissAction才可以触发
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论