This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ayanova",
|
"name": "ayanova",
|
||||||
"version": "8.0.0-alpha.25",
|
"version": "8.0.0-alpha.29",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
|
|||||||
@@ -10,11 +10,7 @@
|
|||||||
https://github.com/vuetifyjs/vuetify/issues/9607
|
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-navigation-drawer
|
||||||
v-if="isAuthenticated"
|
v-if="isAuthenticated"
|
||||||
v-model="drawer"
|
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
|
//https://medium.com/@dougallrich/give-users-control-over-app-updates-in-vue-cli-3-pwas-20453aedc1f2
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
registration: null,
|
registration: null,
|
||||||
updateExists: false
|
updateExists: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
//pwa update
|
//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 });
|
document.addEventListener("swUpdated", this.showRefreshUI, { once: true });
|
||||||
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
||||||
if (this.refreshing) return;
|
if (this.refreshing) return;
|
||||||
@@ -402,9 +399,24 @@ export default {
|
|||||||
return this.$store.state.newNotificationCount;
|
return this.$store.state.newNotificationCount;
|
||||||
},
|
},
|
||||||
//PWA update
|
//PWA update
|
||||||
showRefreshUI(e) {
|
async showRefreshUI(e) {
|
||||||
this.registration = e.detail;
|
this.registration = e.detail;
|
||||||
this.updateExists = true;
|
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() {
|
refreshApp() {
|
||||||
this.updateExists = false;
|
this.updateExists = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default {
|
export default {
|
||||||
version: "8.0.0-alpha.25",
|
version: "8.0.0-alpha.29",
|
||||||
copyright: "© 1999-2020, Ground Zero Tech-Works Inc."
|
copyright: "© 1999-2020, Ground Zero Tech-Works Inc."
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -231,7 +231,8 @@ export default {
|
|||||||
"TimeSpanHours",
|
"TimeSpanHours",
|
||||||
"TimeSpanMinutes",
|
"TimeSpanMinutes",
|
||||||
"TimeSpanSeconds",
|
"TimeSpanSeconds",
|
||||||
"DirectNotification"
|
"DirectNotification",
|
||||||
|
"UpdateAvailable"
|
||||||
],
|
],
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user