cordova-plugin-appice 2.0.7 → 2.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-appice",
3
- "version": "2.0.07",
3
+ "version": "2.0.09",
4
4
  "description": "AppICE Plugin for Cordova/PhoneGap",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-appice",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-appice" version="2.0.07">
2
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-appice" version="2.0.09">
3
3
  <name>AppICE</name>
4
4
  <description>AppICE Plugin for Cordova/PhoneGap</description>
5
5
  <license>Commercial</license>
@@ -110,13 +110,12 @@
110
110
  </config-file>
111
111
 
112
112
  <framework src="com.google.android.gms:play-services-ads:16.0.0" />
113
- <framework src="com.google.android.gms:play-services-location:21.0.1" />
114
- <framework src="com.google.firebase:firebase-iid:20.0.0" />
115
- <framework src="com.google.firebase:firebase-messaging:20.0.0" />
116
- <framework src="com.google.firebase:firebase-core:16.0.9" />
113
+ <framework src="com.google.android.gms:play-services-location:21.0.1" />
114
+ <framework src="com.google.firebase:firebase-messaging:23.0.6" />
115
+ <framework src="com.google.firebase:firebase-core:21.1.0" />
117
116
  <framework src="com.android.support:support-v4:+" />
118
117
  <framework src="src/build.gradle" custom="true" type="gradleReference" />
119
- <framework src="appice.io.android:sdk:2.5.63"/>
118
+ <framework src="appice.io.android:sdk:2.5.64-release"/>
120
119
 
121
120
  <!--to add modified firebasex files,includes appice classin
122
121
  manifest,when SSL pinning enabled adds tag to manifest -->
@@ -1,7 +1,7 @@
1
1
  module.exports = function(context) {
2
2
  var fs =require ('fs');
3
3
  var path = require('path');
4
- var shell = require('shelljs');
4
+ var shell = require('shelljs');
5
5
 
6
6
  var platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
7
7
  var platformRootios = path.join(context.opts.projectRoot, 'platforms/ios');
@@ -32,13 +32,19 @@ const appName = appConfig.name();
32
32
  throw new Error('Unable to find AndroidManifest.xml: ' + err);
33
33
  }
34
34
  var serviceTag='<service android:exported="true" android:name="com.appice.appicemfppush.AppICEMFPPush">';
35
-
36
35
  if (data.indexOf(serviceTag) == -1) {
37
36
  var result = data.replace(/<service android:exported="false" android:name="com.ibm.fcmtest.myIntentService">/g,serviceTag);
38
37
  fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
39
38
  if (err) {
40
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
39
+ var result = data.replace(/<service android:exported="false" android:name="com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushNewIntentService">/g,serviceTag);
40
+ fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
41
+ if (err) {
42
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
43
+ }
44
+
45
+ });
41
46
  }
47
+
42
48
  });
43
49
 
44
50
  }
@@ -57,11 +63,19 @@ const appName = appConfig.name();
57
63
 
58
64
  if (data.indexOf(serviceTag) == -1) {
59
65
  var result = data.replace(/<service android:exported="false" android:name="com.ibm.fcmtest.myIntentService">/g,serviceTag);
60
- fs.writeFile(manifestFileNewRoot, result, 'utf8', function (err) {
61
- if (err) {
62
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
63
- }
64
- });
66
+ fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
67
+ if (err) {
68
+
69
+ var result = data.replace(/<service android:exported="false" android:name="com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushNewIntentService">/g,serviceTag);
70
+ fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
71
+ if (err) {
72
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
73
+ }
74
+
75
+ });
76
+ }
77
+
78
+ });
65
79
 
66
80
  }
67
81
  });
@@ -109,4 +123,4 @@ const appName = appConfig.name();
109
123
 
110
124
 
111
125
  }
112
- }
126
+ }
package/src/build.gradle CHANGED
@@ -1,6 +1,15 @@
1
1
  allprojects {
2
2
  apply from: 'repositories.gradle'
3
3
  repositories {
4
- maven { url "https://jitpack.io" }
4
+ maven {
5
+ url "https://gitlab.com/api/v4/projects/10636887/packages/maven"
6
+ credentials(HttpHeaderCredentials) {
7
+ name = "Deploy-Token"
8
+ value = ""
9
+ }
10
+ authentication {
11
+ header(HttpHeaderAuthentication)
12
+ }
13
+ }
5
14
  }
6
15
  }
@@ -1,4 +1,3 @@
1
-
2
1
  #import "AppDelegate+AppICEPlugin.h"
3
2
  #import "AppICEPlugin.h"
4
3
  #import <objc/runtime.h>
@@ -10,9 +9,7 @@
10
9
 
11
10
  #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
12
11
  @import UserNotifications;
13
- #endif
14
12
 
15
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
16
13
  @interface AppDelegate () <UNUserNotificationCenterDelegate>
17
14
  @end
18
15
  #endif
@@ -26,47 +23,46 @@ static id appdelegate;
26
23
  typedef void (*OriginalImpType)(id self, SEL selector);
27
24
  static OriginalImpType originalImp;
28
25
  + (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
26
 
36
-
37
-
38
- //for Notification received
39
- Method originalDidReceiveRemoteNotification = class_getInstanceMethod(self, @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:));
27
+ NSLog(@"In Appice Load method");
28
+
29
+ // Swizzling method for handling received remote notifications
30
+ Method originalDidReceiveRemoteNotification = class_getInstanceMethod(self, @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:));
40
31
  Method swizzleDidReceiveRemoteNotification = class_getInstanceMethod(self, @selector(application:swizzleddidReceiveRemoteNotification:fetchCompletionHandler:));
41
32
  method_exchangeImplementations(originalDidReceiveRemoteNotification, swizzleDidReceiveRemoteNotification);
42
-
43
-
44
-
45
33
 
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:));
34
+ // Swizzling method for handling notification responses
35
+ Method originalDidResponseRemoteNotification = class_getInstanceMethod(self, @selector(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:));
36
+ Method swizzleDidResponseRemoteNotification = class_getInstanceMethod(self, @selector(userNotificationCenter:swizzleddidReceiveNotificationResponse:withCompletionHandler:));
37
+ method_exchangeImplementations(originalDidResponseRemoteNotification, swizzleDidResponseRemoteNotification);
38
+
39
+ // Swizzling method for handling notification will present
40
+ Method originalwillPresentNotification = class_getInstanceMethod(self, @selector(userNotificationCenter:willPresentNotification:withCompletionHandler:));
41
+ Method swizzlewillPresentNotification = class_getInstanceMethod(self, @selector(userNotificationCenter:swizzledwillPresentNotification:withCompletionHandler:));
42
+ method_exchangeImplementations(originalwillPresentNotification, swizzlewillPresentNotification);
43
+
44
+ // Swizzling method for handling device token registration for remote notifications
45
+ Method originaldidRegisterForRemoteNotificationsWithDeviceToken = class_getInstanceMethod(self, @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:));
54
46
  Method swizzleddidRegisterForRemoteNotificationsWithDeviceToken = class_getInstanceMethod(self, @selector(application:swizzleddidRegisterForRemoteNotificationsWithDeviceToken:));
55
47
  method_exchangeImplementations(originaldidRegisterForRemoteNotificationsWithDeviceToken, swizzleddidRegisterForRemoteNotificationsWithDeviceToken);
48
+
49
+ // Swizzling method for handling failures during remote notification registration
50
+ Method originaldidFailToRegisterForRemoteNotificationsWithError = class_getInstanceMethod(self, @selector(application:didFailToRegisterForRemoteNotificationsWithError:));
51
+ Method swizzleddidFailToRegisterForRemoteNotificationsWithError = class_getInstanceMethod(self, @selector(application:swizzleddidFailToRegisterForRemoteNotificationsWithError:));
52
+ method_exchangeImplementations(originaldidFailToRegisterForRemoteNotificationsWithError, swizzleddidFailToRegisterForRemoteNotificationsWithError);
53
+
54
+
56
55
  }
57
56
 
58
- +(id) delegate{
59
- return appdelegate;
60
- }
61
-
62
- - (id)init
63
- {
57
+ - (id)init {
64
58
  self = [super init];
65
59
 
66
- appdelegate = self;
67
-
68
60
  NSLog(@"Appice+delegate init");
69
61
 
62
+ // Set the current instance as the delegate for UNUserNotificationCenter.
63
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
64
+ center.delegate = self;
65
+
70
66
  return self;
71
67
  }
72
68
 
@@ -75,121 +71,144 @@ static OriginalImpType originalImp;
75
71
  }
76
72
 
77
73
  - (NSNumber *)applicationInBackground {
78
- return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
74
+ return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
79
75
  }
80
- -(void)application:(UIApplication *)application swizzleddidReceiveRemoteNotification:(NSDictionary *)userInfo
81
- fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
76
+
77
+ #pragma mark - Handling received remote notifications
78
+
79
+ // Swizzled method for handling received remote notifications
80
+ - (void)application:(UIApplication *)application swizzleddidReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
81
+ NSLog(@"inside swizzledidreceive %@", userInfo);
82
82
  @try {
83
+ // Check if the push is from Appice server.
83
84
  BOOL appIceServer = [[appICE sharedInstance] isAppICENotification:userInfo];
84
- if(appIceServer)
85
- {
86
- [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
85
+ if (appIceServer) {
86
+ // If yes, Appice plugin will be notified.
87
+ [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
87
88
  completionHandler(UIBackgroundFetchResultNewData);
88
- }
89
- else
90
- {
89
+ } else {
90
+ // Else, the notification is not related to Appice, so it will be handled by other third-party plugin.
91
91
  [self application:application swizzleddidReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
92
92
  }
93
93
  }
94
94
  @catch (NSException *exception) {
95
- NSLog(@"exception from did receive notfication cordova = %@",exception.reason);
96
- } @finally {
97
-
95
+ NSLog(@"exception from did receive notification cordova = %@", exception.reason);
98
96
  }
99
97
  }
100
98
 
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;
99
+ -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
100
+ NSLog(@"inside original didReceiveRemoteNotification %@",userInfo);
101
+ completionHandler(UIBackgroundFetchResultNewData);
109
102
  }
110
103
 
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
- }];
104
+ #pragma mark - Handling of remote notification response
105
+ // Swizzled method for handling remote notification response
106
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center swizzleddidReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
107
+
108
+ @try {
109
+ NSDictionary *userInfo = response.notification.request.content.userInfo;
110
+ NSLog(@"inside swizzledidresponse %@",userInfo);
111
+ BOOL appIceServer = [[appICE sharedInstance] isAppICENotification:userInfo];
112
+ if(appIceServer)
113
+ {
114
+ // If yes, Appice plugin will be notified.
115
+ [[AppICEPlugin appice] onHandleNotificationUResponse:userInfo];
116
+ completionHandler();
117
+ }
118
+ else
119
+ {
120
+ // Else, the notification is not related to Appice, so it will be handled by other third-party plugin.
121
+ [self userNotificationCenter:center swizzleddidReceiveNotificationResponse:response withCompletionHandler:completionHandler];
122
+ }
123
+
121
124
  }
122
- else {
123
- [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
124
- [[UIApplication sharedApplication] registerForRemoteNotifications];
125
+ @catch (NSException *exception) {
126
+ NSLog(@"exception from did response notfication cordova = %@",exception.reason);
125
127
  }
126
128
  }
127
-
128
- #pragma mark - Register Remote Notification
129
-
130
- - (void)application:(UIApplication*)application swizzleddidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
129
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
130
+
131
131
  @try {
132
- [[AppICEPlugin appice] handleToken:deviceToken];
133
- } @catch(NSException *e){}
132
+ NSLog(@"In original userNotificationCenter");
133
+ }
134
+ @catch (NSException *exception) {
135
+
136
+ }
134
137
  }
135
-
138
+ #pragma mark - Handling of remote notification registration failures
139
+ // Swizzled method for handling remote notification registration failures
136
140
  - (void)application:(UIApplication*)application swizzleddidFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
137
141
  @try {
138
142
  [[AppICEPlugin appice] handleTokenError:error];
143
+ [self application:application swizzleddidFailToRegisterForRemoteNotificationsWithError:error];
139
144
  } @catch (NSException *exception) {
145
+ NSLog(@"exception from swizzleddidFailToRegisterForRemoteNotificationsWithError cordova = %@",exception.reason);
140
146
  }
141
147
  }
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
-
148
+ - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
150
149
  @try {
151
- [[AppICEPlugin appice] onHandleLocalNotification:notification];
150
+ NSLog(@"in original didFailToRegisterForRemoteNotificationsWithError");
152
151
  } @catch (NSException *exception) {
153
152
  }
154
153
  }
154
+ #pragma mark - Handle Device Token
155
+ // Swizzled method for handling Device Token
156
+ - (void)application:(UIApplication*)application swizzleddidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
157
+ @try {
158
+ NSLog(@"apns token appIce %@",deviceToken);
159
+ [[AppICEPlugin appice] handleToken:deviceToken];
160
+ [self application:application swizzleddidRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
161
+
162
+ } @catch(NSException *e){
163
+ NSLog(@"exception from swizzleddidRegisterForRemoteNotificationsWithDeviceToken cordova = %@",e.reason);
164
+ }
165
+ }
166
+ - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
167
+ {
168
+ @try {
169
+ NSLog(@"inside didRegisterForRemoteNotificationsWithDeviceToken %@",deviceToken);
170
+
171
+ } @catch (NSException *exception) {
172
+ }
173
+ }
174
+ #pragma mark - Handle Local Notification
155
175
 
156
- /*- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
176
+ - (void) application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification {
177
+
157
178
  @try {
158
- [[AppICEPlugin appice] onHandleRemoteUNotification:userInfo];
179
+ NSLog(@"inside didReceiveLocalNotification");
159
180
  } @catch (NSException *exception) {
160
181
  }
161
- }*/
182
+ }
162
183
 
184
+ #pragma mark - Handling of remote notification willPresentNotification
163
185
 
164
186
  #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
165
187
  - (void)userNotificationCenter:(UNUserNotificationCenter *)center
166
188
  willPresentNotification:(UNNotification *)notification
167
189
  withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
168
190
  @try {
169
- [[AppICEPlugin appice] onHandleRemoteUNotification:notification.request.content.userInfo];
170
-
171
- completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
191
+ NSLog(@"inside original willPresentNotification");
172
192
  } @catch (NSException *exception) {
173
-
193
+
174
194
  } @finally {
175
195
 
176
196
  }
177
197
  }
178
198
 
179
- - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
180
-
199
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
200
+ swizzledwillPresentNotification:(UNNotification *)notification
201
+ withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
181
202
  @try {
182
- NSDictionary *userInfo = response.notification.request.content.userInfo;
183
-
184
- [[AppICEPlugin appice] onHandleNotificationUResponse:userInfo];
185
-
186
- completionHandler();
203
+ completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
187
204
  } @catch (NSException *exception) {
205
+ NSLog(@"exception from willPresentNotification cordova = %@",exception.reason);
188
206
 
189
207
  } @finally {
190
208
 
191
209
  }
192
210
  }
211
+
193
212
  #endif
194
213
 
195
214
  #pragma mark - Handle Notification Action
@@ -243,7 +262,7 @@ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
243
262
  return NO;
244
263
  }
245
264
  [[AppICEPlugin appice] onHandleOpenURLNotification:url];
246
-
265
+
247
266
  } @catch (NSException *exception) {
248
267
  }
249
268
  return YES;
@@ -257,3 +276,4 @@ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
257
276
  }
258
277
 
259
278
  @end
279
+
@@ -207,15 +207,16 @@ static NSInteger const kNotificationStackSize = 10;
207
207
  }
208
208
  -(void)sendCallback:(NSDictionary *)userInfo {
209
209
 
210
-
210
+
211
211
  @try {
212
212
  if (userInfo != NULL&& [userInfo objectForKey:@"data"] != NULL) {
213
213
  NSDictionary *data = [userInfo objectForKey:@"data"];
214
214
  NSDictionary *message = [data objectForKey:@"message"];
215
+ [self sendNotification:userInfo];
215
216
  if (message != NULL && [message objectForKey:@"et"] != NULL) {
216
217
  NSString *et = [message objectForKey:@"et"];
217
218
  if (et != NULL
218
- // && [et caseInsensitiveCompare:@"dl"] == NSOrderedSame
219
+ // && [et caseInsensitiveCompare:@"dl"] == NSOrderedSame
219
220
  ) {
220
221
  NSMutableDictionary *dpDict = [[NSMutableDictionary alloc] init];
221
222
  @try {
@@ -233,10 +234,10 @@ static NSInteger const kNotificationStackSize = 10;
233
234
 
234
235
  @try {
235
236
  NSDictionary *cdata = [message objectForKey:@"cdata"];
236
- // NSString *template = [cdata objectForKey:@"template"];
237
- // if (template != NULL
238
- //&& [template isKindOfClass:[NSString class]]
239
- // ) {
237
+ NSString *template = [cdata objectForKey:@"template"];
238
+ if (template != NULL
239
+ && [template isKindOfClass:[NSString class]]
240
+ ) {
240
241
  NSString *udata = (NSString*) cdata;
241
242
  if ([udata hasPrefix:@"http://"] || [udata hasPrefix:@"https://"]) {
242
243
  // cdata contains length text inside url - fetch and process it
@@ -254,41 +255,42 @@ static NSInteger const kNotificationStackSize = 10;
254
255
  NSDictionary *jsonObject1 = [NSJSONSerialization JSONObjectWithData:[response dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:nil];
255
256
 
256
257
  NSLog(@"shailesh res :%@",jsonObject1);
257
- [self fillDicData:jsonObject1 within:dpDict];
258
+ [self fillDicData:jsonObject1 within:dpDict];
258
259
 
259
- // NSString * cdatastr = [jsonObject1 objectForKey:@"cdata"];
260
+ // NSString * cdatastr = [jsonObject1 objectForKey:@"cdata"];
260
261
  //[dpDict setObject:cdatastr forKey:@"cdata"];
261
- [self sendNotification:dpDict];
262
+ // [self sendNotification:dpDict];
263
+
262
264
 
263
-
264
265
  }
265
266
  }];
266
267
  [self setFailBlock:^(NSError *error) {
267
-
268
- NSLog(@"Error in request :%@", [error localizedDescription]);
268
+
269
+ NSLog(@"Error in request :%@", [error localizedDescription]);
269
270
  }];
270
271
  [self startASyncHttp];
271
- }
272
-
273
- // }
274
- else if (cdata != NULL && [cdata isKindOfClass:[NSDictionary class]]) {
275
- // cdata contains object process encoded data and store in dictionary to be passed to cordova
276
- NSDictionary *jsonObject = (NSDictionary*) cdata;
277
- [self fillDicData:jsonObject within:dpDict];
272
+ }
273
+
274
+ // }
275
+ else if (cdata != NULL && [cdata isKindOfClass:[NSDictionary class]]) {
276
+ // cdata contains object process encoded data and store in dictionary to be passed to cordova
277
+ NSDictionary *jsonObject = (NSDictionary*) cdata;
278
+ [self fillDicData:jsonObject within:dpDict];
279
+ }
280
+
281
+ }
282
+ }@catch(NSException *e) {
283
+ NSLog(@"Exception : %@", [e callStackSymbols]);
284
+ }
285
+ NSLog(@"Appice - sendallback : %@", dpDict);
286
+ if (dpDict != NULL) {
287
+ //[self sendNotification:dpDict];
278
288
  }
279
-
280
- } @catch(NSException *e) {
281
- NSLog(@"Exception : %@", [e callStackSymbols]);
282
- }
283
- NSLog(@"Appice - sendallback : %@", dpDict);
284
- if (dpDict != NULL) {
285
- //[self sendNotification:dpDict];
286
- }
287
289
  }
288
290
  }
291
+
289
292
  }
290
-
291
- } @catch (NSException *exception) {
293
+ }@catch (NSException *exception) {
292
294
 
293
295
  } @finally {
294
296
 
@@ -435,38 +437,12 @@ static NSInteger const kNotificationStackSize = 10;
435
437
 
436
438
  #pragma mark - Cordova Methods
437
439
 
438
- /**
439
- Notification Registration
440
- */
441
- - (void)registerForRemoteNotification {
442
- @try {
443
- if(SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0")) {
444
- UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
445
- center.delegate = [AppDelegate delegate];
446
- [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
447
- if( !error ){
448
- dispatch_async(dispatch_get_main_queue(), ^{
449
- [[UIApplication sharedApplication] registerForRemoteNotifications];
450
- });
451
- }
452
- }];
453
- }
454
- else {
455
- [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
456
- [[UIApplication sharedApplication] registerForRemoteNotifications];
457
- }
458
- } @catch (NSException *exception) {
459
-
460
- } @finally {
461
-
462
- }
463
- }
464
440
 
465
441
  -(void)startContext:(CDVInvokedUrlCommand *)command {
466
442
  @try {
467
443
  [self.commandDelegate runInBackground:^{
468
444
  @try {
469
- [self registerForRemoteNotification];
445
+
470
446
 
471
447
  [[appICE sharedInstance] startContext];
472
448
 
@@ -500,8 +476,7 @@ static NSInteger const kNotificationStackSize = 10;
500
476
 
501
477
  [appICE setupKeys:appKey withapiKey:apiKey withappId:appID otherSdkdeviceId:gcmID region:region baseUrl:baseUrl certficates:certs];
502
478
  }
503
-
504
- [self registerForRemoteNotification];
479
+
505
480
 
506
481
  [[appICE sharedInstance] startContext];
507
482