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

Refactor download provider's downloadImportedMods to work with less callbacks #1478

Open
wants to merge 2 commits into
base: importprofilemodal-refactor-pt517
Choose a base branch
from

Conversation

anttimaki
Copy link
Collaborator

No description provided.

ThunderstoreDownloadProvider.downloadImportedMods:

- Drop completedCallback argument and return the comboList on success
  instead
- Rename callback argument to totalProgressCallback for clarity's sake
  and simplify it's signature. The other params are no longer needed
  since the errors aren't handled via the callback anymore

BetterThunderstoreDownloader

- Throw errors instead of reporting them via the callback system. While
  this is now inconsistent with other parts of the code base, the
  simplified error handling is deemed good enough reason to do so
  this simplifies the error handling on call site
- Define singleModProcessCallback internally. This also fixed an
  off-by-one (mod) in the progress percentage calculation, and doesn't
  mark a mod fully processed when it's downloaded, but only when it's
  also saved to disk
- The mods are now downloaded and saved using the internal helper
  methods instead of public downloadAndSave method which was previously
  called via public queueDownloadDependencies. The new functionality
  should be otherwise identical to downloadAndSave, except the steps
  can be awaited separately instead of relying on a callback to save
  the mod to disk

ImportProfileModal.vue

- Use the refactored downloadImportedProfileMods
- Expect errors to be thrown and handle them accordingly
- Drop downloadProgressCallback since a simple oneliner will do now
- Change downloadCompletedCallback to not use callbacks of its own
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants