|
|
@@ -352,7 +352,9 @@
|
|
|
content.body = @"您收到了新的好友申请";
|
|
|
content.sound = [UNNotificationSound defaultSound];
|
|
|
content.badge = @(self.addFriendBadgeCount);
|
|
|
-
|
|
|
+ content.userInfo = @{
|
|
|
+ @"addFriend":@(1)
|
|
|
+ };
|
|
|
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0.1 repeats:NO];
|
|
|
|
|
|
NSString *identifier = [NSString stringWithFormat:@"FriendRequest_%@", [[NSUUID UUID] UUIDString]];
|
|
|
@@ -706,9 +708,16 @@
|
|
|
|
|
|
#pragma mark 用户点击消息推送或滑动
|
|
|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
|
|
|
- completionHandler(UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner |
|
|
|
- UNNotificationPresentationOptionSound |
|
|
|
- UNNotificationPresentationOptionBadge);
|
|
|
+
|
|
|
+ NSDictionary *userInfo = notification.request.content.userInfo;
|
|
|
+ NSInteger addFriend = [[userInfo objectForKey:@"addFriend"] integerValue];
|
|
|
+ if (addFriend) {
|
|
|
+ // 添加好友通知在app内也要展示
|
|
|
+ completionHandler(UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner |
|
|
|
+ UNNotificationPresentationOptionSound |
|
|
|
+ UNNotificationPresentationOptionBadge);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
|