Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show IndexedDB-related operations on Splash screen's progress bar #1276

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading