Skip to content

Commit

Permalink
feat: installStatus in-app update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed Oct 20, 2023
1 parent f853a84 commit feff02e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions utils/capacitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class CapacitorPlugins {
}
if (result.flexibleUpdateAllowed) {
await AppUpdate.startFlexibleUpdate();
await this.showToast(t("downloading_update"));
this.addFlexibleListener();
}
}
Expand All @@ -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;
}
});
Expand Down

0 comments on commit feff02e

Please sign in to comment.