Force user to click at least once on a button before showing the map, otherwise NoSleep might not work

This commit is contained in:
Lucas Verney 2018-07-17 16:37:46 +02:00
parent fbe8298814
commit 959cdba36c
6 changed files with 13 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<v-toolbar
app
>
<router-link :to="{ name: 'Onboarding' }" class="noLinkDecoration">
<router-link :to="{ name: 'Map' }" class="noLinkDecoration">
<v-toolbar-title v-text="title" class="ma-0"></v-toolbar-title>
</router-link>
<v-spacer></v-spacer>

View File

@ -4,6 +4,7 @@ import * as api from '@/api';
import i18n from '@/i18n';
import {
INTRO_WAS_SEEN,
IS_LOADING,
IS_DONE_LOADING,
PUSH_REPORT,
@ -56,3 +57,7 @@ export function setLocale({ commit }, { locale }) {
export function setSetting({ commit }, { setting, value }) {
return commit(SET_SETTING, { setting, value });
}
export function markIntroAsSeen({ commit }) {
return commit(INTRO_WAS_SEEN);
}

View File

@ -1,3 +1,4 @@
export const INTRO_WAS_SEEN = 'INTRO_WAS_SEEN';
export const IS_LOADING = 'IS_LOADING';
export const IS_DONE_LOADING = 'IS_DONE_LOADING';
export const PUSH_REPORT = 'PUSH_REPORT';

View File

@ -52,6 +52,7 @@ if (storageAvailable('localStorage')) {
}
export const initialState = {
hasGoneThroughIntro: false,
isLoading: false,
reportDetails: {
id: null,
@ -67,6 +68,9 @@ export const initialState = {
};
export const mutations = {
[types.INTRO_WAS_SEEN](state) {
state.hasGoneThroughIntro = true;
},
[types.IS_LOADING](state) {
state.isLoading = true;
},

View File

@ -52,7 +52,7 @@ export default {
ReportDialog,
},
created() {
if (!this.$store.state.settings.skipOnboarding) {
if (!this.$store.state.hasGoneThroughIntro) {
this.$router.replace({ name: 'Onboarding' });
}
},

View File

@ -55,6 +55,7 @@ export default {
this.hasGeolocationPermission = (result.state === 'granted');
});
}
this.$store.dispatch('markIntroAsSeen');
},
data() {
let step = 0;