Skip to content

Commit 1723765

Browse files
feat: added installer check
1 parent d30612c commit 1723765

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

src/lib/config.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const BASE_URL = "https://acode.app";
22
let hasPro = false;
33

4-
export default {
4+
const config = {
55
BASE_URL,
66
SUPPORTED_EDITOR: "cm",
77
FILE_NAME_REGEX: /^((?![:<>"\\\|\?\*]).)*$/,
@@ -21,9 +21,11 @@ export default {
2121
CUSTOM_THEME: 'body[theme="custom"]',
2222
FEEDBACK_EMAIL: "acode@foxdebug.com",
2323
ERUDA_CDN: "https://cdn.jsdelivr.net/npm/eruda",
24+
2425
get PLAY_STORE_URL() {
2526
return `https://play.google.com/store/apps/details?id=${BuildInfo.packageName}`;
2627
},
28+
2729
API_BASE: `${BASE_URL}/api`,
2830
SKU_LIST: ["crystal", "bronze", "silver", "gold", "platinum", "titanium"],
2931
LOG_FILE_NAME: "Acode.log",
@@ -36,12 +38,29 @@ export default {
3638
TWITTER_URL: "https://x.com/foxbiz_io",
3739
INSTAGRAM_URL: "https://www.instagram.com/foxbiz.io/",
3840
FOXBIZ_URL: "https://foxbiz.io",
39-
IAP_AVAILABLE: typeof iap !== "undefined",
41+
42+
//assume playstore build until proven otherwise
43+
IAP_AVAILABLE: true,
4044

4145
get HAS_PRO() {
4246
return hasPro;
4347
},
48+
4449
set HAS_PRO(value) {
4550
hasPro = value;
4651
},
4752
};
53+
54+
system.getInstaller(
55+
(installer) => {
56+
config.IAP_AVAILABLE =
57+
typeof iap !== "undefined" && installer != null && installer !== "null" &&
58+
installer === "com.android.vending";
59+
},
60+
(error) => {
61+
console.error(error);
62+
config.IAP_AVAILABLE = true;
63+
}
64+
)
65+
66+
export default config;

0 commit comments

Comments
 (0)