mawaqit / android-tv-app

Prayer times App for Android TV
https://mawaqit.net
Other
34 stars 15 forks source link

Feat/quran/download #1120

Closed YassinNouh21 closed 1 month ago

YassinNouh21 commented 2 months ago

πŸ“ Summary

**This PR implements the Download Quran feature for issue #1109

Description

This pull request adds the Download Quran feature to the app. The feature allows users to check for updates to the Quran content and download the latest version if available. The implementation follows the business logic and handles various edge cases to ensure a smooth and reliable download process.

Key components of the feature:

  1. DownloadQuranNotifier: Manages the state of the download process and handles the business logic for checking updates, downloading, extracting, and cleaning up.
  2. DownloadQuranRemoteDataSource: Interacts with the remote server to fetch the remote Quran version and download the Quran ZIP file.
  3. DownloadQuranLocalDataSource: Handles local file operations such as saving SVG files, deleting existing files, extracting the ZIP file, and creating directories.
  4. Custom exception classes (QuranException, CancelDownloadException, etc.) to handle specific error scenarios.

The feature includes the following flow:

  1. Check for Quran Update: Compares the local and remote Quran versions to determine if an update is available.
  2. Download Quran: If an update is available and the user chooses to download, the Quran ZIP file is downloaded from the remote server.
  3. Extract Quran: After the download is complete, the ZIP file is extracted, and the old Quran files are deleted.
  4. Cleanup: The downloaded ZIP file is deleted, and the local Quran version is updated.
  5. Error Handling: Various error scenarios are handled gracefully, with appropriate error messages displayed to the user.
  6. Cancellation: The user can cancel the download process at any time, and the app will clean up any incomplete downloads.

The implementation ensures a reliable and user-friendly download experience for updating the Quran content within the app.

Tests

πŸ§ͺ Use case 1

πŸ’¬ Description:

  1. Launch the app and navigate to the Quran download screen.
  2. Check for an available Quran update.
  3. If an update is available, choose to download the update.
  4. Verify that the download progress is displayed correctly.
  5. Wait for the download and extraction process to complete.
  6. Verify that the user is notified of the successful update.
  7. Access the updated Quran content within the app and ensure it matches the latest version.

πŸ“· Screenshots or GIFs (if applicable): [Attach relevant screenshots or GIFs showcasing the feature in action]

πŸ§ͺ Use case 2

πŸ’¬ Description:

  1. Launch the app and navigate to the Quran download screen.
  2. Check for an available Quran update.
  3. If an update is available, choose to download the update.
  4. While the download is in progress, cancel the download.
  5. Verify that the download is stopped, and any partially downloaded files are cleaned up.
  6. Verify that the user is notified that the download has been cancelled.

πŸ“· Screenshots or GIFs (if applicable): [Attach relevant screenshots or GIFs showcasing the cancellation scenario]

Checklist:

YassinNouh21 commented 3 weeks ago

revert