From b0419fd6a9a0421c68d8889e6ccfdd879b9fe56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4ki?= Date: Mon, 25 Nov 2024 15:59:56 +0200 Subject: [PATCH] Rename Vuex store attributes and methods The "background" update originally referred to the periodic updates, i.e. not the update that happens on splash screen and shows the progress to user. The Vuex state is now shared between the background updates and user triggered manual updates that show a lightweight status reporting, so the naming was bit misleading. --- src/components/ModListUpdateBanner.vue | 6 +++--- src/components/mixins/UtilityMixin.vue | 6 +++--- .../settings-components/SettingsView.vue | 8 ++++---- src/store/modules/TsModsModule.ts | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/ModListUpdateBanner.vue b/src/components/ModListUpdateBanner.vue index b87d0e142..8b90d12d9 100644 --- a/src/components/ModListUpdateBanner.vue +++ b/src/components/ModListUpdateBanner.vue @@ -18,7 +18,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) { } get isUpdateInProgress(): boolean { - return this.$store.state.tsMods.isBackgroundUpdateInProgress; + return this.$store.state.tsMods.isThunderstoreModListUpdateInProgress; } @Watch('isUpdateInProgress') @@ -34,7 +34,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) { return; } - this.$store.commit('tsMods/startBackgroundUpdate'); + this.$store.commit('tsMods/startThunderstoreModListUpdate'); this.updateError = ''; try { @@ -48,7 +48,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) { } catch (e) { this.updateError = `${e}`; } finally { - this.$store.commit('tsMods/finishBackgroundUpdate'); + this.$store.commit('tsMods/finishThunderstoreModListUpdate'); } } } diff --git a/src/components/mixins/UtilityMixin.vue b/src/components/mixins/UtilityMixin.vue index f4d023a6a..00bac8e53 100644 --- a/src/components/mixins/UtilityMixin.vue +++ b/src/components/mixins/UtilityMixin.vue @@ -59,12 +59,12 @@ export default class UtilityMixin extends Vue { return; } - if (this.$store.state.tsMods.isBackgroundUpdateInProgress) { + if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { return; } try { - this.$store.commit("tsMods/startBackgroundUpdate"); + this.$store.commit("tsMods/startThunderstoreModListUpdate"); await this.refreshThunderstoreModList(); } catch (e) { if (this.tsBackgroundRefreshFailed) { @@ -75,7 +75,7 @@ export default class UtilityMixin extends Vue { this.tsBackgroundRefreshFailed = true; return; } finally { - this.$store.commit("tsMods/finishBackgroundUpdate"); + this.$store.commit("tsMods/finishThunderstoreModListUpdate"); } this.tsBackgroundRefreshFailed = false; diff --git a/src/components/settings-components/SettingsView.vue b/src/components/settings-components/SettingsView.vue index 7e776ec2b..48ad9f642 100644 --- a/src/components/settings-components/SettingsView.vue +++ b/src/components/settings-components/SettingsView.vue @@ -299,7 +299,7 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; 'Refresh online mod list', 'Check for any new mod releases.', async () => { - if (this.$store.state.tsMods.isBackgroundUpdateInProgress) { + if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { return "Checking for new releases"; } if (this.$store.state.tsMods.connectionError.length > 0) { @@ -312,11 +312,11 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; }, 'fa-exchange-alt', async () => { - if (this.$store.state.tsMods.isBackgroundUpdateInProgress) { + if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { return; } - this.$store.commit("tsMods/startBackgroundUpdate"); + this.$store.commit("tsMods/startThunderstoreModListUpdate"); this.$store.commit("tsMods/setConnectionError", ""); try { @@ -324,7 +324,7 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; } catch (e) { this.$store.commit("tsMods/setConnectionError", e); } finally { - this.$store.commit("tsMods/finishBackgroundUpdate"); + this.$store.commit("tsMods/finishThunderstoreModListUpdate"); } } ), diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 754e0bb47..1b0c6321c 100644 --- a/src/store/modules/TsModsModule.ts +++ b/src/store/modules/TsModsModule.ts @@ -22,7 +22,7 @@ interface State { connectionError: string; deprecated: Map; exclusions?: string[]; - isBackgroundUpdateInProgress: boolean; + isThunderstoreModListUpdateInProgress: boolean; mods: ThunderstoreMod[]; modsLastUpdated?: Date; } @@ -54,8 +54,8 @@ export const TsModsModule = { deprecated: new Map(), /*** Packages available through API that should be ignored by the manager */ exclusions: undefined, - /*** Mod list is automatically and periodically updated in the background */ - isBackgroundUpdateInProgress: false, + /*** Mod list is updated from the API automatically and by user action */ + isThunderstoreModListUpdateInProgress: false, /*** All mods available through API for the current active game */ mods: [], /*** When was the mod list last refreshed from the API? */ @@ -128,8 +128,8 @@ export const TsModsModule = { clearModCache(state) { state.cache.clear(); }, - finishBackgroundUpdate(state) { - state.isBackgroundUpdateInProgress = false; + finishThunderstoreModListUpdate(state) { + state.isThunderstoreModListUpdateInProgress = false; }, setConnectionError(state, error: string|unknown) { if (typeof error === 'string') { @@ -148,8 +148,8 @@ export const TsModsModule = { setExclusions(state, payload: string[]) { state.exclusions = payload; }, - startBackgroundUpdate(state) { - state.isBackgroundUpdateInProgress = true; + startThunderstoreModListUpdate(state) { + state.isThunderstoreModListUpdateInProgress = true; }, updateDeprecated(state, allMods: ThunderstoreMod[]) { state.deprecated = Deprecations.getDeprecatedPackageMap(allMods);