diff --git a/package.json b/package.json
index 5811d1a59..26273cc14 100644
--- a/package.json
+++ b/package.json
@@ -41,8 +41,8 @@
"com.foxdebug.acode.rk.plugin.plugincontext": {},
"cordova-plugin-system": {},
"com.foxdebug.acode.rk.auth": {},
- "com.foxdebug.acode.rk.exec.proot": {},
- "cordova-plugin-iap": {}
+ "cordova-plugin-iap": {},
+ "com.foxdebug.acode.rk.exec.proot": {}
},
"platforms": [
"android"
diff --git a/src/lib/config.js b/src/lib/config.js
index a34d196a9..6e10c27ba 100644
--- a/src/lib/config.js
+++ b/src/lib/config.js
@@ -1,7 +1,7 @@
const BASE_URL = "https://acode.app";
let hasPro = false;
-export default {
+const config = {
BASE_URL,
SUPPORTED_EDITOR: "cm",
FILE_NAME_REGEX: /^((?![:<>"\\\|\?\*]).)*$/,
@@ -21,9 +21,11 @@ export default {
CUSTOM_THEME: 'body[theme="custom"]',
FEEDBACK_EMAIL: "acode@foxdebug.com",
ERUDA_CDN: "https://cdn.jsdelivr.net/npm/eruda",
+
get PLAY_STORE_URL() {
return `https://play.google.com/store/apps/details?id=${BuildInfo.packageName}`;
},
+
API_BASE: `${BASE_URL}/api`,
SKU_LIST: ["crystal", "bronze", "silver", "gold", "platinum", "titanium"],
LOG_FILE_NAME: "Acode.log",
@@ -36,12 +38,31 @@ export default {
TWITTER_URL: "https://x.com/foxbiz_io",
INSTAGRAM_URL: "https://www.instagram.com/foxbiz.io/",
FOXBIZ_URL: "https://foxbiz.io",
- IAP_AVAILABLE: typeof iap !== "undefined",
+
+ //assume playstore build until proven otherwise
+ IAP_AVAILABLE: true,
get HAS_PRO() {
return hasPro;
},
+
set HAS_PRO(value) {
hasPro = value;
},
};
+
+system.getInstaller(
+ (installer) => {
+ config.IAP_AVAILABLE =
+ typeof iap !== "undefined" &&
+ installer != null &&
+ installer !== "null" &&
+ installer === "com.android.vending";
+ },
+ (error) => {
+ console.error(error);
+ config.IAP_AVAILABLE = true;
+ },
+);
+
+export default config;
diff --git a/src/pages/plugin/plugin.js b/src/pages/plugin/plugin.js
index 88fc2f688..eb6112184 100644
--- a/src/pages/plugin/plugin.js
+++ b/src/pages/plugin/plugin.js
@@ -5,6 +5,7 @@ import alert from "dialogs/alert";
import loader from "dialogs/loader";
import purchaseListener from "handlers/purchase";
import actionStack from "lib/actionStack";
+import auth from "lib/auth";
import config from "lib/config";
import installPlugin from "lib/installPlugin";
import InstallState from "lib/installState";
diff --git a/src/pages/plugin/plugin.view.js b/src/pages/plugin/plugin.view.js
index 503537643..c0eb3a35e 100644
--- a/src/pages/plugin/plugin.view.js
+++ b/src/pages/plugin/plugin.view.js
@@ -9,6 +9,7 @@ import alert from "dialogs/alert";
import DOMPurify from "dompurify";
import Ref from "html-tag-js/ref";
import actionStack from "lib/actionStack";
+import auth from "lib/auth";
import config from "lib/config";
import helpers from "utils/helpers";
import Url from "utils/Url";
@@ -271,6 +272,7 @@ function handleTabClick(e) {
}
function Buttons({
+ id,
name,
isPaid,
installed,
@@ -283,6 +285,29 @@ function Buttons({
minVersionCode,
isSupported = true,
}) {
+ async function openPluginWebsite() {
+ try {
+ const user = await auth.getLoggedInUser();
+ if (!user) {
+ CustomTabs.open(
+ `${config.BASE_URL}/login?redirect=app`,
+ { showTitle: true },
+ () => {},
+ () => {},
+ );
+ return;
+ }
+
+ CustomTabs.open(
+ `${config.BASE_URL}/plugin/${id}`,
+ { showTitle: true },
+ () => {},
+ () => {},
+ );
+ } catch (e) {
+ console.error(e);
+ }
+ }
if (!isSupported) {
return (
+
+ {price}
+
+ );
+ }
+
if (isPaid && !purchased && price) {
return (