cordova-plugin-appice 2.0.7 → 2.0.8

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.
Files changed (35) hide show
  1. package/README.md +122 -122
  2. package/example/config.xml +59 -59
  3. package/example/package.json +38 -38
  4. package/example/res/ai_android.pem +40 -40
  5. package/example/www/css/index.css +116 -116
  6. package/example/www/index.html +62 -62
  7. package/example/www/js/index.js +102 -102
  8. package/libcordova/android-release-aar.gradle +62 -62
  9. package/libcordova/build.gradle +50 -50
  10. package/libcordova/proguard-rules.pro +21 -21
  11. package/libcordova/src/main/AndroidManifest.xml +24 -24
  12. package/libcordova/src/main/java/com/appice/cordova/AppICEPlugin.java +968 -968
  13. package/libcordova/src/main/java/com/appice/cordova/CampaignCampsReceiver.java +95 -95
  14. package/libcordova/src/main/java/com/appice/cordova/NotificationEventService.java +55 -55
  15. package/libcordova/src/main/res/values/strings.xml +3 -3
  16. package/package.json +26 -26
  17. package/plugin.xml +128 -129
  18. package/scripts/BeforeAndroidBuilt.js +126 -112
  19. package/scripts/BeforeIosBuilt.js +38 -38
  20. package/scripts/androidAfterPluginAdd.js +159 -159
  21. package/scripts/androidAfterPluginRm.js +195 -195
  22. package/scripts/iOSAfterPluginAdd.js +98 -98
  23. package/scripts/iOSAfterPluginRm.js +74 -74
  24. package/src/build.gradle +14 -5
  25. package/src/firebase/modified/android/FirebasePluginMessagingService.java +356 -356
  26. package/src/firebase/modified/ios/AppDelegate+FirebasePlugin.m +529 -529
  27. package/src/firebase/modified/modified.iml +10 -10
  28. package/src/firebase/original/android/FirebasePluginMessagingService.java +348 -348
  29. package/src/firebase/original/ios/AppDelegate+FirebasePlugin.m +519 -519
  30. package/src/firebase/original/original.iml +10 -10
  31. package/src/ios/AppDelegate+AppICEPlugin.h +8 -8
  32. package/src/ios/AppDelegate+AppICEPlugin.m +191 -259
  33. package/src/ios/AppICEPlugin.h +90 -90
  34. package/src/ios/AppICEPlugin.m +1062 -1087
  35. package/www/AppICE.js +283 -283
@@ -1,11 +1,11 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$">
6
- <sourceFolder url="file://$MODULE_DIR$/android" isTestSource="false" packagePrefix="org.apache.cordova.firebase" />
7
- </content>
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- </component>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$">
6
+ <sourceFolder url="file://$MODULE_DIR$/android" isTestSource="false" packagePrefix="org.apache.cordova.firebase" />
7
+ </content>
8
+ <orderEntry type="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ </component>
11
11
  </module>
@@ -1,8 +1,8 @@
1
-
2
- #import "AppDelegate.h"
3
-
4
- @interface AppDelegate (AppICEPlugin)
5
-
6
- +(id) delegate;
7
-
8
- @end
1
+
2
+ #import "AppDelegate.h"
3
+
4
+ @interface AppDelegate (AppICEPlugin)
5
+
6
+ +(id) delegate;
7
+
8
+ @end
@@ -1,259 +1,191 @@
1
-
2
- #import "AppDelegate+AppICEPlugin.h"
3
- #import "AppICEPlugin.h"
4
- #import <objc/runtime.h>
5
- #import "appICE.h"
6
-
7
-
8
-
9
-
10
-
11
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
12
- @import UserNotifications;
13
- #endif
14
-
15
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
16
- @interface AppDelegate () <UNUserNotificationCenterDelegate>
17
- @end
18
- #endif
19
-
20
- #define kApplicationInBackgroundKey @"applicationInBackground"
21
- #define SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
22
-
23
- @implementation AppDelegate (AppICEPlugin)
24
-
25
- static id appdelegate;
26
- typedef void (*OriginalImpType)(id self, SEL selector);
27
- static OriginalImpType originalImp;
28
- + (void)load {
29
- /*
30
- //for did finish launch method
31
- Method originalDidFinishLaunchingWithOptions = class_getInstanceMethod(self, @selector(application:didFinishLaunchingWithOptions:));
32
-
33
- Method swizzledDidFinishLaunchingWithOptions = class_getInstanceMethod(self, @selector(application:swizzledDidFinishLaunchingWithOptions:));
34
- method_exchangeImplementations(originalDidFinishLaunchingWithOptions, swizzledDidFinishLaunchingWithOptions);
35
-
36
-
37
-
38
- //for Notification received
39
- Method originalDidReceiveRemoteNotification = class_getInstanceMethod(self, @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:));
40
- Method swizzleDidReceiveRemoteNotification = class_getInstanceMethod(self, @selector(application:swizzleddidReceiveRemoteNotification:fetchCompletionHandler:));
41
- method_exchangeImplementations(originalDidReceiveRemoteNotification, swizzleDidReceiveRemoteNotification);
42
-
43
-
44
-
45
-
46
- //for remote notfication failed
47
- Method originaldidFailToRegisterForRemoteNotificationsWithError = class_getInstanceMethod(self, @selector(application:didFailToRegisterForRemoteNotificationsWithError:));
48
- Method swizzleddidFailToRegisterForRemoteNotificationsWithError = class_getInstanceMethod(self, @selector(application:swizzleddidFailToRegisterForRemoteNotificationsWithError:));
49
- method_exchangeImplementations(originaldidFailToRegisterForRemoteNotificationsWithError, swizzleddidFailToRegisterForRemoteNotificationsWithError);
50
- NSLog(@"Appice+delegate loaded"); */
51
-
52
- //for device token register
53
- Method originaldidRegisterForRemoteNotificationsWithDeviceToken = class_getInstanceMethod(self, @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:));
54
- Method swizzleddidRegisterForRemoteNotificationsWithDeviceToken = class_getInstanceMethod(self, @selector(application:swizzleddidRegisterForRemoteNotificationsWithDeviceToken:));
55
- method_exchangeImplementations(originaldidRegisterForRemoteNotificationsWithDeviceToken, swizzleddidRegisterForRemoteNotificationsWithDeviceToken);
56
- }
57
-
58
- +(id) delegate{
59
- return appdelegate;
60
- }
61
-
62
- - (id)init
63
- {
64
- self = [super init];
65
-
66
- appdelegate = self;
67
-
68
- NSLog(@"Appice+delegate init");
69
-
70
- return self;
71
- }
72
-
73
- - (void)setApplicationInBackground:(NSNumber *)applicationInBackground {
74
- objc_setAssociatedObject(self, kApplicationInBackgroundKey, applicationInBackground, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
75
- }
76
-
77
- - (NSNumber *)applicationInBackground {
78
- return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
79
- }
80
- -(void)application:(UIApplication *)application swizzleddidReceiveRemoteNotification:(NSDictionary *)userInfo
81
- fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
82
- @try {
83
- BOOL appIceServer = [[appICE sharedInstance] isAppICENotification:userInfo];
84
- if(appIceServer)
85
- {
86
- [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
87
- completionHandler(UIBackgroundFetchResultNewData);
88
- }
89
- else
90
- {
91
- [self application:application swizzleddidReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
92
- }
93
- }
94
- @catch (NSException *exception) {
95
- NSLog(@"exception from did receive notfication cordova = %@",exception.reason);
96
- } @finally {
97
-
98
- }
99
- }
100
-
101
- - (BOOL)application:(UIApplication *)application swizzledDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
102
- [self application:application swizzledDidFinishLaunchingWithOptions:launchOptions];
103
-
104
- [self registerForRemoteNotification];
105
-
106
- self.applicationInBackground = @(YES);
107
-
108
- return YES;
109
- }
110
-
111
- - (void)registerForRemoteNotification {
112
- if(SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0")) {
113
- UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
114
- center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
115
- if( !error ){
116
- dispatch_async(dispatch_get_main_queue(), ^{
117
- [[UIApplication sharedApplication] registerForRemoteNotifications];
118
- });
119
- }
120
- }];
121
- }
122
- else {
123
- [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
124
- [[UIApplication sharedApplication] registerForRemoteNotifications];
125
- }
126
- }
127
-
128
- #pragma mark - Register Remote Notification
129
-
130
- - (void)application:(UIApplication*)application swizzleddidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
131
- @try {
132
- [[AppICEPlugin appice] handleToken:deviceToken];
133
- } @catch(NSException *e){}
134
- }
135
-
136
- - (void)application:(UIApplication*)application swizzleddidFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
137
- @try {
138
- [[AppICEPlugin appice] handleTokenError:error];
139
- } @catch (NSException *exception) {
140
- }
141
- }
142
- // - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
143
- // {
144
- // [[AppICEPlugin appice] handleToken:deviceToken];
145
- // }
146
- #pragma mark - Handle Notification info
147
-
148
- - (void) application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification {
149
-
150
- @try {
151
- [[AppICEPlugin appice] onHandleLocalNotification:notification];
152
- } @catch (NSException *exception) {
153
- }
154
- }
155
-
156
- /*- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
157
- @try {
158
- [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
159
- } @catch (NSException *exception) {
160
- }
161
- }*/
162
-
163
-
164
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
165
- - (void)userNotificationCenter:(UNUserNotificationCenter *)center
166
- willPresentNotification:(UNNotification *)notification
167
- withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
168
- @try {
169
- [[AppICEPlugin appice] onHandleRemoteUNotification:notification.request.content.userInfo];
170
-
171
- completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
172
- } @catch (NSException *exception) {
173
-
174
- } @finally {
175
-
176
- }
177
- }
178
-
179
- - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
180
-
181
- @try {
182
- NSDictionary *userInfo = response.notification.request.content.userInfo;
183
-
184
- [[AppICEPlugin appice] onHandleNotificationUResponse:userInfo];
185
-
186
- completionHandler();
187
- } @catch (NSException *exception) {
188
-
189
- } @finally {
190
-
191
- }
192
- }
193
- #endif
194
-
195
- #pragma mark - Handle Notification Action
196
-
197
- - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void(^)())completionHandler {
198
-
199
- @try {
200
- [[AppICEPlugin appice] onHandleActionForIdentifier:identifier];
201
-
202
- if (completionHandler) {
203
- completionHandler();
204
- }
205
- } @catch (NSException *exception) {
206
-
207
- } @finally {
208
-
209
- }
210
- }
211
-
212
- - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler
213
- {
214
- @try {
215
- [[AppICEPlugin appice] onHandleActionForIdentifier:identifier];
216
-
217
- if (completionHandler) {
218
- completionHandler();
219
- }
220
- } @catch (NSException *exception) {
221
-
222
- } @finally {
223
-
224
- }
225
- }
226
-
227
- #pragma mark - OpenURL Functions
228
-
229
- - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation {
230
- @try {
231
- if (!url) {
232
- return NO;
233
- }
234
- [[AppICEPlugin appice] onHandleOpenURLNotification:url];
235
- } @catch (NSException *exception) {
236
- }
237
- return YES;
238
- }
239
-
240
- - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
241
- @try {
242
- if (!url) {
243
- return NO;
244
- }
245
- [[AppICEPlugin appice] onHandleOpenURLNotification:url];
246
-
247
- } @catch (NSException *exception) {
248
- }
249
- return YES;
250
- }
251
-
252
- - (void)openURL:(NSURL*)url options:(NSDictionary<NSString *, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion {
253
- @try {
254
- [[AppICEPlugin appice] onHandleOpenURLNotification:url];
255
- } @catch (NSException *exception) {
256
- }
257
- }
258
-
259
- @end
1
+ #import "AppDelegate+AppICEPlugin.h"
2
+ #import "AppICEPlugin.h"
3
+ #import <objc/runtime.h>
4
+ #import "appICE.h"
5
+
6
+
7
+
8
+
9
+
10
+ #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
11
+ @import UserNotifications;
12
+ #endif
13
+
14
+ #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
15
+ @interface AppDelegate () <UNUserNotificationCenterDelegate>
16
+ @end
17
+ #endif
18
+
19
+ #define kApplicationInBackgroundKey @"applicationInBackground"
20
+ #define SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
21
+
22
+ @implementation AppDelegate (AppICEPlugin)
23
+
24
+ static id appdelegate;
25
+ typedef void (*OriginalImpType)(id self, SEL selector);
26
+ static OriginalImpType originalImp;
27
+ + (void)load {
28
+
29
+ NSLog(@"In Appice Load method");
30
+
31
+ }
32
+
33
+ - (id)init
34
+ {
35
+ self = [super init];
36
+
37
+ NSLog(@"Appice+delegate init");
38
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
39
+ center.delegate = self;
40
+ return self;
41
+ }
42
+
43
+ - (void)setApplicationInBackground:(NSNumber *)applicationInBackground {
44
+ objc_setAssociatedObject(self, kApplicationInBackgroundKey, applicationInBackground, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
45
+ }
46
+
47
+ - (NSNumber *)applicationInBackground {
48
+ return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
49
+ }
50
+
51
+
52
+ #pragma mark - Register Remote Notification
53
+
54
+
55
+ - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
56
+ {
57
+ // swizzle method called
58
+ @try {
59
+ [[AppICEPlugin appice] handleToken:deviceToken];
60
+ NSLog(@"inside didRegisterForRemoteNotificationsWithDeviceToken %@",deviceToken);
61
+ } @catch (NSException *exception) {
62
+ }
63
+ }
64
+ #pragma mark - Handle Notification info
65
+
66
+ - (void) application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification {
67
+
68
+ @try {
69
+ NSLog(@"inside didReceiveLocalNotification");
70
+ } @catch (NSException *exception) {
71
+ }
72
+ }
73
+
74
+ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
75
+ {
76
+ @try {
77
+ BOOL appIceServer = [[appICE sharedInstance] isAppICENotification:userInfo];
78
+ if(appIceServer)
79
+ {
80
+ // if yes appice plugin will be notified
81
+ [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
82
+ completionHandler(UIBackgroundFetchResultNewData);
83
+ }
84
+ NSLog(@"inside didrecieveremotenotification %@",userInfo);
85
+ } @catch (NSException *exception) {
86
+ }
87
+
88
+ }
89
+
90
+
91
+ #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
92
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
93
+ willPresentNotification:(UNNotification *)notification
94
+ withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
95
+ @try {
96
+
97
+ completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
98
+ } @catch (NSException *exception) {
99
+
100
+ } @finally {
101
+
102
+ }
103
+ }
104
+
105
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
106
+
107
+ @try {
108
+
109
+ NSDictionary *userInfo = response.notification.request.content.userInfo;
110
+ NSLog(@"inside didReceiveNotificationResponse %@",userInfo);
111
+ BOOL appIceServer = [[appICE sharedInstance] isAppICENotification:userInfo];
112
+ if(appIceServer)
113
+ {
114
+ [[AppICEPlugin appice] onHandleNotificationUResponse:userInfo];
115
+
116
+ }
117
+ completionHandler();
118
+ } @catch (NSException *exception) {
119
+
120
+ } @finally {
121
+
122
+ }
123
+ }
124
+ #endif
125
+
126
+ #pragma mark - Handle Notification Action
127
+
128
+ - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void(^)())completionHandler {
129
+
130
+ @try {
131
+ [[AppICEPlugin appice] onHandleActionForIdentifier:identifier];
132
+
133
+ if (completionHandler) {
134
+ completionHandler();
135
+ }
136
+ } @catch (NSException *exception) {
137
+
138
+ } @finally {
139
+
140
+ }
141
+ }
142
+
143
+ - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler
144
+ {
145
+ @try {
146
+ [[AppICEPlugin appice] onHandleActionForIdentifier:identifier];
147
+
148
+ if (completionHandler) {
149
+ completionHandler();
150
+ }
151
+ } @catch (NSException *exception) {
152
+
153
+ } @finally {
154
+
155
+ }
156
+ }
157
+
158
+ #pragma mark - OpenURL Functions
159
+
160
+ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation {
161
+ @try {
162
+ if (!url) {
163
+ return NO;
164
+ }
165
+ [[AppICEPlugin appice] onHandleOpenURLNotification:url];
166
+ } @catch (NSException *exception) {
167
+ }
168
+ return YES;
169
+ }
170
+
171
+ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
172
+ @try {
173
+ if (!url) {
174
+ return NO;
175
+ }
176
+ [[AppICEPlugin appice] onHandleOpenURLNotification:url];
177
+
178
+ } @catch (NSException *exception) {
179
+ }
180
+ return YES;
181
+ }
182
+
183
+ - (void)openURL:(NSURL*)url options:(NSDictionary<NSString *, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion {
184
+ @try {
185
+ [[AppICEPlugin appice] onHandleOpenURLNotification:url];
186
+ } @catch (NSException *exception) {
187
+ }
188
+ }
189
+
190
+ @end
191
+