cordova-plugin-insider 1.2.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/.github/CODEOWNERS +8 -0
- package/.github/workflows/git-leak.yml +25 -0
- package/.github/workflows/insider-cordova-SDK_release.yml +61 -0
- package/.github/workflows/release_task_merger.yml +22 -0
- package/.github/workflows/release_version_setter.yml +43 -0
- package/README.md +104 -0
- package/hooks/FSUtils.js +28 -0
- package/hooks/after_plugin_install.js +81 -0
- package/hooks/before_plugin_uninstall.js +49 -0
- package/package.json +19 -0
- package/plugin.xml +91 -0
- package/release_version.sh +27 -0
- package/slack_notifier.sh +20 -0
- package/src/android/CDVUtils.java +120 -0
- package/src/android/Constants.java +41 -0
- package/src/android/InsiderPlugin.java +814 -0
- package/src/android/build-extras.gradle +38 -0
- package/src/android/res/values/dimens.xml +4 -0
- package/src/android/res/values-sw600dp/dimens.xml +3 -0
- package/src/android/res/values-sw720dp/dimens.xml +3 -0
- package/src/android/res/values-xhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxxhdpi/dimens.xml +4 -0
- package/src/ios/IDFAHelper.h +7 -0
- package/src/ios/IDFAHelper.m +19 -0
- package/src/ios/InsiderPlugin.h +58 -0
- package/src/ios/InsiderPlugin.m +758 -0
- package/types/CallbackType.d.ts +7 -0
- package/types/ContentOptimizerDataType.d.ts +4 -0
- package/types/Event.d.ts +9 -0
- package/types/Gender.d.ts +5 -0
- package/types/Identifier.d.ts +7 -0
- package/types/InsiderPlugin.d.ts +51 -0
- package/types/Product.d.ts +18 -0
- package/types/User.d.ts +27 -0
- package/www/CallbackType.js +7 -0
- package/www/Constants.js +86 -0
- package/www/ContentOptimizerDataType.js +4 -0
- package/www/Event.js +96 -0
- package/www/Gender.js +5 -0
- package/www/Identifier.js +66 -0
- package/www/InsiderPlugin.js +364 -0
- package/www/Product.js +211 -0
- package/www/User.js +303 -0
- package/www/Utils.js +18 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This is a comment.
|
|
2
|
+
# Each line is a file pattern followed by one or more owners.
|
|
3
|
+
|
|
4
|
+
# These owners will be the default owners for everything in
|
|
5
|
+
# the repo. Unless a later match takes precedence,
|
|
6
|
+
# @global-owner1 and @global-owner2 will be requested for
|
|
7
|
+
# review when someone opens a pull request.
|
|
8
|
+
* @melih-useinsider
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: gitleaks
|
|
2
|
+
on: [push]
|
|
3
|
+
env:
|
|
4
|
+
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
gitleaks:
|
|
8
|
+
runs-on: self-runner-node
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout Repository
|
|
11
|
+
uses: actions/checkout@v2
|
|
12
|
+
with:
|
|
13
|
+
fetch-depth: '2'
|
|
14
|
+
- name: Clone GitLeak Action
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
with:
|
|
17
|
+
repository: useinsider/gitleaks-action
|
|
18
|
+
ref: master
|
|
19
|
+
token: ${{ secrets.PAT }}
|
|
20
|
+
path: .github/actions/gitleaks-action
|
|
21
|
+
- name: Install Dependencies
|
|
22
|
+
run: npm install
|
|
23
|
+
working-directory: .github/actions/gitleaks-action
|
|
24
|
+
- name: gitleaks-action
|
|
25
|
+
uses: ./.github/actions/gitleaks-action
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Cordova Insider Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version_name:
|
|
7
|
+
required: true
|
|
8
|
+
description: The new version name of the SDK to be released (1.0.0)
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
if: github.actor == 'sonerdm' || github.actor == 'melih-useinsider'
|
|
13
|
+
name: Create Release
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v3
|
|
19
|
+
with:
|
|
20
|
+
ref: develop
|
|
21
|
+
|
|
22
|
+
- name: Publish Cordova SDK
|
|
23
|
+
uses: actions/setup-node@v3.2.0
|
|
24
|
+
with:
|
|
25
|
+
node-version: 12
|
|
26
|
+
registry-url: https://registry.npmjs.org/
|
|
27
|
+
run: |
|
|
28
|
+
npm ci
|
|
29
|
+
npm test
|
|
30
|
+
npm publish
|
|
31
|
+
text=":iphone: Cordova SDK is published with version: ${{ github.event.inputs.version_name }}"
|
|
32
|
+
./slack_notifier.sh mob-deployment mob-sdk-releaser "$text"
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
35
|
+
SLACK_NOTIFIER_AUTH_KEY: ${{ secrets.SLACK_NOTIFIER_AUTH_KEY }}
|
|
36
|
+
|
|
37
|
+
release-nh:
|
|
38
|
+
needs: release
|
|
39
|
+
name: Create NH Release
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- name: Checkout code
|
|
44
|
+
uses: actions/checkout@v3
|
|
45
|
+
with:
|
|
46
|
+
ref: develop-nh
|
|
47
|
+
|
|
48
|
+
- name: Publish Cordova SDK
|
|
49
|
+
uses: actions/setup-node@v3.2.0
|
|
50
|
+
with:
|
|
51
|
+
node-version: 12
|
|
52
|
+
registry-url: https://registry.npmjs.org/
|
|
53
|
+
run: |
|
|
54
|
+
npm ci
|
|
55
|
+
npm test
|
|
56
|
+
npm publish
|
|
57
|
+
text=":iphone: Cordova NH SDK is published with version: ${{ github.event.inputs.version_name }}-nh"
|
|
58
|
+
./slack_notifier.sh mob-deployment mob-sdk-releaser "$text"
|
|
59
|
+
env:
|
|
60
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
61
|
+
SLACK_NOTIFIER_AUTH_KEY: ${{ secrets.SLACK_NOTIFIER_AUTH_KEY }}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Release Task Merger
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version_name:
|
|
7
|
+
required: true
|
|
8
|
+
description: The new version name of the SDK to be released (1.0.0)
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
sdk_releaser:
|
|
12
|
+
if: github.actor == 'sonerdm' || github.actor == 'MahammadMD' || github.actor == 'melih-useinsider'
|
|
13
|
+
name: Trigger mobile-devops repository task merger
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Repository Dispatch
|
|
17
|
+
uses: peter-evans/repository-dispatch@v1
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.GIT_TOKEN }}
|
|
20
|
+
repository: useinsider/mobile-devops
|
|
21
|
+
event-type: sdk-release-module
|
|
22
|
+
client-payload: '{"repo-name": "insider-cordova-SDK", "sdk_version_name": "${{ github.event.inputs.version_name }}"}'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Release Version Setter
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
repository_dispatch:
|
|
5
|
+
types: [trigger-release-version-setter]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
release_version_setter:
|
|
9
|
+
name: Run Version Setter
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout code
|
|
13
|
+
uses: actions/checkout@v3
|
|
14
|
+
with:
|
|
15
|
+
ref: develop
|
|
16
|
+
|
|
17
|
+
- name: Configure AWS credentials
|
|
18
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
19
|
+
with:
|
|
20
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
21
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
22
|
+
aws-region: eu-west-1
|
|
23
|
+
|
|
24
|
+
- name: Run release_version.sh
|
|
25
|
+
run: |
|
|
26
|
+
./release_version.sh ${{ github.event.client_payload.sdk_version_name }}
|
|
27
|
+
|
|
28
|
+
- name: Push changes to develop
|
|
29
|
+
run: |
|
|
30
|
+
git config --global user.name 'sonerdm'
|
|
31
|
+
git config --global user.email 'soner@useinsider.com'
|
|
32
|
+
git remote set-url origin https://x-access-token:${{ secrets.GIT_TOKEN }}@github.com/${{ github.repository }}
|
|
33
|
+
git commit -am "Release version ${{ github.event.client_payload.sdk_version_name }}"
|
|
34
|
+
git push
|
|
35
|
+
env:
|
|
36
|
+
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
37
|
+
|
|
38
|
+
- name: Notify QAs
|
|
39
|
+
run: |
|
|
40
|
+
text=":tatakae: Cordova SDK is ready to test with version: ${{ github.event.client_payload.sdk_version_name }} <!subteam^SUUGFQNVA|mobileqa>"
|
|
41
|
+
./slack_notifier.sh mob-deployment mob-sdk-releaser "$text"
|
|
42
|
+
env:
|
|
43
|
+
SLACK_NOTIFIER_AUTH_KEY: ${{ secrets.SLACK_NOTIFIER_AUTH_KEY }}
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Insider Cordova SDK
|
|
2
|
+
|
|
3
|
+
## Start
|
|
4
|
+
|
|
5
|
+
1. Install Cordova CLI if you haven't done this before.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install -g cordova
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
2. Create a Cordova project or use the existing one. To create a Cordova project, you can use the cordova create path [id [name [config]]] [options] command. For more details, please refer to cordova create command.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
3. Add the Android, iOS or both platform to the project if you haven't done this before.
|
|
15
|
+
```
|
|
16
|
+
cordova platform add android
|
|
17
|
+
cordova platform add iOS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
5. First add cordova package attributes in package.json
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
...
|
|
26
|
+
"cordova-plugin-insider": "cordova-plugin-insider"
|
|
27
|
+
},
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
"plugins": {
|
|
32
|
+
....
|
|
33
|
+
"cordova-plugin-insider": {}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
6. And Run the following command to download the modules.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
npm install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
7. Run the code below to add the plugin to the project.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
cordova plugin add cordova-plugin-insider
|
|
47
|
+
```
|
|
48
|
+
### Android
|
|
49
|
+
|
|
50
|
+
1. Add your google-service.json and agconnect-service.json files to the home directory of the demo project.
|
|
51
|
+
2. Add your fileName.jks file in platforms/android/app/ directory.
|
|
52
|
+
1. Edit singingConfig in build.gradle(:app) (platforms/android/app).
|
|
53
|
+
3. And change partner name and app group name in index.js (www/js/index.js:50)
|
|
54
|
+
4. Configure partner name from your app’s platforms > android > cordova-plugin-insider > ecommerce-build-extras.gradle
|
|
55
|
+
```
|
|
56
|
+
// DO NOT FORGET to change partner_name.
|
|
57
|
+
// Use only lowercase and partner_name is provided by Insider.
|
|
58
|
+
|
|
59
|
+
manifestPlaceholders = [ partner: "partner_name" ]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
5. Run the following code to set the ...-service.json files in the project.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
cordova build android
|
|
66
|
+
```
|
|
67
|
+
6. And run project (Recommend: with Android Studio).
|
|
68
|
+
|
|
69
|
+
### iOS
|
|
70
|
+
|
|
71
|
+
1. Add the code below in pod file and pod install.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
# DO NOT MODIFY -- auto-generated by Apache Cordova
|
|
75
|
+
source 'https://cdn.cocoapods.org/'
|
|
76
|
+
platform :ios, '11.0'
|
|
77
|
+
use_frameworks!
|
|
78
|
+
target 'InsiderDemo' do
|
|
79
|
+
project 'InsiderDemo.xcodeproj'
|
|
80
|
+
pod 'InsiderMobile'
|
|
81
|
+
pod 'InsiderHybrid'
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
target 'InsiderNotificationContent' do
|
|
85
|
+
inherit! :search_paths
|
|
86
|
+
# Pods for InsiderNotificationContent
|
|
87
|
+
pod "InsiderMobileAdvancedNotification"
|
|
88
|
+
end
|
|
89
|
+
target 'InsiderNotificationService' do
|
|
90
|
+
inherit! :search_paths
|
|
91
|
+
# Pods for InsiderNotificationService
|
|
92
|
+
pod "InsiderMobileAdvancedNotification"
|
|
93
|
+
end
|
|
94
|
+
```
|
|
95
|
+
2. Run the following code to set the www/* files.
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
cordova build ios
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
3. And run project (Recommend: with XCode).
|
|
102
|
+
4. Edit the URL Types value to add test device.
|
|
103
|
+
5. To run alert on ios, you need to add the "cordova-plugin-dialogs" package to the project. And you should show alert using this function while initing.
|
|
104
|
+
1. https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-dialogs/index.html
|
package/hooks/FSUtils.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var fs = require("fs");
|
|
4
|
+
|
|
5
|
+
var FSUtils = (function () {
|
|
6
|
+
var api = {};
|
|
7
|
+
|
|
8
|
+
api.exists = function (path) {
|
|
9
|
+
try {
|
|
10
|
+
return fs.existsSync(path);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
/*NOPE*/
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
api.readFile = function (path, encoding) {
|
|
18
|
+
return fs.readFileSync(path, encoding);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
api.writeFile = function (path, content) {
|
|
22
|
+
fs.writeFileSync(path, content);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return api;
|
|
26
|
+
})();
|
|
27
|
+
|
|
28
|
+
module.exports = FSUtils;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var FSUtils = require("./FSUtils");
|
|
4
|
+
|
|
5
|
+
var ROOT_BUILD_GRADLE_FILE = "platforms/android/build.gradle";
|
|
6
|
+
var ROOT_REPOSITORIES_GRADLE_FILE = "platforms/android/repositories.gradle";
|
|
7
|
+
var APP_REPOSITORIES_GRADLE_FILE = "platforms/android/app/repositories.gradle";
|
|
8
|
+
var COMMENT = "//This line is added by cordova-plugin-insider plugin";
|
|
9
|
+
var NEW_LINE = "\n";
|
|
10
|
+
|
|
11
|
+
module.exports = function (context) {
|
|
12
|
+
if (!FSUtils.exists(ROOT_BUILD_GRADLE_FILE)) {
|
|
13
|
+
console.log("root gradle file does not exist. after_plugin_install script wont be executed.");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var rootGradleContent = FSUtils.readFile(ROOT_BUILD_GRADLE_FILE, "UTF-8");
|
|
17
|
+
var lines = rootGradleContent.split(NEW_LINE);
|
|
18
|
+
|
|
19
|
+
var depAddedLines = addAGConnectDependency(lines);
|
|
20
|
+
var repoAddedLines = addHuaweiRepo(depAddedLines);
|
|
21
|
+
|
|
22
|
+
FSUtils.writeFile(ROOT_BUILD_GRADLE_FILE, repoAddedLines.join(NEW_LINE));
|
|
23
|
+
|
|
24
|
+
updateRepositoriesGradle(ROOT_REPOSITORIES_GRADLE_FILE);
|
|
25
|
+
updateRepositoriesGradle(APP_REPOSITORIES_GRADLE_FILE);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function addAGConnectDependency(lines) {
|
|
29
|
+
var AG_CONNECT_DEPENDENCY = "classpath 'com.huawei.agconnect:agcp:1.6.2.300' " + COMMENT;
|
|
30
|
+
var pattern = /(\s*)classpath(\s+)[\',\"]com.android.tools.build:gradle.*[^\]\n]/m;
|
|
31
|
+
var index;
|
|
32
|
+
|
|
33
|
+
for (var i = 0; i < lines.length; i++) {
|
|
34
|
+
var line = lines[i];
|
|
35
|
+
if (pattern.test(line)) {
|
|
36
|
+
index = i;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
lines.splice(index + 1, 0, AG_CONNECT_DEPENDENCY);
|
|
42
|
+
return lines;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function addHuaweiRepo(lines) {
|
|
46
|
+
var HUAWEI_REPO = "maven { url 'https://developer.huawei.com/repo/' } " + COMMENT;
|
|
47
|
+
var pattern = /(\s*)jcenter\(\)/m;
|
|
48
|
+
var indexList = [];
|
|
49
|
+
|
|
50
|
+
for (var i = 0; i < lines.length; i++) {
|
|
51
|
+
var line = lines[i];
|
|
52
|
+
if (pattern.test(line)) {
|
|
53
|
+
indexList.push(i);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (var i = 0; i < indexList.length; i++) {
|
|
58
|
+
lines.splice(indexList[i] + 1, 0, HUAWEI_REPO);
|
|
59
|
+
if (i < indexList.length - 1) {
|
|
60
|
+
indexList[i + 1] = indexList[i + 1] + 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return lines;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function updateRepositoriesGradle(file) {
|
|
68
|
+
if (FSUtils.exists(file)) {
|
|
69
|
+
var repoGradleContent = FSUtils.readFile(file, "UTF-8");
|
|
70
|
+
if (repoGradleContent.indexOf("developer.huawei.com/repo") === -1) {
|
|
71
|
+
var lastIndexOfCurlyBracket = repoGradleContent.lastIndexOf("}");
|
|
72
|
+
|
|
73
|
+
repoGradleContent =
|
|
74
|
+
repoGradleContent.substring(0, lastIndexOfCurlyBracket) +
|
|
75
|
+
" maven { url 'https://developer.huawei.com/repo/' } "+COMMENT+" \n}" +
|
|
76
|
+
repoGradleContent.substring(lastIndexOfCurlyBracket + 1);
|
|
77
|
+
|
|
78
|
+
FSUtils.writeFile(file, repoGradleContent);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var FSUtils = require("./FSUtils");
|
|
4
|
+
|
|
5
|
+
var ROOT_GRADLE_FILE = "platforms/android/build.gradle";
|
|
6
|
+
var ROOT_REPOSITORIES_GRADLE_FILE = "platforms/android/repositories.gradle";
|
|
7
|
+
var APP_REPOSITORIES_GRADLE_FILE = "platforms/android/app/repositories.gradle";
|
|
8
|
+
var COMMENT = "//This line is added by cordova-plugin-insider plugin";
|
|
9
|
+
var NEW_LINE = "\n";
|
|
10
|
+
|
|
11
|
+
module.exports = function (context) {
|
|
12
|
+
removeLinesFromGradle(ROOT_GRADLE_FILE);
|
|
13
|
+
removeLinesFromGradle(ROOT_REPOSITORIES_GRADLE_FILE);
|
|
14
|
+
removeLinesFromGradle(APP_REPOSITORIES_GRADLE_FILE);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function removeLinesFromGradle(repositoryPath) {
|
|
18
|
+
if (!FSUtils.exists(repositoryPath)) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var rootGradleContent = FSUtils.readFile(repositoryPath, "UTF-8");
|
|
23
|
+
var lines = rootGradleContent.split(NEW_LINE);
|
|
24
|
+
var linesAfterRemove = removeLinesAddedByPlugin(lines);
|
|
25
|
+
FSUtils.writeFile(repositoryPath, linesAfterRemove.join(NEW_LINE));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function removeLinesAddedByPlugin(lines) {
|
|
29
|
+
var indexList = [];
|
|
30
|
+
for (var i = 0; i < lines.length; i++) {
|
|
31
|
+
var line = lines[i];
|
|
32
|
+
if (line.includes(COMMENT)) {
|
|
33
|
+
indexList.push(i);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (var i = 0; i < indexList.length; i++) {
|
|
38
|
+
lines.splice(indexList[i], 1);
|
|
39
|
+
|
|
40
|
+
//if a line is removed, indexes are changed
|
|
41
|
+
if (i !== indexList.length - 1) {
|
|
42
|
+
for (var j = i + 1; j < indexList.length; j++) {
|
|
43
|
+
indexList[j] = indexList[j] - 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return lines;
|
|
49
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cordova-plugin-insider",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "A plugin that you can use Insider SDK with Cordova and Ionic",
|
|
5
|
+
"cordova_name": "Insider Cordova Plugin",
|
|
6
|
+
"cordova": {
|
|
7
|
+
"id": "cordova-plugin-insider",
|
|
8
|
+
"platforms": ["android","ios"]
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"cordova-plugin-insider",
|
|
12
|
+
"cordova-insider",
|
|
13
|
+
"ionic-insider"
|
|
14
|
+
],
|
|
15
|
+
"main": "www/InsiderPlugin.js",
|
|
16
|
+
"typings": "types/InsiderPlugin.d.ts",
|
|
17
|
+
"author": "useinsider",
|
|
18
|
+
"license": "ISC"
|
|
19
|
+
}
|
package/plugin.xml
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
+
<plugin id="cordova-plugin-insider" version="1.2.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
<name>Insider</name>
|
|
4
|
+
<description>Insider Cordova Plugin</description>
|
|
5
|
+
<keywords>insider,cordova,cordova-ios,cordova-android</keywords>
|
|
6
|
+
<license>Apache 2.0 License</license>
|
|
7
|
+
|
|
8
|
+
<js-module name="InsiderPlugin" src="www/InsiderPlugin.js">
|
|
9
|
+
<clobbers target="Insider" />
|
|
10
|
+
</js-module>
|
|
11
|
+
|
|
12
|
+
<js-module name="CallbackType" src="www/CallbackType.js"/>
|
|
13
|
+
<js-module name="ContentOptimizerDataType" src="www/ContentOptimizerDataType.js" />
|
|
14
|
+
<js-module name="Gender" src="www/Gender.js" />
|
|
15
|
+
<js-module name="Identifier" src="www/Identifier.js"/>
|
|
16
|
+
<js-module name="Product" src="www/Product.js"/>
|
|
17
|
+
<js-module name="Event" src="www/Event.js" />
|
|
18
|
+
<js-module name="User" src="www/User.js" />
|
|
19
|
+
<js-module name="Constants" src="www/Constants.js" />
|
|
20
|
+
<js-module name="Utils" src="www/Utils.js" />
|
|
21
|
+
|
|
22
|
+
<engines>
|
|
23
|
+
<engine name="cordova" version=">=7.0.0" />
|
|
24
|
+
<engine name="cordova-android" version=">=6.3.0" />
|
|
25
|
+
<engine name="cordova-ios" version=">=4.3.0" />
|
|
26
|
+
</engines>
|
|
27
|
+
|
|
28
|
+
<platform name="android">
|
|
29
|
+
<framework src="src/android/build-extras.gradle" custom="true" type="gradleReference" />
|
|
30
|
+
|
|
31
|
+
<hook type="before_plugin_uninstall" src="hooks/before_plugin_uninstall.js"/>
|
|
32
|
+
<hook type="after_plugin_install" src="hooks/after_plugin_install.js"/>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<config-file target="config.xml" parent="/*">
|
|
36
|
+
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
|
|
37
|
+
<preference name="GradlePluginGoogleServicesVersion" value="4.3.10" />
|
|
38
|
+
</config-file>
|
|
39
|
+
|
|
40
|
+
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
41
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
42
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
43
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
44
|
+
</config-file>
|
|
45
|
+
|
|
46
|
+
<config-file parent="/*" target="res/xml/config.xml">
|
|
47
|
+
<feature name="InsiderPlugin">
|
|
48
|
+
<param name="android-package" value="com.useinsider.cordova.InsiderPlugin" />
|
|
49
|
+
<param name="onload" value="true" />
|
|
50
|
+
</feature>
|
|
51
|
+
</config-file>
|
|
52
|
+
|
|
53
|
+
<source-file src="src/android/InsiderPlugin.java" target-dir="src/com/useinsider/cordova" />
|
|
54
|
+
<source-file src="src/android/Constants.java" target-dir="src/com/useinsider/cordova" />
|
|
55
|
+
<source-file src="src/android/CDVUtils.java" target-dir="src/com/useinsider/cordova" />
|
|
56
|
+
|
|
57
|
+
<resource-file src="src/android/res/values/dimens.xml" target="res/values/dimens.xml" />
|
|
58
|
+
<resource-file src="src/android/res/values-sw600dp/dimens.xml" target="res/values-sw600dp/dimens.xml" />
|
|
59
|
+
<resource-file src="src/android/res/values-sw720dp/dimens.xml" target="res/values-sw720dp/dimens.xml" />
|
|
60
|
+
<resource-file src="src/android/res/values-xhdpi/dimens.xml" target="res/values-xhdpi/dimens.xml" />
|
|
61
|
+
<resource-file src="src/android/res/values-xxhdpi/dimens.xml" target="res/values-xxhdpi/dimens.xml" />
|
|
62
|
+
<resource-file src="src/android/res/values-xxxhdpi/dimens.xml" target="res/values-xxxhdpi/dimens.xml" />
|
|
63
|
+
</platform>
|
|
64
|
+
|
|
65
|
+
<platform name="ios">
|
|
66
|
+
<framework src="libsqlite3.tbd" />
|
|
67
|
+
<framework src="libicucore.tbd" />
|
|
68
|
+
|
|
69
|
+
<podspec>
|
|
70
|
+
<config>
|
|
71
|
+
<source url="https://cdn.cocoapods.org/" />
|
|
72
|
+
</config>
|
|
73
|
+
<pods use-frameworks="true">
|
|
74
|
+
<pod name="InsiderMobile" spec="12.5.0" />
|
|
75
|
+
<pod name="InsiderHybrid" spec="1.1.2" />
|
|
76
|
+
</pods>
|
|
77
|
+
</podspec>
|
|
78
|
+
|
|
79
|
+
<config-file parent="/*" target="config.xml">
|
|
80
|
+
<feature name="InsiderPlugin">
|
|
81
|
+
<param name="ios-package" value="InsiderPlugin" />
|
|
82
|
+
</feature>
|
|
83
|
+
</config-file>
|
|
84
|
+
|
|
85
|
+
<source-file src="src/ios/InsiderPlugin.m" />
|
|
86
|
+
<header-file src="src/ios/InsiderPlugin.h" />
|
|
87
|
+
|
|
88
|
+
<source-file src="src/ios/IDFAHelper.m" />
|
|
89
|
+
<header-file src="src/ios/IDFAHelper.h" />
|
|
90
|
+
</platform>
|
|
91
|
+
</plugin>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
NEW_CV_VERSION_NAME=$1
|
|
4
|
+
|
|
5
|
+
packagejson_file_path="package.json"
|
|
6
|
+
gradle_file_path="src/android/build-extras.gradle"
|
|
7
|
+
|
|
8
|
+
CURRENT_CV_SDK_VERSION=$(sed -n 3p $packagejson_file_path | cut -d '"' -f 4)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
CURRENT_ANDROID_VERSION=$(sed -n 22p $gradle_file_path | awk '{print $2}' | awk -F : '{print $3}' | cut -d "'" -f 1)
|
|
12
|
+
CURRENT_ANDROID_HYBRID_VERSION=$(sed -n 23p $gradle_file_path | awk '{print $2}' | awk -F : '{print $3}' | cut -d "'" -f 1)
|
|
13
|
+
|
|
14
|
+
LATEST_iOS_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/iOS/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $2}')
|
|
15
|
+
LATEST_iOS_HYBRID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/iOSHybrid/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $2}')
|
|
16
|
+
|
|
17
|
+
LATEST_ANDROID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/android/com/useinsider/insider/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $5}' | cut -d "-" -f 1)
|
|
18
|
+
LATEST_ANDROID_HYBRID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/android/com/useinsider/insiderhybrid/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $5}')
|
|
19
|
+
|
|
20
|
+
# # Set new version in package.json
|
|
21
|
+
# sed -i "s/$CURRENT_CV_SDK_VERSION/$NEW_CV_VERSION_NAME/" $packagejson_file_path
|
|
22
|
+
|
|
23
|
+
# # Set new version in podspec
|
|
24
|
+
# sed -i "s/$CURRENT_iOS_VERSION/$LATEST_iOS_VERSION/;s/$CURRENT_iOS_HYBRID_VERSION/$LATEST_iOS_HYBRID_VERSION/" $podspec_file_path
|
|
25
|
+
|
|
26
|
+
# # Set new version in build.gradle
|
|
27
|
+
# sed -i "s/$CURRENT_ANDROID_VERSION/$LATEST_ANDROID_VERSION/;s/$CURRENT_ANDROID_HYBRID_VERSION/$LATEST_ANDROID_HYBRID_VERSION/" $gradle_file_path
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
SLACK_ENDPOINT="https://mobile.useinsider.com/api/lilith/slack_notifier"
|
|
3
|
+
|
|
4
|
+
CHANNEL=$1
|
|
5
|
+
USERNAME=$2
|
|
6
|
+
TEXT="$3"
|
|
7
|
+
|
|
8
|
+
generate_post_data()
|
|
9
|
+
{
|
|
10
|
+
cat <<EOF
|
|
11
|
+
{
|
|
12
|
+
"channel": "$CHANNEL",
|
|
13
|
+
"message": "$TEXT",
|
|
14
|
+
"username": "$USERNAME",
|
|
15
|
+
"auth_key": "$SLACK_NOTIFIER_AUTH_KEY"
|
|
16
|
+
}
|
|
17
|
+
EOF
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
curl -i -H "Content-Type:application/json" -X POST --data "$(generate_post_data)" $SLACK_ENDPOINT >/dev/null 2>&1
|