cordova-plugin-insider 1.7.0 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-insider",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A plugin that you can use Insider SDK with Cordova and Ionic",
5
5
  "cordova_name": "Insider Cordova Plugin",
6
6
  "cordova": {
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-insider" version="1.7.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="cordova-plugin-insider" version="1.8.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>
@@ -70,8 +70,8 @@
70
70
  <source url="https://cdn.cocoapods.org/" />
71
71
  </config>
72
72
  <pods use-frameworks="true">
73
- <pod name="InsiderMobile" spec="12.8.6" />
74
- <pod name="InsiderGeofence" spec="1.0.3" />
73
+ <pod name="InsiderMobile" spec="13.2.2" />
74
+ <pod name="InsiderGeofence" spec="1.1.0" />
75
75
  <pod name="InsiderHybrid" spec="1.4.0" />
76
76
  </pods>
77
77
  </podspec>
@@ -112,6 +112,8 @@ public class InsiderPlugin extends CordovaPlugin {
112
112
  Insider.Instance.setCustomEndpoint(args.getString(3));
113
113
 
114
114
  init(args.getString(0), args.getString(1));
115
+ } else if (action.equals("reinitWithPartnerName")) {
116
+ Insider.Instance.reinitWithPartnerName(args.getString(0));
115
117
  } else if (action.equals("setGDPRConsent")) {
116
118
  Insider.Instance.setGDPRConsent(Boolean.parseBoolean(args.getString(0)));
117
119
  } else if (action.equals("startTrackingGeofence")) {
@@ -16,7 +16,7 @@ android {
16
16
  }
17
17
 
18
18
  dependencies {
19
- implementation 'com.useinsider:insider:14.0.0'
19
+ implementation 'com.useinsider:insider:14.1.1'
20
20
  implementation 'com.useinsider:insiderhybrid:1.1.6'
21
21
 
22
22
  implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
@@ -9,6 +9,7 @@
9
9
 
10
10
  - (void) init:(CDVInvokedUrlCommand *)command;
11
11
  - (void) initWithLaunchOptions:(CDVInvokedUrlCommand *)command;
12
+ - (void) reinitWithPartnerName:(CDVInvokedUrlCommand *)command;
12
13
  - (void) registerWithQuietPermission:(CDVInvokedUrlCommand *)command;
13
14
  - (void) enableIDFACollection:(CDVInvokedUrlCommand *)command;
14
15
  - (void) setGDPRConsent:(CDVInvokedUrlCommand *)command;
@@ -15,12 +15,13 @@
15
15
  @try {
16
16
  if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2])
17
17
  return;
18
- [self.commandDelegate runInBackground:^{
19
- NSString* partnerName = [[command arguments] objectAtIndex:0];
20
- NSString* appGroup = [[command arguments] objectAtIndex:1];
21
- [Insider initWithLaunchOptions:nil partnerName:partnerName appGroup:appGroup];
22
- [self sendSuccessResultWithString:@"Insider Cordova Plugin: Initialized" andCommand:command];
23
- }];
18
+
19
+ NSString* partnerName = [[command arguments] objectAtIndex:0];
20
+ NSString* appGroup = [[command arguments] objectAtIndex:1];
21
+
22
+ [Insider initWithLaunchOptions:nil partnerName:partnerName appGroup:appGroup];
23
+
24
+ [self sendSuccessResultWithString:@"Insider Cordova Plugin: Initialized" andCommand:command];
24
25
  } @catch (NSException *exception) {
25
26
  [Insider sendError:exception desc:@"Insider.m - init"];
26
27
  }
@@ -32,13 +33,12 @@
32
33
  if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2])
33
34
  return;
34
35
 
35
- [self.commandDelegate runInBackground:^{
36
- [Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
37
- [Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
38
- [Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2]];
39
- [Insider resumeSession];
40
- [self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithLaunchOptions" andCommand:command];
41
- }];
36
+ [Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
37
+ [Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
38
+ [Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2]];
39
+ [Insider hybridApplicationDidBecomeActive];
40
+
41
+ [self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithLaunchOptions" andCommand:command];
42
42
  } @catch (NSException *exception){
43
43
  [Insider sendError:exception desc:@"Insider Cordova Plugin - initWithLaunchOptions"];
44
44
  }
@@ -49,19 +49,35 @@
49
49
  if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2] || ![command.arguments objectAtIndex:3]) {
50
50
  return;
51
51
  }
52
- [self.commandDelegate runInBackground:^{
53
- [Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
54
- [Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
55
- [Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2] customEndpoint:[command.arguments objectAtIndex:3]];
56
- [Insider resumeSession];
57
- [self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithCustomEndpoint" andCommand:command];
58
- }];
59
52
 
53
+ [Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
54
+ [Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
55
+ [Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2] customEndpoint:[command.arguments objectAtIndex:3]];
56
+ [Insider hybridApplicationDidBecomeActive];
57
+
58
+ [self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithCustomEndpoint" andCommand:command];
60
59
  } @catch (NSException *exception){
61
60
  [Insider sendError:exception desc:@"Insider Cordova Plugin.m - initWithCustomEndpoint"];
62
61
  }
63
62
  }
64
63
 
64
+ - (void) reinitWithPartnerName:(CDVInvokedUrlCommand *)command {
65
+ @try {
66
+ if (![command.arguments objectAtIndex:0])
67
+ return;
68
+
69
+ [self.commandDelegate runInBackground:^{
70
+ NSString* partnerName = [[command arguments] objectAtIndex:0];
71
+
72
+ [Insider reinitWithPartnerName:partnerName];
73
+
74
+ [self sendSuccessResultWithString:@"Insider Cordova Plugin: Re-Initialized." andCommand:command];
75
+ }];
76
+ } @catch (NSException *exception) {
77
+ [Insider sendError:exception desc:@"Insider.m - init"];
78
+ }
79
+ }
80
+
65
81
  -(void)registerCallback:(NSDictionary *)callbackDictionary {
66
82
  @try {
67
83
  if (!callbackDictionary || [callbackDictionary count] == 0)
@@ -229,7 +245,7 @@
229
245
  - (void)hybridIntent:(CDVInvokedUrlCommand *)command {
230
246
  @try {
231
247
  [self.commandDelegate runInBackground:^{
232
- [Insider resumeSession];
248
+ [Insider hybridApplicationDidBecomeActive];
233
249
  }];
234
250
  } @catch (NSException *e) {
235
251
  [Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
package/www/Constants.js CHANGED
@@ -83,6 +83,8 @@ module.exports = {
83
83
  // Platform
84
84
  ANDROID: 'android',
85
85
  IOS: 'ios',
86
+ // Reinit
87
+ REINIT_WITH_PARTNER_NAME: 'reinitWithPartnerName',
86
88
  // SDK Version
87
- SDK_VERSION: 'CDV-1.7.0',
89
+ SDK_VERSION: 'CDV-1.8.0',
88
90
  };
@@ -71,6 +71,20 @@ class InsiderPlugin {
71
71
  }
72
72
  }
73
73
 
74
+ reinitWithPartnerName = (partnerName) => {
75
+ if (Utils.checkParameters([
76
+ { type: 'string', value: partnerName }])) {
77
+ Utils.showParameterWarningLog(this.constructor.name + '-reinit');
78
+ return;
79
+ }
80
+
81
+ try {
82
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REINIT_WITH_PARTNER_NAME, [partnerName])
83
+ } catch (error) {
84
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
85
+ }
86
+ };
87
+
74
88
  getCurrentUser = () => {
75
89
  try {
76
90
  return this.insiderUser;