Better handling of skip onboarding setting

This commit is contained in:
Lucas Verney 2018-08-01 11:35:49 +02:00
parent 54eb950a80
commit aca68fb2e3
4 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import i18n from '@/i18n';
import { import {
INTRO_WAS_SEEN, INTRO_WAS_SEEN,
INTRO_WAS_UNSEEN,
IS_DONE_LOADING, IS_DONE_LOADING,
IS_LOADING, IS_LOADING,
PUSH_REPORT, PUSH_REPORT,
@ -82,6 +83,10 @@ export function markIntroAsSeen({ commit }) {
return commit(INTRO_WAS_SEEN); return commit(INTRO_WAS_SEEN);
} }
export function unmarkIntroAsSeen({ commit }) {
return commit(INTRO_WAS_UNSEEN);
}
export function setCurrentMapCenter({ commit, state }, { center }) { export function setCurrentMapCenter({ commit, state }, { center }) {
if (state.map.center.some((item, index) => item !== center[index])) { if (state.map.center.some((item, index) => item !== center[index])) {
commit(SET_CURRENT_MAP_CENTER, { center }); commit(SET_CURRENT_MAP_CENTER, { center });

View File

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

View File

@ -126,6 +126,9 @@ export const mutations = {
[types.INTRO_WAS_SEEN](state) { [types.INTRO_WAS_SEEN](state) {
state.hasGoneThroughIntro = true; state.hasGoneThroughIntro = true;
}, },
[types.INTRO_WAS_UNSEEN](state) {
state.hasGoneThroughIntro = false;
},
[types.IS_DONE_LOADING](state) { [types.IS_DONE_LOADING](state) {
state.isLoading = false; state.isLoading = false;
}, },

View File

@ -83,6 +83,7 @@ export default {
}, },
set(skipOnboarding) { set(skipOnboarding) {
this.$store.dispatch('setSetting', { setting: 'skipOnboarding', value: skipOnboarding }); this.$store.dispatch('setSetting', { setting: 'skipOnboarding', value: skipOnboarding });
this.$store.dispatch('unmarkIntroAsSeen');
}, },
}, },
tileServer: { tileServer: {