@onekeyfe/react-native-jpush 0.0.0-stage → 6.7.0-23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/ReactNativeJpush.podspec +66 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +144 -0
- package/android/fcm/build.gradle +36 -0
- package/android/fcm/consumer-rules.pro +2 -0
- package/android/fcm/src/main/AndroidManifest.xml +25 -0
- package/android/fcm/src/main/java/com/onekey/jpush/fcm/FcmInitProvider.java +25 -0
- package/android/fcm/src/main/java/com/onekey/jpush/fcm/FcmMessagingService.java +84 -0
- package/android/fcm/src/main/java/com/onekey/jpush/fcm/FcmPushManager.java +69 -0
- package/android/fcm/src/test/java/com/onekey/jpush/fcm/FcmAdapterTest.java +684 -0
- package/android/fcm/src/test/java/com/onekey/jpush/fcm/FcmManifestTest.java +54 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +143 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/cn/android/service/JTransitActivity.java +19 -0
- package/android/src/main/java/cn/jiguang/android/BuildConfig.java +10 -0
- package/android/src/main/java/cn/jiguang/android/IDataShare.java +190 -0
- package/android/src/main/java/cn/jiguang/api/BaseLogger.java +82 -0
- package/android/src/main/java/cn/jiguang/api/JAction.java +22 -0
- package/android/src/main/java/cn/jiguang/api/JActionExtra.java +21 -0
- package/android/src/main/java/cn/jiguang/api/JAnalyticsAction.java +11 -0
- package/android/src/main/java/cn/jiguang/api/JCoreInterface.java +228 -0
- package/android/src/main/java/cn/jiguang/api/JCoreManager.java +156 -0
- package/android/src/main/java/cn/jiguang/api/JDispatchAction.java +66 -0
- package/android/src/main/java/cn/jiguang/api/MultiSpHelper.java +114 -0
- package/android/src/main/java/cn/jiguang/api/ReportCallBack.java +9 -0
- package/android/src/main/java/cn/jiguang/api/SdkType.java +13 -0
- package/android/src/main/java/cn/jiguang/api/utils/JCollectionAuth.java +28 -0
- package/android/src/main/java/cn/jiguang/core/JCoreCrypto.java +545 -0
- package/android/src/main/java/cn/jiguang/core/JCoreStorage.java +737 -0
- package/android/src/main/java/cn/jiguang/core/JCoreTcpEngine.java +1395 -0
- package/android/src/main/java/cn/jiguang/core/JCoreWireCodec.java +1716 -0
- package/android/src/main/java/cn/jiguang/internal/ActionManager.java +63 -0
- package/android/src/main/java/cn/jiguang/internal/JConstants.java +61 -0
- package/android/src/main/java/cn/jiguang/internal/JCoreHelperAction.java +12 -0
- package/android/src/main/java/cn/jiguang/internal/JCoreInternalHelper.java +102 -0
- package/android/src/main/java/cn/jiguang/net/DefaultHostVerifier.java +40 -0
- package/android/src/main/java/cn/jiguang/net/HttpRequest.java +78 -0
- package/android/src/main/java/cn/jiguang/net/HttpResponse.java +48 -0
- package/android/src/main/java/cn/jiguang/net/HttpUtils.java +106 -0
- package/android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java +91 -0
- package/android/src/main/java/cn/jiguang/plugins/core/JCorePackage.java +27 -0
- package/android/src/main/java/cn/jiguang/plugins/push/JPushModule.java +773 -0
- package/android/src/main/java/cn/jiguang/plugins/push/JPushPackage.java +25 -0
- package/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java +88 -0
- package/android/src/main/java/cn/jiguang/plugins/push/common/JLogger.java +122 -0
- package/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java +710 -0
- package/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushBroadcastReceiver.java +37 -0
- package/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java +264 -0
- package/android/src/main/java/cn/jiguang/plugins/service/JCoreModuleService.java +7 -0
- package/android/src/main/java/cn/jpush/android/api/BasicPushNotificationBuilder.java +83 -0
- package/android/src/main/java/cn/jpush/android/api/CallBackParams.java +50 -0
- package/android/src/main/java/cn/jpush/android/api/CmdMessage.java +33 -0
- package/android/src/main/java/cn/jpush/android/api/CustomMessage.java +28 -0
- package/android/src/main/java/cn/jpush/android/api/CustomPushNotificationBuilder.java +81 -0
- package/android/src/main/java/cn/jpush/android/api/DefaultPushNotificationBuilder.java +90 -0
- package/android/src/main/java/cn/jpush/android/api/InAppSlotParams.java +65 -0
- package/android/src/main/java/cn/jpush/android/api/InstrumentedActivity.java +17 -0
- package/android/src/main/java/cn/jpush/android/api/InstrumentedListActivity.java +17 -0
- package/android/src/main/java/cn/jpush/android/api/JPushInterface.java +490 -0
- package/android/src/main/java/cn/jpush/android/api/JPushMessage.java +121 -0
- package/android/src/main/java/cn/jpush/android/api/JThirdPlatFormInterface.java +247 -0
- package/android/src/main/java/cn/jpush/android/api/MultiActionsNotificationBuilder.java +72 -0
- package/android/src/main/java/cn/jpush/android/api/NotificationCustomButton.java +50 -0
- package/android/src/main/java/cn/jpush/android/api/NotificationMessage.java +67 -0
- package/android/src/main/java/cn/jpush/android/api/PushNotificationBuilder.java +13 -0
- package/android/src/main/java/cn/jpush/android/api/TagAliasCallback.java +8 -0
- package/android/src/main/java/cn/jpush/android/data/JPushCollectControl.java +96 -0
- package/android/src/main/java/cn/jpush/android/data/JPushConfig.java +79 -0
- package/android/src/main/java/cn/jpush/android/data/JPushConfigEx.java +41 -0
- package/android/src/main/java/cn/jpush/android/data/JPushLocalNotification.java +155 -0
- package/android/src/main/java/cn/jpush/android/helper/JCoreHelper.java +70 -0
- package/android/src/main/java/cn/jpush/android/helper/Logger.java +82 -0
- package/android/src/main/java/cn/jpush/android/local/ActionHelper.java +1293 -0
- package/android/src/main/java/cn/jpush/android/local/ActivityLifeCallBack.java +47 -0
- package/android/src/main/java/cn/jpush/android/local/JPushAction.java +67 -0
- package/android/src/main/java/cn/jpush/android/local/JPushConstants.java +34 -0
- package/android/src/main/java/cn/jpush/android/local/JPushResponse.java +26 -0
- package/android/src/main/java/cn/jpush/android/local/ProxyActivityAction.java +34 -0
- package/android/src/main/java/cn/jpush/android/service/AlarmReceiver.java +15 -0
- package/android/src/main/java/cn/jpush/android/service/BActivity.java +19 -0
- package/android/src/main/java/cn/jpush/android/service/DActivity.java +19 -0
- package/android/src/main/java/cn/jpush/android/service/DaemonService.java +17 -0
- package/android/src/main/java/cn/jpush/android/service/DataProvider.java +136 -0
- package/android/src/main/java/cn/jpush/android/service/DataShare.java +129 -0
- package/android/src/main/java/cn/jpush/android/service/DownloadProvider.java +139 -0
- package/android/src/main/java/cn/jpush/android/service/InitProvider.java +48 -0
- package/android/src/main/java/cn/jpush/android/service/JCommonService.java +79 -0
- package/android/src/main/java/cn/jpush/android/service/JNotifyActivity.java +28 -0
- package/android/src/main/java/cn/jpush/android/service/JPushMessageReceiver.java +94 -0
- package/android/src/main/java/cn/jpush/android/service/PushReceiver.java +26 -0
- package/android/src/main/java/cn/jpush/android/service/PushService.java +28 -0
- package/android/src/main/java/cn/jpush/android/service/SchedulerReceiver.java +17 -0
- package/android/src/main/java/cn/jpush/android/service/TagAliasReceiver.java +11 -0
- package/android/src/main/java/cn/jpush/android/service/WakedResultReceiver.java +24 -0
- package/android/src/main/java/cn/jpush/android/ui/FullScreenView.java +11 -0
- package/android/src/main/java/cn/jpush/android/ui/PopWinActivity.java +16 -0
- package/android/src/main/java/cn/jpush/android/ui/PushActivity.java +27 -0
- package/android/src/main/java/cn/jpush/android/ui/RoundedImageView.java +63 -0
- package/android/src/main/java/cn/jpush/android/ui/ShadowViewCard.java +56 -0
- package/android/src/main/java/cn/jpush/android/ups/ICallbackResult.java +5 -0
- package/android/src/main/java/cn/jpush/android/ups/JPushUPSManager.java +37 -0
- package/android/src/main/java/cn/jpush/android/ups/TokenResult.java +47 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSRegisterCallBack.java +4 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSTurnCallBack.java +4 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSUnRegisterCallBack.java +4 -0
- package/android/src/main/java/com/margelo/nitro/reactnativejpush/ReactNativeJpush.kt +455 -0
- package/android/src/main/java/com/margelo/nitro/reactnativejpush/ReactNativeJpushPackage.kt +50 -0
- package/android/src/main/res/values/jpush_string.xml +7 -0
- package/android/src/main/res/values/jpush_style.xml +22 -0
- package/android/src/test/java/com/margelo/nitro/reactnativejpush/JPushCloudHandshakeTest.java +110 -0
- package/android/src/test/java/com/margelo/nitro/reactnativejpush/JPushHandshakeFailureTest.java +73 -0
- package/android/src/test/java/com/margelo/nitro/reactnativejpush/ReactNativeJpushProtocolTest.java +908 -0
- package/ios/ReactNativeJpush.swift +522 -0
- package/ios/bridge/RCTJCoreModule.h +5 -0
- package/ios/bridge/RCTJCoreModule.m +31 -0
- package/ios/bridge/RCTJPushEventQueue.h +14 -0
- package/ios/bridge/RCTJPushEventQueue.m +23 -0
- package/ios/bridge/RCTJPushModule.h +37 -0
- package/ios/bridge/RCTJPushModule.m +1165 -0
- package/ios/include/JCOREService.h +3 -0
- package/ios/include/JGCOREAPI.h +14 -0
- package/ios/include/JGInforCollectionAuth.h +17 -0
- package/ios/include/JGInforCollectionAuthItems.h +2 -0
- package/ios/include/JGPushNotificationTrigger.h +2 -0
- package/ios/include/JPUSHService.h +359 -0
- package/ios/jcore/JCOREConfiguration.h +141 -0
- package/ios/jcore/JCOREConfiguration.m +703 -0
- package/ios/jcore/JCORECrypto.h +73 -0
- package/ios/jcore/JCORECrypto.m +649 -0
- package/ios/jcore/JCORESisResolver.h +56 -0
- package/ios/jcore/JCORESisResolver.m +525 -0
- package/ios/jcore/JCORETcpSession.h +42 -0
- package/ios/jcore/JCORETcpSession.m +956 -0
- package/ios/jcore/JCOREWireProtocol.h +274 -0
- package/ios/jcore/JCOREWireProtocol.m +1453 -0
- package/ios/jpush/JPUSHModels.m +214 -0
- package/ios/jpush/JPUSHNotificationManager.h +34 -0
- package/ios/jpush/JPUSHNotificationManager.m +360 -0
- package/ios/jpush/JPUSHService.m +794 -0
- package/ios/tests/ReactNativeJpushTests.m +148 -0
- package/lib/module/ReactNativeJpush.nitro.js +4 -0
- package/lib/module/ReactNativeJpush.nitro.js.map +1 -0
- package/lib/module/index.js +801 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeJpush.nitro.d.ts +60 -0
- package/lib/typescript/src/ReactNativeJpush.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +235 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeJpushSpec.cpp +310 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeJpushSpec.hpp +115 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/Func_void_bool.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/Func_void_std__string_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/HybridReactNativeJpushSpec.kt +274 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/reactnativejpushOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativejpush+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativejpush+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativejpushOnLoad.cpp +58 -0
- package/nitrogen/generated/android/reactnativejpushOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/ReactNativeJpush+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Bridge.hpp +147 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/ReactNativeJpushAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeJpushAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeJpushSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeJpushSpecSwift.hpp +402 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeJpushSpec.swift +107 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeJpushSpec_cxx.swift +723 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeJpushSpec.cpp +73 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeJpushSpec.hpp +116 -0
- package/package.json +174 -4
- package/src/ReactNativeJpush.nitro.ts +93 -0
- package/src/index.tsx +1090 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#import "../include/JPUSHService.h"
|
|
2
|
+
#import <CoreLocation/CoreLocation.h>
|
|
3
|
+
#import <UserNotifications/UserNotifications.h>
|
|
4
|
+
|
|
5
|
+
@implementation JPUSHRegisterEntity
|
|
6
|
+
@end
|
|
7
|
+
|
|
8
|
+
@implementation JPushNotificationIdentifier
|
|
9
|
+
|
|
10
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
11
|
+
JPushNotificationIdentifier *copy = [[[self class] allocWithZone:zone] init];
|
|
12
|
+
copy.identifiers = [self.identifiers copyWithZone:zone];
|
|
13
|
+
copy.notificationObj = [self.notificationObj copyWithZone:zone];
|
|
14
|
+
copy.delivered = self.delivered;
|
|
15
|
+
copy.findCompletionHandler = [self.findCompletionHandler copy];
|
|
16
|
+
return copy;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
20
|
+
self = [super init];
|
|
21
|
+
if (self) {
|
|
22
|
+
_identifiers = [coder decodeObjectForKey:@"identifiers"];
|
|
23
|
+
_delivered = [coder decodeBoolForKey:@"delivered"];
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
29
|
+
[coder encodeObject:self.identifiers forKey:@"identifiers"];
|
|
30
|
+
[coder encodeBool:self.delivered forKey:@"delivered"];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
@implementation JPushNotificationSound
|
|
36
|
+
|
|
37
|
+
- (instancetype)init {
|
|
38
|
+
self = [super init];
|
|
39
|
+
if (self) {
|
|
40
|
+
_criticalSoundVolume = 1.0f;
|
|
41
|
+
}
|
|
42
|
+
return self;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
46
|
+
JPushNotificationSound *copy = [[[self class] allocWithZone:zone] init];
|
|
47
|
+
copy.soundName = [self.soundName copyWithZone:zone];
|
|
48
|
+
copy.criticalSoundName = [self.criticalSoundName copyWithZone:zone];
|
|
49
|
+
copy.criticalSoundVolume = self.criticalSoundVolume;
|
|
50
|
+
copy.soundSetting = self.soundSetting;
|
|
51
|
+
return copy;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
55
|
+
self = [super init];
|
|
56
|
+
if (self) {
|
|
57
|
+
_soundName = [coder decodeObjectForKey:@"soundName"];
|
|
58
|
+
_criticalSoundName = [coder decodeObjectForKey:@"criticalSoundName"];
|
|
59
|
+
_criticalSoundVolume = [coder decodeFloatForKey:@"criticalSoundVolume"];
|
|
60
|
+
}
|
|
61
|
+
return self;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
65
|
+
[coder encodeObject:self.soundName forKey:@"soundName"];
|
|
66
|
+
[coder encodeObject:self.criticalSoundName forKey:@"criticalSoundName"];
|
|
67
|
+
[coder encodeFloat:self.criticalSoundVolume forKey:@"criticalSoundVolume"];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@end
|
|
71
|
+
|
|
72
|
+
@implementation JPushNotificationContent
|
|
73
|
+
|
|
74
|
+
- (instancetype)init {
|
|
75
|
+
self = [super init];
|
|
76
|
+
if (self) {
|
|
77
|
+
_summaryArgumentCount = 1;
|
|
78
|
+
_interruptionLevel = 1;
|
|
79
|
+
_relevanceScore = 0.0;
|
|
80
|
+
}
|
|
81
|
+
return self;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
85
|
+
JPushNotificationContent *copy = [[[self class] allocWithZone:zone] init];
|
|
86
|
+
copy.title = [self.title copyWithZone:zone];
|
|
87
|
+
copy.subtitle = [self.subtitle copyWithZone:zone];
|
|
88
|
+
copy.body = [self.body copyWithZone:zone];
|
|
89
|
+
copy.badge = [self.badge copyWithZone:zone];
|
|
90
|
+
copy.action = [self.action copyWithZone:zone];
|
|
91
|
+
copy.categoryIdentifier = [self.categoryIdentifier copyWithZone:zone];
|
|
92
|
+
copy.userInfo = [self.userInfo copyWithZone:zone];
|
|
93
|
+
copy.sound = [self.sound copyWithZone:zone];
|
|
94
|
+
copy.soundSetting = [self.soundSetting copyWithZone:zone];
|
|
95
|
+
copy.attachments = [self.attachments copyWithZone:zone];
|
|
96
|
+
copy.threadIdentifier = [self.threadIdentifier copyWithZone:zone];
|
|
97
|
+
copy.launchImageName = [self.launchImageName copyWithZone:zone];
|
|
98
|
+
copy.summaryArgument = [self.summaryArgument copyWithZone:zone];
|
|
99
|
+
copy.summaryArgumentCount = self.summaryArgumentCount;
|
|
100
|
+
copy.targetContentIdentifier = [self.targetContentIdentifier copyWithZone:zone];
|
|
101
|
+
copy.interruptionLevel = self.interruptionLevel;
|
|
102
|
+
copy.relevanceScore = self.relevanceScore;
|
|
103
|
+
copy.filterCriteria = [self.filterCriteria copyWithZone:zone];
|
|
104
|
+
return copy;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
108
|
+
self = [super init];
|
|
109
|
+
if (self) {
|
|
110
|
+
_title = [coder decodeObjectForKey:@"title"];
|
|
111
|
+
_subtitle = [coder decodeObjectForKey:@"subtitle"];
|
|
112
|
+
_body = [coder decodeObjectForKey:@"body"];
|
|
113
|
+
_badge = [coder decodeObjectForKey:@"badge"];
|
|
114
|
+
_action = [coder decodeObjectForKey:@"action"];
|
|
115
|
+
_categoryIdentifier = [coder decodeObjectForKey:@"categoryIdentifier"];
|
|
116
|
+
_userInfo = [coder decodeObjectForKey:@"userInfo"];
|
|
117
|
+
_sound = [coder decodeObjectForKey:@"sound"];
|
|
118
|
+
_threadIdentifier = [coder decodeObjectForKey:@"threadIdentifier"];
|
|
119
|
+
}
|
|
120
|
+
return self;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
124
|
+
[coder encodeObject:self.title forKey:@"title"];
|
|
125
|
+
[coder encodeObject:self.subtitle forKey:@"subtitle"];
|
|
126
|
+
[coder encodeObject:self.body forKey:@"body"];
|
|
127
|
+
[coder encodeObject:self.badge forKey:@"badge"];
|
|
128
|
+
[coder encodeObject:self.action forKey:@"action"];
|
|
129
|
+
[coder encodeObject:self.categoryIdentifier forKey:@"categoryIdentifier"];
|
|
130
|
+
[coder encodeObject:self.userInfo forKey:@"userInfo"];
|
|
131
|
+
[coder encodeObject:self.sound forKey:@"sound"];
|
|
132
|
+
[coder encodeObject:self.threadIdentifier forKey:@"threadIdentifier"];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@end
|
|
136
|
+
|
|
137
|
+
@implementation JPushNotificationTrigger
|
|
138
|
+
|
|
139
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
140
|
+
JPushNotificationTrigger *copy = [[[self class] allocWithZone:zone] init];
|
|
141
|
+
copy.repeat = self.repeat;
|
|
142
|
+
copy.fireDate = [self.fireDate copyWithZone:zone];
|
|
143
|
+
copy.region = [self.region copyWithZone:zone];
|
|
144
|
+
copy.dateComponents = [self.dateComponents copyWithZone:zone];
|
|
145
|
+
copy.timeInterval = self.timeInterval;
|
|
146
|
+
return copy;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
150
|
+
self = [super init];
|
|
151
|
+
if (self) {
|
|
152
|
+
_repeat = [coder decodeBoolForKey:@"repeat"];
|
|
153
|
+
_fireDate = [coder decodeObjectForKey:@"fireDate"];
|
|
154
|
+
_dateComponents = [coder decodeObjectForKey:@"dateComponents"];
|
|
155
|
+
_timeInterval = [coder decodeDoubleForKey:@"timeInterval"];
|
|
156
|
+
}
|
|
157
|
+
return self;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
161
|
+
[coder encodeBool:self.repeat forKey:@"repeat"];
|
|
162
|
+
[coder encodeObject:self.fireDate forKey:@"fireDate"];
|
|
163
|
+
[coder encodeObject:self.dateComponents forKey:@"dateComponents"];
|
|
164
|
+
[coder encodeDouble:self.timeInterval forKey:@"timeInterval"];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@end
|
|
168
|
+
|
|
169
|
+
@implementation JPushNotificationRequest
|
|
170
|
+
|
|
171
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
172
|
+
JPushNotificationRequest *copy = [[[self class] allocWithZone:zone] init];
|
|
173
|
+
copy.requestIdentifier = [self.requestIdentifier copyWithZone:zone];
|
|
174
|
+
copy.content = [self.content copyWithZone:zone];
|
|
175
|
+
copy.trigger = [self.trigger copyWithZone:zone];
|
|
176
|
+
copy.completionHandler = [self.completionHandler copy];
|
|
177
|
+
return copy;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
181
|
+
self = [super init];
|
|
182
|
+
if (self) {
|
|
183
|
+
_requestIdentifier = [coder decodeObjectForKey:@"requestIdentifier"];
|
|
184
|
+
_content = [coder decodeObjectForKey:@"content"];
|
|
185
|
+
_trigger = [coder decodeObjectForKey:@"trigger"];
|
|
186
|
+
}
|
|
187
|
+
return self;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
191
|
+
[coder encodeObject:self.requestIdentifier forKey:@"requestIdentifier"];
|
|
192
|
+
[coder encodeObject:self.content forKey:@"content"];
|
|
193
|
+
[coder encodeObject:self.trigger forKey:@"trigger"];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@end
|
|
197
|
+
|
|
198
|
+
@implementation JPushInAppMessage
|
|
199
|
+
@end
|
|
200
|
+
|
|
201
|
+
@implementation JPushCollectControl
|
|
202
|
+
|
|
203
|
+
- (instancetype)init {
|
|
204
|
+
self = [super init];
|
|
205
|
+
if (self) {
|
|
206
|
+
_gps = NO;
|
|
207
|
+
_bssid = NO;
|
|
208
|
+
_ssid = NO;
|
|
209
|
+
_cell = NO;
|
|
210
|
+
}
|
|
211
|
+
return self;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#if __has_include("JPUSHService.h")
|
|
3
|
+
#import "JPUSHService.h"
|
|
4
|
+
#else
|
|
5
|
+
#import "../include/JPUSHService.h"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
9
|
+
|
|
10
|
+
@interface JPUSHNotificationManager : NSObject
|
|
11
|
+
|
|
12
|
+
+ (instancetype)shared;
|
|
13
|
+
|
|
14
|
+
@property (nonatomic, weak, nullable) id<JPUSHRegisterDelegate> registerDelegate;
|
|
15
|
+
@property (nonatomic, weak, nullable) id<JPUSHNotiInMessageDelegate> notiInMessageDelegate;
|
|
16
|
+
@property (nonatomic, weak, nullable) id<JPUSHInAppMessageDelegate> inAppMessageDelegate;
|
|
17
|
+
@property (nonatomic, weak, nullable) id<JPUSHGeofenceDelegate> geofenceDelegate;
|
|
18
|
+
|
|
19
|
+
- (void)registerWithConfig:(JPUSHRegisterEntity *)config
|
|
20
|
+
delegate:(nullable id<JPUSHRegisterDelegate>)delegate;
|
|
21
|
+
|
|
22
|
+
- (void)registerTypes:(NSUInteger)types categories:(nullable NSSet *)categories;
|
|
23
|
+
|
|
24
|
+
- (void)addNotification:(JPushNotificationRequest *)request;
|
|
25
|
+
- (void)removeNotification:(nullable JPushNotificationIdentifier *)identifier;
|
|
26
|
+
- (void)findNotification:(JPushNotificationIdentifier *)identifier;
|
|
27
|
+
|
|
28
|
+
- (void)requestAuthorization:(nullable void (^)(JPAuthorizationStatus status))completion;
|
|
29
|
+
- (void)getAuthorizationStatus:(nullable void (^)(JPAuthorizationStatus status))completion;
|
|
30
|
+
- (void)openNotificationSettings:(nullable void (^)(BOOL success))completion;
|
|
31
|
+
|
|
32
|
+
@end
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
#import "JPUSHNotificationManager.h"
|
|
2
|
+
#import <UserNotifications/UserNotifications.h>
|
|
3
|
+
#if __has_include(<UIKit/UIKit.h>)
|
|
4
|
+
#import <UIKit/UIKit.h>
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
@interface JPUSHNotificationManager () <UNUserNotificationCenterDelegate>
|
|
8
|
+
@end
|
|
9
|
+
|
|
10
|
+
@implementation JPUSHNotificationManager
|
|
11
|
+
|
|
12
|
+
+ (instancetype)shared {
|
|
13
|
+
static JPUSHNotificationManager *instance = nil;
|
|
14
|
+
static dispatch_once_t onceToken;
|
|
15
|
+
dispatch_once(&onceToken, ^{
|
|
16
|
+
instance = [[JPUSHNotificationManager alloc] init];
|
|
17
|
+
});
|
|
18
|
+
return instance;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
- (nullable UNUserNotificationCenter *)safeNotificationCenter {
|
|
22
|
+
if ([NSBundle mainBundle].bundleIdentifier.length == 0) {
|
|
23
|
+
return nil;
|
|
24
|
+
}
|
|
25
|
+
@try {
|
|
26
|
+
return [UNUserNotificationCenter currentNotificationCenter];
|
|
27
|
+
} @catch (NSException *exception) {
|
|
28
|
+
return nil;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (void)registerWithConfig:(JPUSHRegisterEntity *)config
|
|
33
|
+
delegate:(id<JPUSHRegisterDelegate>)delegate {
|
|
34
|
+
self.registerDelegate = delegate;
|
|
35
|
+
[self registerTypes:(NSUInteger)config.types categories:config.categories];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)registerTypes:(NSUInteger)types categories:(NSSet *)categories {
|
|
39
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
40
|
+
if (center == nil) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (types != 0 || center.delegate == nil) {
|
|
44
|
+
center.delegate = self;
|
|
45
|
+
}
|
|
46
|
+
if (categories.count > 0) {
|
|
47
|
+
[center setNotificationCategories:categories];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
UNAuthorizationOptions options = UNAuthorizationOptionNone;
|
|
51
|
+
if (types & JPAuthorizationOptionBadge) {
|
|
52
|
+
options |= UNAuthorizationOptionBadge;
|
|
53
|
+
}
|
|
54
|
+
if (types & JPAuthorizationOptionSound) {
|
|
55
|
+
options |= UNAuthorizationOptionSound;
|
|
56
|
+
}
|
|
57
|
+
if (types & JPAuthorizationOptionAlert) {
|
|
58
|
+
options |= UNAuthorizationOptionAlert;
|
|
59
|
+
}
|
|
60
|
+
if (types & JPAuthorizationOptionCarPlay) {
|
|
61
|
+
options |= UNAuthorizationOptionCarPlay;
|
|
62
|
+
}
|
|
63
|
+
if (@available(iOS 12.0, *)) {
|
|
64
|
+
if (types & JPAuthorizationOptionCriticalAlert) {
|
|
65
|
+
options |= UNAuthorizationOptionCriticalAlert;
|
|
66
|
+
}
|
|
67
|
+
if (types & JPAuthorizationOptionProvidesAppNotificationSettings) {
|
|
68
|
+
options |= UNAuthorizationOptionProvidesAppNotificationSettings;
|
|
69
|
+
}
|
|
70
|
+
if (types & JPAuthorizationOptionProvisional) {
|
|
71
|
+
options |= UNAuthorizationOptionProvisional;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (options == UNAuthorizationOptionNone) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
__weak typeof(self) weakSelf = self;
|
|
80
|
+
[center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
|
81
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
82
|
+
#if __has_include(<UIKit/UIKit.h>)
|
|
83
|
+
if (granted) {
|
|
84
|
+
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
87
|
+
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
88
|
+
if ([strongSelf.registerDelegate respondsToSelector:@selector(jpushNotificationAuthorization:withInfo:)]) {
|
|
89
|
+
JPAuthorizationStatus status = granted ? JPAuthorizationStatusAuthorized : JPAuthorizationStatusDenied;
|
|
90
|
+
NSDictionary *info = error ? @{@"error": error.localizedDescription ?: @""} : @{};
|
|
91
|
+
[strongSelf.registerDelegate jpushNotificationAuthorization:status withInfo:info];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)addNotification:(JPushNotificationRequest *)request {
|
|
98
|
+
if (request == nil || request.content == nil) {
|
|
99
|
+
if (request.completionHandler != nil) {
|
|
100
|
+
request.completionHandler(nil);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
NSString *identifier = request.requestIdentifier.length > 0
|
|
106
|
+
? request.requestIdentifier
|
|
107
|
+
: [NSUUID UUID].UUIDString;
|
|
108
|
+
|
|
109
|
+
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
|
|
110
|
+
if (request.content.title != nil) {
|
|
111
|
+
content.title = request.content.title;
|
|
112
|
+
}
|
|
113
|
+
if (request.content.subtitle != nil) {
|
|
114
|
+
content.subtitle = request.content.subtitle;
|
|
115
|
+
}
|
|
116
|
+
if (request.content.body != nil) {
|
|
117
|
+
content.body = request.content.body;
|
|
118
|
+
}
|
|
119
|
+
if (request.content.badge != nil) {
|
|
120
|
+
content.badge = request.content.badge;
|
|
121
|
+
}
|
|
122
|
+
if (request.content.categoryIdentifier.length > 0) {
|
|
123
|
+
content.categoryIdentifier = request.content.categoryIdentifier;
|
|
124
|
+
}
|
|
125
|
+
if (request.content.threadIdentifier.length > 0) {
|
|
126
|
+
content.threadIdentifier = request.content.threadIdentifier;
|
|
127
|
+
}
|
|
128
|
+
if (request.content.userInfo != nil) {
|
|
129
|
+
content.userInfo = request.content.userInfo;
|
|
130
|
+
}
|
|
131
|
+
if (request.content.soundSetting.soundSetting != nil) {
|
|
132
|
+
content.sound = request.content.soundSetting.soundSetting;
|
|
133
|
+
} else if (request.content.soundSetting.soundName.length > 0) {
|
|
134
|
+
content.sound = [UNNotificationSound soundNamed:request.content.soundSetting.soundName];
|
|
135
|
+
} else if (request.content.sound.length > 0) {
|
|
136
|
+
content.sound = [UNNotificationSound soundNamed:request.content.sound];
|
|
137
|
+
} else {
|
|
138
|
+
content.sound = [UNNotificationSound defaultSound];
|
|
139
|
+
}
|
|
140
|
+
if (request.content.attachments.count > 0) {
|
|
141
|
+
content.attachments = request.content.attachments;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
UNNotificationTrigger *trigger = nil;
|
|
145
|
+
if (request.trigger != nil) {
|
|
146
|
+
if (request.trigger.dateComponents != nil) {
|
|
147
|
+
trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:request.trigger.dateComponents
|
|
148
|
+
repeats:request.trigger.repeat];
|
|
149
|
+
} else if (request.trigger.timeInterval > 0) {
|
|
150
|
+
NSTimeInterval interval = request.trigger.repeat ? MAX(60.0, request.trigger.timeInterval) : request.trigger.timeInterval;
|
|
151
|
+
trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:interval
|
|
152
|
+
repeats:request.trigger.repeat];
|
|
153
|
+
} else if (request.trigger.fireDate != nil) {
|
|
154
|
+
NSTimeInterval delta = [request.trigger.fireDate timeIntervalSinceNow];
|
|
155
|
+
if (delta > 0) {
|
|
156
|
+
trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:delta repeats:NO];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
UNNotificationRequest *unRequest = [UNNotificationRequest requestWithIdentifier:identifier
|
|
162
|
+
content:content
|
|
163
|
+
trigger:trigger];
|
|
164
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
165
|
+
if (center == nil) {
|
|
166
|
+
if (request.completionHandler != nil) {
|
|
167
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
168
|
+
request.completionHandler(unRequest);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
[center addNotificationRequest:unRequest
|
|
174
|
+
withCompletionHandler:^(NSError * _Nullable error) {
|
|
175
|
+
if (request.completionHandler != nil) {
|
|
176
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
177
|
+
request.completionHandler(error == nil ? unRequest : nil);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
- (void)removeNotification:(JPushNotificationIdentifier *)identifier {
|
|
184
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
185
|
+
if (center == nil) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (identifier == nil || identifier.identifiers.count == 0) {
|
|
189
|
+
[center removeAllPendingNotificationRequests];
|
|
190
|
+
[center removeAllDeliveredNotifications];
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (identifier.delivered) {
|
|
194
|
+
[center removeDeliveredNotificationsWithIdentifiers:identifier.identifiers];
|
|
195
|
+
} else {
|
|
196
|
+
[center removePendingNotificationRequestsWithIdentifiers:identifier.identifiers];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
- (void)findNotification:(JPushNotificationIdentifier *)identifier {
|
|
201
|
+
if (identifier == nil || identifier.findCompletionHandler == nil) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
205
|
+
if (center == nil) {
|
|
206
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
207
|
+
identifier.findCompletionHandler(@[]);
|
|
208
|
+
});
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
NSSet<NSString *> *filterSet = identifier.identifiers.count > 0
|
|
212
|
+
? [NSSet setWithArray:identifier.identifiers]
|
|
213
|
+
: nil;
|
|
214
|
+
|
|
215
|
+
if (identifier.delivered) {
|
|
216
|
+
[center getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) {
|
|
217
|
+
NSMutableArray *matched = [NSMutableArray array];
|
|
218
|
+
for (UNNotification *item in notifications) {
|
|
219
|
+
if (filterSet == nil || [filterSet containsObject:item.request.identifier]) {
|
|
220
|
+
[matched addObject:item.request];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
224
|
+
identifier.findCompletionHandler(matched);
|
|
225
|
+
});
|
|
226
|
+
}];
|
|
227
|
+
} else {
|
|
228
|
+
[center getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> * _Nonnull requests) {
|
|
229
|
+
NSMutableArray *matched = [NSMutableArray array];
|
|
230
|
+
for (UNNotificationRequest *req in requests) {
|
|
231
|
+
if (filterSet == nil || [filterSet containsObject:req.identifier]) {
|
|
232
|
+
[matched addObject:req];
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
236
|
+
identifier.findCompletionHandler(matched);
|
|
237
|
+
});
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
- (void)requestAuthorization:(void (^)(JPAuthorizationStatus status))completion {
|
|
243
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
244
|
+
if (center == nil) {
|
|
245
|
+
if (completion != nil) {
|
|
246
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
247
|
+
completion(JPAuthorizationNotDetermined);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
UNAuthorizationOptions options = (UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert);
|
|
253
|
+
[center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
|
254
|
+
(void)error;
|
|
255
|
+
JPAuthorizationStatus status = granted ? JPAuthorizationStatusAuthorized : JPAuthorizationStatusDenied;
|
|
256
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
257
|
+
#if __has_include(<UIKit/UIKit.h>)
|
|
258
|
+
if (granted) {
|
|
259
|
+
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
|
260
|
+
}
|
|
261
|
+
#endif
|
|
262
|
+
if (completion != nil) {
|
|
263
|
+
completion(status);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
- (void)getAuthorizationStatus:(void (^)(JPAuthorizationStatus status))completion {
|
|
270
|
+
UNUserNotificationCenter *center = [self safeNotificationCenter];
|
|
271
|
+
if (center == nil) {
|
|
272
|
+
if (completion != nil) {
|
|
273
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
274
|
+
completion(JPAuthorizationNotDetermined);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
|
|
280
|
+
JPAuthorizationStatus status = JPAuthorizationNotDetermined;
|
|
281
|
+
switch (settings.authorizationStatus) {
|
|
282
|
+
case UNAuthorizationStatusDenied:
|
|
283
|
+
status = JPAuthorizationStatusDenied;
|
|
284
|
+
break;
|
|
285
|
+
case UNAuthorizationStatusAuthorized:
|
|
286
|
+
status = JPAuthorizationStatusAuthorized;
|
|
287
|
+
break;
|
|
288
|
+
case UNAuthorizationStatusProvisional:
|
|
289
|
+
status = JPAuthorizationStatusProvisional;
|
|
290
|
+
break;
|
|
291
|
+
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
|
292
|
+
case UNAuthorizationStatusEphemeral:
|
|
293
|
+
status = JPAuthorizationStatusAuthorized;
|
|
294
|
+
break;
|
|
295
|
+
#endif
|
|
296
|
+
default:
|
|
297
|
+
status = JPAuthorizationNotDetermined;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
if (completion != nil) {
|
|
301
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
302
|
+
completion(status);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
- (void)openNotificationSettings:(void (^)(BOOL success))completion {
|
|
309
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
310
|
+
#if __has_include(<UIKit/UIKit.h>)
|
|
311
|
+
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
312
|
+
if (url != nil && [[UIApplication sharedApplication] canOpenURL:url]) {
|
|
313
|
+
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:completion];
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
#endif
|
|
317
|
+
if (completion != nil) {
|
|
318
|
+
completion(NO);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
#pragma mark - UNUserNotificationCenterDelegate
|
|
324
|
+
|
|
325
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
326
|
+
willPresentNotification:(UNNotification *)notification
|
|
327
|
+
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
|
328
|
+
if ([self.registerDelegate respondsToSelector:@selector(jpushNotificationCenter:willPresentNotification:withCompletionHandler:)]) {
|
|
329
|
+
[self.registerDelegate jpushNotificationCenter:center
|
|
330
|
+
willPresentNotification:notification
|
|
331
|
+
withCompletionHandler:^(NSInteger options) {
|
|
332
|
+
completionHandler((UNNotificationPresentationOptions)options);
|
|
333
|
+
}];
|
|
334
|
+
} else {
|
|
335
|
+
completionHandler(UNNotificationPresentationOptionBadge |
|
|
336
|
+
UNNotificationPresentationOptionSound |
|
|
337
|
+
UNNotificationPresentationOptionAlert);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
342
|
+
didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|
343
|
+
withCompletionHandler:(void (^)(void))completionHandler {
|
|
344
|
+
if ([self.registerDelegate respondsToSelector:@selector(jpushNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)]) {
|
|
345
|
+
[self.registerDelegate jpushNotificationCenter:center
|
|
346
|
+
didReceiveNotificationResponse:response
|
|
347
|
+
withCompletionHandler:completionHandler];
|
|
348
|
+
} else {
|
|
349
|
+
completionHandler();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
354
|
+
openSettingsForNotification:(UNNotification *)notification {
|
|
355
|
+
if ([self.registerDelegate respondsToSelector:@selector(jpushNotificationCenter:openSettingsForNotification:)]) {
|
|
356
|
+
[self.registerDelegate jpushNotificationCenter:center openSettingsForNotification:notification];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
@end
|