@purchasely/cordova-plugin-purchasely 2.2.1 → 2.2.4
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/example/config.xml +1 -1
- package/example/package-lock.json +28 -28
- package/example/package.json +4 -7
- package/example/www/js/index.js +2 -3
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/PLYProductActivity.java +1 -0
- package/src/android/PurchaselyPlugin.java +49 -20
- package/src/ios/Hybrid/PLYSubscription+Hybrid.m +6 -2
- package/INTERNAL +0 -33
- package/VERSIONS.md +0 -22
package/example/config.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<widget id="
|
|
2
|
+
<widget id="com.purchasely.demo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
3
|
<name>HelloCordova</name>
|
|
4
4
|
<description>
|
|
5
5
|
A sample Apache Cordova application that responds to the deviceready event.
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"cordova-android": "^10.1.
|
|
12
|
+
"cordova-android": "^10.1.2",
|
|
13
13
|
"cordova-ios": "^6.2.0",
|
|
14
14
|
"cordova-plugin-purchasely": "file:.."
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"..": {
|
|
18
18
|
"name": "cordova-plugin-purchasely",
|
|
19
|
-
"version": "2.2.
|
|
19
|
+
"version": "2.2.3",
|
|
20
20
|
"dev": true,
|
|
21
21
|
"license": "ISC"
|
|
22
22
|
},
|
|
@@ -199,9 +199,9 @@
|
|
|
199
199
|
"dev": true
|
|
200
200
|
},
|
|
201
201
|
"node_modules/cordova-android": {
|
|
202
|
-
"version": "10.1.
|
|
203
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.
|
|
204
|
-
"integrity": "sha512-
|
|
202
|
+
"version": "10.1.2",
|
|
203
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.2.tgz",
|
|
204
|
+
"integrity": "sha512-F28+NvgKO4ZhKFkqctCOh62mhVoNyUuRQh/F/nqp+Sti4ODv2rUa6UeW18khhdYTjlDeihHQsPqxvB7mI6fVYA==",
|
|
205
205
|
"dev": true,
|
|
206
206
|
"dependencies": {
|
|
207
207
|
"android-versions": "^1.7.0",
|
|
@@ -221,9 +221,9 @@
|
|
|
221
221
|
}
|
|
222
222
|
},
|
|
223
223
|
"node_modules/cordova-android/node_modules/fs-extra": {
|
|
224
|
-
"version": "10.0
|
|
225
|
-
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.
|
|
226
|
-
"integrity": "sha512-
|
|
224
|
+
"version": "10.1.0",
|
|
225
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
|
226
|
+
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
|
227
227
|
"dev": true,
|
|
228
228
|
"dependencies": {
|
|
229
229
|
"graceful-fs": "^4.2.0",
|
|
@@ -546,13 +546,13 @@
|
|
|
546
546
|
"node_modules/ios-sim/node_modules/bplist-parser": {
|
|
547
547
|
"version": "0.0.6",
|
|
548
548
|
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
|
|
549
|
-
"integrity": "
|
|
549
|
+
"integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
|
|
550
550
|
"dev": true
|
|
551
551
|
},
|
|
552
552
|
"node_modules/ios-sim/node_modules/nopt": {
|
|
553
553
|
"version": "1.0.9",
|
|
554
554
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz",
|
|
555
|
-
"integrity": "
|
|
555
|
+
"integrity": "sha512-CmUZ3rzN0/4kRHum5pGRiGkhmBMzgtEDxrZVHqRJDSv8qK6s+wzaig/xeyB22Due5aZQeTiEZg/nrmMH2tapDQ==",
|
|
556
556
|
"dev": true,
|
|
557
557
|
"dependencies": {
|
|
558
558
|
"abbrev": "1"
|
|
@@ -848,7 +848,7 @@
|
|
|
848
848
|
"node_modules/properties-parser": {
|
|
849
849
|
"version": "0.3.1",
|
|
850
850
|
"resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",
|
|
851
|
-
"integrity": "
|
|
851
|
+
"integrity": "sha512-AkSQxQAviJ89x4FIxOyHGfO3uund0gvYo7lfD0E+Gp7gFQKrTNgtoYQklu8EhrfHVZUzTwKGZx2r/KDSfnljcA==",
|
|
852
852
|
"dev": true,
|
|
853
853
|
"dependencies": {
|
|
854
854
|
"string.prototype.codepointat": "^0.2.0"
|
|
@@ -903,7 +903,7 @@
|
|
|
903
903
|
"node_modules/rechoir": {
|
|
904
904
|
"version": "0.6.2",
|
|
905
905
|
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
|
|
906
|
-
"integrity": "
|
|
906
|
+
"integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==",
|
|
907
907
|
"dev": true,
|
|
908
908
|
"dependencies": {
|
|
909
909
|
"resolve": "^1.1.6"
|
|
@@ -1063,7 +1063,7 @@
|
|
|
1063
1063
|
"node_modules/stream-buffers": {
|
|
1064
1064
|
"version": "2.2.0",
|
|
1065
1065
|
"resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz",
|
|
1066
|
-
"integrity": "
|
|
1066
|
+
"integrity": "sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==",
|
|
1067
1067
|
"dev": true,
|
|
1068
1068
|
"engines": {
|
|
1069
1069
|
"node": ">= 0.10.0"
|
|
@@ -1108,7 +1108,7 @@
|
|
|
1108
1108
|
"node_modules/tail": {
|
|
1109
1109
|
"version": "0.4.0",
|
|
1110
1110
|
"resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",
|
|
1111
|
-
"integrity": "
|
|
1111
|
+
"integrity": "sha512-i5rOhX0PwkFSbjID14mmuoqrLUIqpJeBwg0esugSbb+6Y+dzgN/O3YZXzzPL7dnQJGbQLs8cwM8Zsak5kFJGcA==",
|
|
1112
1112
|
"dev": true,
|
|
1113
1113
|
"engines": {
|
|
1114
1114
|
"node": ">= 0.4.0"
|
|
@@ -1219,7 +1219,7 @@
|
|
|
1219
1219
|
"node_modules/xml-escape": {
|
|
1220
1220
|
"version": "1.1.0",
|
|
1221
1221
|
"resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz",
|
|
1222
|
-
"integrity": "
|
|
1222
|
+
"integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==",
|
|
1223
1223
|
"dev": true
|
|
1224
1224
|
},
|
|
1225
1225
|
"node_modules/xmlbuilder": {
|
|
@@ -1379,9 +1379,9 @@
|
|
|
1379
1379
|
"dev": true
|
|
1380
1380
|
},
|
|
1381
1381
|
"cordova-android": {
|
|
1382
|
-
"version": "10.1.
|
|
1383
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.
|
|
1384
|
-
"integrity": "sha512-
|
|
1382
|
+
"version": "10.1.2",
|
|
1383
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.2.tgz",
|
|
1384
|
+
"integrity": "sha512-F28+NvgKO4ZhKFkqctCOh62mhVoNyUuRQh/F/nqp+Sti4ODv2rUa6UeW18khhdYTjlDeihHQsPqxvB7mI6fVYA==",
|
|
1385
1385
|
"dev": true,
|
|
1386
1386
|
"requires": {
|
|
1387
1387
|
"android-versions": "^1.7.0",
|
|
@@ -1398,9 +1398,9 @@
|
|
|
1398
1398
|
},
|
|
1399
1399
|
"dependencies": {
|
|
1400
1400
|
"fs-extra": {
|
|
1401
|
-
"version": "10.0
|
|
1402
|
-
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.
|
|
1403
|
-
"integrity": "sha512-
|
|
1401
|
+
"version": "10.1.0",
|
|
1402
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
|
1403
|
+
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
|
1404
1404
|
"dev": true,
|
|
1405
1405
|
"requires": {
|
|
1406
1406
|
"graceful-fs": "^4.2.0",
|
|
@@ -1661,13 +1661,13 @@
|
|
|
1661
1661
|
"bplist-parser": {
|
|
1662
1662
|
"version": "0.0.6",
|
|
1663
1663
|
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
|
|
1664
|
-
"integrity": "
|
|
1664
|
+
"integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
|
|
1665
1665
|
"dev": true
|
|
1666
1666
|
},
|
|
1667
1667
|
"nopt": {
|
|
1668
1668
|
"version": "1.0.9",
|
|
1669
1669
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz",
|
|
1670
|
-
"integrity": "
|
|
1670
|
+
"integrity": "sha512-CmUZ3rzN0/4kRHum5pGRiGkhmBMzgtEDxrZVHqRJDSv8qK6s+wzaig/xeyB22Due5aZQeTiEZg/nrmMH2tapDQ==",
|
|
1671
1671
|
"dev": true,
|
|
1672
1672
|
"requires": {
|
|
1673
1673
|
"abbrev": "1"
|
|
@@ -1882,7 +1882,7 @@
|
|
|
1882
1882
|
"properties-parser": {
|
|
1883
1883
|
"version": "0.3.1",
|
|
1884
1884
|
"resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",
|
|
1885
|
-
"integrity": "
|
|
1885
|
+
"integrity": "sha512-AkSQxQAviJ89x4FIxOyHGfO3uund0gvYo7lfD0E+Gp7gFQKrTNgtoYQklu8EhrfHVZUzTwKGZx2r/KDSfnljcA==",
|
|
1886
1886
|
"dev": true,
|
|
1887
1887
|
"requires": {
|
|
1888
1888
|
"string.prototype.codepointat": "^0.2.0"
|
|
@@ -1913,7 +1913,7 @@
|
|
|
1913
1913
|
"rechoir": {
|
|
1914
1914
|
"version": "0.6.2",
|
|
1915
1915
|
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
|
|
1916
|
-
"integrity": "
|
|
1916
|
+
"integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==",
|
|
1917
1917
|
"dev": true,
|
|
1918
1918
|
"requires": {
|
|
1919
1919
|
"resolve": "^1.1.6"
|
|
@@ -2027,7 +2027,7 @@
|
|
|
2027
2027
|
"stream-buffers": {
|
|
2028
2028
|
"version": "2.2.0",
|
|
2029
2029
|
"resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz",
|
|
2030
|
-
"integrity": "
|
|
2030
|
+
"integrity": "sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==",
|
|
2031
2031
|
"dev": true
|
|
2032
2032
|
},
|
|
2033
2033
|
"string.prototype.codepointat": {
|
|
@@ -2057,7 +2057,7 @@
|
|
|
2057
2057
|
"tail": {
|
|
2058
2058
|
"version": "0.4.0",
|
|
2059
2059
|
"resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",
|
|
2060
|
-
"integrity": "
|
|
2060
|
+
"integrity": "sha512-i5rOhX0PwkFSbjID14mmuoqrLUIqpJeBwg0esugSbb+6Y+dzgN/O3YZXzzPL7dnQJGbQLs8cwM8Zsak5kFJGcA==",
|
|
2061
2061
|
"dev": true
|
|
2062
2062
|
},
|
|
2063
2063
|
"to-regex-range": {
|
|
@@ -2138,7 +2138,7 @@
|
|
|
2138
2138
|
"xml-escape": {
|
|
2139
2139
|
"version": "1.1.0",
|
|
2140
2140
|
"resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz",
|
|
2141
|
-
"integrity": "
|
|
2141
|
+
"integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==",
|
|
2142
2142
|
"dev": true
|
|
2143
2143
|
},
|
|
2144
2144
|
"xmlbuilder": {
|
package/example/package.json
CHANGED
|
@@ -13,17 +13,14 @@
|
|
|
13
13
|
"author": "Apache Cordova Team",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"cordova-android": "^10.1.
|
|
16
|
+
"cordova-android": "^10.1.2",
|
|
17
17
|
"cordova-ios": "^6.2.0",
|
|
18
18
|
"cordova-plugin-purchasely": "file:.."
|
|
19
19
|
},
|
|
20
20
|
"cordova": {
|
|
21
|
-
"plugins": {
|
|
22
|
-
"cordova-plugin-purchasely": {}
|
|
23
|
-
},
|
|
21
|
+
"plugins": {},
|
|
24
22
|
"platforms": [
|
|
25
|
-
"android"
|
|
26
|
-
"ios"
|
|
23
|
+
"android"
|
|
27
24
|
]
|
|
28
25
|
}
|
|
29
|
-
}
|
|
26
|
+
}
|
package/example/www/js/index.js
CHANGED
|
@@ -30,7 +30,7 @@ function onDeviceReady() {
|
|
|
30
30
|
Purchasely.setLanguage('en')
|
|
31
31
|
|
|
32
32
|
Purchasely.startWithAPIKey(
|
|
33
|
-
'
|
|
33
|
+
'fcb39be4-2ba4-4db7-bde3-2a5a1e20745d',
|
|
34
34
|
['Google'],
|
|
35
35
|
null,
|
|
36
36
|
Purchasely.LogLevel.DEBUG,
|
|
@@ -126,7 +126,7 @@ function onPuchaselySdkReady() {
|
|
|
126
126
|
result.parameters.url
|
|
127
127
|
);
|
|
128
128
|
console.log('prevent Purchasely SDK to navigate to website');
|
|
129
|
-
Purchasely.onProcessAction(
|
|
129
|
+
Purchasely.onProcessAction(true);
|
|
130
130
|
} else if (result.action === Purchasely.PaywallAction.close) {
|
|
131
131
|
console.log('User wants to close paywall');
|
|
132
132
|
Purchasely.onProcessAction(true);
|
|
@@ -144,7 +144,6 @@ function onPuchaselySdkReady() {
|
|
|
144
144
|
console.log('User wants to purchase');
|
|
145
145
|
//If you want to intercept it, close paywall and display your screen
|
|
146
146
|
Purchasely.closePaywall();
|
|
147
|
-
Purchasely.onProcessAction(true);
|
|
148
147
|
} else if (result.action === Purchasely.PaywallAction.restore) {
|
|
149
148
|
console.log('User wants to restore his purchases');
|
|
150
149
|
Purchasely.onProcessAction(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "Purchasely is a solution to ease the integration and boost your In-App Purchases & Subscriptions on the App Store, Google Play Store, Amazon Appstore and Huawei App Gallery.",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "@purchasely/cordova-plugin-purchasely",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@purchasely/cordova-plugin-purchasely" version="2.2.
|
|
2
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="2.2.4" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>Purchasely</name>
|
|
4
4
|
<js-module name="Purchasely" src="www/Purchasely.js">
|
|
5
5
|
<clobbers target="Purchasely" />
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
29
29
|
</config>
|
|
30
30
|
<pods use-frameworks="true">
|
|
31
|
-
<pod name="Purchasely" spec="3.2.
|
|
31
|
+
<pod name="Purchasely" spec="3.2.3"/>
|
|
32
32
|
</pods>
|
|
33
33
|
</podspec>
|
|
34
34
|
</platform>
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
|
52
52
|
</activity>
|
|
53
53
|
</config-file>
|
|
54
|
-
<framework src="io.purchasely:core:3.2.
|
|
54
|
+
<framework src="io.purchasely:core:3.2.2" />
|
|
55
55
|
<source-file src="src/android/PurchaselyPlugin.java" target-dir="src/cordova/plugin/purchasely" />
|
|
56
56
|
<source-file src="src/android/PLYProductActivity.java" target-dir="src/cordova/plugin/purchasely" />
|
|
57
57
|
<source-file src="src/android/PLYSubscriptionsActivity.java" target-dir="src/cordova/plugin/purchasely" />
|
|
@@ -63,6 +63,7 @@ public class PLYProductActivity extends AppCompatActivity {
|
|
|
63
63
|
|
|
64
64
|
PurchaselyPlugin.ProductActivity productActivity = new PurchaselyPlugin.ProductActivity();
|
|
65
65
|
productActivity.presentationId = presentationId;
|
|
66
|
+
productActivity.placementId = placementId;
|
|
66
67
|
productActivity.productId = productId;
|
|
67
68
|
productActivity.planId = planId;
|
|
68
69
|
productActivity.contentId = contentId;
|
|
@@ -59,7 +59,8 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
59
59
|
static CallbackContext eventsCallback = null;
|
|
60
60
|
static ProductActivity productActivity = null;
|
|
61
61
|
|
|
62
|
-
private PLYProcessActionListener processActionListener;
|
|
62
|
+
@Nullable private PLYProcessActionListener processActionListener;
|
|
63
|
+
@Nullable private PLYPresentationAction paywallAction;
|
|
63
64
|
|
|
64
65
|
private static int runningModeTransactionOnly = 0;
|
|
65
66
|
private static int runningModeObserver = 1;
|
|
@@ -586,6 +587,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
586
587
|
Purchasely.setPaywallActionsInterceptor(
|
|
587
588
|
(info, plyPresentationAction, map, plyProcessActionListener) -> {
|
|
588
589
|
processActionListener = plyProcessActionListener;
|
|
590
|
+
paywallAction = plyPresentationAction;
|
|
589
591
|
|
|
590
592
|
String url = null;
|
|
591
593
|
if(map.getUrl() != null) {
|
|
@@ -620,7 +622,10 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
620
622
|
}
|
|
621
623
|
|
|
622
624
|
private void closePaywall(CallbackContext callbackContext) {
|
|
623
|
-
Activity purchaselyActivity =
|
|
625
|
+
Activity purchaselyActivity = null;
|
|
626
|
+
if(productActivity != null && productActivity.activity != null) {
|
|
627
|
+
purchaselyActivity = productActivity.activity.get();
|
|
628
|
+
}
|
|
624
629
|
Activity activity = purchaselyActivity != null ? purchaselyActivity : cordova.getActivity();
|
|
625
630
|
Intent intent = new Intent(activity, cordova.getActivity().getClass());
|
|
626
631
|
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
@@ -628,24 +633,40 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
628
633
|
}
|
|
629
634
|
|
|
630
635
|
private void onProcessAction(boolean processAction) {
|
|
631
|
-
if(processActionListener
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
636
|
+
if(processActionListener == null) return;
|
|
637
|
+
|
|
638
|
+
PLYPresentationAction action = PLYPresentationAction.CLOSE;
|
|
639
|
+
if(paywallAction != null) action = paywallAction;
|
|
640
|
+
|
|
641
|
+
switch (action) {
|
|
642
|
+
case PROMO_CODE:
|
|
643
|
+
case RESTORE:
|
|
644
|
+
case PURCHASE:
|
|
645
|
+
case LOGIN:
|
|
646
|
+
case OPEN_PRESENTATION:
|
|
647
|
+
processActionWithPaywallActivity(processAction);
|
|
648
|
+
break;
|
|
649
|
+
default:
|
|
650
|
+
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
private void processActionWithPaywallActivity(boolean processAction) {
|
|
655
|
+
if(processActionListener == null) return;
|
|
656
|
+
|
|
657
|
+
boolean softRelaunched = productActivity != null && productActivity.relaunch(cordova);
|
|
658
|
+
if(softRelaunched) {
|
|
659
|
+
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
660
|
+
} else {
|
|
661
|
+
new Thread(() -> {
|
|
662
|
+
try {
|
|
663
|
+
Thread.sleep(500);
|
|
664
|
+
} catch (InterruptedException e) {
|
|
665
|
+
Log.e("Purchasely", "process action error", e);
|
|
666
|
+
} finally {
|
|
635
667
|
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
636
|
-
} else {
|
|
637
|
-
new Thread(() -> {
|
|
638
|
-
try {
|
|
639
|
-
Thread.sleep(500);
|
|
640
|
-
} catch (InterruptedException e) {
|
|
641
|
-
Log.e("Purchasely", "process action error", e);
|
|
642
|
-
} finally {
|
|
643
|
-
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
644
|
-
}
|
|
645
|
-
}).start();
|
|
646
668
|
}
|
|
647
|
-
|
|
648
|
-
}
|
|
669
|
+
}).start();
|
|
649
670
|
}
|
|
650
671
|
}
|
|
651
672
|
|
|
@@ -669,18 +690,25 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
669
690
|
|
|
670
691
|
public static class ProductActivity {
|
|
671
692
|
String presentationId = null;
|
|
693
|
+
String placementId = null;
|
|
672
694
|
String productId = null;
|
|
673
695
|
String planId = null;
|
|
674
696
|
String contentId = null;
|
|
675
|
-
WeakReference<PLYProductActivity> activity = null;
|
|
697
|
+
@Nullable WeakReference<PLYProductActivity> activity = null;
|
|
676
698
|
|
|
677
699
|
public boolean relaunch(CordovaInterface cordova) {
|
|
678
|
-
PLYProductActivity backgroundActivity =
|
|
700
|
+
PLYProductActivity backgroundActivity = null;
|
|
701
|
+
|
|
702
|
+
if(activity != null) {
|
|
703
|
+
backgroundActivity = activity.get();
|
|
704
|
+
}
|
|
705
|
+
|
|
679
706
|
if(backgroundActivity != null
|
|
680
707
|
&& !backgroundActivity.isFinishing()
|
|
681
708
|
&& !backgroundActivity.isDestroyed()) {
|
|
682
709
|
Intent intent = new Intent(cordova.getActivity(), PLYProductActivity.class);
|
|
683
710
|
intent.putExtra("presentationId", presentationId);
|
|
711
|
+
intent.putExtra("placementId", placementId);
|
|
684
712
|
intent.putExtra("productId", productId);
|
|
685
713
|
intent.putExtra("planId", planId);
|
|
686
714
|
intent.putExtra("contentId", contentId);
|
|
@@ -690,6 +718,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
690
718
|
} else {
|
|
691
719
|
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
692
720
|
intent.putExtra("presentationId", presentationId);
|
|
721
|
+
intent.putExtra("placementId", placementId);
|
|
693
722
|
intent.putExtra("productId", productId);
|
|
694
723
|
intent.putExtra("planId", planId);
|
|
695
724
|
intent.putExtra("contentId", contentId);
|
|
@@ -14,14 +14,18 @@
|
|
|
14
14
|
NSMutableDictionary<NSString *, NSObject *> *dict = [NSMutableDictionary new];
|
|
15
15
|
|
|
16
16
|
[dict setObject:self.plan.asDictionary forKey:@"plan"];
|
|
17
|
+
[dict setObject:self.product.asDictionary forKey:@"product"];
|
|
17
18
|
[dict setObject:[NSNumber numberWithInt:self.subscriptionSource] forKey:@"subscriptionSource"];
|
|
18
19
|
|
|
20
|
+
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
|
|
21
|
+
[dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
|
|
22
|
+
|
|
19
23
|
if (self.nextRenewalDate != nil) {
|
|
20
|
-
[dict setObject
|
|
24
|
+
[dict setObject:[dateFormat stringFromDate:self.nextRenewalDate] forKey:@"nextRenewalDate"];
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
if (self.cancelledDate != nil) {
|
|
24
|
-
[dict setObject
|
|
28
|
+
[dict setObject:[dateFormat stringFromDate:self.cancelledDate] forKey:@"cancelledDate"];
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
return dict;
|
package/INTERNAL
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Purchasely-Cordova-Sources
|
|
2
|
-
|
|
3
|
-
## Add plugin :
|
|
4
|
-
|
|
5
|
-
`cd example/`
|
|
6
|
-
|
|
7
|
-
`cordova plugin add /home/kevin/Documents/Purchasely/Cordova/Purchasely --link`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Add android platform :
|
|
11
|
-
|
|
12
|
-
`cd example/`
|
|
13
|
-
|
|
14
|
-
`cordova platform add android`
|
|
15
|
-
|
|
16
|
-
`cordova run android`
|
|
17
|
-
|
|
18
|
-
### Add Google-Play dependencies
|
|
19
|
-
|
|
20
|
-
In folder `example/platforms/android/app` create a file called `build-extras.gradle` and add thoses lines :
|
|
21
|
-
```groovy
|
|
22
|
-
dependencies {
|
|
23
|
-
implementation "io.purchasely:google-play:2.5.5"
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Troubleshot
|
|
28
|
-
|
|
29
|
-
`cd example/`
|
|
30
|
-
|
|
31
|
-
`cordova platform remove android`
|
|
32
|
-
|
|
33
|
-
`cordova plugin remove cordova-plugin-purchasely`
|
package/VERSIONS.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
This file provides the underlying native SDK versions that the Cordova SDK relies on.
|
|
2
|
-
|
|
3
|
-
| Version | iOS version | Android version |
|
|
4
|
-
|---------|-------------|-----------------|
|
|
5
|
-
| 1.0.2 | 2.5.3 | 2.5.4 |
|
|
6
|
-
| 1.0.3 | 2.5.5 | 2.5.5 |
|
|
7
|
-
| 1.0.4 | 2.5.5 | 2.5.6 |
|
|
8
|
-
| 1.0.5 | 2.6.0 | 2.5.6 |
|
|
9
|
-
| 1.1.0 | 2.7.2 | 2.7.2 |
|
|
10
|
-
| 1.1.1 | 2.7.3 | 2.7.2 |
|
|
11
|
-
| 1.1.2 | 2.7.3 | 2.7.2 |
|
|
12
|
-
| 1.1.3 | 2.7.3 | 2.7.2 |
|
|
13
|
-
| 1.1.6 | 2.7.3 | 2.7.3 |
|
|
14
|
-
| 1.1.7 | 2.7.3 | 2.7.4 |
|
|
15
|
-
| 1.1.8 | 2.7.3 | 2.7.6 |
|
|
16
|
-
| 1.2.0 | 2.8.0 | 2.8.0 |
|
|
17
|
-
| 2.0.0 | 3.0.0 | 3.0.1 |
|
|
18
|
-
| 2.0.1 | 3.0.0 | 3.0.1 |
|
|
19
|
-
| 2.1.0 | 3.1.0 | 3.1.0 |
|
|
20
|
-
| 2.1.1 | 3.1.0 | 3.1.0 |
|
|
21
|
-
| 2.2.0 | 3.2.0 | 3.2.0 |
|
|
22
|
-
| 2.2.1 | 3.2.1 | 3.2.1 |
|