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

Commits on Oct 9, 2024

  1. Configuration menu
    Copy the full SHA
    0e9d8da View commit details
    Browse the repository at this point in the history
  2. Refactor downloading imported mods to work without relying on callbacks

    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
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    f9044c9 View commit details
    Browse the repository at this point in the history