cordova-plugin-insider 2.2.1 → 2.3.0
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/hooks/after_plugin_install.js +1 -1
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/InsiderPlugin.java +22 -0
- package/src/android/build-extras.gradle +1 -1
- package/src/ios/InsiderPlugin.h +4 -0
- package/src/ios/InsiderPlugin.m +59 -0
- package/types/CallbackType.d.ts +2 -0
- package/types/InsiderPlugin.d.ts +4 -0
- package/www/CallbackType.js +1 -0
- package/www/Constants.js +5 -1
- package/www/InsiderPlugin.js +61 -0
|
@@ -26,7 +26,7 @@ module.exports = function (context) {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
function addAGConnectDependency(lines) {
|
|
29
|
-
var AG_CONNECT_DEPENDENCY = "classpath 'com.huawei.agconnect:agcp:1.
|
|
29
|
+
var AG_CONNECT_DEPENDENCY = "classpath 'com.huawei.agconnect:agcp:1.9.1.302' " + COMMENT;
|
|
30
30
|
var pattern = /(\s*)classpath(\s+)[\',\"]com.android.tools.build:gradle.*[^\]\n]/m;
|
|
31
31
|
var index;
|
|
32
32
|
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-insider" version="2.
|
|
2
|
+
<plugin id="cordova-plugin-insider" version="2.3.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>Insider</name>
|
|
4
4
|
<description>Insider Cordova Plugin</description>
|
|
5
5
|
<keywords>insider,cordova,cordova-ios,cordova-android</keywords>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
<config-file target="config.xml" parent="/*">
|
|
35
35
|
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
|
|
36
|
-
<preference name="GradlePluginGoogleServicesVersion" value="4.
|
|
36
|
+
<preference name="GradlePluginGoogleServicesVersion" value="4.4.2" />
|
|
37
37
|
</config-file>
|
|
38
38
|
|
|
39
39
|
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<source url="https://cdn.cocoapods.org/" />
|
|
71
71
|
</config>
|
|
72
72
|
<pods use-frameworks="true">
|
|
73
|
-
<pod name="InsiderMobile" spec="13.
|
|
73
|
+
<pod name="InsiderMobile" spec="13.12.1" />
|
|
74
74
|
<pod name="InsiderGeofence" spec="1.2.0" />
|
|
75
75
|
<pod name="InsiderHybrid" spec="1.6.1" />
|
|
76
76
|
</pods>
|
|
@@ -135,6 +135,8 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
135
135
|
Insider.Instance.reinitWithPartnerName(args.getString(0));
|
|
136
136
|
} else if (action.equals("setGDPRConsent")) {
|
|
137
137
|
Insider.Instance.setGDPRConsent(Boolean.parseBoolean(args.getString(0)));
|
|
138
|
+
} else if (action.equals("setMobileAppAccess")) {
|
|
139
|
+
Insider.Instance.setMobileAppAccess(Boolean.parseBoolean(args.getString(0)));
|
|
138
140
|
} else if (action.equals("startTrackingGeofence")) {
|
|
139
141
|
cordova.getThreadPool().execute(new Runnable() {
|
|
140
142
|
@Override
|
|
@@ -161,6 +163,26 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
161
163
|
|
|
162
164
|
boolean optimizedBoolean = Insider.Instance.getContentBoolWithName(args.getString(0), args.getBoolean(1), boolVariableDataType);
|
|
163
165
|
|
|
166
|
+
callbackSuccess(callbackContext, optimizedBoolean);
|
|
167
|
+
} else if (action.equals("getContentStringWithoutCache")) {
|
|
168
|
+
ContentOptimizerDataType stringVariableDataType = getDataType(args.getString(2));
|
|
169
|
+
|
|
170
|
+
String optimizedString = Insider.Instance.getContentStringWithoutCache(args.getString(0), args.getString(1), stringVariableDataType);
|
|
171
|
+
|
|
172
|
+
if (optimizedString != null && optimizedString.length() > 0) {
|
|
173
|
+
callbackSuccess(callbackContext, optimizedString);
|
|
174
|
+
}
|
|
175
|
+
} else if (action.equals("getContentIntWithoutCache")) {
|
|
176
|
+
ContentOptimizerDataType intVariableDataType = getDataType(args.getString(2));
|
|
177
|
+
|
|
178
|
+
int optimizedInteger = Insider.Instance.getContentIntWithoutCache(args.getString(0), args.getInt(1), intVariableDataType);
|
|
179
|
+
|
|
180
|
+
callbackSuccess(callbackContext, optimizedInteger);
|
|
181
|
+
} else if (action.equals("getContentBoolWithoutCache")) {
|
|
182
|
+
ContentOptimizerDataType boolVariableDataType = getDataType(args.getString(2));
|
|
183
|
+
|
|
184
|
+
boolean optimizedBoolean = Insider.Instance.getContentBoolWithoutCache(args.getString(0), args.getBoolean(1), boolVariableDataType);
|
|
185
|
+
|
|
164
186
|
callbackSuccess(callbackContext, optimizedBoolean);
|
|
165
187
|
} else if (action.equals("removeInapp")) {
|
|
166
188
|
Insider.Instance.removeInapp(this.cordova.getActivity());
|
|
@@ -16,7 +16,7 @@ android {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
implementation 'com.useinsider:insider:14.
|
|
19
|
+
implementation 'com.useinsider:insider:14.10.0'
|
|
20
20
|
implementation 'com.useinsider:insiderhybrid:1.2.0'
|
|
21
21
|
|
|
22
22
|
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
|
package/src/ios/InsiderPlugin.h
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- (void) registerWithQuietPermission:(CDVInvokedUrlCommand *)command;
|
|
14
14
|
- (void) enableIDFACollection:(CDVInvokedUrlCommand *)command;
|
|
15
15
|
- (void) setGDPRConsent:(CDVInvokedUrlCommand *)command;
|
|
16
|
+
- (void) setMobileAppAccess:(CDVInvokedUrlCommand *)command;
|
|
16
17
|
- (void) startTrackingGeofence:(CDVInvokedUrlCommand *)command;
|
|
17
18
|
- (void) tagEvent:(CDVInvokedUrlCommand *)command;
|
|
18
19
|
- (void) enableLocationCollection:(CDVInvokedUrlCommand *)command;
|
|
@@ -22,6 +23,9 @@
|
|
|
22
23
|
- (void) getContentStringWithName:(CDVInvokedUrlCommand *)command;
|
|
23
24
|
- (void) getContentIntWithName:(CDVInvokedUrlCommand *)command;
|
|
24
25
|
- (void) getContentBoolWithName:(CDVInvokedUrlCommand *)command;
|
|
26
|
+
- (void) getContentStringWithoutCache:(CDVInvokedUrlCommand *)command;
|
|
27
|
+
- (void) getContentIntWithoutCache:(CDVInvokedUrlCommand *)command;
|
|
28
|
+
- (void) getContentBoolWithoutCache:(CDVInvokedUrlCommand *)command;
|
|
25
29
|
- (void) visitHomePage:(CDVInvokedUrlCommand *)command;
|
|
26
30
|
- (void) visitListingPage:(CDVInvokedUrlCommand *)command;
|
|
27
31
|
- (void) visitProductDetailPage:(CDVInvokedUrlCommand *)command;
|
package/src/ios/InsiderPlugin.m
CHANGED
|
@@ -123,6 +123,12 @@
|
|
|
123
123
|
[self.commandDelegate evalJs:js];
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
+
case InsiderCallbackTypeSessionStarted:{
|
|
127
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'SESSION_STARTED',""result"":""%@""}", callbackData];
|
|
128
|
+
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
129
|
+
[self.commandDelegate evalJs:js];
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
126
132
|
default:
|
|
127
133
|
break;
|
|
128
134
|
}
|
|
@@ -156,6 +162,17 @@
|
|
|
156
162
|
[Insider sendError:exception desc:@"Insider.m - setGDPRConsent"];
|
|
157
163
|
}
|
|
158
164
|
}
|
|
165
|
+
- (void) setMobileAppAccess:(CDVInvokedUrlCommand *)command {
|
|
166
|
+
@try {
|
|
167
|
+
[self.commandDelegate runInBackground:^{
|
|
168
|
+
NSString* booleanValueByString = [[command arguments] objectAtIndex:0];
|
|
169
|
+
[Insider setMobileAppAccess:[booleanValueByString isEqualToString: @"true"]];
|
|
170
|
+
[self sendSuccessResultWithString:@"SUCCESS" andCommand:command];
|
|
171
|
+
}];
|
|
172
|
+
} @catch (NSException *exception) {
|
|
173
|
+
[Insider sendError:exception desc:@"Insider.m - setMobileAppAccess"];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
159
176
|
|
|
160
177
|
- (void) startTrackingGeofence:(CDVInvokedUrlCommand *)command {
|
|
161
178
|
@try {
|
|
@@ -281,6 +298,30 @@
|
|
|
281
298
|
if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2]) return;
|
|
282
299
|
[self.commandDelegate runInBackground:^{
|
|
283
300
|
bool coResult = [Insider getContentBoolWithName:[command.arguments objectAtIndex:0] defaultBool:[[command.arguments objectAtIndex:1] boolValue] dataType:[[command.arguments objectAtIndex:2] intValue]];
|
|
301
|
+
[self sendSuccessResultWithBool:coResult andCommand:command];
|
|
302
|
+
}];
|
|
303
|
+
} @catch (NSException *e) {
|
|
304
|
+
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
- (void)getContentStringWithoutCache:(CDVInvokedUrlCommand *)command {
|
|
309
|
+
@try {
|
|
310
|
+
if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2]) return;
|
|
311
|
+
[self.commandDelegate runInBackground:^{
|
|
312
|
+
NSString *coResult = [Insider getContentStringWithoutCache:[command.arguments objectAtIndex:0] defaultString:[command.arguments objectAtIndex:1] dataType:[[command.arguments objectAtIndex:2] intValue]];
|
|
313
|
+
[self sendSuccessResultWithString:coResult andCommand:command];
|
|
314
|
+
}];
|
|
315
|
+
} @catch (NSException *e) {
|
|
316
|
+
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
- (void)getContentIntWithoutCache:(CDVInvokedUrlCommand *)command {
|
|
321
|
+
@try {
|
|
322
|
+
if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2]) return;
|
|
323
|
+
[self.commandDelegate runInBackground:^{
|
|
324
|
+
int coResult = [Insider getContentIntWithoutCache:[command.arguments objectAtIndex:0] defaultInt:[[command.arguments objectAtIndex:1] intValue] dataType:[[command.arguments objectAtIndex:2] intValue]];
|
|
284
325
|
[self sendSuccessResultWithInt:coResult andCommand:command];
|
|
285
326
|
}];
|
|
286
327
|
} @catch (NSException *e) {
|
|
@@ -288,6 +329,18 @@
|
|
|
288
329
|
}
|
|
289
330
|
}
|
|
290
331
|
|
|
332
|
+
- (void)getContentBoolWithoutCache:(CDVInvokedUrlCommand *)command {
|
|
333
|
+
@try {
|
|
334
|
+
if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2]) return;
|
|
335
|
+
[self.commandDelegate runInBackground:^{
|
|
336
|
+
bool coResult = [Insider getContentBoolWithoutCache:[command.arguments objectAtIndex:0] defaultBool:[[command.arguments objectAtIndex:1] boolValue] dataType:[[command.arguments objectAtIndex:2] intValue]];
|
|
337
|
+
[self sendSuccessResultWithBool:coResult andCommand:command];
|
|
338
|
+
}];
|
|
339
|
+
} @catch (NSException *e) {
|
|
340
|
+
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
291
344
|
- (void)visitHomePage:(CDVInvokedUrlCommand *)command {
|
|
292
345
|
@try {
|
|
293
346
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -904,6 +957,12 @@
|
|
|
904
957
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
905
958
|
}
|
|
906
959
|
|
|
960
|
+
- (void) sendSuccessResultWithBool:(BOOL)resultMessage andCommand:(CDVInvokedUrlCommand *)command {
|
|
961
|
+
CDVPluginResult *pluginResult = nil;
|
|
962
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:resultMessage];
|
|
963
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
964
|
+
}
|
|
965
|
+
|
|
907
966
|
- (void) sendSuccessResultWithArray:(NSArray *)resultMessage andCommand:(CDVInvokedUrlCommand *)command {
|
|
908
967
|
CDVPluginResult *pluginResult = nil;
|
|
909
968
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:resultMessage];
|
package/types/CallbackType.d.ts
CHANGED
package/types/InsiderPlugin.d.ts
CHANGED
|
@@ -24,12 +24,16 @@ interface InsiderPlugin {
|
|
|
24
24
|
getContentStringWithName(variableName: string, defaultValue: any, contentOptimizerDataType: number): Promise <any>;
|
|
25
25
|
getContentBoolWithName(variableName: string, defaultValue: boolean, contentOptimizerDataType: number): Promise <any>;
|
|
26
26
|
getContentIntWithName(variableName: string, defaultValue: number, contentOptimizerDataType: number): Promise <any>;
|
|
27
|
+
getContentStringWithoutCache(variableName: string, defaultValue: any, contentOptimizerDataType: number): Promise <any>;
|
|
28
|
+
getContentBoolWithoutCache(variableName: string, defaultValue: boolean, contentOptimizerDataType: number): Promise <any>;
|
|
29
|
+
getContentIntWithoutCache(variableName: string, defaultValue: number, contentOptimizerDataType: number): Promise <any>;
|
|
27
30
|
visitHomePage(): void;
|
|
28
31
|
visitListingPage(taxonomy: object): void;
|
|
29
32
|
visitProductDetailPage(product: object): void;
|
|
30
33
|
visitCartPage(products: object): void;
|
|
31
34
|
startTrackingGeofence(): void;
|
|
32
35
|
setGDPRConsent(gdprConsent: boolean): void;
|
|
36
|
+
setMobileAppAccess(mobileAppAccess: boolean): void;
|
|
33
37
|
enableIDFACollection(idfaCollection: boolean): void;
|
|
34
38
|
removeInapp(): void;
|
|
35
39
|
registerWithQuietPermission(booleanValue: boolean): void;
|
package/www/CallbackType.js
CHANGED
package/www/Constants.js
CHANGED
|
@@ -47,12 +47,16 @@ module.exports = {
|
|
|
47
47
|
GET_CONTENT_STRING_WITH_NAME: 'getContentStringWithName',
|
|
48
48
|
GET_CONTENT_BOOL_WITH_NAME: 'getContentBoolWithName',
|
|
49
49
|
GET_CONTENT_INT_WITH_NAME: 'getContentIntWithName',
|
|
50
|
+
GET_CONTENT_STRING_WITHOUT_CACHE: 'getContentStringWithoutCache',
|
|
51
|
+
GET_CONTENT_BOOL_WITHOUT_CACHE: 'getContentBoolWithoutCache',
|
|
52
|
+
GET_CONTENT_INT_WITHOUT_CACHE: 'getContentIntWithoutCache',
|
|
50
53
|
VISIT_HOME_PAGE: 'visitHomePage',
|
|
51
54
|
VISIT_LISTING_PAGE: 'visitListingPage',
|
|
52
55
|
VISIT_PRODUCT_DETAIL_PAGE: 'visitProductDetailPage',
|
|
53
56
|
VISIT_CART_PAGE: 'visitCartPage',
|
|
54
57
|
START_TRACKING_GEOFENCE: 'startTrackingGeofence',
|
|
55
58
|
SET_GDPR_CONSENT: 'setGDPRConsent',
|
|
59
|
+
SET_MOBILE_APP_ACCESS: 'setMobileAppAccess',
|
|
56
60
|
REMOVE_IN_APP: 'removeInapp',
|
|
57
61
|
REGISTER_WITH_QUIET_PERMISSION: 'registerWithQuietPermission',
|
|
58
62
|
SET_HYBRID_PUSH_TOKEN: 'setPushToken',
|
|
@@ -94,5 +98,5 @@ module.exports = {
|
|
|
94
98
|
// Reinit
|
|
95
99
|
REINIT_WITH_PARTNER_NAME: 'reinitWithPartnerName',
|
|
96
100
|
// SDK Version
|
|
97
|
-
SDK_VERSION: 'CDV-2.
|
|
101
|
+
SDK_VERSION: 'CDV-2.3.0',
|
|
98
102
|
};
|
package/www/InsiderPlugin.js
CHANGED
|
@@ -299,6 +299,54 @@ class InsiderPlugin {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
getContentStringWithoutCache = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
303
|
+
if (Utils.checkParameters([
|
|
304
|
+
{ type: 'string', value: variableName },
|
|
305
|
+
{ type: 'string', value: defaultValue },
|
|
306
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
307
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentStringWithoutCache');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
try {
|
|
312
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_STRING_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
313
|
+
} catch (error) {
|
|
314
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
getContentBoolWithoutCache = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
319
|
+
if (Utils.checkParameters([
|
|
320
|
+
{ type: 'string', value: variableName },
|
|
321
|
+
{ type: 'boolean', value: defaultValue },
|
|
322
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
323
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentBoolWithoutCache');
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_BOOL_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
getContentIntWithoutCache = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
335
|
+
if (Utils.checkParameters([
|
|
336
|
+
{ type: 'string', value: variableName },
|
|
337
|
+
{ type: 'number', value: defaultValue },
|
|
338
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
339
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentIntWithoutCache');
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
try {
|
|
344
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_INT_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
302
350
|
visitHomePage = () => {
|
|
303
351
|
try {
|
|
304
352
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_HOME_PAGE, []);
|
|
@@ -376,6 +424,19 @@ class InsiderPlugin {
|
|
|
376
424
|
}
|
|
377
425
|
};
|
|
378
426
|
|
|
427
|
+
setMobileAppAccess = (mobileAppAccess) => {
|
|
428
|
+
if (Utils.checkParameters([{ type: 'boolean', value: mobileAppAccess }])) {
|
|
429
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setMobileAppAccess');
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
try {
|
|
434
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_MOBILE_APP_ACCESS, [mobileAppAccess.toString().toLowerCase()]);
|
|
435
|
+
} catch (error) {
|
|
436
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
379
440
|
enableIDFACollection = (idfaCollection) => {
|
|
380
441
|
if (Utils.checkParameters([{ type: 'boolean', value: idfaCollection }])) {
|
|
381
442
|
Utils.showParameterWarningLog(this.constructor.name + '-enableIDFACollection');
|