From feff02e642ae1fc7f4e18e012928be44a8b2e932 Mon Sep 17 00:00:00 2001 From: Yizack Rangel Date: Fri, 20 Oct 2023 17:06:05 -0500 Subject: [PATCH] feat: installStatus in-app update --- utils/capacitor.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/capacitor.js b/utils/capacitor.js index 396ebd92..322c021c 100644 --- a/utils/capacitor.js +++ b/utils/capacitor.js @@ -116,6 +116,7 @@ class CapacitorPlugins { } if (result.flexibleUpdateAllowed) { await AppUpdate.startFlexibleUpdate(); + await this.showToast(t("downloading_update")); this.addFlexibleListener(); } } @@ -127,15 +128,13 @@ class CapacitorPlugins { addFlexibleListener () { AppUpdate.addListener("onFlexibleUpdateStateChange", async ({ installStatus }) => { switch(installStatus) { - case FlexibleUpdateInstallStatus.DOWNLOADING: - this.showToast(t("downloading_update")); - break; case FlexibleUpdateInstallStatus.DOWNLOADED: await AppUpdate.removeAllListeners(); await this.completeFlexibleUpdate(); break; case FlexibleUpdateInstallStatus.FAILED: this.showToast(t("error_update")); + await AppUpdate.removeAllListeners(); break; } });