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

Fix/schedule on off #1535

Merged
merged 19 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
69e6049
fix: Improve Quran Download and Navigation Experience (#1452)
YassinNouh21 Dec 1, 2024
243ae96
Update pubspec.yaml
ibrahim-zehhaf-mawaqit Dec 1, 2024
da6736a
fix: Resolve overlapping and focus issues for Back and Switch buttons…
YassinNouh21 Dec 1, 2024
6679d80
fix: Resolve pop-up issue when selecting Listening mode (#1455)
YassinNouh21 Dec 1, 2024
6601d42
Update pubspec.yaml
ibrahim-zehhaf-mawaqit Dec 2, 2024
195620e
merge main branch
ghassenbenzahra123 Dec 3, 2024
50435b9
Merge branch 'release-1.18.0' of /~https://github.com/mawaqit/android-t…
ghassenbenzahra123 Dec 22, 2024
e2645b9
fix merger conflict'
ghassenbenzahra123 Dec 22, 2024
8f70412
Merge branch 'release-1.18.0' of /~https://github.com/mawaqit/android-t…
ghassenbenzahra123 Dec 27, 2024
f345678
Merge branch 'release-1.18.0' of /~https://github.com/mawaqit/android-t…
ghassenbenzahra123 Dec 29, 2024
fec0e6a
Merge branch 'release-1.18.0' of /~https://github.com/mawaqit/android-t…
ghassenbenzahra123 Dec 31, 2024
054b626
fix schedule save after device restart
ghassenbenzahra123 Jan 8, 2025
9d2bc75
fix reshedule to clear timers
ghassenbenzahra123 Jan 9, 2025
de1de5a
add printstatements debug prod
ghassenbenzahra123 Jan 11, 2025
af1709e
remove restore on main
ghassenbenzahra123 Jan 13, 2025
5bb4972
add delay to restore timers
ghassenbenzahra123 Jan 13, 2025
e595644
remove feature from settings
ghassenbenzahra123 Jan 16, 2025
fd2847f
remove print statements
ghassenbenzahra123 Jan 16, 2025
a2ab068
Merge branch 'release-1.18.0' into fix/schedule-on-off
ghassenbenzahra123 Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'package:mawaqit/src/services/audio_manager.dart';
import 'package:mawaqit/src/services/FeatureManager.dart';
import 'package:mawaqit/src/services/mosque_manager.dart';
import 'package:mawaqit/src/services/theme_manager.dart';
import 'package:mawaqit/src/services/toggle_screen_feature_manager.dart';
import 'package:mawaqit/src/services/user_preferences_manager.dart';
import 'package:media_kit/media_kit.dart';
import 'package:path_provider/path_provider.dart';
Expand All @@ -53,6 +54,7 @@ Future<void> main() async {
Hive.registerAdapter(ReciterModelAdapter());
Hive.registerAdapter(MoshafModelAdapter());
MediaKit.ensureInitialized();

runApp(
riverpod.ProviderScope(
child: MyApp(),
Expand All @@ -62,6 +64,8 @@ Future<void> main() async {
],
),
);
await Future.delayed(const Duration(seconds: 5));
await ToggleScreenFeature.restoreScheduledTimers();
},
);
}
Expand Down
19 changes: 10 additions & 9 deletions lib/src/pages/SettingScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,18 @@ class _SettingScreenState extends ConsumerState<SettingScreen> {
style: theme.textTheme.headlineSmall,
textAlign: TextAlign.center,
),
_SettingItem(
title: S.of(context).screenLock,
subtitle: S.of(context).screenLockDesc,
icon: Icon(Icons.power_settings_new, size: 35),
onTap: () => showDialog(
context: context,
builder: (context) => ScreenLockModal(
timeShiftManager: timeShiftManager,
if (timeShiftManager.isLauncherInstalled)
_SettingItem(
title: S.of(context).screenLock,
subtitle: S.of(context).screenLockDesc,
icon: Icon(Icons.power_settings_new, size: 35),
onTap: () => showDialog(
context: context,
builder: (context) => ScreenLockModal(
timeShiftManager: timeShiftManager,
),
),
),
),
_SettingItem(
title: S.of(context).appTimezone,
subtitle: S.of(context).descTimezone,
Expand Down
33 changes: 10 additions & 23 deletions lib/src/services/mosque_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:mawaqit/src/const/constants.dart';
import 'package:mawaqit/src/helpers/Api.dart';
import 'package:mawaqit/src/helpers/PerformanceHelper.dart';
import 'package:mawaqit/src/helpers/SharedPref.dart';
import 'package:mawaqit/src/helpers/TimeShiftManager.dart';
import 'package:mawaqit/src/mawaqit_image/mawaqit_cache.dart';
import 'package:mawaqit/src/models/mosque.dart';
import 'package:mawaqit/src/models/mosqueConfig.dart';
Expand Down Expand Up @@ -216,29 +217,15 @@ class MosqueManager extends ChangeNotifier with WeatherMixin, AudioMixin, Mosque
(e) {
times = e;
final today = useTomorrowTimes ? AppDateTime.tomorrow() : AppDateTime.now();
if (isDeviceRooted) {
if (isToggleScreenActivated) {
ToggleScreenFeature.getLastEventDate().then((lastEventDate) async {
if (lastEventDate != null && lastEventDate.day != today.day) {
isEventsSet = false; // Reset the flag if it's a new day
await ToggleScreenFeature.cancelAllScheduledTimers();
ToggleScreenFeature.toggleFeatureState(false);
ToggleScreenFeature.checkEventsScheduled().then((_) {
if (!isEventsSet) {
ToggleScreenFeature.scheduleToggleScreen(
isIshaFajrOnly,
e.dayTimesStrings(today, salahOnly: false),
minuteBefore,
minuteAfter,
);
ToggleScreenFeature.toggleFeatureState(true);
ToggleScreenFeature.setLastEventDate(today);
isEventsSet = true;
}
});
}
});
}
final timeShiftManager = TimeShiftManager();

if (isDeviceRooted && isToggleScreenActivated && timeShiftManager.isLauncherInstalled) {
ToggleScreenFeature.handleDailyRescheduling(
isIshaFajrOnly: isIshaFajrOnly,
timeStrings: e.dayTimesStrings(today, salahOnly: false),
minuteBefore: minuteBefore,
minuteAfter: minuteAfter,
);
}

notifyListeners();
Expand Down
Loading
Loading