@purchasely/cordova-plugin-purchasely 1.1.6 → 2.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/VERSIONS.md +5 -0
- package/example/package-lock.json +74 -60
- package/example/package.json +6 -5
- package/example/www/index.html +3 -0
- package/example/www/js/index.js +73 -13
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/.idea/workspace.xml +19 -1
- package/src/android/PLYProductActivity.java +8 -3
- package/src/android/PurchaselyPlugin.java +84 -50
- package/src/ios/CDVPurchasely.h +7 -11
- package/src/ios/CDVPurchasely.m +151 -78
- package/src/ios/Hybrid/PLYPlan+Hybrid.m +4 -0
- package/www/Purchasely.js +37 -13
- package/src/android/.idea/runConfigurations.xml +0 -10
package/VERSIONS.md
CHANGED
|
@@ -10,3 +10,8 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
|
|
|
10
10
|
| 1.1.1 | 2.7.3 | 2.7.2 |
|
|
11
11
|
| 1.1.2 | 2.7.3 | 2.7.2 |
|
|
12
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 |
|
|
@@ -10,14 +10,15 @@
|
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
13
|
-
"cordova-android": "^10.1.
|
|
13
|
+
"cordova-android": "^10.1.0",
|
|
14
14
|
"cordova-ios": "^6.2.0",
|
|
15
|
+
"cordova-plugin-purchasely": "file:..",
|
|
15
16
|
"cordova-plugin-whitelist": "^1.3.5"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"..": {
|
|
19
|
-
"name": "
|
|
20
|
-
"version": "
|
|
20
|
+
"name": "cordova-plugin-purchasely",
|
|
21
|
+
"version": "2.0.0",
|
|
21
22
|
"dev": true,
|
|
22
23
|
"license": "ISC"
|
|
23
24
|
},
|
|
@@ -155,12 +156,12 @@
|
|
|
155
156
|
}
|
|
156
157
|
},
|
|
157
158
|
"node_modules/bplist-creator": {
|
|
158
|
-
"version": "0.0
|
|
159
|
-
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.
|
|
160
|
-
"integrity": "sha512-
|
|
159
|
+
"version": "0.1.0",
|
|
160
|
+
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz",
|
|
161
|
+
"integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==",
|
|
161
162
|
"dev": true,
|
|
162
163
|
"dependencies": {
|
|
163
|
-
"stream-buffers": "
|
|
164
|
+
"stream-buffers": "2.2.x"
|
|
164
165
|
}
|
|
165
166
|
},
|
|
166
167
|
"node_modules/bplist-parser": {
|
|
@@ -204,9 +205,9 @@
|
|
|
204
205
|
"dev": true
|
|
205
206
|
},
|
|
206
207
|
"node_modules/cordova-android": {
|
|
207
|
-
"version": "10.1.
|
|
208
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.
|
|
209
|
-
"integrity": "sha512-
|
|
208
|
+
"version": "10.1.0",
|
|
209
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
|
|
210
|
+
"integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
|
|
210
211
|
"dev": true,
|
|
211
212
|
"dependencies": {
|
|
212
213
|
"android-versions": "^1.7.0",
|
|
@@ -285,6 +286,10 @@
|
|
|
285
286
|
"node": ">=10"
|
|
286
287
|
}
|
|
287
288
|
},
|
|
289
|
+
"node_modules/cordova-plugin-purchasely": {
|
|
290
|
+
"resolved": "..",
|
|
291
|
+
"link": true
|
|
292
|
+
},
|
|
288
293
|
"node_modules/cordova-plugin-whitelist": {
|
|
289
294
|
"version": "1.3.5",
|
|
290
295
|
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
|
|
@@ -805,14 +810,13 @@
|
|
|
805
810
|
}
|
|
806
811
|
},
|
|
807
812
|
"node_modules/plist": {
|
|
808
|
-
"version": "3.0.
|
|
809
|
-
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.
|
|
810
|
-
"integrity": "sha512-
|
|
813
|
+
"version": "3.0.4",
|
|
814
|
+
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
|
|
815
|
+
"integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
|
|
811
816
|
"dev": true,
|
|
812
817
|
"dependencies": {
|
|
813
818
|
"base64-js": "^1.5.1",
|
|
814
|
-
"xmlbuilder": "^9.0.7"
|
|
815
|
-
"xmldom": "^0.5.0"
|
|
819
|
+
"xmlbuilder": "^9.0.7"
|
|
816
820
|
},
|
|
817
821
|
"engines": {
|
|
818
822
|
"node": ">=6"
|
|
@@ -961,9 +965,9 @@
|
|
|
961
965
|
}
|
|
962
966
|
},
|
|
963
967
|
"node_modules/signal-exit": {
|
|
964
|
-
"version": "3.0.
|
|
965
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
966
|
-
"integrity": "sha512-
|
|
968
|
+
"version": "3.0.6",
|
|
969
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
|
|
970
|
+
"integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
|
|
967
971
|
"dev": true
|
|
968
972
|
},
|
|
969
973
|
"node_modules/simctl": {
|
|
@@ -977,14 +981,26 @@
|
|
|
977
981
|
}
|
|
978
982
|
},
|
|
979
983
|
"node_modules/simple-plist": {
|
|
980
|
-
"version": "1.
|
|
981
|
-
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.
|
|
982
|
-
"integrity": "sha512-
|
|
984
|
+
"version": "1.3.0",
|
|
985
|
+
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
|
|
986
|
+
"integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
|
|
983
987
|
"dev": true,
|
|
984
988
|
"dependencies": {
|
|
985
|
-
"bplist-creator": "0.0
|
|
986
|
-
"bplist-parser": "0.
|
|
987
|
-
"plist": "^3.0.
|
|
989
|
+
"bplist-creator": "0.1.0",
|
|
990
|
+
"bplist-parser": "0.3.0",
|
|
991
|
+
"plist": "^3.0.4"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
"node_modules/simple-plist/node_modules/bplist-parser": {
|
|
995
|
+
"version": "0.3.0",
|
|
996
|
+
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
|
|
997
|
+
"integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
|
|
998
|
+
"dev": true,
|
|
999
|
+
"dependencies": {
|
|
1000
|
+
"big-integer": "1.6.x"
|
|
1001
|
+
},
|
|
1002
|
+
"engines": {
|
|
1003
|
+
"node": ">= 5.10.0"
|
|
988
1004
|
}
|
|
989
1005
|
},
|
|
990
1006
|
"node_modules/stream-buffers": {
|
|
@@ -1146,15 +1162,6 @@
|
|
|
1146
1162
|
"node": ">=4.0"
|
|
1147
1163
|
}
|
|
1148
1164
|
},
|
|
1149
|
-
"node_modules/xmldom": {
|
|
1150
|
-
"version": "0.5.0",
|
|
1151
|
-
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",
|
|
1152
|
-
"integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==",
|
|
1153
|
-
"dev": true,
|
|
1154
|
-
"engines": {
|
|
1155
|
-
"node": ">=10.0.0"
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
1165
|
"node_modules/yallist": {
|
|
1159
1166
|
"version": "4.0.0",
|
|
1160
1167
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
|
@@ -1263,12 +1270,12 @@
|
|
|
1263
1270
|
"dev": true
|
|
1264
1271
|
},
|
|
1265
1272
|
"bplist-creator": {
|
|
1266
|
-
"version": "0.0
|
|
1267
|
-
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.
|
|
1268
|
-
"integrity": "sha512-
|
|
1273
|
+
"version": "0.1.0",
|
|
1274
|
+
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz",
|
|
1275
|
+
"integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==",
|
|
1269
1276
|
"dev": true,
|
|
1270
1277
|
"requires": {
|
|
1271
|
-
"stream-buffers": "
|
|
1278
|
+
"stream-buffers": "2.2.x"
|
|
1272
1279
|
}
|
|
1273
1280
|
},
|
|
1274
1281
|
"bplist-parser": {
|
|
@@ -1306,9 +1313,9 @@
|
|
|
1306
1313
|
"dev": true
|
|
1307
1314
|
},
|
|
1308
1315
|
"cordova-android": {
|
|
1309
|
-
"version": "10.1.
|
|
1310
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.
|
|
1311
|
-
"integrity": "sha512-
|
|
1316
|
+
"version": "10.1.0",
|
|
1317
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
|
|
1318
|
+
"integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
|
|
1312
1319
|
"dev": true,
|
|
1313
1320
|
"requires": {
|
|
1314
1321
|
"android-versions": "^1.7.0",
|
|
@@ -1377,6 +1384,9 @@
|
|
|
1377
1384
|
"xml-escape": "^1.1.0"
|
|
1378
1385
|
}
|
|
1379
1386
|
},
|
|
1387
|
+
"cordova-plugin-purchasely": {
|
|
1388
|
+
"version": "file:.."
|
|
1389
|
+
},
|
|
1380
1390
|
"cordova-plugin-whitelist": {
|
|
1381
1391
|
"version": "1.3.5",
|
|
1382
1392
|
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
|
|
@@ -1764,14 +1774,13 @@
|
|
|
1764
1774
|
"dev": true
|
|
1765
1775
|
},
|
|
1766
1776
|
"plist": {
|
|
1767
|
-
"version": "3.0.
|
|
1768
|
-
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.
|
|
1769
|
-
"integrity": "sha512-
|
|
1777
|
+
"version": "3.0.4",
|
|
1778
|
+
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
|
|
1779
|
+
"integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
|
|
1770
1780
|
"dev": true,
|
|
1771
1781
|
"requires": {
|
|
1772
1782
|
"base64-js": "^1.5.1",
|
|
1773
|
-
"xmlbuilder": "^9.0.7"
|
|
1774
|
-
"xmldom": "^0.5.0"
|
|
1783
|
+
"xmlbuilder": "^9.0.7"
|
|
1775
1784
|
}
|
|
1776
1785
|
},
|
|
1777
1786
|
"properties-parser": {
|
|
@@ -1857,9 +1866,9 @@
|
|
|
1857
1866
|
"dev": true
|
|
1858
1867
|
},
|
|
1859
1868
|
"signal-exit": {
|
|
1860
|
-
"version": "3.0.
|
|
1861
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
1862
|
-
"integrity": "sha512-
|
|
1869
|
+
"version": "3.0.6",
|
|
1870
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
|
|
1871
|
+
"integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
|
|
1863
1872
|
"dev": true
|
|
1864
1873
|
},
|
|
1865
1874
|
"simctl": {
|
|
@@ -1873,14 +1882,25 @@
|
|
|
1873
1882
|
}
|
|
1874
1883
|
},
|
|
1875
1884
|
"simple-plist": {
|
|
1876
|
-
"version": "1.
|
|
1877
|
-
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.
|
|
1878
|
-
"integrity": "sha512-
|
|
1885
|
+
"version": "1.3.0",
|
|
1886
|
+
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
|
|
1887
|
+
"integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
|
|
1879
1888
|
"dev": true,
|
|
1880
1889
|
"requires": {
|
|
1881
|
-
"bplist-creator": "0.0
|
|
1882
|
-
"bplist-parser": "0.
|
|
1883
|
-
"plist": "^3.0.
|
|
1890
|
+
"bplist-creator": "0.1.0",
|
|
1891
|
+
"bplist-parser": "0.3.0",
|
|
1892
|
+
"plist": "^3.0.4"
|
|
1893
|
+
},
|
|
1894
|
+
"dependencies": {
|
|
1895
|
+
"bplist-parser": {
|
|
1896
|
+
"version": "0.3.0",
|
|
1897
|
+
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
|
|
1898
|
+
"integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
|
|
1899
|
+
"dev": true,
|
|
1900
|
+
"requires": {
|
|
1901
|
+
"big-integer": "1.6.x"
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1884
1904
|
}
|
|
1885
1905
|
},
|
|
1886
1906
|
"stream-buffers": {
|
|
@@ -2000,12 +2020,6 @@
|
|
|
2000
2020
|
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=",
|
|
2001
2021
|
"dev": true
|
|
2002
2022
|
},
|
|
2003
|
-
"xmldom": {
|
|
2004
|
-
"version": "0.5.0",
|
|
2005
|
-
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",
|
|
2006
|
-
"integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==",
|
|
2007
|
-
"dev": true
|
|
2008
|
-
},
|
|
2009
2023
|
"yallist": {
|
|
2010
2024
|
"version": "4.0.0",
|
|
2011
2025
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
package/example/package.json
CHANGED
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
17
|
-
"cordova-android": "^10.1.
|
|
17
|
+
"cordova-android": "^10.1.0",
|
|
18
18
|
"cordova-ios": "^6.2.0",
|
|
19
|
+
"cordova-plugin-purchasely": "file:..",
|
|
19
20
|
"cordova-plugin-whitelist": "^1.3.5"
|
|
20
21
|
},
|
|
21
22
|
"cordova": {
|
|
22
23
|
"plugins": {
|
|
23
24
|
"cordova-plugin-whitelist": {},
|
|
24
|
-
"
|
|
25
|
+
"cordova-plugin-purchasely": {}
|
|
25
26
|
},
|
|
26
27
|
"platforms": [
|
|
27
|
-
"
|
|
28
|
-
"
|
|
28
|
+
"android",
|
|
29
|
+
"ios"
|
|
29
30
|
]
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
|
+
}
|
package/example/www/index.html
CHANGED
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
<div style="margin-top: 20px;">
|
|
60
60
|
<button id="restore">Restore</button>
|
|
61
61
|
</div>
|
|
62
|
+
<div style="margin-top: 20px;">
|
|
63
|
+
<button id="silentRestore">Silent restore</button>
|
|
64
|
+
</div>
|
|
62
65
|
<div style="margin-top: 20px;">
|
|
63
66
|
<button id="openDeeplink">Deeplink</button>
|
|
64
67
|
</div>
|
package/example/www/js/index.js
CHANGED
|
@@ -29,12 +29,14 @@ function onDeviceReady() {
|
|
|
29
29
|
|
|
30
30
|
console.log("Hi");
|
|
31
31
|
|
|
32
|
+
Purchasely.setLanguage('en')
|
|
33
|
+
|
|
32
34
|
Purchasely.startWithAPIKey(
|
|
33
35
|
'afa96c76-1d8e-4e3c-a48f-204a3cd93a15',
|
|
34
36
|
['Google'],
|
|
35
37
|
null,
|
|
36
38
|
Purchasely.LogLevel.DEBUG,
|
|
37
|
-
|
|
39
|
+
Purchasely.RunningMode.full,
|
|
38
40
|
(isConfigured) => {
|
|
39
41
|
if(isConfigured) onPuchaselySdkReady();
|
|
40
42
|
},
|
|
@@ -46,6 +48,7 @@ function onDeviceReady() {
|
|
|
46
48
|
document.getElementById("presentSubscriptions").addEventListener("click", presentSubscriptions);
|
|
47
49
|
document.getElementById("purchaseWithPlanVendorId").addEventListener("click", purchaseWithPlanVendorId);
|
|
48
50
|
document.getElementById("restore").addEventListener("click", restore);
|
|
51
|
+
document.getElementById("silentRestore").addEventListener("click", silentRestore);
|
|
49
52
|
document.getElementById("processToPayment").addEventListener("click", processToPayment);
|
|
50
53
|
|
|
51
54
|
}
|
|
@@ -81,9 +84,26 @@ function onPuchaselySdkReady() {
|
|
|
81
84
|
Purchasely.setLogLevel(Purchasely.LogLevel.DEBUG);
|
|
82
85
|
|
|
83
86
|
Purchasely.setAttribute(Purchasely.Attribute.FIREBASE_APP_INSTANCE_ID, "1");
|
|
87
|
+
Purchasely.setAttribute(Purchasely.Attribute.BATCH_INSTALLATION_ID, "testBatch1");
|
|
84
88
|
|
|
85
89
|
Purchasely.isReadyToPurchase(true);
|
|
86
90
|
|
|
91
|
+
Purchasely.planWithIdentifier('PURCHASELY_PLUS_MONTHLY', (plan) => {
|
|
92
|
+
console.log(' ==> Plan');
|
|
93
|
+
console.log(plan.vendorId);
|
|
94
|
+
console.log(plan.productId);
|
|
95
|
+
console.log(plan.name);
|
|
96
|
+
console.log(plan.price);
|
|
97
|
+
console.log(plan.amount);
|
|
98
|
+
console.log(plan.period);
|
|
99
|
+
console.log(plan.hasIntroductoryPrice);
|
|
100
|
+
console.log(plan.introPrice);
|
|
101
|
+
console.log(plan.introAmount);
|
|
102
|
+
console.log(plan.introDuration);
|
|
103
|
+
}, (error) => {
|
|
104
|
+
console.log(error);
|
|
105
|
+
});
|
|
106
|
+
|
|
87
107
|
Purchasely.setDefaultPresentationResultHandler(callback => {
|
|
88
108
|
console.log(callback);
|
|
89
109
|
if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
|
|
@@ -92,20 +112,48 @@ function onPuchaselySdkReady() {
|
|
|
92
112
|
console.log("User purchased " + callback.plan.vendorId);
|
|
93
113
|
}
|
|
94
114
|
},
|
|
95
|
-
|
|
115
|
+
(error) => {
|
|
96
116
|
console.log("Error with purchase : " + error);
|
|
97
117
|
});
|
|
98
118
|
|
|
99
|
-
Purchasely.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Purchasely.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
Purchasely.setPaywallActionInterceptor((result) => {
|
|
120
|
+
console.log(result);
|
|
121
|
+
console.log('Received action from paywall ' + result.info.presentationId);
|
|
122
|
+
|
|
123
|
+
if (result.action === Purchasely.PaywallAction.navigate) {
|
|
124
|
+
console.log(
|
|
125
|
+
'User wants to navigate to website ' +
|
|
126
|
+
result.parameters.title +
|
|
127
|
+
' ' +
|
|
128
|
+
result.parameters.url
|
|
129
|
+
);
|
|
130
|
+
console.log('prevent Purchasely SDK to navigate to website');
|
|
131
|
+
Purchasely.onProcessAction(false);
|
|
132
|
+
} else if (result.action === Purchasely.PaywallAction.close) {
|
|
133
|
+
console.log('User wants to close paywall');
|
|
134
|
+
Purchasely.onProcessAction(true);
|
|
135
|
+
} else if (result.action === Purchasely.PaywallAction.login) {
|
|
136
|
+
console.log('User wants to login');
|
|
137
|
+
//Present your own screen for user to log in
|
|
138
|
+
Purchasely.closePaywall();
|
|
139
|
+
Purchasely.userLogin('MY_USER_ID');
|
|
140
|
+
//Call this method to update Purchasely Paywall
|
|
141
|
+
Purchasely.onProcessAction(true);
|
|
142
|
+
} else if (result.action === Purchasely.PaywallAction.open_presentation) {
|
|
143
|
+
console.log('User wants to open a new paywall');
|
|
144
|
+
Purchasely.onProcessAction(true);
|
|
145
|
+
} else if (result.action === Purchasely.PaywallAction.purchase) {
|
|
146
|
+
console.log('User wants to purchase');
|
|
147
|
+
//If you want to intercept it, close paywall and display your screen
|
|
148
|
+
Purchasely.closePaywall();
|
|
149
|
+
Purchasely.onProcessAction(true);
|
|
150
|
+
} else if (result.action === Purchasely.PaywallAction.restore) {
|
|
151
|
+
console.log('User wants to restore his purchases');
|
|
152
|
+
Purchasely.onProcessAction(true);
|
|
153
|
+
} else {
|
|
154
|
+
console.log('Action unknown ' + result.action);
|
|
155
|
+
Purchasely.onProcessAction(true);
|
|
156
|
+
}
|
|
109
157
|
});
|
|
110
158
|
}
|
|
111
159
|
|
|
@@ -136,7 +184,7 @@ function purchaseWithPlanVendorId() {
|
|
|
136
184
|
|
|
137
185
|
function processToPayment() {
|
|
138
186
|
// Call this method to process to payment
|
|
139
|
-
Purchasely.
|
|
187
|
+
Purchasely.onProcessAction(true);
|
|
140
188
|
}
|
|
141
189
|
|
|
142
190
|
function restore() {
|
|
@@ -151,6 +199,18 @@ function restore() {
|
|
|
151
199
|
);
|
|
152
200
|
}
|
|
153
201
|
|
|
202
|
+
function silentRestore() {
|
|
203
|
+
Purchasely.silentRestoreAllProducts(
|
|
204
|
+
(plan) => {
|
|
205
|
+
if(plan) console.log("Silent restore " + plan.vendorId);
|
|
206
|
+
else console.log("Nothing to restore");
|
|
207
|
+
},
|
|
208
|
+
(error) => {
|
|
209
|
+
console.log("Silent Restore failed " + error);
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
154
214
|
function openDeeplink() {
|
|
155
215
|
Purchasely.handle(
|
|
156
216
|
"purchasely://ply/presentations/CAROUSEL",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="2.0.0" 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="
|
|
31
|
+
<pod name="Purchasely" spec="3.0.0"/>
|
|
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:
|
|
54
|
+
<framework src="io.purchasely:core:3.0.1" />
|
|
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" />
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
<option name="autoReloadType" value="NONE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="ad0a27bd-64f4-4852-98a1-a7dc8e28a72f" name="Default Changelist" comment=""
|
|
7
|
+
<list default="true" id="ad0a27bd-64f4-4852-98a1-a7dc8e28a72f" name="Default Changelist" comment="">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/../../plugin.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../plugin.xml" afterDir="false" />
|
|
9
|
+
</list>
|
|
8
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
9
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
12
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
13
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
14
|
</component>
|
|
15
|
+
<component name="Git.Settings">
|
|
16
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
|
17
|
+
</component>
|
|
13
18
|
<component name="ProjectId" id="1uz33TZxRidCdjXlE00OtDvw6mD" />
|
|
14
19
|
<component name="ProjectViewState">
|
|
15
20
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
@@ -18,7 +23,9 @@
|
|
|
18
23
|
<component name="PropertiesComponent">
|
|
19
24
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
20
25
|
<property name="android.sdk.path" value="$USER_HOME$/Android/Sdk" />
|
|
26
|
+
<property name="dart.analysis.tool.window.visible" value="false" />
|
|
21
27
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
28
|
+
<property name="show.migrate.to.gradle.popup" value="false" />
|
|
22
29
|
</component>
|
|
23
30
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
24
31
|
<component name="TaskManager">
|
|
@@ -31,4 +38,15 @@
|
|
|
31
38
|
</task>
|
|
32
39
|
<servers />
|
|
33
40
|
</component>
|
|
41
|
+
<component name="Vcs.Log.Tabs.Properties">
|
|
42
|
+
<option name="TAB_STATES">
|
|
43
|
+
<map>
|
|
44
|
+
<entry key="MAIN">
|
|
45
|
+
<value>
|
|
46
|
+
<State />
|
|
47
|
+
</value>
|
|
48
|
+
</entry>
|
|
49
|
+
</map>
|
|
50
|
+
</option>
|
|
51
|
+
</component>
|
|
34
52
|
</project>
|
|
@@ -32,11 +32,16 @@ public class PLYProductActivity extends AppCompatActivity {
|
|
|
32
32
|
|
|
33
33
|
Fragment fragment;
|
|
34
34
|
if(planId != null && !planId.isEmpty()) {
|
|
35
|
-
fragment = Purchasely.planFragment(planId, presentationId, contentId, listener);
|
|
35
|
+
fragment = Purchasely.planFragment(planId, presentationId, contentId, null, listener);
|
|
36
36
|
} else if(productId != null && !productId.isEmpty()) {
|
|
37
|
-
fragment = Purchasely.productFragment(productId, presentationId, contentId, listener);
|
|
37
|
+
fragment = Purchasely.productFragment(productId, presentationId, contentId, null, listener);
|
|
38
38
|
} else {
|
|
39
|
-
fragment = Purchasely.presentationFragment(presentationId, contentId, listener);
|
|
39
|
+
fragment = Purchasely.presentationFragment(presentationId, contentId, null, listener);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if(fragment == null) {
|
|
43
|
+
supportFinishAfterTransition();
|
|
44
|
+
return;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
getSupportFragmentManager().beginTransaction()
|
|
@@ -5,6 +5,9 @@ import android.content.Intent;
|
|
|
5
5
|
import android.net.Uri;
|
|
6
6
|
import android.util.Log;
|
|
7
7
|
|
|
8
|
+
import androidx.annotation.NonNull;
|
|
9
|
+
import androidx.fragment.app.FragmentActivity;
|
|
10
|
+
|
|
8
11
|
import org.apache.cordova.CallbackContext;
|
|
9
12
|
import org.apache.cordova.CordovaInterface;
|
|
10
13
|
import org.apache.cordova.CordovaPlugin;
|
|
@@ -14,21 +17,27 @@ import org.jetbrains.annotations.Nullable;
|
|
|
14
17
|
import org.json.JSONArray;
|
|
15
18
|
import org.json.JSONException;
|
|
16
19
|
import org.json.JSONObject;
|
|
20
|
+
import org.w3c.dom.Attr;
|
|
17
21
|
|
|
18
22
|
import java.lang.ref.WeakReference;
|
|
19
23
|
import java.util.ArrayList;
|
|
20
24
|
import java.util.HashMap;
|
|
25
|
+
import java.util.Iterator;
|
|
21
26
|
import java.util.List;
|
|
27
|
+
import java.util.Locale;
|
|
22
28
|
import java.util.Map;
|
|
29
|
+
import java.util.function.BiConsumer;
|
|
23
30
|
|
|
24
31
|
import io.purchasely.billing.Store;
|
|
25
32
|
import io.purchasely.ext.Attribute;
|
|
26
|
-
import io.purchasely.ext.ContinuePurchaseListener;
|
|
27
33
|
import io.purchasely.ext.DistributionType;
|
|
28
34
|
import io.purchasely.ext.LogLevel;
|
|
29
|
-
import io.purchasely.ext.LoginClosedListener;
|
|
30
35
|
import io.purchasely.ext.PLYAppTechnology;
|
|
36
|
+
import io.purchasely.ext.PLYPaywallActionListener;
|
|
37
|
+
import io.purchasely.ext.PLYPresentationAction;
|
|
38
|
+
import io.purchasely.ext.PLYProcessActionListener;
|
|
31
39
|
import io.purchasely.ext.PLYProductViewResult;
|
|
40
|
+
import io.purchasely.ext.PLYRunningMode;
|
|
32
41
|
import io.purchasely.ext.PlanListener;
|
|
33
42
|
import io.purchasely.ext.ProductListener;
|
|
34
43
|
import io.purchasely.ext.ProductsListener;
|
|
@@ -50,8 +59,13 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
50
59
|
static CallbackContext eventsCallback = null;
|
|
51
60
|
static ProductActivity productActivity = null;
|
|
52
61
|
|
|
53
|
-
private
|
|
54
|
-
|
|
62
|
+
private PLYProcessActionListener processActionListener;
|
|
63
|
+
|
|
64
|
+
private static int runningModeTransactionOnly = 0;
|
|
65
|
+
private static int runningModeObserver = 1;
|
|
66
|
+
private static int runningModePaywallOnly = 2;
|
|
67
|
+
private static int runningModePaywallObserver = 3;
|
|
68
|
+
private static int runningModeFull = 4;
|
|
55
69
|
|
|
56
70
|
@Override
|
|
57
71
|
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
|
@@ -63,7 +77,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
63
77
|
args.getJSONArray(1),
|
|
64
78
|
args.getString(2),
|
|
65
79
|
args.getInt(3),
|
|
66
|
-
args.
|
|
80
|
+
args.getInt(4),
|
|
67
81
|
callbackContext);
|
|
68
82
|
break;
|
|
69
83
|
case "close":
|
|
@@ -84,6 +98,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
84
98
|
case "userLogout":
|
|
85
99
|
userLogout();
|
|
86
100
|
break;
|
|
101
|
+
case "setLanguage":
|
|
102
|
+
setLanguage(args.getString(0));
|
|
103
|
+
break;
|
|
87
104
|
case "setLogLevel":
|
|
88
105
|
setLogLevel(args.getInt(0));
|
|
89
106
|
break;
|
|
@@ -131,6 +148,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
131
148
|
case "restoreAllProducts":
|
|
132
149
|
restoreAllProducts(callbackContext);
|
|
133
150
|
break;
|
|
151
|
+
case "silentRestoreAllProducts":
|
|
152
|
+
restoreAllProducts(callbackContext);
|
|
153
|
+
break;
|
|
134
154
|
case "userSubscriptions":
|
|
135
155
|
userSubscriptions(callbackContext);
|
|
136
156
|
break;
|
|
@@ -153,17 +173,14 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
153
173
|
callbackContext
|
|
154
174
|
);
|
|
155
175
|
break;
|
|
156
|
-
case "
|
|
157
|
-
|
|
176
|
+
case "setPaywallActionInterceptor":
|
|
177
|
+
setPaywallActionInterceptor(callbackContext);
|
|
158
178
|
break;
|
|
159
|
-
case "
|
|
160
|
-
|
|
179
|
+
case "onProcessAction":
|
|
180
|
+
onProcessAction(args.getBoolean(0));
|
|
161
181
|
break;
|
|
162
|
-
case "
|
|
163
|
-
|
|
164
|
-
break;
|
|
165
|
-
case "processToPayment":
|
|
166
|
-
processToPayment(args.getBoolean(0));
|
|
182
|
+
case "closePaywall":
|
|
183
|
+
closePaywall(callbackContext);
|
|
167
184
|
break;
|
|
168
185
|
default:
|
|
169
186
|
return false;
|
|
@@ -203,7 +220,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
203
220
|
JSONArray stores,
|
|
204
221
|
String userId,
|
|
205
222
|
int logLevel,
|
|
206
|
-
|
|
223
|
+
int runningMode,
|
|
207
224
|
CallbackContext callbackContext) {
|
|
208
225
|
ArrayList<String> list = new ArrayList<>();
|
|
209
226
|
for (int i=0; i< stores.length(); i++) {
|
|
@@ -215,11 +232,17 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
215
232
|
}
|
|
216
233
|
ArrayList<Store> storesInstances = getStoresInstances(list);
|
|
217
234
|
|
|
235
|
+
PLYRunningMode plyRunningMode = PLYRunningMode.Full.INSTANCE;
|
|
236
|
+
if(runningMode == runningModeTransactionOnly) plyRunningMode = PLYRunningMode.TransactionOnly.INSTANCE;
|
|
237
|
+
else if(runningMode == runningModeObserver) plyRunningMode = PLYRunningMode.Observer.INSTANCE;
|
|
238
|
+
else if(runningMode == runningModePaywallOnly) plyRunningMode = PLYRunningMode.PaywallOnly.INSTANCE;
|
|
239
|
+
else if(runningMode == runningModePaywallObserver) plyRunningMode = PLYRunningMode.PaywallObserver.INSTANCE;
|
|
240
|
+
|
|
218
241
|
new Purchasely.Builder(cordova.getContext())
|
|
219
242
|
.apiKey(apiKey)
|
|
220
243
|
.stores(storesInstances)
|
|
221
244
|
.userId(userId)
|
|
222
|
-
.
|
|
245
|
+
.runningMode(plyRunningMode)
|
|
223
246
|
.logLevel(LogLevel.values()[logLevel])
|
|
224
247
|
.build();
|
|
225
248
|
|
|
@@ -267,8 +290,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
267
290
|
private void close() {
|
|
268
291
|
defaultCallback = null;
|
|
269
292
|
presentationCallback = null;
|
|
270
|
-
|
|
271
|
-
continuePurchaseListener = null;
|
|
293
|
+
processActionListener = null;
|
|
272
294
|
productActivity = null;
|
|
273
295
|
Purchasely.close();
|
|
274
296
|
}
|
|
@@ -318,6 +340,14 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
318
340
|
Purchasely.setLogLevel(LogLevel.values()[logLevel]);
|
|
319
341
|
}
|
|
320
342
|
|
|
343
|
+
private void setLanguage(String language) {
|
|
344
|
+
try {
|
|
345
|
+
Purchasely.setLanguage(new Locale(language));
|
|
346
|
+
} catch (Exception e) {
|
|
347
|
+
Purchasely.setLanguage(Locale.getDefault());
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
321
351
|
private void isReadyToPurchase(boolean isReadyToPurchase) {
|
|
322
352
|
Purchasely.setReadyToPurchase(isReadyToPurchase);
|
|
323
353
|
}
|
|
@@ -453,7 +483,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
453
483
|
}
|
|
454
484
|
|
|
455
485
|
private void productWithIdentifier(String vendorId, CallbackContext callbackContext) {
|
|
456
|
-
Purchasely.
|
|
486
|
+
Purchasely.product(vendorId, new ProductListener() {
|
|
457
487
|
@Override
|
|
458
488
|
public void onSuccess(@Nullable PLYProduct plyProduct) {
|
|
459
489
|
if(plyProduct != null) {
|
|
@@ -471,7 +501,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
471
501
|
}
|
|
472
502
|
|
|
473
503
|
private void planWithIdentifier(String vendorId, CallbackContext callbackContext) {
|
|
474
|
-
Purchasely.
|
|
504
|
+
Purchasely.plan(vendorId, new PlanListener() {
|
|
475
505
|
@Override
|
|
476
506
|
public void onSuccess(@Nullable PLYPlan plyPlan) {
|
|
477
507
|
if(plyPlan != null) {
|
|
@@ -489,7 +519,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
489
519
|
}
|
|
490
520
|
|
|
491
521
|
private void purchaseWithPlanVendorId(String planVendorId, String contentId, CallbackContext callbackContext) {
|
|
492
|
-
Purchasely.
|
|
522
|
+
Purchasely.plan(planVendorId, new PlanListener() {
|
|
493
523
|
@Override
|
|
494
524
|
public void onSuccess(@Nullable PLYPlan plyPlan) {
|
|
495
525
|
if(plyPlan != null) {
|
|
@@ -512,53 +542,57 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
512
542
|
});
|
|
513
543
|
}
|
|
514
544
|
|
|
515
|
-
private void
|
|
516
|
-
Purchasely.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
520
|
-
cordova.getActivity().startActivity(intent);
|
|
545
|
+
private void setPaywallActionInterceptor(CallbackContext callbackContext) {
|
|
546
|
+
Purchasely.setPaywallActionsInterceptor(
|
|
547
|
+
(info, plyPresentationAction, map, plyProcessActionListener) -> {
|
|
548
|
+
processActionListener = plyProcessActionListener;
|
|
521
549
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
550
|
+
HashMap<String, Object> parametersForCordova = new HashMap<>();
|
|
551
|
+
parametersForCordova.put("title", map.getTitle());
|
|
552
|
+
parametersForCordova.put("url", map.getUrl());
|
|
553
|
+
parametersForCordova.put("plan", transformPlanToMap(map.getPlan()));
|
|
554
|
+
parametersForCordova.put("presentation", map.getPresentation());
|
|
527
555
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if(
|
|
531
|
-
cordova.getActivity().runOnUiThread(() -> loginClosedListener.userLoggedIn(userLoggedIn));
|
|
532
|
-
}
|
|
533
|
-
}
|
|
556
|
+
HashMap<String, Object> infoMap = new HashMap<>();
|
|
557
|
+
if(info.getContentId() != null) infoMap.put("contentId", info.getContentId());
|
|
558
|
+
if(info.getPresentationId() != null) infoMap.put("presentationId", info.getPresentationId());
|
|
534
559
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
540
|
-
cordova.getActivity().startActivity(intent);
|
|
560
|
+
HashMap<String, Object> resultForCordova = new HashMap<>();
|
|
561
|
+
resultForCordova.put("info", infoMap);
|
|
562
|
+
resultForCordova.put("action", plyPresentationAction.getValue());
|
|
563
|
+
resultForCordova.put("parameters", parametersForCordova);
|
|
541
564
|
|
|
542
|
-
PluginResult result = new PluginResult(
|
|
565
|
+
PluginResult result = new PluginResult(
|
|
566
|
+
PluginResult.Status.OK,
|
|
567
|
+
new JSONObject(resultForCordova)
|
|
568
|
+
);
|
|
543
569
|
result.setKeepCallback(true);
|
|
544
570
|
callbackContext.sendPluginResult(result);
|
|
545
571
|
});
|
|
546
572
|
}
|
|
547
573
|
|
|
548
|
-
private void
|
|
549
|
-
|
|
574
|
+
private void closePaywall(CallbackContext callbackContext) {
|
|
575
|
+
Activity purchaselyActivity = productActivity.activity.get();
|
|
576
|
+
Activity activity = purchaselyActivity != null ? purchaselyActivity : cordova.getActivity();
|
|
577
|
+
Intent intent = new Intent(activity, cordova.getActivity().getClass());
|
|
578
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
579
|
+
cordova.getActivity().startActivity(intent);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
private void onProcessAction(boolean processAction) {
|
|
583
|
+
if(processActionListener != null) {
|
|
550
584
|
if(productActivity != null) {
|
|
551
585
|
boolean softRelaunched = productActivity.relaunch(cordova);
|
|
552
586
|
if(softRelaunched) {
|
|
553
|
-
cordova.getActivity().runOnUiThread(() ->
|
|
587
|
+
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
554
588
|
} else {
|
|
555
589
|
new Thread(() -> {
|
|
556
590
|
try {
|
|
557
591
|
Thread.sleep(500);
|
|
558
592
|
} catch (InterruptedException e) {
|
|
559
|
-
Log.e("Purchasely", "process
|
|
593
|
+
Log.e("Purchasely", "process action error", e);
|
|
560
594
|
} finally {
|
|
561
|
-
cordova.getActivity().runOnUiThread(() ->
|
|
595
|
+
cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
|
|
562
596
|
}
|
|
563
597
|
}).start();
|
|
564
598
|
}
|
package/src/ios/CDVPurchasely.h
CHANGED
|
@@ -11,16 +11,13 @@
|
|
|
11
11
|
@interface CDVPurchasely<PLYEventDelegate> : CDVPlugin {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
@property (nonatomic,
|
|
14
|
+
@property (nonatomic, assign) UIViewController* presentedPresentationViewController;
|
|
15
15
|
|
|
16
16
|
@property CDVInvokedUrlCommand* purchasedCommand;
|
|
17
17
|
@property CDVInvokedUrlCommand* eventCommand;
|
|
18
18
|
|
|
19
|
-
@property CDVInvokedUrlCommand*
|
|
20
|
-
@property void (^
|
|
21
|
-
|
|
22
|
-
@property CDVInvokedUrlCommand* authorizePurchaseCommand;
|
|
23
|
-
@property void (^authorizePurchaseHandler)(BOOL authorizePurchase);
|
|
19
|
+
@property CDVInvokedUrlCommand* paywallActionInterceptorCommand;
|
|
20
|
+
@property void (^onProcessActionHandler)(BOOL proceed);
|
|
24
21
|
|
|
25
22
|
- (void)startWithAPIKey:(CDVInvokedUrlCommand*)command;
|
|
26
23
|
- (void)setLogLevel:(CDVInvokedUrlCommand*)command;
|
|
@@ -36,6 +33,7 @@
|
|
|
36
33
|
- (void)presentSubscriptions:(CDVInvokedUrlCommand*)command;
|
|
37
34
|
- (void)purchaseWithPlanVendorId:(CDVInvokedUrlCommand*)command;
|
|
38
35
|
- (void)restoreAllProducts:(CDVInvokedUrlCommand*)command;
|
|
36
|
+
- (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command;
|
|
39
37
|
- (void)purchasedSubscription:(CDVInvokedUrlCommand*)command;
|
|
40
38
|
- (void)allProducts:(CDVInvokedUrlCommand*)command;
|
|
41
39
|
- (void)productWithIdentifier:(CDVInvokedUrlCommand*)command;
|
|
@@ -45,10 +43,8 @@
|
|
|
45
43
|
- (void)removeEventsListener:(CDVInvokedUrlCommand*)command;
|
|
46
44
|
- (void)handle:(CDVInvokedUrlCommand*)command;
|
|
47
45
|
- (void)close:(CDVInvokedUrlCommand*)command;
|
|
48
|
-
- (void)
|
|
49
|
-
- (void)
|
|
50
|
-
- (void)
|
|
51
|
-
- (void)processToPayment:(CDVInvokedUrlCommand*)command;
|
|
52
|
-
|
|
46
|
+
- (void)setPaywallActionInterceptor:(CDVInvokedUrlCommand*)command;
|
|
47
|
+
- (void)onProcessAction:(CDVInvokedUrlCommand*)command;
|
|
48
|
+
- (void)closePaywall:(CDVInvokedUrlCommand*)command;
|
|
53
49
|
|
|
54
50
|
@end
|
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
NSString *apiKey = [command argumentAtIndex:0];
|
|
16
16
|
NSString *userId = [command argumentAtIndex:2];
|
|
17
17
|
NSInteger logLevel = [[command argumentAtIndex:3] intValue];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
NSInteger runningMode = [[command argumentAtIndex:4] intValue];
|
|
19
|
+
|
|
20
|
+
[Purchasely startWithAPIKey:apiKey appUserId:userId runningMode:runningMode eventDelegate:nil uiDelegate:nil paywallActionsInterceptor:nil logLevel:logLevel initialized:^(BOOL initialized, NSError * _Nullable error) {
|
|
21
|
+
if (error != nil) {
|
|
22
|
+
[self failureFor:command resultString: error.localizedDescription];
|
|
23
|
+
} else {
|
|
24
|
+
[self successFor:command resultBool:initialized];
|
|
25
|
+
}
|
|
26
|
+
}];
|
|
27
27
|
[Purchasely setAppTechnology:PLYAppTechnologyCordova];
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -73,60 +73,66 @@
|
|
|
73
73
|
- (void)presentPresentationWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
74
74
|
NSString *presentationVendorId = [command argumentAtIndex:0];
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
UIViewController *ctrl = [Purchasely presentationControllerWith:presentationVendorId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
77
|
+
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
78
|
+
[self successFor:command resultDict:resultDict];
|
|
79
|
+
}];
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
if (ctrl != nil) {
|
|
82
|
+
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
83
|
+
[navCtrl.navigationBar setTranslucent:YES];
|
|
84
|
+
[navCtrl.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
|
85
|
+
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
86
|
+
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
self.presentedPresentationViewController = navCtrl;
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
91
|
+
}
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
- (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
93
95
|
NSString *planVendorId = [command argumentAtIndex:0];
|
|
94
96
|
NSString *presentationVendorId = [command argumentAtIndex:1];
|
|
95
97
|
|
|
96
|
-
UIViewController *ctrl = [Purchasely planControllerFor:planVendorId with:presentationVendorId completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
98
|
+
UIViewController *ctrl = [Purchasely planControllerFor:planVendorId with:presentationVendorId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
97
99
|
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
98
100
|
[self successFor:command resultDict:resultDict];
|
|
99
101
|
}];
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
if (ctrl != nil) {
|
|
104
|
+
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
105
|
+
[navCtrl.navigationBar setTranslucent:YES];
|
|
106
|
+
[navCtrl.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
|
107
|
+
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
108
|
+
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
109
|
+
|
|
110
|
+
self.presentedPresentationViewController = navCtrl;
|
|
111
|
+
|
|
112
|
+
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
- (void)presentProductWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
113
117
|
NSString *productVendorId = [command argumentAtIndex:0];
|
|
114
118
|
NSString *presentationVendorId = [command argumentAtIndex:1];
|
|
115
119
|
|
|
116
|
-
|
|
120
|
+
UIViewController *ctrl = [Purchasely productControllerFor:productVendorId with:presentationVendorId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
117
121
|
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
118
122
|
[self successFor:command resultDict:resultDict];
|
|
119
123
|
}];
|
|
120
124
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
if (ctrl != nil) {
|
|
126
|
+
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
127
|
+
[navCtrl.navigationBar setTranslucent:YES];
|
|
128
|
+
[navCtrl.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
|
129
|
+
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
130
|
+
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
131
|
+
|
|
132
|
+
self.presentedPresentationViewController = navCtrl;
|
|
133
|
+
|
|
134
|
+
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
135
|
+
}
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
- (void)presentSubscriptions:(CDVInvokedUrlCommand*)command {
|
|
@@ -163,6 +169,14 @@
|
|
|
163
169
|
}];
|
|
164
170
|
}
|
|
165
171
|
|
|
172
|
+
- (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command {
|
|
173
|
+
[Purchasely silentRestoreAllProductsWithSuccess:^{
|
|
174
|
+
[self successFor:command];
|
|
175
|
+
} failure:^(NSError * _Nonnull error) {
|
|
176
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
177
|
+
}];
|
|
178
|
+
}
|
|
179
|
+
|
|
166
180
|
- (void)purchasedSubscription:(CDVInvokedUrlCommand*)command {
|
|
167
181
|
self.purchasedCommand = command;
|
|
168
182
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
@@ -249,44 +263,10 @@
|
|
|
249
263
|
- (void)close:(CDVInvokedUrlCommand*)command {
|
|
250
264
|
}
|
|
251
265
|
|
|
252
|
-
- (void)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
[self.presentedPresentationViewController dismissViewControllerAnimated:true completion:^{
|
|
258
|
-
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
259
|
-
[result setKeepCallbackAsBool:YES];
|
|
260
|
-
[self.commandDelegate sendPluginResult:result callbackId:self.loginTappedCommand.callbackId];
|
|
261
|
-
}];
|
|
262
|
-
}];
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
- (void)onUserLoggedIn:(CDVInvokedUrlCommand*)command {
|
|
266
|
-
BOOL userDidLogin = [[command argumentAtIndex:0] boolValue];
|
|
267
|
-
|
|
268
|
-
[Purchasely showController:self.presentedPresentationViewController type: PLYUIControllerTypeProductPage];
|
|
269
|
-
self.loginClosedHandler(userDidLogin);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
- (void)setConfirmPurchaseHandler:(CDVInvokedUrlCommand*)command {
|
|
273
|
-
self.authorizePurchaseCommand = command;
|
|
274
|
-
[Purchasely setConfirmPurchaseHandler:^(UIViewController * _Nonnull controller, void (^ _Nonnull authorizePurchaseHandler)(BOOL)) {
|
|
275
|
-
self.authorizePurchaseHandler = authorizePurchaseHandler;
|
|
276
|
-
|
|
277
|
-
[self.presentedPresentationViewController dismissViewControllerAnimated:true completion:^{
|
|
278
|
-
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
279
|
-
[result setKeepCallbackAsBool:YES];
|
|
280
|
-
[self.commandDelegate sendPluginResult:result callbackId:self.authorizePurchaseCommand.callbackId];
|
|
281
|
-
}];
|
|
282
|
-
}];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
- (void)processToPayment:(CDVInvokedUrlCommand*)command {
|
|
286
|
-
BOOL processToPayment = [[command argumentAtIndex:0] boolValue];
|
|
287
|
-
|
|
288
|
-
[Purchasely showController:self.presentedPresentationViewController type: PLYUIControllerTypeProductPage];
|
|
289
|
-
self.authorizePurchaseHandler(processToPayment);
|
|
266
|
+
- (void)setLanguage:(CDVInvokedUrlCommand*)command {
|
|
267
|
+
NSString *language = [command argumentAtIndex:0];
|
|
268
|
+
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:language];
|
|
269
|
+
[Purchasely setLanguageFrom:locale];
|
|
290
270
|
}
|
|
291
271
|
|
|
292
272
|
// Helpers
|
|
@@ -315,6 +295,99 @@
|
|
|
315
295
|
return productViewResult;
|
|
316
296
|
}
|
|
317
297
|
|
|
298
|
+
- (NSDictionary<NSString *, NSObject *> *) resultDictionaryForActionInterceptor:(PLYPresentationAction) action
|
|
299
|
+
parameters: (PLYPresentationActionParameters * _Nullable) params
|
|
300
|
+
presentationInfos: (PLYPresentationInfo * _Nullable) infos {
|
|
301
|
+
NSMutableDictionary<NSString *, NSObject *> *actionInterceptorResult = [NSMutableDictionary new];
|
|
302
|
+
|
|
303
|
+
NSString* actionString;
|
|
304
|
+
|
|
305
|
+
switch (action) {
|
|
306
|
+
case PLYPresentationActionLogin:
|
|
307
|
+
actionString = @"login";
|
|
308
|
+
break;
|
|
309
|
+
case PLYPresentationActionPurchase:
|
|
310
|
+
actionString = @"purchase";
|
|
311
|
+
break;
|
|
312
|
+
case PLYPresentationActionClose:
|
|
313
|
+
actionString = @"close";
|
|
314
|
+
break;
|
|
315
|
+
case PLYPresentationActionRestore:
|
|
316
|
+
actionString = @"restore";
|
|
317
|
+
break;
|
|
318
|
+
case PLYPresentationActionNavigate:
|
|
319
|
+
actionString = @"navigate";
|
|
320
|
+
break;
|
|
321
|
+
case PLYPresentationActionPromoCode:
|
|
322
|
+
actionString = @"promo_code";
|
|
323
|
+
break;
|
|
324
|
+
case PLYPresentationActionOpenPresentation:
|
|
325
|
+
actionString = @"open_presentation";
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
[actionInterceptorResult setObject:actionString forKey:@"action"];
|
|
330
|
+
|
|
331
|
+
if (infos != nil) {
|
|
332
|
+
NSMutableDictionary<NSString *, NSObject *> *infosResult = [NSMutableDictionary new];
|
|
333
|
+
if (infos.contentId != nil) {
|
|
334
|
+
[infosResult setObject:infos.contentId forKey:@"contentId"];
|
|
335
|
+
}
|
|
336
|
+
if (infos.presentationId != nil) {
|
|
337
|
+
[infosResult setObject:infos.presentationId forKey:@"presentationId"];
|
|
338
|
+
}
|
|
339
|
+
[actionInterceptorResult setObject:infosResult forKey:@"info"];
|
|
340
|
+
}
|
|
341
|
+
if (params != nil) {
|
|
342
|
+
NSMutableDictionary<NSString *, NSObject *> *paramsResult = [NSMutableDictionary new];
|
|
343
|
+
if (params.url != nil) {
|
|
344
|
+
[paramsResult setObject:params.url.absoluteString forKey:@"url"];
|
|
345
|
+
}
|
|
346
|
+
if (params.plan != nil) {
|
|
347
|
+
[paramsResult setObject:[params.plan asDictionary] forKey:@"plan"];
|
|
348
|
+
}
|
|
349
|
+
if (params.title != nil) {
|
|
350
|
+
[paramsResult setObject:params.title forKey:@"title"];
|
|
351
|
+
}
|
|
352
|
+
if (params.presentation != nil) {
|
|
353
|
+
[paramsResult setObject:params.presentation forKey:@"presentation"];
|
|
354
|
+
}
|
|
355
|
+
[actionInterceptorResult setObject:paramsResult forKey:@"parameters"];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return actionInterceptorResult;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
- (void)setPaywallActionInterceptor:(CDVInvokedUrlCommand*)command {
|
|
362
|
+
self.paywallActionInterceptorCommand = command;
|
|
363
|
+
[Purchasely setPaywallActionsInterceptor:^(enum PLYPresentationAction action, PLYPresentationActionParameters * _Nullable parameters, PLYPresentationInfo * _Nullable infos, void (^ _Nonnull onProcessActionHandler)(BOOL)) {
|
|
364
|
+
self.onProcessActionHandler = onProcessActionHandler;
|
|
365
|
+
NSDictionary *resultDict = [self resultDictionaryForActionInterceptor:action parameters:parameters presentationInfos:infos];
|
|
366
|
+
|
|
367
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
|
|
368
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
369
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.paywallActionInterceptorCommand.callbackId];
|
|
370
|
+
|
|
371
|
+
}];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
- (void)onProcessAction:(CDVInvokedUrlCommand*)command {
|
|
375
|
+
BOOL processAction = [[command argumentAtIndex:0] boolValue];
|
|
376
|
+
if (self.onProcessActionHandler != nil) {
|
|
377
|
+
self.onProcessActionHandler(processAction);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
- (void)closePaywall:(CDVInvokedUrlCommand*)command {
|
|
382
|
+
if (self.presentedPresentationViewController != nil) {
|
|
383
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
384
|
+
[self.presentedPresentationViewController dismissViewControllerAnimated:true completion:^{
|
|
385
|
+
self.presentedPresentationViewController = nil;
|
|
386
|
+
}];
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
318
391
|
- (void)successFor:(CDVInvokedUrlCommand *)command {
|
|
319
392
|
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
320
393
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
[dict setObject:self.name forKey:@"name"];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
if (self.appleProductId != nil) {
|
|
29
|
+
[dict setObject:self.appleProductId forKey:@"appleProductId"];
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
NSString *price = [self localizedFullPriceWithLanguage:nil];
|
|
29
33
|
if (price != nil) {
|
|
30
34
|
[dict setObject:price forKey:@"price"];
|
package/www/Purchasely.js
CHANGED
|
@@ -2,8 +2,8 @@ var exec = require('cordova/exec');
|
|
|
2
2
|
|
|
3
3
|
var defaultError = (e) => { console.log(e); }
|
|
4
4
|
|
|
5
|
-
exports.startWithAPIKey = function (apiKey, stores, userId, logLevel,
|
|
6
|
-
exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel,
|
|
5
|
+
exports.startWithAPIKey = function (apiKey, stores, userId, logLevel, runningMode, success, error) {
|
|
6
|
+
exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel, runningMode]);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
exports.addEventsListener = function (success, error) {
|
|
@@ -86,6 +86,10 @@ exports.restoreAllProducts = function (success, error) {
|
|
|
86
86
|
exec(success, error, 'Purchasely', 'restoreAllProducts', []);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
exports.silentRestoreAllProducts = function (success, error) {
|
|
90
|
+
exec(success, error, 'Purchasely', 'silentRestoreAllProducts', []);
|
|
91
|
+
};
|
|
92
|
+
|
|
89
93
|
exports.purchasedSubscription = function (success, error) {
|
|
90
94
|
exec(success, error, 'Purchasely', 'purchasedSubscription', []);
|
|
91
95
|
};
|
|
@@ -106,26 +110,26 @@ exports.productWithIdentifier = function (productId, success) {
|
|
|
106
110
|
exec(success, defaultError, 'Purchasely', 'productWithIdentifier', [productId]);
|
|
107
111
|
};
|
|
108
112
|
|
|
109
|
-
exports.
|
|
110
|
-
exec(success, defaultError, 'Purchasely', '
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
exports.onUserLoggedIn = function (userLoggedIn) {
|
|
114
|
-
exec(() => {}, defaultError, 'Purchasely', 'onUserLoggedIn', [userLoggedIn]);
|
|
113
|
+
exports.setPaywallActionInterceptor = function (success) {
|
|
114
|
+
exec(success, defaultError, 'Purchasely', 'setPaywallActionInterceptor', []);
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
exports.
|
|
118
|
-
exec(
|
|
117
|
+
exports.onProcessAction = function (processAction) {
|
|
118
|
+
exec(() => {}, defaultError, 'Purchasely', 'onProcessAction', [processAction]);
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
exports.
|
|
122
|
-
exec(() => {}, defaultError, 'Purchasely', '
|
|
121
|
+
exports.closePaywall = function () {
|
|
122
|
+
exec(() => {}, defaultError, 'Purchasely', 'closePaywall', []);
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
exports.userSubscriptions = function (success, error) {
|
|
126
126
|
exec(success, defaultError, 'Purchasely', 'userSubscriptions', []);
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
exports.setLanguage = function (language) {
|
|
130
|
+
exec(() => {}, defaultError, 'Purchasely', 'setLanguage', [language]);
|
|
131
|
+
};
|
|
132
|
+
|
|
129
133
|
exports.LogLevel = {
|
|
130
134
|
DEBUG: 0,
|
|
131
135
|
INFO: 1,
|
|
@@ -136,7 +140,8 @@ exports.LogLevel = {
|
|
|
136
140
|
exports.Attribute = {
|
|
137
141
|
AMPLITUDE_SESSION_ID: 0,
|
|
138
142
|
FIREBASE_APP_INSTANCE_ID: 1,
|
|
139
|
-
AIRSHIP_CHANNEL_ID: 2
|
|
143
|
+
AIRSHIP_CHANNEL_ID: 2,
|
|
144
|
+
BATCH_INSTALLATION_ID: 3
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
exports.PurchaseResult = {
|
|
@@ -160,3 +165,22 @@ exports.PlanType = {
|
|
|
160
165
|
nonRenewingSubscription: 3,
|
|
161
166
|
unknown: 4
|
|
162
167
|
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
exports.RunningMode = {
|
|
171
|
+
transactionOnly: 0,
|
|
172
|
+
observer: 1,
|
|
173
|
+
paywallOnly: 2,
|
|
174
|
+
paywallObserver: 3,
|
|
175
|
+
full: 4
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
exports.PaywallAction = {
|
|
179
|
+
close: 'close',
|
|
180
|
+
login: 'login',
|
|
181
|
+
navigate: 'navigate',
|
|
182
|
+
purchase: 'purchase',
|
|
183
|
+
restore: 'restore',
|
|
184
|
+
open_presentation: 'open_presentation',
|
|
185
|
+
promo_code: 'promo_code',
|
|
186
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="RunConfigurationProducerService">
|
|
4
|
-
<option name="ignoredProducers">
|
|
5
|
-
<set>
|
|
6
|
-
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
|
7
|
-
</set>
|
|
8
|
-
</option>
|
|
9
|
-
</component>
|
|
10
|
-
</project>
|