-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: Download the whole quran suwar and quran single surah #1194
Closed
YassinNouh21
wants to merge
87
commits into
feat/quran/quran_main
from
feat/quran/download_audio_surah
Closed
feat: Download the whole quran suwar and quran single surah #1194
YassinNouh21
wants to merge
87
commits into
feat/quran/quran_main
from
feat/quran/download_audio_surah
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…er`, `json_serializable`
…orage, add `QuranRemoteDataSource` to handle remote
… of the quran feature
# Conflicts: # lib/l10n/intl_en.arb # lib/main.dart # lib/src/const/constants.dart
… following paths `assets/img/quran/` `assets/icon/`
- Added `QuranBackground` widget to provide a consistent background with image and gradient.
1. **Quran Notifier**: - Introduced a new method `getSuwarByReciter` in `QuranNotifier` to fetch the list of Surahs filtered by the selected reciter. - Enhanced error handling and state management for fetching Surahs based on the selected reciter. 2. **Reciter Selection Screen**: - Updated the `ReciterSelectionScreen` to use the new `QuranBackground` widget. - Improved the layout and user interaction for selecting reciters and recitation types. - Integrated keyboard navigation for better accessibility. 3. **Quran Player**: - Added a new `QuranPlayerScreen` to provide a dedicated player interface for Quran recitations. - Implemented a `SeekBar` and player controls for managing playback. - Enhanced playback state management with `QuranAudioPlayerState` and `QuranAudioPlayerNotifier`. 4. **Data Source and Repository**: - Added `ReciteRemoteDataSource` and `ReciteLocalDataSource` for managing reciter data. - Introduced `ReciteImpl` as the implementation of `ReciteRepository` for handling reciter-related operations. 5. **Hive Integration**: - Registered Hive adapters for `ReciterModel` and `MoshafModel` to support local data storage.
**Changes:** 1. **lib/src/pages/quran/widget/quran_background.dart** - Wrapped `Scaffold` in a `SafeArea` widget to ensure content is displayed within the safe area of the screen. - Adjusted the structure to consistently use `SafeArea` for both cases when `appBar` is present or not. 2. **lib/src/pages/quran/widget/side_menu.dart** - Imported `sizer` package for responsive layout adjustments. - Modified `width` to use `Sizer` package's percentage width (`18.w`). - Added `BoxConstraints` to set minimum and maximum width for better responsiveness. 3. **lib/src/pages/quran/page/surah_selection_screen.dart** - Added `AppBar` within `QuranBackground` with transparent background and responsive font size using `sizer` package. - Adjusted padding and grid layout within `QuranBackground` to use `Sizer` for dynamic sizing. - Moved the `SideMenu` widget inside the `quranState.when` method for better state management. 4. **lib/src/pages/quran/page/quran_player_screen.dart** - Tweaked the `SliderTheme` to remove unnecessary properties and adjusted `thumbShape` size. - Adjusted font sizes in `Row` displaying position and duration using `sizer` package. - Removed redundant `SizedBox` height adjustments. 5. **lib/src/pages/quran/page/reciter_selection_screen.dart** - Adjusted `sizeOfContainerReciter` for better responsive behavior. - Introduced navigation buttons for scrolling through the reciter list. - Enhanced `_reciterCard` to use `Sizer` for size adjustments. - Improved the `_buildReciterListShimmer` and grid layout for better responsiveness. 6. **lib/src/pages/quran/widget/surah_card.dart** - Adjusted `borderRadius` for `Container` to a more uniform value. - Updated text font size within `SurahCard` to use `sizer` package for responsiven
…ranFavoriteImpl` - Add QuranFavoriteRepository interface for managing favorite reciters and surahs - Implement QuranFavoriteImpl repository using QuranFavoriteLocalDataSource and ReciteLocalDataSource - Create QuranFavoriteLocalDataSource for persisting favorite data using Hive
…avorite state Provide methods to save and retrieve favorite reciters and surahs
- Updated `SurahCard` widget to support favorite functionality: - Converted `SurahCard` to `ConsumerStatefulWidget`. - Added favorite button with `onFavoriteTap` callback. - Introduced `_isFocused` state to manage favorite state UI. - Improved visual feedback for favorite state. - Enhanced `SurahSelectionScreen`: - Added initialization to fetch favorite surahs on screen load. - Integrated `quranFavoriteNotifierProvider` to manage favorite surahs. - Added `reciterId` and `riwayatId` parameters to `SurahSelectionScreen`. - Modified `ReciterSelectionScreen`: - Added `reciterId` and `riwayatId` parameters to navigate to `SurahSelectionScreen`. - Included `onSelected` callback in `ReciterListView` for selection feedback. - Updated repository and data source implementations: - Modified `QuranFavoriteRepository` and `QuranFavoriteLocalDataSource` to use `riwayatId` instead of `riwayat`. - Enhanced methods to support the new favorite functionality. - Included logs for better debugging. - Adjusted `QuranFavoriteNotifier`: - Added methods to save and fetch favorite surahs. - Included state management for favorite operations. - Enhanced `ReciterListView`: - Added `onSelected` callback to manage reciter selection. - Updated Hive data model: - Modified `QuranFavoriteLocalDataSource` to use `QuranReciterFavoriteModel` for managing favorite surahs.
…and prioritize favorite Surahs. - Removed the shade effect from Surah cards when focused. - Implemented a feature to remove bookmarks from Surahs. - Added functionality to prioritize favorite Surahs by listing them at the top of the Surah selection screen.
- Added `audio_file_model.dart` to define the AudioFileModel with JSON serialization support using Dart Mappable. - Updated `reciter_local_data_source.dart` to handle saving and retrieving audio files locally: - Added `saveAudioFile` method to save audio files to local storage. - Added `getAudioFilePath` method to retrieve file paths of locally stored audio files. - Imported necessary packages (`path`, `path_provider`, `dart:io`). - Updated `reciter_remote_data_source.dart` to handle downloading audio files from remote sources: - Added `downloadAudioFile` method to download audio files using Dio. - Added new exceptions in `recite_exception.dart` to handle audio file-related errors: - `FetchAudioFileFailedException`, `SaveAudioFileException`, `FetchAudioFileException`, and `AudioFileNotFoundInCacheException`.
- Add local audio file playback capability - Implement surah download functionality - Add checks for downloaded surah status - Improve audio player state management - Enhance connectivity handling for playback - Refactor audio file downloading to use isolates - Update UI to reflect download status and playback options - Fix various bugs and improve error handling
- Implement debounce mechanism to prevent multiple page pushes when spamming in UI - Enhance offline mode handling in QuranAudioPlayer - Refactor audio source initialization for better reliability - Add playlist refresh functionality after downloading new audio - Improve state management for player controls (next/previous)
…te more about the list
- Add downloadAllSuwar method to QuranAudioPlayer for batch downloading - Update SurahSelectionScreen to use the new batch download functionality - Refactor download button in SurahSelectionScreen to use whenOrNull for better null safety - Pass ReciterModel and MoshafModel to SurahSelectionScreen for more context - Remove local download methods from SurahSelectionScreen - Update ReciterSelectionScreen to pass new required parameters to SurahSelectionScreen
- Add DownloadStatus enum to track download states - Extend DownloadAudioQuranState to include download status - Update DownloadStateNotifier with methods to set and reset download status - Modify QuranAudioPlayer to handle batch downloads and update status - Update SurahSelectionScreen to show download progress and status - Add toast notifications for download completion and no new downloads - Implement Riverpod listener for download status changes - Add new localization strings for download status messages - Disable download button while downloads are in progress
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
This PR implements several enhancements and new features for the Quran audio player and reading functionality.
Description
DownloadAudioQuranNotifier
and state managementKey Changes:
QuranFavoriteNotifier
andQuranFavoriteState
for managing favorite reciters and surahsTests
🧪 Use case 1: Favorite Reciters
💬 Description:
Users can now mark reciters as favorites and easily access them in a separate section.
🧪 Use case 2: Batch Download
💬 Description:
Users can download all Surahs for offline listening with progress tracking.
🧪 Use case 3: Improved Navigation
💬 Description:
Enhanced navigation in Quran player and reading screens with new UI elements.
Checklist: