Vibrate at opening of the Map rather than upon leaving Onboarding, ensure the notification should be displayed and seen by user
This commit is contained in:
parent
0b086c2fce
commit
77433bcab5
@ -5,6 +5,7 @@ import * as constants from '@/constants';
|
|||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
HAS_VIBRATED_ONCE,
|
||||||
INTRO_WAS_SEEN,
|
INTRO_WAS_SEEN,
|
||||||
INTRO_WAS_UNSEEN,
|
INTRO_WAS_UNSEEN,
|
||||||
IS_DONE_LOADING,
|
IS_DONE_LOADING,
|
||||||
@ -91,6 +92,10 @@ export function setSetting({ commit }, { setting, value }) {
|
|||||||
return commit(SET_SETTING, { setting, value });
|
return commit(SET_SETTING, { setting, value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function markHasVibratedOnce({ commit }) {
|
||||||
|
return commit(HAS_VIBRATED_ONCE);
|
||||||
|
}
|
||||||
|
|
||||||
export function markIntroAsSeen({ commit }) {
|
export function markIntroAsSeen({ commit }) {
|
||||||
return commit(INTRO_WAS_SEEN);
|
return commit(INTRO_WAS_SEEN);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
export const HAS_VIBRATED_ONCE = 'HAS_VIBRATED_ONCE';
|
||||||
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 INTRO_WAS_UNSEEN = 'INTRO_WAS_UNSEEN';
|
||||||
export const IS_DONE_LOADING = 'IS_DONE_LOADING';
|
export const IS_DONE_LOADING = 'IS_DONE_LOADING';
|
||||||
|
@ -84,6 +84,7 @@ if (storageAvailable('localStorage')) {
|
|||||||
|
|
||||||
export const initialState = {
|
export const initialState = {
|
||||||
hasGoneThroughIntro: false,
|
hasGoneThroughIntro: false,
|
||||||
|
hasVibratedOnce: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
location: {
|
location: {
|
||||||
error: null,
|
error: null,
|
||||||
@ -120,6 +121,9 @@ export const initialState = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
|
[types.HAS_VIBRATED_ONCE](state) {
|
||||||
|
state.hasVibratedOnce = true;
|
||||||
|
},
|
||||||
[types.INTRO_WAS_SEEN](state) {
|
[types.INTRO_WAS_SEEN](state) {
|
||||||
state.hasGoneThroughIntro = true;
|
state.hasGoneThroughIntro = true;
|
||||||
},
|
},
|
||||||
|
@ -222,6 +222,15 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$store.state.location.error = 1;
|
this.$store.state.location.error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Eventually vibrate, to ensure permission is prompted before cycling
|
||||||
|
if (this.$store.state.settings.hasVibratePermission
|
||||||
|
&& navigator.vibrate
|
||||||
|
&& !this.$store.state.hasVibratedOnce
|
||||||
|
) {
|
||||||
|
navigator.vibrate(100);
|
||||||
|
this.$store.dispatch('markHasVibratedOnce');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$store.dispatch('fetchReports').catch(() => {});
|
this.$store.dispatch('fetchReports').catch(() => {});
|
||||||
},
|
},
|
||||||
|
@ -65,11 +65,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goToMap() {
|
goToMap() {
|
||||||
// Eventually vibrate, to ensure permission is prompted before driving
|
|
||||||
if (this.$store.state.settings.hasVibratePermission && navigator.vibrate) {
|
|
||||||
navigator.vibrate(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$store.state.settings.skipOnboarding) {
|
if (!this.$store.state.settings.skipOnboarding) {
|
||||||
this.$store.dispatch('setSetting', { setting: 'skipOnboarding', value: true });
|
this.$store.dispatch('setSetting', { setting: 'skipOnboarding', value: true });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user