cordova-plugin-insider 2.4.0 → 3.0.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/.git-hooks/README.md +36 -0
- package/.git-hooks/commit-msg +83 -0
- package/LICENSE +7 -0
- package/github_release.sh +114 -0
- package/insider-cordova-plugin.iml +11 -0
- package/package.json +4 -1
- package/plugin.xml +4 -4
- package/src/android/InsiderPlugin.java +16 -13
- package/src/android/build-extras.gradle +6 -5
- package/src/ios/InsiderPlugin.m +3 -3
- package/types/Event.d.ts +5 -0
- package/types/Product.d.ts +5 -0
- package/www/Constants.js +1 -1
- package/www/Event.js +40 -0
- package/www/Product.js +40 -0
- package/www/Utils.js +18 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Git Hooks
|
|
2
|
+
|
|
3
|
+
## 📌 Purpose
|
|
4
|
+
This directory uses Git hooks to enforce standards and automate tasks during the development workflow.
|
|
5
|
+
The main example included is a **`commit-msg`** hook that enforces [Conventional Commits v1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) rules with additional project-specific logic.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📂 Hooks Included
|
|
10
|
+
|
|
11
|
+
### 1. `commit-msg`
|
|
12
|
+
Ensures commit messages follow the Conventional Commits specification, with custom rules:
|
|
13
|
+
|
|
14
|
+
- **Bypasses**:
|
|
15
|
+
- `Merge branch ...` commits (merge commits)
|
|
16
|
+
- `pick ...`, `reword ...`, `edit ...`, `squash ...`, `fixup ...`, `exec ...` messages (interactive rebase auto-generated commits)
|
|
17
|
+
- **JIRA Reference**:
|
|
18
|
+
- If the branch name contains a JIRA ID in the form `MOB-1234`, it will automatically append
|
|
19
|
+
`#Ref: MOB-1234` to the end of the commit message (if not already present).
|
|
20
|
+
- **Optional Description**:
|
|
21
|
+
- `<type>[<scope>][!]: <description>` — the description can be empty.
|
|
22
|
+
- **Header length**:
|
|
23
|
+
- Max 120 characters (hard limit)
|
|
24
|
+
- Warning if over 50 or 72 characters.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🔧 Installation
|
|
29
|
+
|
|
30
|
+
### 1. Copy Hooks to `.git/hooks/`
|
|
31
|
+
|
|
32
|
+
Run the following commands under project's directory:
|
|
33
|
+
```bash
|
|
34
|
+
cp .git-hooks/commit-msg .git/hooks/commit-msg
|
|
35
|
+
chmod +x .git/hooks/commit-msg
|
|
36
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
COMMIT_MSG_FILE="$1"
|
|
4
|
+
COMMIT_MSG_FIRST_LINE=$(head -n1 "$COMMIT_MSG_FILE")
|
|
5
|
+
|
|
6
|
+
# 1. Skip "Merge branch ..." commits
|
|
7
|
+
if echo "$COMMIT_MSG_FIRST_LINE" | grep -qE "^Merge branch "; then
|
|
8
|
+
exit 0
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
# 2. Skip interactive rebase auto-commits
|
|
12
|
+
if echo "$COMMIT_MSG_FIRST_LINE" | grep -qE "^(pick|reword|edit|squash|fixup|exec) "; then
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Allowed Conventional Commit types (v1.0.0 + release)
|
|
17
|
+
ALLOWED_TYPES="feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|release"
|
|
18
|
+
|
|
19
|
+
# Regex – type(scope)!?: description (description required)
|
|
20
|
+
FIRST_LINE_REGEX="^(${ALLOWED_TYPES})(\([^\)]+\))?(!)?: [^ ].+$"
|
|
21
|
+
|
|
22
|
+
error() {
|
|
23
|
+
echo "⛔ Error: $1"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
warn() {
|
|
27
|
+
echo "⚠️ Warning: $1"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# 3. Validate header format
|
|
31
|
+
if ! echo "$COMMIT_MSG_FIRST_LINE" | grep -qE "${FIRST_LINE_REGEX}"; then
|
|
32
|
+
error "Commit mesajı başlığı Conventional Commits v1.0.0 formatına uymuyor."
|
|
33
|
+
echo "Mevcut mesaj: \"$COMMIT_MSG_FIRST_LINE\""
|
|
34
|
+
echo ""
|
|
35
|
+
echo "Beklenen format: <tip>[<scope>][!]: <açıklama>"
|
|
36
|
+
echo "Geçerli tipler: ${ALLOWED_TYPES}"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# 4. Header length check (max 120 chars)
|
|
41
|
+
HEADER_LENGTH=${#COMMIT_MSG_FIRST_LINE}
|
|
42
|
+
if [ "$HEADER_LENGTH" -gt 120 ]; then
|
|
43
|
+
error "İlk satır 120 karakteri aşıyor. (Mevcut uzunluk: $HEADER_LENGTH)"
|
|
44
|
+
exit 1
|
|
45
|
+
elif [ "$HEADER_LENGTH" -gt 72 ]; then
|
|
46
|
+
warn "İlk satır 72 karakterden uzun. (Mevcut uzunluk: $HEADER_LENGTH)"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# 5. Body check (optional)
|
|
50
|
+
LINE_NO=0
|
|
51
|
+
while IFS= read -r line; do
|
|
52
|
+
LINE_NO=$((LINE_NO + 1))
|
|
53
|
+
# Second line should be empty if body exists
|
|
54
|
+
if [ "$LINE_NO" -eq 2 ] && [ -n "$line" ]; then
|
|
55
|
+
warn "İkinci satır boş olmalı (body varsa)."
|
|
56
|
+
fi
|
|
57
|
+
done < "$COMMIT_MSG_FILE"
|
|
58
|
+
|
|
59
|
+
# 6. BREAKING CHANGE footer check
|
|
60
|
+
if grep -qE '^BREAKING CHANGE: ' "$COMMIT_MSG_FILE"; then
|
|
61
|
+
if ! grep -qE '^BREAKING CHANGE: .{1,}' "$COMMIT_MSG_FILE"; then
|
|
62
|
+
error "BREAKING CHANGE açıklaması boş olamaz."
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# 7. Append JIRA ID from branch name
|
|
68
|
+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
|
69
|
+
JIRA_ID=$(echo "$BRANCH_NAME" | grep -oE 'MOB-[0-9]+')
|
|
70
|
+
|
|
71
|
+
if [ -n "$JIRA_ID" ]; then
|
|
72
|
+
if ! grep -q "$JIRA_ID" "$COMMIT_MSG_FILE"; then
|
|
73
|
+
{
|
|
74
|
+
echo ""
|
|
75
|
+
echo "#Ref: $JIRA_ID"
|
|
76
|
+
} >> "$COMMIT_MSG_FILE"
|
|
77
|
+
echo "ℹ️ Task ID referans olarak eklendi: $JIRA_ID"
|
|
78
|
+
fi
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
echo "✅ Commit mesajı Conventional Commits v1.0.0 kurallarına uygun."
|
|
82
|
+
exit 0
|
|
83
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2016 Insider
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,114 @@
|
|
|
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}"
|
|
@@ -0,0 +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$/src/android" isTestSource="false" packagePrefix="com.useinsider.cordova" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-insider",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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": {
|
|
@@ -26,5 +26,8 @@
|
|
|
26
26
|
"@babel/cli": "^7.27.2",
|
|
27
27
|
"@babel/core": "^7.27.4",
|
|
28
28
|
"@babel/preset-env": "^7.27.2"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"babel": "^5.8.38"
|
|
29
32
|
}
|
|
30
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="
|
|
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">
|
|
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="
|
|
74
|
-
<pod name="InsiderGeofence" spec="1.2.
|
|
75
|
-
<pod name="InsiderHybrid" spec="1.7.
|
|
73
|
+
<pod name="InsiderMobile" spec="14.0.4" />
|
|
74
|
+
<pod name="InsiderGeofence" spec="1.2.3" />
|
|
75
|
+
<pod name="InsiderHybrid" spec="1.7.5" />
|
|
76
76
|
</pods>
|
|
77
77
|
</podspec>
|
|
78
78
|
|
|
@@ -64,18 +64,6 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
64
64
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
65
65
|
@Override
|
|
66
66
|
public void run() {
|
|
67
|
-
InsiderHybrid.initWithActivity(cordova.getActivity(), partnerName);
|
|
68
|
-
|
|
69
|
-
Insider.Instance.setSDKType("cordova");
|
|
70
|
-
Insider.Instance.setHybridSDKVersion(sdkVersion);
|
|
71
|
-
Insider.Instance.resumeSessionHybridConfig(cordova.getActivity());
|
|
72
|
-
|
|
73
|
-
if (isCoreInitialized) {
|
|
74
|
-
Insider.Instance.resumeSessionHybridRequestConfig();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
isCoreInitialized = true;
|
|
78
|
-
|
|
79
67
|
Insider.Instance.registerInsiderCallback(new InsiderCallback() {
|
|
80
68
|
@Override
|
|
81
69
|
public void doAction(JSONObject jsonObject, InsiderCallbackType insiderCallbackType) {
|
|
@@ -88,6 +76,18 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
88
76
|
}
|
|
89
77
|
}
|
|
90
78
|
});
|
|
79
|
+
|
|
80
|
+
InsiderHybrid.initWithActivity(cordova.getActivity(), partnerName);
|
|
81
|
+
|
|
82
|
+
Insider.Instance.setSDKType("cordova");
|
|
83
|
+
Insider.Instance.setHybridSDKVersion(sdkVersion);
|
|
84
|
+
Insider.Instance.resumeSessionHybridConfig(cordova.getActivity());
|
|
85
|
+
|
|
86
|
+
if (isCoreInitialized) {
|
|
87
|
+
Insider.Instance.resumeSessionHybridRequestConfig();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
isCoreInitialized = true;
|
|
91
91
|
|
|
92
92
|
Insider.Instance.storePartnerName(partnerName);
|
|
93
93
|
}
|
|
@@ -1018,7 +1018,10 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
1018
1018
|
product.setCustomAttributeWithDate(key, (Date) value);
|
|
1019
1019
|
break;
|
|
1020
1020
|
case "String[]":
|
|
1021
|
-
product.
|
|
1021
|
+
product.setCustomAttributeWithStringArray(key, (String[]) value);
|
|
1022
|
+
break;
|
|
1023
|
+
case "Number[]":
|
|
1024
|
+
product.setCustomAttributeWithNumericArray(key, (Number[]) value);
|
|
1022
1025
|
break;
|
|
1023
1026
|
default:
|
|
1024
1027
|
break;
|
|
@@ -5,23 +5,24 @@ repositories {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
android {
|
|
8
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
8
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
9
9
|
useLibrary 'org.apache.http.legacy'
|
|
10
10
|
|
|
11
11
|
defaultConfig {
|
|
12
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
13
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
12
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
13
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
14
14
|
multiDexEnabled true
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
implementation 'com.useinsider:insider:
|
|
20
|
-
implementation 'com.useinsider:insiderhybrid:1.3.
|
|
19
|
+
implementation 'com.useinsider:insider:15.1.3'
|
|
20
|
+
implementation 'com.useinsider:insiderhybrid:1.3.3'
|
|
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'
|
|
24
24
|
|
|
25
|
+
implementation "androidx.work:work-runtime:2.9.1"
|
|
25
26
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
26
27
|
implementation 'androidx.lifecycle:lifecycle-process:2.7.0'
|
|
27
28
|
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
|
package/src/ios/InsiderPlugin.m
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
[Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
|
|
37
37
|
[Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
|
|
38
38
|
[Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2]];
|
|
39
|
-
[Insider
|
|
39
|
+
[Insider applicationDidBecomeActive];
|
|
40
40
|
|
|
41
41
|
[self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithLaunchOptions" andCommand:command];
|
|
42
42
|
} @catch (NSException *exception){
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
[Insider registerInsiderCallbackWithSelector:@selector(registerCallback:) sender:self];
|
|
54
54
|
[Insider setHybridSDKVersion:[command.arguments objectAtIndex:1]];
|
|
55
55
|
[Insider initWithLaunchOptions:nil partnerName:[command.arguments objectAtIndex:0] appGroup:[command.arguments objectAtIndex:2] customEndpoint:[command.arguments objectAtIndex:3]];
|
|
56
|
-
[Insider
|
|
56
|
+
[Insider applicationDidBecomeActive];
|
|
57
57
|
|
|
58
58
|
[self sendSuccessResultWithString:@"Insider Cordova Plugin: initWithCustomEndpoint" andCommand:command];
|
|
59
59
|
} @catch (NSException *exception){
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
- (void)hybridIntent:(CDVInvokedUrlCommand *)command {
|
|
263
263
|
@try {
|
|
264
264
|
[self.commandDelegate runInBackground:^{
|
|
265
|
-
[Insider
|
|
265
|
+
[Insider applicationDidBecomeActive];
|
|
266
266
|
}];
|
|
267
267
|
} @catch (NSException *e) {
|
|
268
268
|
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
package/types/Event.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export interface Event {
|
|
|
4
4
|
addParameterWithDouble(key: string, value: number): Event;
|
|
5
5
|
addParameterWithBoolean(key: string, value: boolean): Event;
|
|
6
6
|
addParameterWithDate(key: string, value: string): Event;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `addParameterWithStringArray` instead.
|
|
9
|
+
*/
|
|
7
10
|
addParameterWithArray(key: string, value: object): Event;
|
|
11
|
+
addParameterWithStringArray(key: string, value: Array<string>): Event;
|
|
12
|
+
addParameterWithNumericArray(key: string, value: Array<number>): Event;
|
|
8
13
|
build(): void;
|
|
9
14
|
}
|
package/types/Product.d.ts
CHANGED
|
@@ -15,5 +15,10 @@ export interface Product {
|
|
|
15
15
|
setCustomAttributeWithBoolean(key: string, value: boolean):Product;
|
|
16
16
|
setCustomAttributeWithDouble(key: string, value: number):Product;
|
|
17
17
|
setCustomAttributeWithDate(key: string, value: Date):Product;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `setCustomAttributeWithStringArray` instead.
|
|
20
|
+
*/
|
|
18
21
|
setCustomAttributeWithArray(key: string, value: object):Product;
|
|
22
|
+
setCustomAttributeWithStringArray(key: string, value: Array<string>):Product;
|
|
23
|
+
setCustomAttributeWithNumericArray(key: string, value: Array<number>):Product;
|
|
19
24
|
}
|
package/www/Constants.js
CHANGED
package/www/Event.js
CHANGED
|
@@ -136,6 +136,46 @@ var Event = /*#__PURE__*/function () {
|
|
|
136
136
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "addParameterWithStringArray",
|
|
141
|
+
value: function addParameterWithStringArray(key, value) {
|
|
142
|
+
if (Utils.checkParameters([{
|
|
143
|
+
type: 'string',
|
|
144
|
+
value: key
|
|
145
|
+
}, {
|
|
146
|
+
type: 'string_array',
|
|
147
|
+
value: value
|
|
148
|
+
}])) {
|
|
149
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithStringArray');
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
this.parameters[key] = value;
|
|
154
|
+
return this;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "addParameterWithNumericArray",
|
|
161
|
+
value: function addParameterWithNumericArray(key, value) {
|
|
162
|
+
if (Utils.checkParameters([{
|
|
163
|
+
type: 'string',
|
|
164
|
+
value: key
|
|
165
|
+
}, {
|
|
166
|
+
type: 'numeric_array',
|
|
167
|
+
value: value
|
|
168
|
+
}])) {
|
|
169
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithNumericArray');
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
this.parameters[key] = value;
|
|
174
|
+
return this;
|
|
175
|
+
} catch (error) {
|
|
176
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
139
179
|
}, {
|
|
140
180
|
key: "build",
|
|
141
181
|
value: function build() {
|
package/www/Product.js
CHANGED
|
@@ -462,6 +462,46 @@ var Product = /*#__PURE__*/function () {
|
|
|
462
462
|
}
|
|
463
463
|
return this;
|
|
464
464
|
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "setCustomAttributeWithStringArray",
|
|
467
|
+
value: function setCustomAttributeWithStringArray(key, value) {
|
|
468
|
+
if (Utils.checkParameters([{
|
|
469
|
+
type: 'string',
|
|
470
|
+
value: key
|
|
471
|
+
}, {
|
|
472
|
+
type: 'string_array',
|
|
473
|
+
value: value
|
|
474
|
+
}])) {
|
|
475
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithStringArray');
|
|
476
|
+
return this;
|
|
477
|
+
}
|
|
478
|
+
try {
|
|
479
|
+
this.productOptMap[key] = value;
|
|
480
|
+
} catch (error) {
|
|
481
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
482
|
+
}
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
}, {
|
|
486
|
+
key: "setCustomAttributeWithNumericArray",
|
|
487
|
+
value: function setCustomAttributeWithNumericArray(key, value) {
|
|
488
|
+
if (Utils.checkParameters([{
|
|
489
|
+
type: 'string',
|
|
490
|
+
value: key
|
|
491
|
+
}, {
|
|
492
|
+
type: 'numeric_array',
|
|
493
|
+
value: value
|
|
494
|
+
}])) {
|
|
495
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithNumericArray');
|
|
496
|
+
return this;
|
|
497
|
+
}
|
|
498
|
+
try {
|
|
499
|
+
this.productOptMap[key] = value;
|
|
500
|
+
} catch (error) {
|
|
501
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
502
|
+
}
|
|
503
|
+
return this;
|
|
504
|
+
}
|
|
465
505
|
}]);
|
|
466
506
|
}();
|
|
467
507
|
module.exports = Product;
|
package/www/Utils.js
CHANGED
|
@@ -13,7 +13,24 @@ module.exports = {
|
|
|
13
13
|
},
|
|
14
14
|
checkParameters: function checkParameters(parameters) {
|
|
15
15
|
return parameters.some(function (parameterConfig) {
|
|
16
|
-
|
|
16
|
+
switch (parameterConfig.type) {
|
|
17
|
+
case "numeric_array":
|
|
18
|
+
if (!Array.isArray(parameterConfig.value)) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return !parameterConfig.value.every(function (item) {
|
|
22
|
+
return typeof item === "number";
|
|
23
|
+
});
|
|
24
|
+
case "string_array":
|
|
25
|
+
if (!Array.isArray(parameterConfig.value)) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return !parameterConfig.value.every(function (item) {
|
|
29
|
+
return typeof item === "string";
|
|
30
|
+
});
|
|
31
|
+
default:
|
|
32
|
+
return parameterConfig.type !== _typeof(parameterConfig.value);
|
|
33
|
+
}
|
|
17
34
|
});
|
|
18
35
|
},
|
|
19
36
|
showParameterWarningLog: function showParameterWarningLog(functionName) {
|