From e4ac27f75e83c74bf589be1e6e3fc50a224e8d03 Mon Sep 17 00:00:00 2001 From: D-Bao <49440133+D-Bao@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:06:05 +0100 Subject: [PATCH] Fix upgrade button not working --- src/popup/components/AppSettings.vue | 19 +++++++++++-------- src/popup/components/Main.vue | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/popup/components/AppSettings.vue b/src/popup/components/AppSettings.vue index a12c006..22e1544 100644 --- a/src/popup/components/AppSettings.vue +++ b/src/popup/components/AppSettings.vue @@ -207,15 +207,18 @@ export default { }, async upgrade() { if (process.env.MAC) { - console.log("send upgrade event to host app"); - await browser.runtime.sendNativeMessage( - "application.id", - JSON.stringify({ - upgrade: {}, - }) - ); + try { + console.log("send upgrade event to host app"); + await browser.runtime.sendNativeMessage( + "application.id", + JSON.stringify({ + upgrade: {}, + }) + ); + } catch (error) { + console.info("can't send data to native app", error); + } } else { - console.info("can't send data to native app", error); let apiUrl = await SLStorage.get(SLStorage.SETTINGS.API_URL); let upgradeURL = apiUrl + "/dashboard/pricing"; browser.tabs.create({ url: upgradeURL }); diff --git a/src/popup/components/Main.vue b/src/popup/components/Main.vue index 3757036..942a0e9 100644 --- a/src/popup/components/Main.vue +++ b/src/popup/components/Main.vue @@ -525,15 +525,18 @@ export default { async upgrade() { if (process.env.MAC) { - console.log("send upgrade event to host app"); - await browser.runtime.sendNativeMessage( - "application.id", - JSON.stringify({ - upgrade: {}, - }) - ); + try { + console.log("send upgrade event to host app"); + await browser.runtime.sendNativeMessage( + "application.id", + JSON.stringify({ + upgrade: {}, + }) + ); + } catch (error) { + console.info("can't send data to native app", error); + } } else { - console.info("can't send data to native app", error); let upgradeURL = this.apiUrl + "/dashboard/pricing"; browser.tabs.create({ url: upgradeURL }); }