cordova-plugin-insider 3.0.0 → 3.0.2

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": "3.0.0",
3
+ "version": "3.0.2",
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": {
@@ -28,6 +28,6 @@
28
28
  "@babel/preset-env": "^7.27.2"
29
29
  },
30
30
  "dependencies": {
31
- "babel": "^5.8.38"
31
+ "babel": "^6.23.0"
32
32
  }
33
33
  }
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-insider" version="3.0.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="3.0.2" 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,9 +70,9 @@
70
70
  <source url="https://cdn.cocoapods.org/" />
71
71
  </config>
72
72
  <pods use-frameworks="true">
73
- <pod name="InsiderMobile" spec="14.0.4" />
74
- <pod name="InsiderGeofence" spec="1.2.3" />
75
- <pod name="InsiderHybrid" spec="1.7.5" />
73
+ <pod name="InsiderMobile" spec="14.2.2" />
74
+ <pod name="InsiderGeofence" spec="1.2.4" />
75
+ <pod name="InsiderHybrid" spec="1.7.6" />
76
76
  </pods>
77
77
  </podspec>
78
78
 
@@ -584,6 +584,29 @@ public class InsiderPlugin extends CordovaPlugin {
584
584
  Insider.Instance.getCurrentUser().login(insiderIdentifiers);
585
585
  } else if (action.equals(InsiderHybridMethods.LOGOUT)) {
586
586
  Insider.Instance.getCurrentUser().logout();
587
+ // TODO: Use InsiderHybridMethods.LOGOUT_RESETTING_INSIDER_ID constant when insiderhybrid is upgraded to version with this constant
588
+ } else if (action.equals("logoutResettingInsiderID")) {
589
+ InsiderIdentifiers[] identifiers = null;
590
+
591
+ if (args.get(0) != null && !args.isNull(0)) {
592
+ identifiers = convertJSONArrayToInsiderIdentifiersArray(args.getJSONArray(0));
593
+ }
594
+
595
+ if (args.length() > 1) {
596
+ final CallbackContext finalCallbackContext = callbackContext;
597
+ Insider.Instance.getCurrentUser().logoutResettingInsiderID(identifiers, new InsiderUser.InsiderIDResult() {
598
+ @Override
599
+ public void insiderIDResult(String insiderID) {
600
+ if (insiderID != null) {
601
+ callbackSuccess(finalCallbackContext, insiderID);
602
+ } else {
603
+ callbackSuccess(finalCallbackContext, "");
604
+ }
605
+ }
606
+ });
607
+ } else {
608
+ Insider.Instance.getCurrentUser().logoutResettingInsiderID(identifiers);
609
+ }
587
610
  } else if (action.equals(Constants.HANDLE_NOTIFICATION)) {
588
611
  if (args.get(0) == null)
589
612
  return false;
@@ -1030,4 +1053,36 @@ public class InsiderPlugin extends CordovaPlugin {
1030
1053
  Insider.Instance.putException(e);
1031
1054
  }
1032
1055
  }
1056
+
1057
+ private InsiderIdentifiers[] convertJSONArrayToInsiderIdentifiersArray(JSONArray identifiersArray) throws JSONException {
1058
+ if (identifiersArray == null || identifiersArray.length() == 0) {
1059
+ return null;
1060
+ }
1061
+
1062
+ InsiderIdentifiers[] identifiers = new InsiderIdentifiers[identifiersArray.length()];
1063
+ for (int i = 0; i < identifiersArray.length(); i++) {
1064
+ JSONObject identifierMap = identifiersArray.getJSONObject(i);
1065
+ InsiderIdentifiers insiderIdentifiers = new InsiderIdentifiers();
1066
+
1067
+ Map<String, Object> identifierData = CDVUtils.convertJSONToMap(identifierMap.toString());
1068
+ for (String key : identifierData.keySet()) {
1069
+ switch (key) {
1070
+ case InsiderHybridMethods.ADD_EMAIL:
1071
+ insiderIdentifiers.addEmail(String.valueOf(identifierData.get(key)));
1072
+ break;
1073
+ case InsiderHybridMethods.ADD_PHONE_NUMBER:
1074
+ insiderIdentifiers.addPhoneNumber(String.valueOf(identifierData.get(key)));
1075
+ break;
1076
+ case InsiderHybridMethods.ADD_USER_ID:
1077
+ insiderIdentifiers.addUserID(String.valueOf(identifierData.get(key)));
1078
+ break;
1079
+ default:
1080
+ insiderIdentifiers.addCustomIdentifier(key, String.valueOf(identifierData.get(key)));
1081
+ break;
1082
+ }
1083
+ }
1084
+ identifiers[i] = insiderIdentifiers;
1085
+ }
1086
+ return identifiers;
1087
+ }
1033
1088
  }
@@ -16,8 +16,8 @@ android {
16
16
  }
17
17
 
18
18
  dependencies {
19
- implementation 'com.useinsider:insider:15.1.3'
20
- implementation 'com.useinsider:insiderhybrid:1.3.3'
19
+ implementation 'com.useinsider:insider:15.2.1'
20
+ implementation 'com.useinsider:insiderhybrid:1.3.4'
21
21
 
22
22
  implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
23
23
  implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4'
@@ -31,7 +31,7 @@ dependencies {
31
31
  implementation 'com.google.firebase:firebase-messaging:24.0.0'
32
32
  implementation 'com.google.android.play:review:2.0.1'
33
33
 
34
- implementation 'com.huawei.hms:push:6.12.0.300'
34
+ implementation 'com.huawei.hms:push:6.13.0.300'
35
35
  implementation 'com.huawei.hms:ads-identifier:3.4.62.300'
36
- implementation 'com.huawei.hms:location:6.11.0.301'
36
+ implementation 'com.huawei.hms:location:6.16.0.302'
37
37
  }
@@ -61,6 +61,7 @@
61
61
  - (void) unsetCustomAttribute:(CDVInvokedUrlCommand *)command;
62
62
  - (void) login:(CDVInvokedUrlCommand *)command;
63
63
  - (void) logout:(CDVInvokedUrlCommand *)command;
64
+ - (void) logoutResettingInsiderID:(CDVInvokedUrlCommand *)command;
64
65
  - (void) signUpConfirmation:(CDVInvokedUrlCommand *)command;
65
66
  - (void) putException:(CDVInvokedUrlCommand *)command;
66
67
  - (void) handleNotification:(CDVInvokedUrlCommand *)command;
@@ -772,6 +772,31 @@
772
772
  }
773
773
  }
774
774
 
775
+ - (void)logoutResettingInsiderID:(CDVInvokedUrlCommand *)command {
776
+ @try {
777
+ dispatch_async(dispatch_get_main_queue(), ^{
778
+ NSArray *identifiersArray = nil;
779
+ if ([command.arguments count] > 0 && [command.arguments objectAtIndex:0] != [NSNull null]) {
780
+ identifiersArray = [command.arguments objectAtIndex:0];
781
+ }
782
+
783
+ NSArray<InsiderIdentifiers *> *identifiers = [self convertArrayToInsiderIdentifiersArray:identifiersArray];
784
+
785
+ if ([command.arguments count] > 1) {
786
+ [[Insider getCurrentUser] logoutResettingInsiderID:identifiers insiderIDResult:^(NSString *insiderID) {
787
+ NSString *insiderIDToPass = insiderID ? insiderID : @"";
788
+ [self sendSuccessResultWithString:insiderIDToPass andCommand:command];
789
+ }];
790
+ } else {
791
+ [[Insider getCurrentUser] logoutResettingInsiderID:identifiers];
792
+ [self sendSuccessResultWithString:@"SUCCESS" andCommand:command];
793
+ }
794
+ });
795
+ } @catch (NSException *e) {
796
+ [Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
797
+ }
798
+ }
799
+
775
800
  - (void)signUpConfirmation:(CDVInvokedUrlCommand *)command {
776
801
  @try {
777
802
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -979,4 +1004,28 @@
979
1004
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
980
1005
  }
981
1006
 
1007
+ - (NSArray<InsiderIdentifiers *> *)convertArrayToInsiderIdentifiersArray:(NSArray *)identifiersArray {
1008
+ if (identifiersArray == nil || identifiersArray.count == 0) {
1009
+ return nil;
1010
+ }
1011
+
1012
+ NSMutableArray<InsiderIdentifiers *> *identifiers = [NSMutableArray array];
1013
+ for (NSDictionary *identifierDict in identifiersArray) {
1014
+ InsiderIdentifiers *insiderIdentifiers = [[InsiderIdentifiers alloc] init];
1015
+ for (NSString *key in identifierDict.allKeys) {
1016
+ if ([key isEqualToString:@"addEmail"]) {
1017
+ insiderIdentifiers.addEmail([identifierDict objectForKey:key]);
1018
+ } else if ([key isEqualToString:@"addPhoneNumber"]) {
1019
+ insiderIdentifiers.addPhoneNumber([identifierDict objectForKey:key]);
1020
+ } else if ([key isEqualToString:@"addUserID"]) {
1021
+ insiderIdentifiers.addUserID([identifierDict objectForKey:key]);
1022
+ } else {
1023
+ insiderIdentifiers.addCustomIdentifier(key, [identifierDict objectForKey:key]);
1024
+ }
1025
+ }
1026
+ [identifiers addObject:insiderIdentifiers];
1027
+ }
1028
+ return identifiers;
1029
+ }
1030
+
982
1031
  @end
package/types/User.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface User {
17
17
  setWhatsappOptin(whatsappOptin: boolean): User;
18
18
  login(identifiers:object, insiderIDResult: Function): void;
19
19
  logout(): void;
20
+ logoutResettingInsiderID(identifiers?: object[] | null, insiderIDResult?: (insiderID: string) => void): void;
20
21
  setCustomAttributeWithString(key: string, value: string): User;
21
22
  setCustomAttributeWithInt(key: string, value: number): User;
22
23
  setCustomAttributeWithDouble(key: string, value: number): User;
package/www/Constants.js CHANGED
@@ -22,6 +22,7 @@ module.exports = {
22
22
  SET_WHATSAPP_OPTIN: 'setWhatsappOptin',
23
23
  LOGIN: 'login',
24
24
  LOGOUT: 'logout',
25
+ LOGOUT_RESETTING_INSIDER_ID: 'logoutResettingInsiderID',
25
26
  SET_CUSTOM_ATTRIBUTE_WITH_STRING: 'setCustomAttributeWithString',
26
27
  SET_CUSTOM_ATTRIBUTE_WITH_INT: 'setCustomAttributeWithInt',
27
28
  SET_CUSTOM_ATTRIBUTE_WITH_DOUBLE: 'setCustomAttributeWithDouble',
@@ -109,5 +110,5 @@ module.exports = {
109
110
  // Reinit
110
111
  REINIT_WITH_PARTNER_NAME: 'reinitWithPartnerName',
111
112
  // SDK Version
112
- SDK_VERSION: 'CDV-3.0.0'
113
+ SDK_VERSION: 'CDV-3.0.2'
113
114
  };
package/www/User.js CHANGED
@@ -319,6 +319,27 @@ var User = /*#__PURE__*/function () {
319
319
  Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
320
320
  }
321
321
  }
322
+ }, {
323
+ key: "logoutResettingInsiderID",
324
+ value: function logoutResettingInsiderID(identifiers, insiderIDResult) {
325
+ try {
326
+ var identifiersArray = identifiers && Array.isArray(identifiers) ? identifiers.map(function (id) {
327
+ return id.identifiers;
328
+ }) : null;
329
+ if (!Utils.checkParameters([{
330
+ type: 'function',
331
+ value: insiderIDResult
332
+ }])) {
333
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.LOGOUT_RESETTING_INSIDER_ID, [identifiersArray, insiderIDResult]).then(function (id) {
334
+ return insiderIDResult(id);
335
+ });
336
+ } else {
337
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.LOGOUT_RESETTING_INSIDER_ID, [identifiersArray]);
338
+ }
339
+ } catch (error) {
340
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
341
+ }
342
+ }
322
343
  }, {
323
344
  key: "setCustomAttributeWithString",
324
345
  value: function setCustomAttributeWithString(key, value) {
package/github_release.sh DELETED
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Minimal GitHub Release Script
5
- # Gereksinim: gh (GitHub CLI) -> gh auth login
6
- # Bulunduğun branch'in HEAD'inden release oluşturur.
7
- # Tag = --version (örn: 1.2.3)
8
- # Notes = --generate-notes (varsayılan) | --notes-file | --no-notes
9
-
10
- VERSION=""
11
- ASSETS=()
12
- DRY_RUN="false"
13
- NOTES_FILE=""
14
- NO_NOTES="false"
15
- TITLE=""
16
- flags=""
17
-
18
- usage() {
19
- cat <<EOF
20
- Kullanım: $(basename "$0") -v <versiyon> [opsiyonlar]
21
-
22
- Zorunlu:
23
- -v, --version <semver> Örn: 1.2.3 (release tag adı)
24
-
25
- Opsiyonel:
26
- -a, --asset <path> Framework dosyası (tekrarlanabilir)
27
- -t, --title <string> Release başlığı (yok ise version kullanılır)
28
- --notes-file <path> Notları dosyadan al (--generate-notes devre dışı)
29
- --no-notes Not ekleme veya oluşturma
30
- --dry-run Komutları yazdır, çalıştırma
31
-
32
- Örnekler:
33
- $(basename "$0") -v 1.2.3
34
- $(basename "$0") -v 1.2.3 --title Title --notes-file CHANGELOG.md
35
- $(basename "$0") -v 1.2.3 --asset build/ios/InsiderMobile.xcframework.zip
36
- EOF
37
- }
38
-
39
- # Check validity of arguments
40
- while [[ $# -gt 0 ]]; do
41
- case "$1" in
42
- -v|--version) VERSION="$2"; shift 2;;
43
- -a|--asset) ASSETS+=("$2"); shift 2;;
44
- -t|--title) TITLE="$2"; shift 2;;
45
- --notes-file) NOTES_FILE="$2"; shift 2;;
46
- --no-notes) NO_NOTES="true"; shift;;
47
- --dry-run) DRY_RUN="true"; shift;;
48
- -h|--help) usage; exit 0;;
49
- *) echo "⛔ Error: Bilinmeyen argüman: $1"; usage; exit 1;;
50
- esac
51
- done
52
-
53
- if [[ -z "${VERSION}" ]]; then
54
- echo "⛔ Error: --version parametresi zorunludur. Örn: -v 1.2.3"
55
- usage
56
- exit 1
57
- fi
58
-
59
- if ! command -v gh >/dev/null 2>&1; then
60
- echo "⛔ Error: GitHub CLI (gh) bulunamadı."
61
- echo "ℹ️ Kurulum: https://cli.github.com ve 'gh auth login' komutunu çalıştırın."
62
- exit 1
63
- fi
64
-
65
- # Dry run method
66
- run() {
67
- echo "+ $*"
68
- if [[ "${DRY_RUN}" == "false" ]]; then
69
- eval "$@"
70
- fi
71
- }
72
-
73
- # Check if there exists a release with same version
74
- if gh release view "${VERSION}" >/dev/null 2>&1; then
75
- echo "⛔ Error: Bu tag için zaten bir release mevcut: ${VERSION}"
76
- exit 1
77
- fi
78
-
79
- # Assign title
80
- if [[ -z "${TITLE}" ]]; then
81
- flags+="--title \"${VERSION}\""
82
- else
83
- flags+="--title \"${TITLE}\""
84
- fi
85
-
86
- # Construct release flags
87
- if [[ "${NO_NOTES}" == "true" ]]; then
88
- flags+=" --notes \"\""
89
- elif [[ -n "${NOTES_FILE}" ]]; then
90
- if [[ ! -f "${NOTES_FILE}" ]]; then
91
- echo "⛔ Error: Not dosyası bulunamadı: ${NOTES_FILE}"
92
- exit 1
93
- fi
94
- flags+=" --notes-file \"${NOTES_FILE}\""
95
- else
96
- flags+=" --generate-notes"
97
- fi
98
-
99
- # Create the release on Github
100
- run "gh release create \"${VERSION}\" ${flags}"
101
-
102
- # Upload Framework file
103
- if [[ ${#ASSETS[@]} -gt 0 ]]; then
104
- echo "📦 Framework dosyası yükleniyor..."
105
- for a in "${ASSETS[@]}"; do
106
- if [[ -f "${a}" ]]; then
107
- run "gh release upload \"${VERSION}\" \"${a}\" --clobber"
108
- else
109
- echo "⚠️ Warning: Asset bulunamadı, atlanıyor: ${a}"
110
- fi
111
- done
112
- fi
113
-
114
- echo "✅ Sürüm oluşturuldu: ${VERSION}"
@@ -1,11 +0,0 @@
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$/src/android" isTestSource="false" packagePrefix="com.useinsider.cordova" />
7
- </content>
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- </component>
11
- </module>