@purchasely/cordova-plugin-purchasely 1.1.3 → 1.1.8
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 +3 -0
- package/example/package-lock.json +118 -196
- package/example/package.json +3 -3
- package/example/www/index.html +3 -0
- package/example/www/js/index.js +6 -4
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/.idea/vcs.xml +6 -0
- package/src/android/PLYProductActivity.java +24 -0
- package/src/android/PurchaselyPlugin.java +64 -11
- package/src/ios/CDVPurchasely.h +2 -0
- package/src/ios/CDVPurchasely.m +25 -7
- package/src/ios/Hybrid/PLYPlan+Hybrid.m +61 -40
package/VERSIONS.md
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
13
|
-
"cordova-android": "^
|
|
13
|
+
"cordova-android": "^10.1.1",
|
|
14
14
|
"cordova-ios": "^6.2.0",
|
|
15
15
|
"cordova-plugin-whitelist": "^1.3.5"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"..": {
|
|
19
19
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.6",
|
|
21
21
|
"dev": true,
|
|
22
22
|
"license": "ISC"
|
|
23
23
|
},
|
|
@@ -204,27 +204,39 @@
|
|
|
204
204
|
"dev": true
|
|
205
205
|
},
|
|
206
206
|
"node_modules/cordova-android": {
|
|
207
|
-
"version": "
|
|
208
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-
|
|
209
|
-
"integrity": "sha512-
|
|
207
|
+
"version": "10.1.1",
|
|
208
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.1.tgz",
|
|
209
|
+
"integrity": "sha512-eoJp5AcDMHniqmxj0CbUF/rVQfbbp108TWKU6oyJW9rl/ZTJqZxm5ybznl+1/1MBksklxhMeipMn0Iwd0kEzEQ==",
|
|
210
210
|
"dev": true,
|
|
211
211
|
"dependencies": {
|
|
212
|
-
"android-versions": "^1.
|
|
213
|
-
"cordova-common": "^4.0.
|
|
214
|
-
"execa": "^
|
|
215
|
-
"fast-glob": "^3.2.
|
|
216
|
-
"fs-extra": "^
|
|
217
|
-
"is-path-inside": "^3.0.
|
|
218
|
-
"nopt": "^
|
|
212
|
+
"android-versions": "^1.7.0",
|
|
213
|
+
"cordova-common": "^4.0.2",
|
|
214
|
+
"execa": "^5.1.1",
|
|
215
|
+
"fast-glob": "^3.2.7",
|
|
216
|
+
"fs-extra": "^10.0.0",
|
|
217
|
+
"is-path-inside": "^3.0.3",
|
|
218
|
+
"nopt": "^5.0.0",
|
|
219
219
|
"properties-parser": "^0.3.1",
|
|
220
|
-
"semver": "^7.3.
|
|
220
|
+
"semver": "^7.3.5",
|
|
221
|
+
"untildify": "^4.0.0",
|
|
221
222
|
"which": "^2.0.2"
|
|
222
223
|
},
|
|
223
|
-
"
|
|
224
|
-
"
|
|
224
|
+
"engines": {
|
|
225
|
+
"node": ">=12.0.0"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"node_modules/cordova-android/node_modules/fs-extra": {
|
|
229
|
+
"version": "10.0.0",
|
|
230
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
|
|
231
|
+
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
|
|
232
|
+
"dev": true,
|
|
233
|
+
"dependencies": {
|
|
234
|
+
"graceful-fs": "^4.2.0",
|
|
235
|
+
"jsonfile": "^6.0.1",
|
|
236
|
+
"universalify": "^2.0.0"
|
|
225
237
|
},
|
|
226
238
|
"engines": {
|
|
227
|
-
"node": ">=
|
|
239
|
+
"node": ">=12"
|
|
228
240
|
}
|
|
229
241
|
},
|
|
230
242
|
"node_modules/cordova-common": {
|
|
@@ -273,21 +285,6 @@
|
|
|
273
285
|
"node": ">=10"
|
|
274
286
|
}
|
|
275
287
|
},
|
|
276
|
-
"node_modules/cordova-ios/node_modules/nopt": {
|
|
277
|
-
"version": "5.0.0",
|
|
278
|
-
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
|
279
|
-
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
|
280
|
-
"dev": true,
|
|
281
|
-
"dependencies": {
|
|
282
|
-
"abbrev": "1"
|
|
283
|
-
},
|
|
284
|
-
"bin": {
|
|
285
|
-
"nopt": "bin/nopt.js"
|
|
286
|
-
},
|
|
287
|
-
"engines": {
|
|
288
|
-
"node": ">=6"
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
288
|
"node_modules/cordova-plugin-whitelist": {
|
|
292
289
|
"version": "1.3.5",
|
|
293
290
|
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
|
|
@@ -336,15 +333,6 @@
|
|
|
336
333
|
"node": ">= 0.4.0"
|
|
337
334
|
}
|
|
338
335
|
},
|
|
339
|
-
"node_modules/end-of-stream": {
|
|
340
|
-
"version": "1.4.4",
|
|
341
|
-
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
|
342
|
-
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
|
343
|
-
"dev": true,
|
|
344
|
-
"dependencies": {
|
|
345
|
-
"once": "^1.4.0"
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
336
|
"node_modules/endent": {
|
|
349
337
|
"version": "1.4.1",
|
|
350
338
|
"resolved": "https://registry.npmjs.org/endent/-/endent-1.4.1.tgz",
|
|
@@ -357,19 +345,19 @@
|
|
|
357
345
|
}
|
|
358
346
|
},
|
|
359
347
|
"node_modules/execa": {
|
|
360
|
-
"version": "
|
|
361
|
-
"resolved": "https://registry.npmjs.org/execa/-/execa-
|
|
362
|
-
"integrity": "sha512-
|
|
348
|
+
"version": "5.1.1",
|
|
349
|
+
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
|
350
|
+
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
|
363
351
|
"dev": true,
|
|
364
352
|
"dependencies": {
|
|
365
|
-
"cross-spawn": "^7.0.
|
|
366
|
-
"get-stream": "^
|
|
367
|
-
"human-signals": "^
|
|
353
|
+
"cross-spawn": "^7.0.3",
|
|
354
|
+
"get-stream": "^6.0.0",
|
|
355
|
+
"human-signals": "^2.1.0",
|
|
368
356
|
"is-stream": "^2.0.0",
|
|
369
357
|
"merge-stream": "^2.0.0",
|
|
370
|
-
"npm-run-path": "^4.0.
|
|
371
|
-
"onetime": "^5.1.
|
|
372
|
-
"signal-exit": "^3.0.
|
|
358
|
+
"npm-run-path": "^4.0.1",
|
|
359
|
+
"onetime": "^5.1.2",
|
|
360
|
+
"signal-exit": "^3.0.3",
|
|
373
361
|
"strip-final-newline": "^2.0.0"
|
|
374
362
|
},
|
|
375
363
|
"engines": {
|
|
@@ -453,15 +441,12 @@
|
|
|
453
441
|
"dev": true
|
|
454
442
|
},
|
|
455
443
|
"node_modules/get-stream": {
|
|
456
|
-
"version": "
|
|
457
|
-
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-
|
|
458
|
-
"integrity": "sha512-
|
|
444
|
+
"version": "6.0.1",
|
|
445
|
+
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
|
446
|
+
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
|
459
447
|
"dev": true,
|
|
460
|
-
"dependencies": {
|
|
461
|
-
"pump": "^3.0.0"
|
|
462
|
-
},
|
|
463
448
|
"engines": {
|
|
464
|
-
"node": ">=
|
|
449
|
+
"node": ">=10"
|
|
465
450
|
},
|
|
466
451
|
"funding": {
|
|
467
452
|
"url": "https://github.com/sponsors/sindresorhus"
|
|
@@ -506,12 +491,12 @@
|
|
|
506
491
|
"dev": true
|
|
507
492
|
},
|
|
508
493
|
"node_modules/human-signals": {
|
|
509
|
-
"version": "
|
|
510
|
-
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-
|
|
511
|
-
"integrity": "sha512-
|
|
494
|
+
"version": "2.1.0",
|
|
495
|
+
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
|
|
496
|
+
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
|
|
512
497
|
"dev": true,
|
|
513
498
|
"engines": {
|
|
514
|
-
"node": ">=
|
|
499
|
+
"node": ">=10.17.0"
|
|
515
500
|
}
|
|
516
501
|
},
|
|
517
502
|
"node_modules/inflight": {
|
|
@@ -706,16 +691,18 @@
|
|
|
706
691
|
}
|
|
707
692
|
},
|
|
708
693
|
"node_modules/nopt": {
|
|
709
|
-
"version": "
|
|
710
|
-
"resolved": "https://registry.npmjs.org/nopt/-/nopt-
|
|
711
|
-
"integrity": "sha512-
|
|
694
|
+
"version": "5.0.0",
|
|
695
|
+
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
|
696
|
+
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
|
712
697
|
"dev": true,
|
|
713
698
|
"dependencies": {
|
|
714
|
-
"abbrev": "1"
|
|
715
|
-
"osenv": "^0.1.4"
|
|
699
|
+
"abbrev": "1"
|
|
716
700
|
},
|
|
717
701
|
"bin": {
|
|
718
702
|
"nopt": "bin/nopt.js"
|
|
703
|
+
},
|
|
704
|
+
"engines": {
|
|
705
|
+
"node": ">=6"
|
|
719
706
|
}
|
|
720
707
|
},
|
|
721
708
|
"node_modules/npm-run-path": {
|
|
@@ -760,34 +747,6 @@
|
|
|
760
747
|
"url": "https://github.com/sponsors/sindresorhus"
|
|
761
748
|
}
|
|
762
749
|
},
|
|
763
|
-
"node_modules/os-homedir": {
|
|
764
|
-
"version": "1.0.2",
|
|
765
|
-
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
|
766
|
-
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
|
767
|
-
"dev": true,
|
|
768
|
-
"engines": {
|
|
769
|
-
"node": ">=0.10.0"
|
|
770
|
-
}
|
|
771
|
-
},
|
|
772
|
-
"node_modules/os-tmpdir": {
|
|
773
|
-
"version": "1.0.2",
|
|
774
|
-
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
|
775
|
-
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
|
776
|
-
"dev": true,
|
|
777
|
-
"engines": {
|
|
778
|
-
"node": ">=0.10.0"
|
|
779
|
-
}
|
|
780
|
-
},
|
|
781
|
-
"node_modules/osenv": {
|
|
782
|
-
"version": "0.1.5",
|
|
783
|
-
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
|
|
784
|
-
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
|
785
|
-
"dev": true,
|
|
786
|
-
"dependencies": {
|
|
787
|
-
"os-homedir": "^1.0.0",
|
|
788
|
-
"os-tmpdir": "^1.0.0"
|
|
789
|
-
}
|
|
790
|
-
},
|
|
791
750
|
"node_modules/p-finally": {
|
|
792
751
|
"version": "1.0.0",
|
|
793
752
|
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
|
@@ -871,16 +830,6 @@
|
|
|
871
830
|
"node": ">= 0.3.1"
|
|
872
831
|
}
|
|
873
832
|
},
|
|
874
|
-
"node_modules/pump": {
|
|
875
|
-
"version": "3.0.0",
|
|
876
|
-
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
|
877
|
-
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
|
878
|
-
"dev": true,
|
|
879
|
-
"dependencies": {
|
|
880
|
-
"end-of-stream": "^1.1.0",
|
|
881
|
-
"once": "^1.3.1"
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
833
|
"node_modules/q": {
|
|
885
834
|
"version": "1.5.1",
|
|
886
835
|
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
|
|
@@ -1012,9 +961,9 @@
|
|
|
1012
961
|
}
|
|
1013
962
|
},
|
|
1014
963
|
"node_modules/signal-exit": {
|
|
1015
|
-
"version": "3.0.
|
|
1016
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
1017
|
-
"integrity": "sha512-
|
|
964
|
+
"version": "3.0.5",
|
|
965
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
|
|
966
|
+
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
|
|
1018
967
|
"dev": true
|
|
1019
968
|
},
|
|
1020
969
|
"node_modules/simctl": {
|
|
@@ -1116,6 +1065,15 @@
|
|
|
1116
1065
|
"node": ">= 0.4.0"
|
|
1117
1066
|
}
|
|
1118
1067
|
},
|
|
1068
|
+
"node_modules/untildify": {
|
|
1069
|
+
"version": "4.0.0",
|
|
1070
|
+
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
|
1071
|
+
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
|
|
1072
|
+
"dev": true,
|
|
1073
|
+
"engines": {
|
|
1074
|
+
"node": ">=8"
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1119
1077
|
"node_modules/uuid": {
|
|
1120
1078
|
"version": "7.0.3",
|
|
1121
1079
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
|
|
@@ -1348,21 +1306,35 @@
|
|
|
1348
1306
|
"dev": true
|
|
1349
1307
|
},
|
|
1350
1308
|
"cordova-android": {
|
|
1351
|
-
"version": "
|
|
1352
|
-
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-
|
|
1353
|
-
"integrity": "sha512-
|
|
1309
|
+
"version": "10.1.1",
|
|
1310
|
+
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.1.tgz",
|
|
1311
|
+
"integrity": "sha512-eoJp5AcDMHniqmxj0CbUF/rVQfbbp108TWKU6oyJW9rl/ZTJqZxm5ybznl+1/1MBksklxhMeipMn0Iwd0kEzEQ==",
|
|
1354
1312
|
"dev": true,
|
|
1355
1313
|
"requires": {
|
|
1356
|
-
"android-versions": "^1.
|
|
1357
|
-
"cordova-common": "^4.0.
|
|
1358
|
-
"execa": "^
|
|
1359
|
-
"fast-glob": "^3.2.
|
|
1360
|
-
"fs-extra": "^
|
|
1361
|
-
"is-path-inside": "^3.0.
|
|
1362
|
-
"nopt": "^
|
|
1314
|
+
"android-versions": "^1.7.0",
|
|
1315
|
+
"cordova-common": "^4.0.2",
|
|
1316
|
+
"execa": "^5.1.1",
|
|
1317
|
+
"fast-glob": "^3.2.7",
|
|
1318
|
+
"fs-extra": "^10.0.0",
|
|
1319
|
+
"is-path-inside": "^3.0.3",
|
|
1320
|
+
"nopt": "^5.0.0",
|
|
1363
1321
|
"properties-parser": "^0.3.1",
|
|
1364
|
-
"semver": "^7.3.
|
|
1322
|
+
"semver": "^7.3.5",
|
|
1323
|
+
"untildify": "^4.0.0",
|
|
1365
1324
|
"which": "^2.0.2"
|
|
1325
|
+
},
|
|
1326
|
+
"dependencies": {
|
|
1327
|
+
"fs-extra": {
|
|
1328
|
+
"version": "10.0.0",
|
|
1329
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
|
|
1330
|
+
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
|
|
1331
|
+
"dev": true,
|
|
1332
|
+
"requires": {
|
|
1333
|
+
"graceful-fs": "^4.2.0",
|
|
1334
|
+
"jsonfile": "^6.0.1",
|
|
1335
|
+
"universalify": "^2.0.0"
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1366
1338
|
}
|
|
1367
1339
|
},
|
|
1368
1340
|
"cordova-common": {
|
|
@@ -1403,17 +1375,6 @@
|
|
|
1403
1375
|
"which": "^2.0.2",
|
|
1404
1376
|
"xcode": "^3.0.1",
|
|
1405
1377
|
"xml-escape": "^1.1.0"
|
|
1406
|
-
},
|
|
1407
|
-
"dependencies": {
|
|
1408
|
-
"nopt": {
|
|
1409
|
-
"version": "5.0.0",
|
|
1410
|
-
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
|
1411
|
-
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
|
1412
|
-
"dev": true,
|
|
1413
|
-
"requires": {
|
|
1414
|
-
"abbrev": "1"
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
1378
|
}
|
|
1418
1379
|
},
|
|
1419
1380
|
"cordova-plugin-whitelist": {
|
|
@@ -1448,15 +1409,6 @@
|
|
|
1448
1409
|
"sax": "1.1.4"
|
|
1449
1410
|
}
|
|
1450
1411
|
},
|
|
1451
|
-
"end-of-stream": {
|
|
1452
|
-
"version": "1.4.4",
|
|
1453
|
-
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
|
1454
|
-
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
|
1455
|
-
"dev": true,
|
|
1456
|
-
"requires": {
|
|
1457
|
-
"once": "^1.4.0"
|
|
1458
|
-
}
|
|
1459
|
-
},
|
|
1460
1412
|
"endent": {
|
|
1461
1413
|
"version": "1.4.1",
|
|
1462
1414
|
"resolved": "https://registry.npmjs.org/endent/-/endent-1.4.1.tgz",
|
|
@@ -1469,19 +1421,19 @@
|
|
|
1469
1421
|
}
|
|
1470
1422
|
},
|
|
1471
1423
|
"execa": {
|
|
1472
|
-
"version": "
|
|
1473
|
-
"resolved": "https://registry.npmjs.org/execa/-/execa-
|
|
1474
|
-
"integrity": "sha512-
|
|
1424
|
+
"version": "5.1.1",
|
|
1425
|
+
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
|
1426
|
+
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
|
1475
1427
|
"dev": true,
|
|
1476
1428
|
"requires": {
|
|
1477
|
-
"cross-spawn": "^7.0.
|
|
1478
|
-
"get-stream": "^
|
|
1479
|
-
"human-signals": "^
|
|
1429
|
+
"cross-spawn": "^7.0.3",
|
|
1430
|
+
"get-stream": "^6.0.0",
|
|
1431
|
+
"human-signals": "^2.1.0",
|
|
1480
1432
|
"is-stream": "^2.0.0",
|
|
1481
1433
|
"merge-stream": "^2.0.0",
|
|
1482
|
-
"npm-run-path": "^4.0.
|
|
1483
|
-
"onetime": "^5.1.
|
|
1484
|
-
"signal-exit": "^3.0.
|
|
1434
|
+
"npm-run-path": "^4.0.1",
|
|
1435
|
+
"onetime": "^5.1.2",
|
|
1436
|
+
"signal-exit": "^3.0.3",
|
|
1485
1437
|
"strip-final-newline": "^2.0.0"
|
|
1486
1438
|
}
|
|
1487
1439
|
},
|
|
@@ -1547,13 +1499,10 @@
|
|
|
1547
1499
|
"dev": true
|
|
1548
1500
|
},
|
|
1549
1501
|
"get-stream": {
|
|
1550
|
-
"version": "
|
|
1551
|
-
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-
|
|
1552
|
-
"integrity": "sha512-
|
|
1553
|
-
"dev": true
|
|
1554
|
-
"requires": {
|
|
1555
|
-
"pump": "^3.0.0"
|
|
1556
|
-
}
|
|
1502
|
+
"version": "6.0.1",
|
|
1503
|
+
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
|
1504
|
+
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
|
1505
|
+
"dev": true
|
|
1557
1506
|
},
|
|
1558
1507
|
"glob": {
|
|
1559
1508
|
"version": "7.1.7",
|
|
@@ -1585,9 +1534,9 @@
|
|
|
1585
1534
|
"dev": true
|
|
1586
1535
|
},
|
|
1587
1536
|
"human-signals": {
|
|
1588
|
-
"version": "
|
|
1589
|
-
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-
|
|
1590
|
-
"integrity": "sha512-
|
|
1537
|
+
"version": "2.1.0",
|
|
1538
|
+
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
|
|
1539
|
+
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
|
|
1591
1540
|
"dev": true
|
|
1592
1541
|
},
|
|
1593
1542
|
"inflight": {
|
|
@@ -1737,13 +1686,12 @@
|
|
|
1737
1686
|
}
|
|
1738
1687
|
},
|
|
1739
1688
|
"nopt": {
|
|
1740
|
-
"version": "
|
|
1741
|
-
"resolved": "https://registry.npmjs.org/nopt/-/nopt-
|
|
1742
|
-
"integrity": "sha512-
|
|
1689
|
+
"version": "5.0.0",
|
|
1690
|
+
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
|
1691
|
+
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
|
1743
1692
|
"dev": true,
|
|
1744
1693
|
"requires": {
|
|
1745
|
-
"abbrev": "1"
|
|
1746
|
-
"osenv": "^0.1.4"
|
|
1694
|
+
"abbrev": "1"
|
|
1747
1695
|
}
|
|
1748
1696
|
},
|
|
1749
1697
|
"npm-run-path": {
|
|
@@ -1779,28 +1727,6 @@
|
|
|
1779
1727
|
"mimic-fn": "^2.1.0"
|
|
1780
1728
|
}
|
|
1781
1729
|
},
|
|
1782
|
-
"os-homedir": {
|
|
1783
|
-
"version": "1.0.2",
|
|
1784
|
-
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
|
1785
|
-
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
|
1786
|
-
"dev": true
|
|
1787
|
-
},
|
|
1788
|
-
"os-tmpdir": {
|
|
1789
|
-
"version": "1.0.2",
|
|
1790
|
-
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
|
1791
|
-
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
|
1792
|
-
"dev": true
|
|
1793
|
-
},
|
|
1794
|
-
"osenv": {
|
|
1795
|
-
"version": "0.1.5",
|
|
1796
|
-
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
|
|
1797
|
-
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
|
1798
|
-
"dev": true,
|
|
1799
|
-
"requires": {
|
|
1800
|
-
"os-homedir": "^1.0.0",
|
|
1801
|
-
"os-tmpdir": "^1.0.0"
|
|
1802
|
-
}
|
|
1803
|
-
},
|
|
1804
1730
|
"p-finally": {
|
|
1805
1731
|
"version": "1.0.0",
|
|
1806
1732
|
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
|
@@ -1857,16 +1783,6 @@
|
|
|
1857
1783
|
"string.prototype.codepointat": "^0.2.0"
|
|
1858
1784
|
}
|
|
1859
1785
|
},
|
|
1860
|
-
"pump": {
|
|
1861
|
-
"version": "3.0.0",
|
|
1862
|
-
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
|
1863
|
-
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
|
1864
|
-
"dev": true,
|
|
1865
|
-
"requires": {
|
|
1866
|
-
"end-of-stream": "^1.1.0",
|
|
1867
|
-
"once": "^1.3.1"
|
|
1868
|
-
}
|
|
1869
|
-
},
|
|
1870
1786
|
"q": {
|
|
1871
1787
|
"version": "1.5.1",
|
|
1872
1788
|
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
|
|
@@ -1941,9 +1857,9 @@
|
|
|
1941
1857
|
"dev": true
|
|
1942
1858
|
},
|
|
1943
1859
|
"signal-exit": {
|
|
1944
|
-
"version": "3.0.
|
|
1945
|
-
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.
|
|
1946
|
-
"integrity": "sha512-
|
|
1860
|
+
"version": "3.0.5",
|
|
1861
|
+
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
|
|
1862
|
+
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
|
|
1947
1863
|
"dev": true
|
|
1948
1864
|
},
|
|
1949
1865
|
"simctl": {
|
|
@@ -2024,6 +1940,12 @@
|
|
|
2024
1940
|
"integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==",
|
|
2025
1941
|
"dev": true
|
|
2026
1942
|
},
|
|
1943
|
+
"untildify": {
|
|
1944
|
+
"version": "4.0.0",
|
|
1945
|
+
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
|
1946
|
+
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
|
|
1947
|
+
"dev": true
|
|
1948
|
+
},
|
|
2027
1949
|
"uuid": {
|
|
2028
1950
|
"version": "7.0.3",
|
|
2029
1951
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
|
package/example/package.json
CHANGED
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
17
|
-
"cordova-android": "^
|
|
17
|
+
"cordova-android": "^10.1.1",
|
|
18
18
|
"cordova-ios": "^6.2.0",
|
|
19
19
|
"cordova-plugin-whitelist": "^1.3.5"
|
|
20
20
|
},
|
|
21
21
|
"cordova": {
|
|
22
22
|
"plugins": {
|
|
23
23
|
"cordova-plugin-whitelist": {},
|
|
24
|
-
"cordova-plugin-purchasely": {}
|
|
24
|
+
"@purchasley/cordova-plugin-purchasely": {}
|
|
25
25
|
},
|
|
26
26
|
"platforms": [
|
|
27
27
|
"ios",
|
|
28
28
|
"android"
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
package/example/www/index.html
CHANGED
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
<div style="margin-top: 20px;">
|
|
48
48
|
<button id="openPresentation">Open Presentation</button>
|
|
49
49
|
</div>
|
|
50
|
+
<div style="margin-top: 20px;">
|
|
51
|
+
<button id="processToPayment">Continue payment</button>
|
|
52
|
+
</div>
|
|
50
53
|
<div style="margin-top: 20px;">
|
|
51
54
|
<button id="presentSubscriptions">Open Subscriptions</button>
|
|
52
55
|
</div>
|
package/example/www/js/index.js
CHANGED
|
@@ -46,7 +46,7 @@ function onDeviceReady() {
|
|
|
46
46
|
document.getElementById("presentSubscriptions").addEventListener("click", presentSubscriptions);
|
|
47
47
|
document.getElementById("purchaseWithPlanVendorId").addEventListener("click", purchaseWithPlanVendorId);
|
|
48
48
|
document.getElementById("restore").addEventListener("click", restore);
|
|
49
|
-
document.getElementById("
|
|
49
|
+
document.getElementById("processToPayment").addEventListener("click", processToPayment);
|
|
50
50
|
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -106,9 +106,6 @@ function onPuchaselySdkReady() {
|
|
|
106
106
|
|
|
107
107
|
Purchasely.setConfirmPurchaseHandler(onPurchaseTapped => {
|
|
108
108
|
// Present your own screen before purchase
|
|
109
|
-
|
|
110
|
-
// Call this method to process to payment
|
|
111
|
-
Purchasely.processToPayment(true);
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
|
|
@@ -137,6 +134,11 @@ function purchaseWithPlanVendorId() {
|
|
|
137
134
|
Purchasely.purchaseWithPlanVendorId("PURCHASELY_PLUS_MONTHLY");
|
|
138
135
|
}
|
|
139
136
|
|
|
137
|
+
function processToPayment() {
|
|
138
|
+
// Call this method to process to payment
|
|
139
|
+
Purchasely.processToPayment(true);
|
|
140
|
+
}
|
|
141
|
+
|
|
140
142
|
function restore() {
|
|
141
143
|
Purchasely.restoreAllProducts(
|
|
142
144
|
(plan) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
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="1.1.
|
|
2
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="1.1.8" 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" />
|
|
@@ -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:2.7.
|
|
54
|
+
<framework src="io.purchasely:core:2.7.6" />
|
|
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" />
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
package cordova.plugin.purchasely;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
3
5
|
import android.os.Bundle;
|
|
4
6
|
|
|
5
7
|
import androidx.annotation.Nullable;
|
|
6
8
|
import androidx.appcompat.app.AppCompatActivity;
|
|
7
9
|
import androidx.fragment.app.Fragment;
|
|
8
10
|
|
|
11
|
+
import java.lang.ref.WeakReference;
|
|
12
|
+
|
|
9
13
|
import io.purchasely.ext.ProductViewResultListener;
|
|
10
14
|
import io.purchasely.ext.Purchasely;
|
|
11
15
|
|
|
@@ -41,7 +45,27 @@ public class PLYProductActivity extends AppCompatActivity {
|
|
|
41
45
|
"id",
|
|
42
46
|
package_name), fragment)
|
|
43
47
|
.commit();
|
|
48
|
+
|
|
49
|
+
PurchaselyPlugin.ProductActivity productActivity = new PurchaselyPlugin.ProductActivity();
|
|
50
|
+
productActivity.presentationId = presentationId;
|
|
51
|
+
productActivity.productId = productId;
|
|
52
|
+
productActivity.planId = planId;
|
|
53
|
+
productActivity.contentId = contentId;
|
|
54
|
+
productActivity.activity = new WeakReference<>(this);
|
|
55
|
+
PurchaselyPlugin.productActivity = productActivity;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Override
|
|
59
|
+
protected void onDestroy() {
|
|
60
|
+
PurchaselyPlugin.productActivity.activity = null;
|
|
61
|
+
super.onDestroy();
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
ProductViewResultListener listener = PurchaselyPlugin::sendPurchaseResult;
|
|
65
|
+
|
|
66
|
+
static Intent newIntent(Activity activity) {
|
|
67
|
+
Intent intent = new Intent(activity, PLYProductActivity.class);
|
|
68
|
+
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
|
69
|
+
return intent;
|
|
70
|
+
}
|
|
47
71
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
package cordova.plugin.purchasely;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
3
4
|
import android.content.Intent;
|
|
4
5
|
import android.net.Uri;
|
|
5
6
|
import android.util.Log;
|
|
6
7
|
|
|
7
|
-
import androidx.fragment.app.FragmentActivity;
|
|
8
|
-
|
|
9
8
|
import org.apache.cordova.CallbackContext;
|
|
9
|
+
import org.apache.cordova.CordovaInterface;
|
|
10
10
|
import org.apache.cordova.CordovaPlugin;
|
|
11
11
|
import org.apache.cordova.PluginResult;
|
|
12
12
|
import org.jetbrains.annotations.NotNull;
|
|
@@ -15,6 +15,7 @@ import org.json.JSONArray;
|
|
|
15
15
|
import org.json.JSONException;
|
|
16
16
|
import org.json.JSONObject;
|
|
17
17
|
|
|
18
|
+
import java.lang.ref.WeakReference;
|
|
18
19
|
import java.util.ArrayList;
|
|
19
20
|
import java.util.HashMap;
|
|
20
21
|
import java.util.List;
|
|
@@ -24,18 +25,13 @@ import io.purchasely.billing.Store;
|
|
|
24
25
|
import io.purchasely.ext.Attribute;
|
|
25
26
|
import io.purchasely.ext.ContinuePurchaseListener;
|
|
26
27
|
import io.purchasely.ext.DistributionType;
|
|
27
|
-
import io.purchasely.ext.EventListener;
|
|
28
28
|
import io.purchasely.ext.LogLevel;
|
|
29
29
|
import io.purchasely.ext.LoginClosedListener;
|
|
30
|
-
import io.purchasely.ext.LoginTappedListener;
|
|
31
30
|
import io.purchasely.ext.PLYAppTechnology;
|
|
32
|
-
import io.purchasely.ext.PLYEvent;
|
|
33
31
|
import io.purchasely.ext.PLYProductViewResult;
|
|
34
32
|
import io.purchasely.ext.PlanListener;
|
|
35
33
|
import io.purchasely.ext.ProductListener;
|
|
36
34
|
import io.purchasely.ext.ProductsListener;
|
|
37
|
-
import io.purchasely.ext.PurchaseCompletionListener;
|
|
38
|
-
import io.purchasely.ext.PurchaseListener;
|
|
39
35
|
import io.purchasely.ext.Purchasely;
|
|
40
36
|
import io.purchasely.ext.State;
|
|
41
37
|
import io.purchasely.ext.StoreType;
|
|
@@ -52,6 +48,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
52
48
|
static CallbackContext defaultCallback = null;
|
|
53
49
|
static CallbackContext presentationCallback = null;
|
|
54
50
|
static CallbackContext eventsCallback = null;
|
|
51
|
+
static ProductActivity productActivity = null;
|
|
55
52
|
|
|
56
53
|
private LoginClosedListener loginClosedListener = null;
|
|
57
54
|
private ContinuePurchaseListener continuePurchaseListener = null;
|
|
@@ -272,6 +269,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
272
269
|
presentationCallback = null;
|
|
273
270
|
loginClosedListener = null;
|
|
274
271
|
continuePurchaseListener = null;
|
|
272
|
+
productActivity = null;
|
|
275
273
|
Purchasely.close();
|
|
276
274
|
}
|
|
277
275
|
|
|
@@ -351,7 +349,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
351
349
|
String contentId,
|
|
352
350
|
CallbackContext callbackContext) {
|
|
353
351
|
presentationCallback = callbackContext;
|
|
354
|
-
Intent intent =
|
|
352
|
+
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
355
353
|
intent.putExtra("presentationId", presentationVendorId);
|
|
356
354
|
intent.putExtra("contentId", contentId);
|
|
357
355
|
cordova.getActivity().startActivity(intent);
|
|
@@ -362,7 +360,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
362
360
|
String contentId,
|
|
363
361
|
CallbackContext callbackContext) {
|
|
364
362
|
presentationCallback = callbackContext;
|
|
365
|
-
Intent intent =
|
|
363
|
+
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
366
364
|
intent.putExtra("presentationId", presentationVendorId);
|
|
367
365
|
intent.putExtra("productId", productVendorId);
|
|
368
366
|
intent.putExtra("contentId", contentId);
|
|
@@ -374,7 +372,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
374
372
|
String contentId,
|
|
375
373
|
CallbackContext callbackContext) {
|
|
376
374
|
presentationCallback = callbackContext;
|
|
377
|
-
Intent intent =
|
|
375
|
+
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
378
376
|
intent.putExtra("presentationId", presentationVendorId);
|
|
379
377
|
intent.putExtra("planId", planVendorId);
|
|
380
378
|
intent.putExtra("contentId", contentId);
|
|
@@ -517,6 +515,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
517
515
|
private void setLoginTappedHandler(CallbackContext callbackContext) {
|
|
518
516
|
Purchasely.setLoginTappedHandler((fragmentActivity, loginClosedListener) -> {
|
|
519
517
|
this.loginClosedListener = loginClosedListener;
|
|
518
|
+
Intent intent = new Intent(fragmentActivity, cordova.getActivity().getClass());
|
|
519
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
520
|
+
cordova.getActivity().startActivity(intent);
|
|
520
521
|
|
|
521
522
|
PluginResult result = new PluginResult(PluginResult.Status.OK);
|
|
522
523
|
result.setKeepCallback(true);
|
|
@@ -526,6 +527,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
526
527
|
|
|
527
528
|
private void onUserLoggedIn(boolean userLoggedIn) {
|
|
528
529
|
if(loginClosedListener != null) {
|
|
530
|
+
if(productActivity != null) productActivity.relaunch(cordova);
|
|
529
531
|
cordova.getActivity().runOnUiThread(() -> loginClosedListener.userLoggedIn(userLoggedIn));
|
|
530
532
|
}
|
|
531
533
|
}
|
|
@@ -533,6 +535,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
533
535
|
private void setConfirmPurchaseHandler(CallbackContext callbackContext) {
|
|
534
536
|
Purchasely.setConfirmPurchaseHandler((fragmentActivity, continuePurchaseListener) -> {
|
|
535
537
|
this.continuePurchaseListener = continuePurchaseListener;
|
|
538
|
+
Intent intent = new Intent(fragmentActivity, cordova.getActivity().getClass());
|
|
539
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
540
|
+
cordova.getActivity().startActivity(intent);
|
|
536
541
|
|
|
537
542
|
PluginResult result = new PluginResult(PluginResult.Status.OK);
|
|
538
543
|
result.setKeepCallback(true);
|
|
@@ -542,7 +547,23 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
542
547
|
|
|
543
548
|
private void processToPayment(boolean continueToPayment) {
|
|
544
549
|
if(continuePurchaseListener != null) {
|
|
545
|
-
|
|
550
|
+
if(productActivity != null) {
|
|
551
|
+
boolean softRelaunched = productActivity.relaunch(cordova);
|
|
552
|
+
if(softRelaunched) {
|
|
553
|
+
cordova.getActivity().runOnUiThread(() -> continuePurchaseListener.processToPayment(continueToPayment));
|
|
554
|
+
} else {
|
|
555
|
+
new Thread(() -> {
|
|
556
|
+
try {
|
|
557
|
+
Thread.sleep(500);
|
|
558
|
+
} catch (InterruptedException e) {
|
|
559
|
+
Log.e("Purchasely", "process to payment error", e);
|
|
560
|
+
} finally {
|
|
561
|
+
cordova.getActivity().runOnUiThread(() -> continuePurchaseListener.processToPayment(continueToPayment));
|
|
562
|
+
}
|
|
563
|
+
}).start();
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
}
|
|
546
567
|
}
|
|
547
568
|
}
|
|
548
569
|
|
|
@@ -563,4 +584,36 @@ public class PurchaselyPlugin extends CordovaPlugin {
|
|
|
563
584
|
}
|
|
564
585
|
return map;
|
|
565
586
|
}
|
|
587
|
+
|
|
588
|
+
public static class ProductActivity {
|
|
589
|
+
String presentationId = null;
|
|
590
|
+
String productId = null;
|
|
591
|
+
String planId = null;
|
|
592
|
+
String contentId = null;
|
|
593
|
+
WeakReference<PLYProductActivity> activity = null;
|
|
594
|
+
|
|
595
|
+
public boolean relaunch(CordovaInterface cordova) {
|
|
596
|
+
PLYProductActivity backgroundActivity = activity.get();
|
|
597
|
+
if(backgroundActivity != null
|
|
598
|
+
&& !backgroundActivity.isFinishing()
|
|
599
|
+
&& !backgroundActivity.isDestroyed()) {
|
|
600
|
+
Intent intent = new Intent(cordova.getActivity(), PLYProductActivity.class);
|
|
601
|
+
intent.putExtra("presentationId", presentationId);
|
|
602
|
+
intent.putExtra("productId", productId);
|
|
603
|
+
intent.putExtra("planId", planId);
|
|
604
|
+
intent.putExtra("contentId", contentId);
|
|
605
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
606
|
+
cordova.getActivity().startActivity(intent);
|
|
607
|
+
return true;
|
|
608
|
+
} else {
|
|
609
|
+
Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
|
|
610
|
+
intent.putExtra("presentationId", presentationId);
|
|
611
|
+
intent.putExtra("productId", productId);
|
|
612
|
+
intent.putExtra("planId", planId);
|
|
613
|
+
intent.putExtra("contentId", contentId);
|
|
614
|
+
cordova.getActivity().startActivity(intent);
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
566
619
|
}
|
package/src/ios/CDVPurchasely.h
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
@interface CDVPurchasely<PLYEventDelegate> : CDVPlugin {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
@property (nonatomic, retain) UIViewController* presentedPresentationViewController;
|
|
15
|
+
|
|
14
16
|
@property CDVInvokedUrlCommand* purchasedCommand;
|
|
15
17
|
@property CDVInvokedUrlCommand* eventCommand;
|
|
16
18
|
|
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
NSInteger logLevel = [[command argumentAtIndex:3] intValue];
|
|
18
18
|
BOOL observerMode = [[command argumentAtIndex:4] boolValue];
|
|
19
19
|
|
|
20
|
-
[Purchasely startWithAPIKey:apiKey appUserId:userId observerMode:observerMode eventDelegate:nil uiDelegate:nil confirmPurchaseHandler:nil logLevel:logLevel initialized
|
|
20
|
+
[Purchasely startWithAPIKey:apiKey appUserId:userId observerMode:observerMode eventDelegate:nil uiDelegate:nil confirmPurchaseHandler: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
|
+
}];
|
|
21
27
|
[Purchasely setAppTechnology:PLYAppTechnologyCordova];
|
|
22
28
|
}
|
|
23
29
|
|
|
@@ -78,6 +84,8 @@
|
|
|
78
84
|
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
79
85
|
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
80
86
|
|
|
87
|
+
self.presentedPresentationViewController = navCtrl;
|
|
88
|
+
|
|
81
89
|
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
82
90
|
}
|
|
83
91
|
|
|
@@ -96,6 +104,8 @@
|
|
|
96
104
|
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
97
105
|
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
98
106
|
|
|
107
|
+
self.presentedPresentationViewController = navCtrl;
|
|
108
|
+
|
|
99
109
|
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
100
110
|
}
|
|
101
111
|
|
|
@@ -114,6 +124,8 @@
|
|
|
114
124
|
[navCtrl.navigationBar setShadowImage: [UIImage new]];
|
|
115
125
|
[navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
|
|
116
126
|
|
|
127
|
+
self.presentedPresentationViewController = navCtrl;
|
|
128
|
+
|
|
117
129
|
[Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
|
|
118
130
|
}
|
|
119
131
|
|
|
@@ -242,15 +254,18 @@
|
|
|
242
254
|
[Purchasely setLoginTappedHandler:^(UIViewController * _Nonnull controller, void (^ _Nonnull closedHandler)(BOOL)) {
|
|
243
255
|
self.loginClosedHandler = closedHandler;
|
|
244
256
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
+
}];
|
|
248
262
|
}];
|
|
249
263
|
}
|
|
250
264
|
|
|
251
265
|
- (void)onUserLoggedIn:(CDVInvokedUrlCommand*)command {
|
|
252
266
|
BOOL userDidLogin = [[command argumentAtIndex:0] boolValue];
|
|
253
267
|
|
|
268
|
+
[Purchasely showController:self.presentedPresentationViewController type: PLYUIControllerTypeProductPage];
|
|
254
269
|
self.loginClosedHandler(userDidLogin);
|
|
255
270
|
}
|
|
256
271
|
|
|
@@ -259,15 +274,18 @@
|
|
|
259
274
|
[Purchasely setConfirmPurchaseHandler:^(UIViewController * _Nonnull controller, void (^ _Nonnull authorizePurchaseHandler)(BOOL)) {
|
|
260
275
|
self.authorizePurchaseHandler = authorizePurchaseHandler;
|
|
261
276
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
+
}];
|
|
265
282
|
}];
|
|
266
283
|
}
|
|
267
284
|
|
|
268
285
|
- (void)processToPayment:(CDVInvokedUrlCommand*)command {
|
|
269
286
|
BOOL processToPayment = [[command argumentAtIndex:0] boolValue];
|
|
270
287
|
|
|
288
|
+
[Purchasely showController:self.presentedPresentationViewController type: PLYUIControllerTypeProductPage];
|
|
271
289
|
self.authorizePurchaseHandler(processToPayment);
|
|
272
290
|
}
|
|
273
291
|
|
|
@@ -10,46 +10,67 @@
|
|
|
10
10
|
@implementation PLYPlan (Hybrid)
|
|
11
11
|
|
|
12
12
|
- (NSDictionary *)asDictionary {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
13
|
+
NSMutableDictionary<NSString *, NSObject *> *dict = [NSMutableDictionary new];
|
|
14
|
+
|
|
15
|
+
[dict setObject:self.vendorId forKey:@"vendorId"];
|
|
16
|
+
[dict setObject:@(self.hasIntroductoryPrice) forKey:@"hasIntroductoryPrice"];
|
|
17
|
+
[dict setObject:@([self type]) forKey:@"type"];
|
|
18
|
+
|
|
19
|
+
if (self.hasIntroductoryPrice && [[self introAmount] intValue] == 0) {
|
|
20
|
+
[dict setObject:@(YES) forKey:@"hasFreeTrial"];
|
|
21
|
+
[dict removeObjectForKey:@"hasIntroductoryPrice"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (self.name != nil) {
|
|
25
|
+
[dict setObject:self.name forKey:@"name"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
NSString *price = [self localizedFullPriceWithLanguage:nil];
|
|
29
|
+
if (price != nil) {
|
|
30
|
+
[dict setObject:price forKey:@"price"];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
NSDecimalNumber *amount = [self amount];
|
|
34
|
+
if (amount != nil) {
|
|
35
|
+
[dict setObject:amount forKey:@"amount"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
NSDecimalNumber *introAmount = [self introAmount];
|
|
39
|
+
if (introAmount != nil) {
|
|
40
|
+
[dict setObject:introAmount forKey:@"introAmount"];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
NSString *currencyCode = [self currencyCode];
|
|
44
|
+
if (currencyCode != nil) {
|
|
45
|
+
[dict setObject:currencyCode forKey:@"currencyCode"];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
NSString *currencySymbol = [self currencySymbol];
|
|
49
|
+
if (currencySymbol != nil) {
|
|
50
|
+
[dict setObject:currencySymbol forKey:@"currencySymbol"];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
NSString *period = [self localizedPeriodWithLanguage:nil];
|
|
54
|
+
if (period != nil) {
|
|
55
|
+
[dict setObject:period forKey:@"period"];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
NSString *introPrice = [self localizedFullIntroductoryPriceWithLanguage:nil];
|
|
59
|
+
if (introPrice != nil) {
|
|
60
|
+
[dict setObject:introPrice forKey:@"introPrice"];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
NSString *introDuration = [self localizedIntroductoryDurationWithLanguage:nil];
|
|
64
|
+
if (introDuration != nil) {
|
|
65
|
+
[dict setObject:introDuration forKey:@"introDuration"];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
NSString *introPeriod = [self localizedIntroductoryPeriodWithLanguage:nil];
|
|
69
|
+
if (introPeriod != nil) {
|
|
70
|
+
[dict setObject:introPeriod forKey:@"introPeriod"];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return dict;
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
@end
|