This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ayanova",
|
||||
"version": "8.0.0-alpha.25",
|
||||
"version": "8.0.0-alpha.29",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
||||
@@ -10,11 +10,7 @@
|
||||
https://github.com/vuetifyjs/vuetify/issues/9607
|
||||
|
||||
-->
|
||||
<template>
|
||||
<button v-if="updateExists" @click="refreshApp">
|
||||
New version available! Click to update
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<v-navigation-drawer
|
||||
v-if="isAuthenticated"
|
||||
v-model="drawer"
|
||||
@@ -279,11 +275,12 @@ export default {
|
||||
//https://medium.com/@dougallrich/give-users-control-over-app-updates-in-vue-cli-3-pwas-20453aedc1f2
|
||||
refreshing: false,
|
||||
registration: null,
|
||||
updateExists: false
|
||||
updateExists: true
|
||||
};
|
||||
},
|
||||
created() {
|
||||
//pwa update
|
||||
//https://medium.com/@dougallrich/give-users-control-over-app-updates-in-vue-cli-3-pwas-20453aedc1f2
|
||||
document.addEventListener("swUpdated", this.showRefreshUI, { once: true });
|
||||
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
||||
if (this.refreshing) return;
|
||||
@@ -402,9 +399,24 @@ export default {
|
||||
return this.$store.state.newNotificationCount;
|
||||
},
|
||||
//PWA update
|
||||
showRefreshUI(e) {
|
||||
async showRefreshUI(e) {
|
||||
this.registration = e.detail;
|
||||
this.updateExists = true;
|
||||
|
||||
//Ok, if not logged in just force the update immediately
|
||||
if (!this.isAuthenticated) {
|
||||
this.refreshApp();
|
||||
return;
|
||||
}
|
||||
|
||||
//User is logged in offer to update in a dialog with translated text
|
||||
let dialogResult = await window.$gz.dialog.confirmGeneric(
|
||||
"UpdateAvailable"
|
||||
);
|
||||
if (dialogResult == false) {
|
||||
return;
|
||||
}
|
||||
this.refreshApp();
|
||||
},
|
||||
refreshApp() {
|
||||
this.updateExists = false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default {
|
||||
version: "8.0.0-alpha.25",
|
||||
version: "8.0.0-alpha.29",
|
||||
copyright: "© 1999-2020, Ground Zero Tech-Works Inc."
|
||||
};
|
||||
|
||||
@@ -231,7 +231,8 @@ export default {
|
||||
"TimeSpanHours",
|
||||
"TimeSpanMinutes",
|
||||
"TimeSpanSeconds",
|
||||
"DirectNotification"
|
||||
"DirectNotification",
|
||||
"UpdateAvailable"
|
||||
],
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user