-
Notifications
You must be signed in to change notification settings - Fork 19
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/ Play adhan and show notification when app is on foreground #1310
base: release-1.19
Are you sure you want to change the base?
Conversation
* fix: Improve Quran Download and Navigation Experience (#1452) * fix: Ensure correct Moshaf type (Hafs) is displayed after download * fix: display Hafs Quran correctly and remove success dialog - Set Hafs as default Moshaf type if none is selected. - Auto-dismiss success dialog on download completion. - Improved state invalidation for Quran reading updates. - Added FocusNode for better dialog interaction. - Optimized resource management with keepAlive and link.close(). * fix: improve Quran Download and Navigation Experience - Redirect user to Quran reading screen automatically after successful download and extraction of Quran (Hafs). - Remove the unnecessary "OK" button to confirm Quran download completion, streamlining the user experience. - Enhance state management for download-related UI in `quran_reading_screen.dart` to handle various download states (needed, downloading, extracting). - Update `download_quran_popup.dart` to ensure proper navigation based on the user's first-time download experience. - Improve error handling and loading indicators for a smoother and more intuitive flow. * fix formating * Update pubspec.yaml * fix: Resolve overlapping and focus issues for Back and Switch buttons (#1457) * fix: Resolve pop-up issue when selecting Listening mode (#1455) - updated `_handleNavigation` method in `quran_mode_selection_screen.dart` to use `async/await` for ensuring proper completion of Quran mode selection before navigation. - fixed unexpected pop-ups by adjusting the handling of the `moshafType` state in `download_quran_popup.dart`. - improved navigation flow for both Reading and Listening modes, ensuring seamless user experience. Co-authored-by: Ghassen Ben Zahra <ghassen.benzahra@gmail.com> * Update pubspec.yaml * fix merger conflict' * remove just audio package * format code --------- Co-authored-by: Yassin Nouh <70436855+YassinNouh21@users.noreply.github.com> Co-authored-by: Ibrahim ZEHHAF <97339607+ibrahim-zehhaf-mawaqit@users.noreply.github.com>
* fix: Improve Quran Download and Navigation Experience (#1452) * fix: Ensure correct Moshaf type (Hafs) is displayed after download * fix: display Hafs Quran correctly and remove success dialog - Set Hafs as default Moshaf type if none is selected. - Auto-dismiss success dialog on download completion. - Improved state invalidation for Quran reading updates. - Added FocusNode for better dialog interaction. - Optimized resource management with keepAlive and link.close(). * fix: improve Quran Download and Navigation Experience - Redirect user to Quran reading screen automatically after successful download and extraction of Quran (Hafs). - Remove the unnecessary "OK" button to confirm Quran download completion, streamlining the user experience. - Enhance state management for download-related UI in `quran_reading_screen.dart` to handle various download states (needed, downloading, extracting). - Update `download_quran_popup.dart` to ensure proper navigation based on the user's first-time download experience. - Improve error handling and loading indicators for a smoother and more intuitive flow. * fix formating * Update pubspec.yaml * fix: Resolve overlapping and focus issues for Back and Switch buttons (#1457) * fix: Resolve pop-up issue when selecting Listening mode (#1455) - updated `_handleNavigation` method in `quran_mode_selection_screen.dart` to use `async/await` for ensuring proper completion of Quran mode selection before navigation. - fixed unexpected pop-ups by adjusting the handling of the `moshafType` state in `download_quran_popup.dart`. - improved navigation flow for both Reading and Listening modes, ensuring seamless user experience. Co-authored-by: Ghassen Ben Zahra <ghassen.benzahra@gmail.com> * Update pubspec.yaml * fix merger conflict' * fix schedule save after device restart * fix reshedule to clear timers * add printstatements debug prod * remove restore on main * add delay to restore timers * remove feature from settings * remove print statements --------- Co-authored-by: Yassin Nouh <70436855+YassinNouh21@users.noreply.github.com> Co-authored-by: Ibrahim ZEHHAF <97339607+ibrahim-zehhaf-mawaqit@users.noreply.github.com>
* fix: Improve Quran Download and Navigation Experience (#1452) * fix: Ensure correct Moshaf type (Hafs) is displayed after download * fix: display Hafs Quran correctly and remove success dialog - Set Hafs as default Moshaf type if none is selected. - Auto-dismiss success dialog on download completion. - Improved state invalidation for Quran reading updates. - Added FocusNode for better dialog interaction. - Optimized resource management with keepAlive and link.close(). * fix: improve Quran Download and Navigation Experience - Redirect user to Quran reading screen automatically after successful download and extraction of Quran (Hafs). - Remove the unnecessary "OK" button to confirm Quran download completion, streamlining the user experience. - Enhance state management for download-related UI in `quran_reading_screen.dart` to handle various download states (needed, downloading, extracting). - Update `download_quran_popup.dart` to ensure proper navigation based on the user's first-time download experience. - Improve error handling and loading indicators for a smoother and more intuitive flow. * fix formating * Update pubspec.yaml * fix: Resolve overlapping and focus issues for Back and Switch buttons (#1457) * fix: Resolve pop-up issue when selecting Listening mode (#1455) - updated `_handleNavigation` method in `quran_mode_selection_screen.dart` to use `async/await` for ensuring proper completion of Quran mode selection before navigation. - fixed unexpected pop-ups by adjusting the handling of the `moshafType` state in `download_quran_popup.dart`. - improved navigation flow for both Reading and Listening modes, ensuring seamless user experience. Co-authored-by: Ghassen Ben Zahra <ghassen.benzahra@gmail.com> * Update pubspec.yaml * fix merger conflict' * merge main into 1.18 * code format --------- Co-authored-by: Yassin Nouh <70436855+YassinNouh21@users.noreply.github.com> Co-authored-by: Ibrahim ZEHHAF <97339607+ibrahim-zehhaf-mawaqit@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -137,6 +138,13 @@ dependencies: | |||
|
|||
wakelock_plus: 1.1.4 | |||
wakelock_plus_platform_interface: 1.1.0 | |||
flutter_background_service: ^5.0.9 | |||
audio_service: ^0.18.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will crach onvo tv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BackgroundService class is handling too many responsibilities - audio playback, notifications, and prayer scheduling.
Consider splitting it into separate services:
PrayerSchedulerService
AdhanAudioService
PrayerNotificationService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
services/audio_service
service/adhan_notification_service
import '../models/mosqueConfig.dart'; | ||
import '../models/times.dart'; | ||
|
||
class BackgroundService with WidgetsBindingObserver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no clean up or dispose for the audioPlayer and notificaiton
@override
Future<void> dispose() async {
_notificationTimer?.cancel();
await _audioPlayer?.dispose();
await dismissExistingNotification();
_scheduledTimes.clear();
super.dispose();
}
if (_scheduledTimes.contains(scheduleTime)) return false; | ||
final delay = scheduleTime.difference(AppDateTime.now()); | ||
return !delay.isNegative; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make it more thread safe
static final _lock = Lock(); // The "ticket system"
static final Set<DateTime> _scheduledTimes = {};
static void schedulePrayerTasks(...) async {
await _lock.synchronized(() async {
if (_scheduledTimes.contains(scheduleTime)) return;
_scheduledTimes.add(scheduleTime);
_schedulePrayerTimer(...);
});
}
what can produce Users get multiple alerts for the same prayer time.
try { | ||
await dismissExistingNotification(); | ||
await NotificationOverlay.showNotification( | ||
'$salahName time ($prayerName) notification', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'$salahName time ($prayerName) notification' // Not localized
📝 Summary
This PR fixes #719
Description
Demo
20240910_185152.mp4
Checklist: