Skip to content

Commit

Permalink
Merge pull request #1276 from ebkr/splash-progress
Browse files Browse the repository at this point in the history
Show IndexedDB-related operations on Splash screen's progress bar
  • Loading branch information
anttimaki authored Apr 15, 2024
2 parents 3108fc6 + 446af67 commit a91caab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/components/mixins/SplashMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export default class SplashMixin extends Vue {
return this.requests.reduce((x, y) => x.merge(y));
}
resetRequestProgresses() {
this.requests.forEach((request) => request.setProgress(0));
}
// Get the list of game-specific packages to exclude.
async getExclusions() {
this.loadingText = 'Connecting to GitHub repository';
Expand All @@ -41,7 +45,8 @@ export default class SplashMixin extends Vue {
this.getRequestItem('ExclusionsList').setProgress(progress);
};
await this.$store.dispatch('tsMods/updateExclusions');
await this.$store.dispatch('tsMods/updateExclusions', showProgress);
this.getRequestItem('ExclusionsList').setProgress(100);
}
Expand Down Expand Up @@ -75,7 +80,9 @@ export default class SplashMixin extends Vue {
this.loadingText = 'You may be offline or Thunderstore is unavailabe. Checking cache.';
}
this.getRequestItem('CacheOperations').setProgress(50);
await this.$store.dispatch('tsMods/updateMods');
this.getRequestItem('CacheOperations').setProgress(100);
if (this.$store.state.tsMods.modsLastUpdated === undefined) {
this.heroTitle = 'Failed to get mods from Thunderstore and cache';
Expand Down
7 changes: 3 additions & 4 deletions src/pages/Splash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ export default class Splash extends mixins(SplashMixin) {
requests = [
new RequestItem('UpdateCheck', 0),
new RequestItem('ThunderstoreDownload', 0),
new RequestItem('ExclusionsList', 0)
new RequestItem('ExclusionsList', 0),
new RequestItem('CacheOperations', 0)
];
// Ensure that r2modman isn't outdated.
Expand Down Expand Up @@ -194,9 +195,7 @@ export default class Splash extends mixins(SplashMixin) {
}
retryConnection() {
this.getRequestItem('UpdateCheck').setProgress(0);
this.getRequestItem('ExclusionsList').setProgress(0);
this.getRequestItem('ThunderstoreDownload').setProgress(0);
this.resetRequestProgresses();
this.isOffline = false;
this.checkForUpdates();
}
Expand Down
7 changes: 5 additions & 2 deletions src/store/modules/TsModsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ export const TsModsModule = {
},

actions: <ActionTree<State, RootState>>{
async updateExclusions({commit}) {
const exclusions = await ConnectionProvider.instance.getExclusions();
async updateExclusions(
{commit},
progressCallback?: (progress: number) => void
) {
const exclusions = await ConnectionProvider.instance.getExclusions(progressCallback);
commit('setExclusions', exclusions);
},

Expand Down

0 comments on commit a91caab

Please sign in to comment.