Skip to content

Commit 3155163

Browse files
feat: IAP_AVAILABLE
1 parent de51132 commit 3155163

5 files changed

Lines changed: 18 additions & 4 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
"cordova-plugin-server": {},
3030
"cordova-plugin-ftp": {},
3131
"cordova-plugin-sdcard": {},
32-
"cordova-plugin-iap": {},
3332
"cordova-plugin-advanced-http": {
3433
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
3534
},
3635
"cordova-plugin-websocket": {},
3736
"cordova-plugin-buildinfo": {},
3837
"cordova-plugin-browser": {},
3938
"cordova-plugin-sftp": {},
40-
"com.foxdebug.acode.rk.exec.proot": {},
4139
"com.foxdebug.acode.rk.exec.terminal": {},
4240
"com.foxdebug.acode.rk.customtabs": {},
4341
"com.foxdebug.acode.rk.plugin.plugincontext": {},
4442
"cordova-plugin-system": {},
45-
"com.foxdebug.acode.rk.auth": {}
43+
"com.foxdebug.acode.rk.auth": {},
44+
"com.foxdebug.acode.rk.exec.proot": {},
45+
"cordova-plugin-iap": {}
4646
},
4747
"platforms": [
4848
"android"

src/lib/acode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ export default class Acode {
321321
view: cmView,
322322
});
323323

324+
this.define("config",config);
324325
this.define("Url", Url);
325326
this.define("page", Page);
326327
this.define("Color", Color);

src/lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
TWITTER_URL: "https://x.com/foxbiz_io",
3737
INSTAGRAM_URL: "https://www.instagram.com/foxbiz.io/",
3838
FOXBIZ_URL: "https://foxbiz.io",
39+
IAP_AVAILABLE: typeof iap !== "undefined",
3940

4041
get HAS_PRO() {
4142
return hasPro;

src/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ async function onDeviceReady() {
206206
}
207207

208208
if (navigator.onLine) {
209-
const purchases = await helpers.promisify(iap.getPurchases);
209+
const purchases = await helpers.promisify(iap.getPurchases).catch((e) => {
210+
console.log("error", "purchase retrieval error");
211+
console.log("error", e);
212+
return [];
213+
});
210214
const isPro = purchases.find((p) =>
211215
p.productIds.includes("acode_pro_new"),
212216
);

utils/scripts/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ if [ "$fdroidFlag" = "fdroid" ]; then
4848
if [ -d "plugins/com.foxdebug.acode.rk.exec.proot" ]; then
4949
cordova plugin remove com.foxdebug.acode.rk.exec.proot
5050
fi
51+
52+
if [ -d "plugins/cordova-plugin-iap" ]; then
53+
cordova plugin remove cordova-plugin-iap
54+
fi
5155
else
5256
if [ -n "$tmpdir" ]; then
5357
echo "false" > "$tmpdir/fdroid.bool"
@@ -57,6 +61,10 @@ else
5761
if [ -d "src/plugins/proot" ] && [ ! -d "plugins/com.foxdebug.acode.rk.exec.proot" ]; then
5862
cordova plugin add src/plugins/proot/
5963
fi
64+
65+
if [ -d "src/plugins/iap" ] && [ ! -d "plugins/cordova-plugin-iap" ]; then
66+
cordova plugin add src/plugins/iap/
67+
fi
6068
fi
6169

6270

0 commit comments

Comments
 (0)