mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83b7ca162a | ||
|
|
7f2179fe32 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jpush-phonegap-plugin",
|
"name": "jpush-phonegap-plugin",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"description": "JPush for cordova plugin",
|
"description": "JPush for cordova plugin",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "jpush-phonegap-plugin",
|
"id": "jpush-phonegap-plugin",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ NSDictionary *_launchOptions;
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
|
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
|
||||||
NSMutableDictionary *userInfo = @[].mutableCopy;
|
NSMutableDictionary *userInfo = @{}.mutableCopy;
|
||||||
|
|
||||||
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
|
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
|
||||||
userInfo = [self jpushFormatAPNSDic:notification.request.content.userInfo];
|
userInfo = [self jpushFormatAPNSDic:notification.request.content.userInfo];
|
||||||
@@ -169,6 +169,10 @@ NSDictionary *_launchOptions;
|
|||||||
userInfo[@"identifier"] = notification.request.identifier;
|
userInfo[@"identifier"] = notification.request.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([userInfo[@"aps"][@"content-available"] isEqualToNumber:@(1)]) {// content-available 当用户开启后台推送是,防止触发两次事件
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
|
||||||
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
|
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user