diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts
index c924689a..de577166 100644
--- a/src/store/modules/settings.ts
+++ b/src/store/modules/settings.ts
@@ -11,21 +11,25 @@ export enum OpenTradeVizOptions {
export enum SettingsGetters {
openTradesInTitle = 'openTradesInTitle',
timezone = 'timezone',
+ backgroundSync = 'backgroundSync',
}
export enum SettingsActions {
setOpenTradesInTitle = 'setOpenTradesInTitle',
setTimeZone = 'setTimeZone',
+ setBackgroundSync = 'setBackgroundSync',
}
export enum SettingsMutations {
setOpenTrades = 'setOpenTrades',
setTimeZone = 'setTimeZone',
+ setBackgroundSync = 'setBackgroundSync',
}
export interface SettingsType {
openTradesInTitle: string;
timezone: string;
+ backgroundSync: boolean;
}
function getSettings() {
@@ -37,7 +41,7 @@ function getSettings() {
}
const storedSettings = getSettings();
-function updateSetting(key: string, value: string) {
+function updateSetting(key: string, value: string | boolean) {
const settings = getSettings() || {};
settings[key] = value;
localStorage.setItem(STORE_UI_SETTINGS, JSON.stringify(settings));
@@ -46,18 +50,22 @@ function updateSetting(key: string, value: string) {
const state: SettingsType = {
openTradesInTitle: storedSettings?.openTradesInTitle || OpenTradeVizOptions.showPill,
timezone: storedSettings.timezone || 'UTC',
+ backgroundSync: storedSettings.backgroundSync || true,
};
export default {
namespaced: true,
state,
getters: {
- [SettingsGetters.openTradesInTitle](state) {
+ [SettingsGetters.openTradesInTitle](state): string {
return state.openTradesInTitle;
},
- [SettingsGetters.timezone](state) {
+ [SettingsGetters.timezone](state): string {
return state.timezone;
},
+ [SettingsGetters.backgroundSync](state): boolean {
+ return state.backgroundSync;
+ },
},
mutations: {
[SettingsMutations.setOpenTrades](state, value: string) {
@@ -68,6 +76,10 @@ export default {
state.timezone = timezone;
updateSetting('timezone', timezone);
},
+ [SettingsMutations.setBackgroundSync](state, backgroundSync: boolean) {
+ state.backgroundSync = backgroundSync;
+ updateSetting('backgroundSync', backgroundSync);
+ },
},
actions: {
[SettingsActions.setOpenTradesInTitle]({ commit }, locked: boolean) {
@@ -77,5 +89,8 @@ export default {
setTimezone(timezone);
commit(SettingsMutations.setTimeZone, timezone);
},
+ [SettingsActions.setBackgroundSync]({ commit }, timezone: string) {
+ commit(SettingsMutations.setBackgroundSync, timezone);
+ },
},
};
diff --git a/src/views/Settings.vue b/src/views/Settings.vue
index d1f643a3..56eecb19 100644
--- a/src/views/Settings.vue
+++ b/src/views/Settings.vue
@@ -22,6 +22,9 @@
>
+
+ Background sync
+
@@ -46,10 +49,14 @@ export default class Template extends Vue {
@uiSettingsNs.Getter [SettingsGetters.timezone]: string;
+ @uiSettingsNs.Getter [SettingsGetters.backgroundSync]: boolean;
+
@uiSettingsNs.Action [SettingsActions.setOpenTradesInTitle];
@uiSettingsNs.Action [SettingsActions.setTimeZone];
+ @uiSettingsNs.Action [SettingsActions.setBackgroundSync];
+
openTradesOptions = [
{ value: OpenTradeVizOptions.showPill, text: 'Show pill in icon' },
{ value: OpenTradeVizOptions.asTitle, text: 'Show in title' },
@@ -82,6 +89,14 @@ export default class Template extends Vue {
set layoutLockedLocal(value: boolean) {
this.setLayoutLocked(value);
}
+
+ get backgroundSyncLocal(): boolean {
+ return this.backgroundSync;
+ }
+
+ set backgroundSyncLocal(value: boolean) {
+ this.setBackgroundSync(value);
+ }
}