@purchasely/cordova-plugin-purchasely 2.1.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSIONS.md +4 -1
- package/example/config.xml +1 -1
- package/example/package-lock.json +50 -81
- package/example/package.json +1 -4
- package/example/www/js/index.js +4 -4
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/PLYProductActivity.java +1 -0
- package/src/android/PurchaselyPlugin.java +8 -0
- package/src/ios/CDVPurchasely.m +167 -157
- package/src/ios/Hybrid/PLYSubscription+Hybrid.m +6 -2
- package/www/Purchasely.js +11 -2
package/VERSIONS.md
CHANGED
|
@@ -17,4 +17,7 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
|
|
|
17
17
|
| 2.0.0 | 3.0.0 | 3.0.1 |
|
|
18
18
|
| 2.0.1 | 3.0.0 | 3.0.1 |
|
|
19
19
|
| 2.1.0 | 3.1.0 | 3.1.0 |
|
|
20
|
-
| 2.1.1 | 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 |
|
|
23
|
+
| 2.2.2 | 3.2.2 | 3.2.2 |
|
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,16 +9,14 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
13
12
|
"cordova-android": "^10.1.0",
|
|
14
13
|
"cordova-ios": "^6.2.0",
|
|
15
|
-
"cordova-plugin-purchasely": "file:.."
|
|
16
|
-
"cordova-plugin-whitelist": "^1.3.5"
|
|
14
|
+
"cordova-plugin-purchasely": "file:.."
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"..": {
|
|
20
18
|
"name": "cordova-plugin-purchasely",
|
|
21
|
-
"version": "2.
|
|
19
|
+
"version": "2.2.1",
|
|
22
20
|
"dev": true,
|
|
23
21
|
"license": "ISC"
|
|
24
22
|
},
|
|
@@ -68,10 +66,6 @@
|
|
|
68
66
|
"node": ">= 8"
|
|
69
67
|
}
|
|
70
68
|
},
|
|
71
|
-
"node_modules/@purchasely/cordova-plugin-purchasely": {
|
|
72
|
-
"resolved": "..",
|
|
73
|
-
"link": true
|
|
74
|
-
},
|
|
75
69
|
"node_modules/abbrev": {
|
|
76
70
|
"version": "1.1.1",
|
|
77
71
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
|
@@ -227,9 +221,9 @@
|
|
|
227
221
|
}
|
|
228
222
|
},
|
|
229
223
|
"node_modules/cordova-android/node_modules/fs-extra": {
|
|
230
|
-
"version": "10.0.
|
|
231
|
-
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.
|
|
232
|
-
"integrity": "sha512-
|
|
224
|
+
"version": "10.0.1",
|
|
225
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
|
|
226
|
+
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
|
|
233
227
|
"dev": true,
|
|
234
228
|
"dependencies": {
|
|
235
229
|
"graceful-fs": "^4.2.0",
|
|
@@ -290,22 +284,6 @@
|
|
|
290
284
|
"resolved": "..",
|
|
291
285
|
"link": true
|
|
292
286
|
},
|
|
293
|
-
"node_modules/cordova-plugin-whitelist": {
|
|
294
|
-
"version": "1.3.5",
|
|
295
|
-
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
|
|
296
|
-
"integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA==",
|
|
297
|
-
"dev": true,
|
|
298
|
-
"engines": {
|
|
299
|
-
"cordovaDependencies": {
|
|
300
|
-
"0.0.0": {
|
|
301
|
-
"cordova-android": ">=4.0.0"
|
|
302
|
-
},
|
|
303
|
-
"1.3.5": {
|
|
304
|
-
"cordova-android": ">=4.0.0 <10.0.0"
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
287
|
"node_modules/cross-spawn": {
|
|
310
288
|
"version": "7.0.3",
|
|
311
289
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
|
@@ -568,7 +546,7 @@
|
|
|
568
546
|
"node_modules/ios-sim/node_modules/bplist-parser": {
|
|
569
547
|
"version": "0.0.6",
|
|
570
548
|
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
|
|
571
|
-
"integrity": "
|
|
549
|
+
"integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
|
|
572
550
|
"dev": true
|
|
573
551
|
},
|
|
574
552
|
"node_modules/ios-sim/node_modules/nopt": {
|
|
@@ -587,9 +565,9 @@
|
|
|
587
565
|
}
|
|
588
566
|
},
|
|
589
567
|
"node_modules/is-core-module": {
|
|
590
|
-
"version": "2.
|
|
591
|
-
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.
|
|
592
|
-
"integrity": "sha512
|
|
568
|
+
"version": "2.9.0",
|
|
569
|
+
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
|
|
570
|
+
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
|
|
593
571
|
"dev": true,
|
|
594
572
|
"dependencies": {
|
|
595
573
|
"has": "^1.0.3"
|
|
@@ -855,9 +833,9 @@
|
|
|
855
833
|
}
|
|
856
834
|
},
|
|
857
835
|
"node_modules/plist": {
|
|
858
|
-
"version": "3.0.
|
|
859
|
-
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.
|
|
860
|
-
"integrity": "sha512-
|
|
836
|
+
"version": "3.0.5",
|
|
837
|
+
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz",
|
|
838
|
+
"integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==",
|
|
861
839
|
"dev": true,
|
|
862
840
|
"dependencies": {
|
|
863
841
|
"base64-js": "^1.5.1",
|
|
@@ -1044,15 +1022,15 @@
|
|
|
1044
1022
|
}
|
|
1045
1023
|
},
|
|
1046
1024
|
"node_modules/signal-exit": {
|
|
1047
|
-
"version": "3.0.
|
|
1048
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
1049
|
-
"integrity": "sha512-
|
|
1025
|
+
"version": "3.0.7",
|
|
1026
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
|
1027
|
+
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
|
|
1050
1028
|
"dev": true
|
|
1051
1029
|
},
|
|
1052
1030
|
"node_modules/simctl": {
|
|
1053
|
-
"version": "2.0.
|
|
1054
|
-
"resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.
|
|
1055
|
-
"integrity": "sha512-
|
|
1031
|
+
"version": "2.0.3",
|
|
1032
|
+
"resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.3.tgz",
|
|
1033
|
+
"integrity": "sha512-kKCak0yszxHae5eVWcmrjV3ouUGac3sjlhjdLWpyPu4eiQcWoHsCrqS34kkgzHN8Ystqkh/LFjzrldk/g3BYJg==",
|
|
1056
1034
|
"dev": true,
|
|
1057
1035
|
"dependencies": {
|
|
1058
1036
|
"shelljs": "^0.8.5",
|
|
@@ -1060,20 +1038,20 @@
|
|
|
1060
1038
|
}
|
|
1061
1039
|
},
|
|
1062
1040
|
"node_modules/simple-plist": {
|
|
1063
|
-
"version": "1.3.
|
|
1064
|
-
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.
|
|
1065
|
-
"integrity": "sha512-
|
|
1041
|
+
"version": "1.3.1",
|
|
1042
|
+
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz",
|
|
1043
|
+
"integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==",
|
|
1066
1044
|
"dev": true,
|
|
1067
1045
|
"dependencies": {
|
|
1068
1046
|
"bplist-creator": "0.1.0",
|
|
1069
|
-
"bplist-parser": "0.3.
|
|
1070
|
-
"plist": "^3.0.
|
|
1047
|
+
"bplist-parser": "0.3.1",
|
|
1048
|
+
"plist": "^3.0.5"
|
|
1071
1049
|
}
|
|
1072
1050
|
},
|
|
1073
1051
|
"node_modules/simple-plist/node_modules/bplist-parser": {
|
|
1074
|
-
"version": "0.3.
|
|
1075
|
-
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.
|
|
1076
|
-
"integrity": "sha512-
|
|
1052
|
+
"version": "0.3.1",
|
|
1053
|
+
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz",
|
|
1054
|
+
"integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==",
|
|
1077
1055
|
"dev": true,
|
|
1078
1056
|
"dependencies": {
|
|
1079
1057
|
"big-integer": "1.6.x"
|
|
@@ -1298,9 +1276,6 @@
|
|
|
1298
1276
|
"fastq": "^1.6.0"
|
|
1299
1277
|
}
|
|
1300
1278
|
},
|
|
1301
|
-
"@purchasely/cordova-plugin-purchasely": {
|
|
1302
|
-
"version": "file:.."
|
|
1303
|
-
},
|
|
1304
1279
|
"abbrev": {
|
|
1305
1280
|
"version": "1.1.1",
|
|
1306
1281
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
|
@@ -1423,9 +1398,9 @@
|
|
|
1423
1398
|
},
|
|
1424
1399
|
"dependencies": {
|
|
1425
1400
|
"fs-extra": {
|
|
1426
|
-
"version": "10.0.
|
|
1427
|
-
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.
|
|
1428
|
-
"integrity": "sha512-
|
|
1401
|
+
"version": "10.0.1",
|
|
1402
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
|
|
1403
|
+
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
|
|
1429
1404
|
"dev": true,
|
|
1430
1405
|
"requires": {
|
|
1431
1406
|
"graceful-fs": "^4.2.0",
|
|
@@ -1478,12 +1453,6 @@
|
|
|
1478
1453
|
"cordova-plugin-purchasely": {
|
|
1479
1454
|
"version": "file:.."
|
|
1480
1455
|
},
|
|
1481
|
-
"cordova-plugin-whitelist": {
|
|
1482
|
-
"version": "1.3.5",
|
|
1483
|
-
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
|
|
1484
|
-
"integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA==",
|
|
1485
|
-
"dev": true
|
|
1486
|
-
},
|
|
1487
1456
|
"cross-spawn": {
|
|
1488
1457
|
"version": "7.0.3",
|
|
1489
1458
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
|
@@ -1692,7 +1661,7 @@
|
|
|
1692
1661
|
"bplist-parser": {
|
|
1693
1662
|
"version": "0.0.6",
|
|
1694
1663
|
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
|
|
1695
|
-
"integrity": "
|
|
1664
|
+
"integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
|
|
1696
1665
|
"dev": true
|
|
1697
1666
|
},
|
|
1698
1667
|
"nopt": {
|
|
@@ -1707,9 +1676,9 @@
|
|
|
1707
1676
|
}
|
|
1708
1677
|
},
|
|
1709
1678
|
"is-core-module": {
|
|
1710
|
-
"version": "2.
|
|
1711
|
-
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.
|
|
1712
|
-
"integrity": "sha512
|
|
1679
|
+
"version": "2.9.0",
|
|
1680
|
+
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
|
|
1681
|
+
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
|
|
1713
1682
|
"dev": true,
|
|
1714
1683
|
"requires": {
|
|
1715
1684
|
"has": "^1.0.3"
|
|
@@ -1901,9 +1870,9 @@
|
|
|
1901
1870
|
"dev": true
|
|
1902
1871
|
},
|
|
1903
1872
|
"plist": {
|
|
1904
|
-
"version": "3.0.
|
|
1905
|
-
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.
|
|
1906
|
-
"integrity": "sha512-
|
|
1873
|
+
"version": "3.0.5",
|
|
1874
|
+
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz",
|
|
1875
|
+
"integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==",
|
|
1907
1876
|
"dev": true,
|
|
1908
1877
|
"requires": {
|
|
1909
1878
|
"base64-js": "^1.5.1",
|
|
@@ -2018,15 +1987,15 @@
|
|
|
2018
1987
|
}
|
|
2019
1988
|
},
|
|
2020
1989
|
"signal-exit": {
|
|
2021
|
-
"version": "3.0.
|
|
2022
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
2023
|
-
"integrity": "sha512-
|
|
1990
|
+
"version": "3.0.7",
|
|
1991
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
|
1992
|
+
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
|
|
2024
1993
|
"dev": true
|
|
2025
1994
|
},
|
|
2026
1995
|
"simctl": {
|
|
2027
|
-
"version": "2.0.
|
|
2028
|
-
"resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.
|
|
2029
|
-
"integrity": "sha512-
|
|
1996
|
+
"version": "2.0.3",
|
|
1997
|
+
"resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.3.tgz",
|
|
1998
|
+
"integrity": "sha512-kKCak0yszxHae5eVWcmrjV3ouUGac3sjlhjdLWpyPu4eiQcWoHsCrqS34kkgzHN8Ystqkh/LFjzrldk/g3BYJg==",
|
|
2030
1999
|
"dev": true,
|
|
2031
2000
|
"requires": {
|
|
2032
2001
|
"shelljs": "^0.8.5",
|
|
@@ -2034,20 +2003,20 @@
|
|
|
2034
2003
|
}
|
|
2035
2004
|
},
|
|
2036
2005
|
"simple-plist": {
|
|
2037
|
-
"version": "1.3.
|
|
2038
|
-
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.
|
|
2039
|
-
"integrity": "sha512-
|
|
2006
|
+
"version": "1.3.1",
|
|
2007
|
+
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz",
|
|
2008
|
+
"integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==",
|
|
2040
2009
|
"dev": true,
|
|
2041
2010
|
"requires": {
|
|
2042
2011
|
"bplist-creator": "0.1.0",
|
|
2043
|
-
"bplist-parser": "0.3.
|
|
2044
|
-
"plist": "^3.0.
|
|
2012
|
+
"bplist-parser": "0.3.1",
|
|
2013
|
+
"plist": "^3.0.5"
|
|
2045
2014
|
},
|
|
2046
2015
|
"dependencies": {
|
|
2047
2016
|
"bplist-parser": {
|
|
2048
|
-
"version": "0.3.
|
|
2049
|
-
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.
|
|
2050
|
-
"integrity": "sha512-
|
|
2017
|
+
"version": "0.3.1",
|
|
2018
|
+
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz",
|
|
2019
|
+
"integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==",
|
|
2051
2020
|
"dev": true,
|
|
2052
2021
|
"requires": {
|
|
2053
2022
|
"big-integer": "1.6.x"
|
package/example/package.json
CHANGED
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
"author": "Apache Cordova Team",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
17
16
|
"cordova-android": "^10.1.0",
|
|
18
17
|
"cordova-ios": "^6.2.0",
|
|
19
|
-
"cordova-plugin-purchasely": "file:.."
|
|
20
|
-
"cordova-plugin-whitelist": "^1.3.5"
|
|
18
|
+
"cordova-plugin-purchasely": "file:.."
|
|
21
19
|
},
|
|
22
20
|
"cordova": {
|
|
23
21
|
"plugins": {
|
|
24
|
-
"cordova-plugin-whitelist": {},
|
|
25
22
|
"cordova-plugin-purchasely": {}
|
|
26
23
|
},
|
|
27
24
|
"platforms": [
|
package/example/www/js/index.js
CHANGED
|
@@ -156,10 +156,10 @@ function onPuchaselySdkReady() {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
function openPresentation() {
|
|
159
|
-
Purchasely.
|
|
160
|
-
|
|
161
|
-
null,
|
|
162
|
-
true,
|
|
159
|
+
Purchasely.presentPresentationForPlacement(
|
|
160
|
+
'onboarding', //placementId
|
|
161
|
+
null, //contentId
|
|
162
|
+
true, //fullscreen
|
|
163
163
|
(callback) => {
|
|
164
164
|
console.log(callback);
|
|
165
165
|
if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.2",
|
|
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
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="2.2.2" 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.
|
|
31
|
+
<pod name="Purchasely" spec="3.2.2"/>
|
|
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.1
|
|
54
|
+
<framework src="io.purchasely:core:3.2.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" />
|
|
@@ -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;
|
|
@@ -78,6 +78,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
78
78
|
getStringFromJson(args.getString(2)),
|
|
79
79
|
args.getInt(3),
|
|
80
80
|
args.getInt(4),
|
|
81
|
+
getStringFromJson(args.getString(5)),
|
|
81
82
|
callbackContext);
|
|
82
83
|
break;
|
|
83
84
|
case "close":
|
|
@@ -240,6 +241,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
240
241
|
String userId,
|
|
241
242
|
int logLevel,
|
|
242
243
|
int runningMode,
|
|
244
|
+
String cordovaSdkVersion,
|
|
243
245
|
CallbackContext callbackContext) {
|
|
244
246
|
ArrayList<String> list = new ArrayList<>();
|
|
245
247
|
for (int i=0; i< stores.length(); i++) {
|
|
@@ -265,6 +267,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
265
267
|
.logLevel(LogLevel.values()[logLevel])
|
|
266
268
|
.build();
|
|
267
269
|
|
|
270
|
+
Purchasely.setSdkBridgeVersion(cordovaSdkVersion);
|
|
268
271
|
Purchasely.setAppTechnology(PLYAppTechnology.CORDOVA);
|
|
269
272
|
|
|
270
273
|
Purchasely.start((isConfigured, error) -> {
|
|
@@ -599,6 +602,8 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
599
602
|
if(info.getContentId() != null) infoMap.put("contentId", info.getContentId());
|
|
600
603
|
if(info.getPresentationId() != null) infoMap.put("presentationId", info.getPresentationId());
|
|
601
604
|
if(info.getPlacementId() != null) infoMap.put("placementId", info.getPlacementId());
|
|
605
|
+
if(info.getAbTestId() != null) infoMap.put("abTestId", info.getAbTestId());
|
|
606
|
+
if(info.getAbTestVariantId() != null) infoMap.put("abTestVariantId", info.getAbTestVariantId());
|
|
602
607
|
|
|
603
608
|
HashMap<String, Object> resultForCordova = new HashMap<>();
|
|
604
609
|
resultForCordova.put("info", infoMap);
|
|
@@ -664,6 +669,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
664
669
|
|
|
665
670
|
public static class ProductActivity {
|
|
666
671
|
String presentationId = null;
|
|
672
|
+
String placementId = null;
|
|
667
673
|
String productId = null;
|
|
668
674
|
String planId = null;
|
|
669
675
|
String contentId = null;
|
|
@@ -676,6 +682,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
676
682
|
&& !backgroundActivity.isDestroyed()) {
|
|
677
683
|
Intent intent = new Intent(cordova.getActivity(), PLYProductActivity.class);
|
|
678
684
|
intent.putExtra("presentationId", presentationId);
|
|
685
|
+
intent.putExtra("placementId", placementId);
|
|
679
686
|
intent.putExtra("productId", productId);
|
|
680
687
|
intent.putExtra("planId", planId);
|
|
681
688
|
intent.putExtra("contentId", contentId);
|
|
@@ -685,6 +692,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
685
692
|
} else {
|
|
686
693
|
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
687
694
|
intent.putExtra("presentationId", presentationId);
|
|
695
|
+
intent.putExtra("placementId", placementId);
|
|
688
696
|
intent.putExtra("productId", productId);
|
|
689
697
|
intent.putExtra("planId", planId);
|
|
690
698
|
intent.putExtra("contentId", contentId);
|
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
@implementation CDVPurchasely
|
|
13
13
|
|
|
14
14
|
- (void)startWithAPIKey:(CDVInvokedUrlCommand*)command {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
NSString *apiKey = [command argumentAtIndex:0];
|
|
16
|
+
NSString *userId = [command argumentAtIndex:2];
|
|
17
|
+
NSInteger logLevel = [[command argumentAtIndex:3] intValue];
|
|
18
|
+
NSInteger runningMode = [[command argumentAtIndex:4] intValue];
|
|
19
|
+
NSString *purchaselySdkVersion = [command argumentAtIndex:5];
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
[Purchasely setSdkBridgeVersion:purchaselySdkVersion];
|
|
22
|
+
|
|
23
|
+
[Purchasely setAppTechnology:PLYAppTechnologyCordova];
|
|
21
24
|
[Purchasely startWithAPIKey:apiKey appUserId:userId runningMode:runningMode eventDelegate:nil uiDelegate:nil paywallActionsInterceptor:nil logLevel:logLevel initialized:^(BOOL initialized, NSError * _Nullable error) {
|
|
22
25
|
if (error != nil) {
|
|
23
26
|
[self failureFor:command resultString: error.localizedDescription];
|
|
@@ -28,50 +31,50 @@
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
- (void)setLogLevel:(CDVInvokedUrlCommand*)command {
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
NSInteger logLevel = [[command argumentAtIndex:0] intValue];
|
|
35
|
+
[Purchasely setLogLevel:logLevel];
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
- (void)userLogin:(CDVInvokedUrlCommand*)command {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
NSString *userId = [command argumentAtIndex:0];
|
|
40
|
+
[Purchasely userLoginWith:userId shouldRefresh:^(BOOL refresh) {
|
|
41
|
+
[self successFor:command resultBool:refresh];
|
|
42
|
+
}];
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
- (void)userLogout:(CDVInvokedUrlCommand*)command {
|
|
43
|
-
|
|
46
|
+
[Purchasely userLogout];
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
- (void)setAttribute:(CDVInvokedUrlCommand*)command {
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
NSInteger attribute = [[command argumentAtIndex:0] intValue];
|
|
51
|
+
NSString *value = [command argumentAtIndex:1];
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
[Purchasely setAttribute:attribute value:value];
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
- (void)getAnonymousUserId:(CDVInvokedUrlCommand*)command {
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
NSString *anonymousId = [Purchasely anonymousUserId];
|
|
58
|
+
[self successFor:command resultString:anonymousId];
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
- (void)isReadyToPurchase:(CDVInvokedUrlCommand*)command {
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
BOOL isReadyToPurchase = [[command argumentAtIndex:0] boolValue];
|
|
63
|
+
[Purchasely isReadyToPurchase: isReadyToPurchase];
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
- (void)setDefaultPresentationResultHandler:(CDVInvokedUrlCommand*)command {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
[Purchasely setDefaultPresentationResultHandler:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
68
|
+
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
|
|
71
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
72
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
73
|
+
}];
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
- (void)presentPresentationWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
74
|
-
|
|
77
|
+
NSString *presentationVendorId = [command argumentAtIndex:0];
|
|
75
78
|
NSString *contentId = [command argumentAtIndex:1];
|
|
76
79
|
BOOL isFullscreen = [[command argumentAtIndex:2] boolValue];
|
|
77
80
|
|
|
@@ -123,15 +126,15 @@
|
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
- (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
NSString *planVendorId = [command argumentAtIndex:0];
|
|
130
|
+
NSString *presentationVendorId = [command argumentAtIndex:1];
|
|
128
131
|
NSString *contentId = [command argumentAtIndex:2];
|
|
129
132
|
BOOL isFullscreen = [[command argumentAtIndex:3] boolValue];
|
|
130
133
|
|
|
131
134
|
UIViewController *ctrl = [Purchasely planControllerFor:planVendorId with:presentationVendorId contentId:contentId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
136
|
+
[self successFor:command resultDict:resultDict];
|
|
137
|
+
}];
|
|
135
138
|
|
|
136
139
|
if (ctrl != nil) {
|
|
137
140
|
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
@@ -150,15 +153,15 @@
|
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
- (void)presentProductWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
NSString *productVendorId = [command argumentAtIndex:0];
|
|
157
|
+
NSString *presentationVendorId = [command argumentAtIndex:1];
|
|
155
158
|
NSString *contentId = [command argumentAtIndex:2];
|
|
156
159
|
BOOL isFullscreen = [[command argumentAtIndex:3] boolValue];
|
|
157
160
|
|
|
158
161
|
UIViewController *ctrl = [Purchasely productControllerFor:productVendorId with:presentationVendorId contentId:contentId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
|
|
163
|
+
[self successFor:command resultDict:resultDict];
|
|
164
|
+
}];
|
|
162
165
|
|
|
163
166
|
if (ctrl != nil) {
|
|
164
167
|
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
@@ -177,163 +180,163 @@
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
- (void)presentSubscriptions:(CDVInvokedUrlCommand*)command {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
UIViewController *ctrl = [Purchasely subscriptionsController];
|
|
184
|
+
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
|
|
185
|
+
ctrl.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target:navCtrl action:@selector(close)];
|
|
183
186
|
|
|
184
|
-
|
|
187
|
+
[Purchasely showController:navCtrl type: PLYUIControllerTypeSubscriptionList];
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
- (void)purchaseWithPlanVendorId:(CDVInvokedUrlCommand*)command {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
191
|
+
NSString *planVendorId = [command argumentAtIndex:0];
|
|
192
|
+
|
|
193
|
+
[Purchasely planWith:planVendorId
|
|
194
|
+
success:^(PLYPlan * _Nonnull plan) {
|
|
195
|
+
[Purchasely purchaseWithPlan:plan
|
|
196
|
+
success:^{
|
|
197
|
+
[self successFor:command resultDict: plan.asDictionary];
|
|
198
|
+
}
|
|
199
|
+
failure:^(NSError * _Nonnull error) {
|
|
200
|
+
[self failureFor:command resultString: error.localizedDescription];
|
|
201
|
+
}];
|
|
202
|
+
}
|
|
203
|
+
failure:^(NSError * _Nullable error) {
|
|
204
|
+
[self failureFor:command resultString: error.localizedDescription];
|
|
205
|
+
}];
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
- (void)restoreAllProducts:(CDVInvokedUrlCommand*)command {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
[Purchasely restoreAllProductsWithSuccess:^{
|
|
210
|
+
[self successFor:command];
|
|
211
|
+
} failure:^(NSError * _Nonnull error) {
|
|
212
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
213
|
+
}];
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
- (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
[Purchasely silentRestoreAllProductsWithSuccess:^{
|
|
218
|
+
[self successFor:command];
|
|
219
|
+
} failure:^(NSError * _Nonnull error) {
|
|
220
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
221
|
+
}];
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
- (void)purchasedSubscription:(CDVInvokedUrlCommand*)command {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
self.purchasedCommand = command;
|
|
226
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
227
|
+
selector:@selector(reloadContent:)
|
|
228
|
+
name: @"ply_purchasedSubscription"
|
|
229
|
+
object:nil];
|
|
227
230
|
}
|
|
228
231
|
|
|
229
232
|
- (void)allProducts:(CDVInvokedUrlCommand*)command {
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
[Purchasely allProductsWithSuccess:^(NSArray<PLYProduct *> * _Nonnull products) {
|
|
234
|
+
NSMutableArray *productsArray = [NSMutableArray array];
|
|
232
235
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
for (PLYProduct *product in products) {
|
|
237
|
+
if (product != nil) {
|
|
238
|
+
[productsArray addObject: product.asDictionary];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
[self successFor:command resultArray:productsArray];
|
|
243
|
+
} failure:^(NSError * _Nullable error) {
|
|
244
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
245
|
+
}];
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
- (void)productWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
246
|
-
|
|
249
|
+
NSString *productVendorId = [command argumentAtIndex:0];
|
|
247
250
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
[Purchasely productWith:productVendorId
|
|
252
|
+
success:^(PLYProduct * _Nonnull product) {
|
|
253
|
+
[self successFor:command resultDict:product.asDictionary];
|
|
254
|
+
}
|
|
255
|
+
failure:^(NSError * _Nullable error) {
|
|
256
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
257
|
+
}];
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
- (void)planWithIdentifier:(CDVInvokedUrlCommand*)command {
|
|
258
|
-
|
|
261
|
+
NSString *planVendorId = [command argumentAtIndex:0];
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
[Purchasely planWith:planVendorId
|
|
264
|
+
success:^(PLYPlan * _Nonnull plan) {
|
|
265
|
+
[self successFor:command resultDict:plan.asDictionary];
|
|
266
|
+
}
|
|
267
|
+
failure:^(NSError * _Nullable error) {
|
|
268
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
269
|
+
}];
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
- (void)userSubscriptions:(CDVInvokedUrlCommand*)command {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
273
|
+
[Purchasely userSubscriptionsWithSuccess:^(NSArray<PLYSubscription *> * _Nullable subscriptions) {
|
|
274
|
+
NSMutableArray *result = [NSMutableArray new];
|
|
275
|
+
for (PLYSubscription *subscription in subscriptions) {
|
|
276
|
+
[result addObject:subscription.asDictionary];
|
|
277
|
+
}
|
|
278
|
+
[self successFor:command resultArray:result];
|
|
279
|
+
}
|
|
280
|
+
failure:^(NSError * _Nonnull error) {
|
|
281
|
+
[self failureFor:command resultString:error.localizedDescription];
|
|
282
|
+
}];
|
|
280
283
|
}
|
|
281
284
|
|
|
282
285
|
- (void)addEventsListener:(CDVInvokedUrlCommand*)command {
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
[Purchasely setEventDelegate:self];
|
|
287
|
+
self.eventCommand = command;
|
|
285
288
|
}
|
|
286
289
|
|
|
287
290
|
- (void)removeEventsListener:(CDVInvokedUrlCommand*)command {
|
|
288
|
-
|
|
289
|
-
|
|
291
|
+
[Purchasely setEventDelegate:nil];
|
|
292
|
+
self.eventCommand = nil;
|
|
290
293
|
}
|
|
291
294
|
|
|
292
295
|
- (void)handle:(CDVInvokedUrlCommand*)command {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
NSString *deeplinkString = [command argumentAtIndex:0];
|
|
297
|
+
NSURL *deeplink = [NSURL URLWithString:deeplinkString];
|
|
298
|
+
|
|
299
|
+
if (deeplink != nil) {
|
|
300
|
+
BOOL result = [Purchasely handleWithDeeplink:deeplink];
|
|
301
|
+
[self successFor:command resultBool:result];
|
|
302
|
+
} else {
|
|
303
|
+
[self successFor:command resultBool:NO];
|
|
304
|
+
}
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
- (void)close:(CDVInvokedUrlCommand*)command {
|
|
305
308
|
}
|
|
306
309
|
|
|
307
310
|
- (void)setLanguage:(CDVInvokedUrlCommand*)command {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
+
NSString *language = [command argumentAtIndex:0];
|
|
312
|
+
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:language];
|
|
313
|
+
[Purchasely setLanguageFrom:locale];
|
|
311
314
|
}
|
|
312
315
|
|
|
313
316
|
// Helpers
|
|
314
317
|
|
|
315
318
|
- (NSDictionary<NSString *, NSObject *> *) resultDictionaryForPresentationController:(PLYProductViewControllerResult)result plan:(PLYPlan * _Nullable)plan {
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
NSMutableDictionary<NSString *, NSObject *> *productViewResult = [NSMutableDictionary new];
|
|
320
|
+
int resultString;
|
|
318
321
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
322
|
+
switch (result) {
|
|
323
|
+
case PLYProductViewControllerResultPurchased:
|
|
324
|
+
resultString = PLYProductViewControllerResultPurchased;
|
|
325
|
+
break;
|
|
326
|
+
case PLYProductViewControllerResultRestored:
|
|
327
|
+
resultString = PLYProductViewControllerResultRestored;
|
|
328
|
+
break;
|
|
329
|
+
case PLYProductViewControllerResultCancelled:
|
|
330
|
+
resultString = PLYProductViewControllerResultCancelled;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
330
333
|
|
|
331
|
-
|
|
334
|
+
[productViewResult setObject:[NSNumber numberWithInt:resultString] forKey:@"result"];
|
|
332
335
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
if (plan != nil) {
|
|
337
|
+
[productViewResult setObject:[plan asDictionary] forKey:@"plan"];
|
|
338
|
+
}
|
|
339
|
+
return productViewResult;
|
|
337
340
|
}
|
|
338
341
|
|
|
339
342
|
- (NSDictionary<NSString *, NSObject *> *) resultDictionaryForActionInterceptor:(PLYPresentationAction) action
|
|
@@ -380,6 +383,13 @@
|
|
|
380
383
|
if (infos.placementId != nil) {
|
|
381
384
|
[infosResult setObject:infos.placementId forKey:@"placementId"];
|
|
382
385
|
}
|
|
386
|
+
if (infos.abTestId != nil) {
|
|
387
|
+
[infosResult setObject:infos.abTestId forKey:@"abTestId"];
|
|
388
|
+
}
|
|
389
|
+
if (infos.abTestVariantId != nil) {
|
|
390
|
+
[infosResult setObject:infos.abTestVariantId forKey:@"abTestVariantId"];
|
|
391
|
+
}
|
|
392
|
+
|
|
383
393
|
[actionInterceptorResult setObject:infosResult forKey:@"info"];
|
|
384
394
|
}
|
|
385
395
|
if (params != nil) {
|
|
@@ -433,43 +443,43 @@
|
|
|
433
443
|
}
|
|
434
444
|
|
|
435
445
|
- (void)successFor:(CDVInvokedUrlCommand *)command {
|
|
436
|
-
|
|
437
|
-
|
|
446
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
447
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
438
448
|
}
|
|
439
449
|
|
|
440
450
|
- (void)successFor:(CDVInvokedUrlCommand *)command resultBool:(BOOL)resultBool {
|
|
441
|
-
|
|
442
|
-
|
|
451
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:resultBool];
|
|
452
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
443
453
|
}
|
|
444
454
|
|
|
445
455
|
- (void)successFor:(CDVInvokedUrlCommand *)command resultString:(NSString *)resultString {
|
|
446
|
-
|
|
447
|
-
|
|
456
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:resultString];
|
|
457
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
448
458
|
}
|
|
449
459
|
|
|
450
460
|
- (void)failureFor:(CDVInvokedUrlCommand *)command resultString:(NSString *)resultString {
|
|
451
|
-
|
|
452
|
-
|
|
461
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:resultString];
|
|
462
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
453
463
|
}
|
|
454
464
|
|
|
455
465
|
- (void)successFor:(CDVInvokedUrlCommand *)command resultArray:(NSArray *)resultArray {
|
|
456
|
-
|
|
457
|
-
|
|
466
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:resultArray];
|
|
467
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
458
468
|
}
|
|
459
469
|
|
|
460
470
|
- (void)failureFor:(CDVInvokedUrlCommand *)command resultArray:(NSArray *)resultArray {
|
|
461
|
-
|
|
462
|
-
|
|
471
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsArray:resultArray];
|
|
472
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
463
473
|
}
|
|
464
474
|
|
|
465
475
|
- (void)successFor:(CDVInvokedUrlCommand *)command resultDict:(NSDictionary *)resultDict {
|
|
466
|
-
|
|
467
|
-
|
|
476
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
|
|
477
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
468
478
|
}
|
|
469
479
|
|
|
470
480
|
- (void)failureFor:(CDVInvokedUrlCommand *)command resultDict:(NSDictionary *)resultDict {
|
|
471
|
-
|
|
472
|
-
|
|
481
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:resultDict];
|
|
482
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
473
483
|
}
|
|
474
484
|
|
|
475
485
|
|
|
@@ -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/www/Purchasely.js
CHANGED
|
@@ -3,7 +3,11 @@ var exec = require('cordova/exec');
|
|
|
3
3
|
var defaultError = (e) => { console.log(e); }
|
|
4
4
|
|
|
5
5
|
exports.startWithAPIKey = function (apiKey, stores, userId, logLevel, runningMode, success, error) {
|
|
6
|
-
|
|
6
|
+
var cordovaSdkVersion = cordova.define.moduleMap['cordova/plugin_list'].exports['metadata']['cordova-plugin-purchasely']
|
|
7
|
+
if(!cordovaSdkVersion) {
|
|
8
|
+
cordovaSdkVersion = "2.2.0" //fallback if we cannot find version from metadata
|
|
9
|
+
}
|
|
10
|
+
exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel, runningMode, cordovaSdkVersion]);
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
exports.addEventsListener = function (success, error) {
|
|
@@ -133,7 +137,12 @@ exports.Attribute = {
|
|
|
133
137
|
AMPLITUDE_SESSION_ID: 0,
|
|
134
138
|
FIREBASE_APP_INSTANCE_ID: 1,
|
|
135
139
|
AIRSHIP_CHANNEL_ID: 2,
|
|
136
|
-
|
|
140
|
+
BATCH_INSTALLATION_ID: 3,
|
|
141
|
+
ADJUST_ID: 4,
|
|
142
|
+
APPSFLYER_ID: 5,
|
|
143
|
+
ONESIGNAL_PLAYER_ID: 6,
|
|
144
|
+
MIXPANEL_DISTINCT_ID: 7,
|
|
145
|
+
CLEVER_TAP_ID: 8
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
exports.PurchaseResult = {
|