diff --git a/src/components/Map.vue b/src/components/Map.vue index 6b35c28..9fc843e 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -148,7 +148,6 @@ export default { } }, onMoveStart(ev) { - console.log(ev, this.isProgrammaticMove); if (!this.isProgrammaticMove) { this.showRecenterButton(); } diff --git a/src/i18n/en.js b/src/i18n/en.js index 5282719..a58dda6 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -35,6 +35,7 @@ export default { }, settings: { locale: 'Language', + preventSuspend: 'Prevent device from going to sleep', save: 'Save', }, }; diff --git a/src/i18n/fr.js b/src/i18n/fr.js index 0ee57b3..8f5dd3d 100644 --- a/src/i18n/fr.js +++ b/src/i18n/fr.js @@ -12,6 +12,9 @@ export default { fetching: 'En attente de votre position…', unavailable: "Désolé, la géolocalisation n'est pas disponible dans votre navigateur.", }, + intro: { + start: "C'est parti !", + }, menu: { About: 'Aide', Map: 'Carte', @@ -32,6 +35,7 @@ export default { }, settings: { locale: 'Langue', + preventSuspend: "Empêcher l'appareil de passer en veille", save: 'Sauver', }, }; diff --git a/src/views/Map.vue b/src/views/Map.vue index 26082e5..4d38fa0 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -138,8 +138,17 @@ export default { this.accuracy = position.coords.accuracy ? position.coords.accuracy : null; }, setNoSleep() { - this.noSleep = new NoSleep(); - this.noSleep.enable(); + let preventSuspend = localStorage.getItem('preventSuspend'); + if (preventSuspend) { + preventSuspend = JSON.parse(preventSuspend); + } else { + preventSuspend = true; + } + + if (preventSuspend) { + this.noSleep = new NoSleep(); + this.noSleep.enable(); + } }, disableNoSleep() { if (this.noSleep) { diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 76183c1..a414295 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -11,6 +11,11 @@ required > + + {{ $t('settings.save') }} @@ -24,15 +29,23 @@ import { storageAvailable } from '@/tools'; export default { data() { + let preventSuspend = localStorage.getItem('preventSuspend'); + if (preventSuspend) { + preventSuspend = JSON.parse(preventSuspend); + } else { + preventSuspend = true; + } return { i18nItems: Object.keys(messages), i18nSelect: this.$i18n.locale, + preventSuspend, }; }, methods: { submit() { if (storageAvailable('localStorage')) { localStorage.setItem('i18nSetting', this.i18nSelect); + localStorage.setItem('preventSuspend', JSON.stringify(this.preventSuspend)); } this.$i18n.locale = this.i18nSelect; },