Skip to content

Commit f1507ff

Browse files
authored
Merge branch 'main' into feat-map-ui
2 parents 5b612c3 + 453b825 commit f1507ff

File tree

7 files changed

+49
-19
lines changed

7 files changed

+49
-19
lines changed

components/settings/SettingsAboutDialog.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,19 @@
5050
<div class="tt-settings__about">
5151
<v-container class="d-flex align-center">
5252
<img
53-
src="https://felixinx.me/wp-content/uploads/2021/11/cropped-Logo-FD-270x270.png"
53+
src="https://www.gravatar.com/avatar/6e45287de1e42819a97f91bfe4477b1f"
5454
width="40px"
5555
height="40px"
56+
class="rounded-circle"
5657
/>
5758
<div class="ml-4">
5859
<!-- eslint-disable -->
5960
<a
60-
href="https://felixinx.me"
61-
class="font-weight-medium text-decoration-none text-body-1"
61+
href="https://read.cv/felixinx"
62+
class="
63+
font-weight-medium
64+
text-decoration-none text-body-1
65+
"
6266
>
6367
<!-- eslint-enable -->
6468
{{ $t('aboutDialog.by') }}
@@ -68,7 +72,7 @@
6872
{{ $t('aboutDialog.contact') }}
6973
<!-- eslint-disable vue/no-v-html -->
7074
<a
71-
href="https://felixinx.me/en/contact-me/"
75+
href="https://docs.google.com/forms/d/e/1FAIpQLSda-86sV12itRXPhLaw-WDDJI38GOSefq_7X006s1YP6pN4eg/viewform?usp=sf_link"
7276
v-html="$t('aboutDialog.contactBtn')"
7377
></a>
7478
<!-- eslint-enable vue/no-v-html -->

i18n/en.js

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ export default {
202202
success: 'Success!',
203203
error: 'Error while installing',
204204
updateAvailable: 'An update is available',
205+
updatePending:
206+
'The update is being installed! When ready, the page will refresh.',
205207
installUpdate: 'Refresh to update now',
206208
},
207209
agenciesTitle: 'Agencies',

i18n/fr.js

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ export default {
198198
success: 'Succès!',
199199
error: "Erreur lors de l'installation",
200200
updateAvailable: 'Une mise à jour est disponible',
201+
updatePending:
202+
"La mise à jour est en cours d'installation! Lorsque prête, la page rafraîchira.",
201203
installUpdate: 'Rafraîchir maintenant',
202204
},
203205
agenciesTitle: 'Agences',

layouts/default.vue

100755100644
Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@
2424
:timeout="-1"
2525
>
2626
<span :class="[settingsDarkMode && 'black--text']">
27-
{{ $t('settings.pwa.updateAvailable') }}
27+
{{
28+
$t(
29+
`settings.pwa.${
30+
updatePending ? 'updatePending' : 'updateAvailable'
31+
}`
32+
)
33+
}}
2834
</span>
2935
<template #action>
3036
<v-btn
37+
v-if="!updatePending"
3138
small
3239
depressed
3340
block
3441
:color="settingsDarkMode ? null : 'primary'"
35-
@click="$store.dispatch('app/installUpdate')"
42+
@click="installUpdate"
3643
>
3744
{{ $t('settings.pwa.installUpdate') }}
3845
</v-btn>
3946
</template>
4047
</v-snackbar>
48+
<script async defer data-website-id="4007fee1-66a9-4b46-92e7-8fed4a802139" data-domains="www.transittracker.ca,transittracker.ca" data-cache="true" src="https://stats.felixinx.me/umami.js"></script>
4149
</v-app>
4250
</template>
4351

@@ -63,6 +71,7 @@ export default {
6371
mdiMenuDown,
6472
mdiTable,
6573
mdiViewGrid,
74+
workbox: null,
6675
}),
6776
head() {
6877
return this.$nuxtI18nHead({ addSeoAttributes: true })
@@ -141,6 +150,9 @@ export default {
141150
this.$store.commit('app/set', { key: 'openDownloadAssistant', value })
142151
},
143152
},
153+
updatePending() {
154+
return this.$store.state.app.updatePending
155+
},
144156
},
145157
mounted() {
146158
this.checkForOldSettings()
@@ -153,7 +165,7 @@ export default {
153165
// Set language only if defined
154166
if (this.settingsLang) this.$i18n.setLocale(this.settingsLang)
155167
156-
this.handleWorkboxEvents()
168+
//this.handleWorkboxEvents()
157169
158170
// Install prompt
159171
window.addEventListener('beforeinstallprompt', (event) => {
@@ -222,23 +234,36 @@ export default {
222234
},
223235
async handleWorkboxEvents() {
224236
// Workbox update
225-
const workbox = await window.$workbox
237+
this.workbox = await window.$workbox
226238
227-
if (!workbox) {
239+
if (!this.workbox) {
228240
return
229241
}
230242
231-
workbox.addEventListener('installed', (event) => {
232-
if (!event.isUpdate) {
233-
return
234-
}
243+
// Occurs when the user accepts the update and the new SW is ready to take control
244+
this.workbox.addEventListener('controlling', () => {
245+
console.log('WB Controlling')
246+
window.location.reload()
247+
})
235248
249+
// The new SW is installing but is waiting for activation
250+
this.workbox.addEventListener('waiting', (event) => {
251+
console.log('WB Waiting')
236252
this.$store.commit('app/set', {
237253
key: 'updateAvailable',
238254
value: true,
239255
})
240256
})
241257
},
258+
installUpdate() {
259+
console.log('WB skip waiting')
260+
this.$store.commit('app/set', {
261+
key: 'updatePending',
262+
value: true,
263+
})
264+
265+
this.workbox.messageSkipWaiting()
266+
},
242267
async verifyNotificationSubscriptionStatus() {
243268
try {
244269
await Notification.requestPermission()

package.json

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@popperjs/core": "^2.11.6",
1919
"@syncfusion/ej2-vue-grids": "^20.3.57",
2020
"animejs": "^3.2.1",
21-
"core-js": "^3.17.2",
21+
"core-js": "^3.25.5",
2222
"dexie": "^3.0.3",
2323
"gtfs-realtime-bindings": "^0.0.6",
2424
"mapbox-gl": "^2.4.1",

store/app.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export const state = () => ({
99
openRegionSwitcher: false,
1010
openSettingsDrawer: false,
1111
openDownloadAssistant: false,
12+
updatePending: false,
13+
notificationsCentre: false,
1214
})
1315

1416
export const mutations = {
@@ -76,9 +78,4 @@ export const actions = {
7678
commit('set', { key: 'installPrompt', value: null })
7779
})
7880
},
79-
installUpdate({ commit }) {
80-
commit('set', { key: 'updateAvailable', value: false })
81-
82-
window.location.reload()
83-
},
8481
}

yarn.lock

100755100644
File mode changed.

0 commit comments

Comments
 (0)