Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
"com.foxdebug.acode.rk.customtabs": {},
"com.foxdebug.acode.rk.plugin.plugincontext": {},
"cordova-plugin-system": {},
"com.foxdebug.acode.rk.auth": {},
"com.foxdebug.acode.rk.exec.proot": {},
"cordova-plugin-iap": {}
"com.foxdebug.acode.rk.auth": {}
},
"platforms": [
"android"
Expand Down Expand Up @@ -72,7 +70,6 @@
"babel-loader": "^10.0.0",
"com.foxdebug.acode.rk.auth": "file:src/plugins/auth",
"com.foxdebug.acode.rk.customtabs": "file:src/plugins/custom-tabs",
"com.foxdebug.acode.rk.exec.proot": "file:src/plugins/proot",
"com.foxdebug.acode.rk.exec.terminal": "file:src/plugins/terminal",
"com.foxdebug.acode.rk.plugin.plugincontext": "file:src/plugins/pluginContext",
"cordova-android": "^15.0.0",
Expand All @@ -83,7 +80,6 @@
"cordova-plugin-device": "^2.1.0",
"cordova-plugin-file": "^8.1.3",
"cordova-plugin-ftp": "file:src/plugins/ftp",
"cordova-plugin-iap": "file:src/plugins/iap",
"cordova-plugin-sdcard": "file:src/plugins/sdcard",
"cordova-plugin-server": "file:src/plugins/server",
"cordova-plugin-sftp": "file:src/plugins/sftp",
Expand Down
2 changes: 2 additions & 0 deletions src/pages/plugin/plugin.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import "./plugin.scss";

Check failure on line 1 in src/pages/plugin/plugin.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import fsOperation from "fileSystem";
import Page from "components/page";
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";
Expand Down Expand Up @@ -252,6 +253,7 @@
const oldText = $button.textContent;

try {

if (!product) throw new Error("Product not found");
const apiStatus = await helpers.checkAPIStatus();

Expand Down
34 changes: 34 additions & 0 deletions src/pages/plugin/plugin.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -271,6 +272,7 @@ function handleTabClick(e) {
}

function Buttons({
id,
name,
isPaid,
installed,
Expand All @@ -283,6 +285,25 @@ function Buttons({
minVersionCode,
isSupported = true,
}) {
async function openPluginWebsite() {
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 },
() => {},
() => {},
);
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.
if (!isSupported) {
return (
<div
Expand Down Expand Up @@ -346,6 +367,19 @@ function Buttons({
);
}

if (!config.IAP_AVAILABLE && isPaid && !purchased && price) {
return (
<button
data-type="buy"
className="btn btn-install"
onclick={openPluginWebsite}
>
<i className="icon open_in_browser"></i>
{price}
</button>
);
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.

if (isPaid && !purchased && price) {
return (
<button data-type="buy" className="btn btn-install" onclick={buy}>
Expand Down
23 changes: 22 additions & 1 deletion src/sidebarApps/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import alert from "dialogs/alert";
import prompt from "dialogs/prompt";
import select from "dialogs/select";
import purchaseListener from "handlers/purchase";
import auth from "lib/auth";
import config from "lib/config";
import InstallState from "lib/installState";
import loadPlugin from "lib/loadPlugin";
Expand Down Expand Up @@ -772,6 +773,27 @@ function ListItem({ icon, name, id, version, downloads, installed, source }) {
});

const isPaid = remotePlugin.price > 0;
if (isPaid && !config.IAP_AVAILABLE) {
const user = await auth.getLoggedInUser();
if (!user) {
CustomTabs.open(
`${config.BASE_URL}/login?redirect=app`,
{ showTitle: true },
() => {},
() => {},
);
return;
}

CustomTabs.open(
`${config.BASE_URL}/plugin/${remotePlugin.id}`,
{ showTitle: true },
() => {},
() => {},
);
return;
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.

if (isPaid) {
[product] = await helpers.promisify(iap.getProducts, [
remotePlugin.sku,
Expand All @@ -781,7 +803,6 @@ function ListItem({ icon, name, id, version, downloads, installed, source }) {
purchaseToken = purchase?.purchaseToken;
}
}

if (isPaid && !purchaseToken) {
if (!product) throw new Error("Product not found");
const apiStatus = await helpers.checkAPIStatus();
Expand Down
Loading