0.1.2 #1

Merged
me merged 40 commits from dev into main 2026-09-28 04:36:44 -07:00
Showing only changes of commit aade4fd7f2 - Show all commits
+4 -1
View File
@@ -173,6 +173,7 @@ class _HomeScreenState extends State<HomeScreen> {
Timer? _alarmTimer; Timer? _alarmTimer;
Future<void> _scheduleAlarm() async { Future<void> _scheduleAlarm() async {
// Ensure that Android has the correct permissions enabled.
final canSchedule = await android?.canScheduleExactNotifications(); final canSchedule = await android?.canScheduleExactNotifications();
if (canSchedule != true) { if (canSchedule != true) {
_showSnack('Permissions not yet granted, requesting...'); _showSnack('Permissions not yet granted, requesting...');
@@ -220,7 +221,7 @@ class _HomeScreenState extends State<HomeScreen> {
_showSnack( _showSnack(
'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)', 'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)',
); );
} else { } else if (Platform.isAndroid) {
// Android: use zonedSchedule (works in background) // Android: use zonedSchedule (works in background)
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local); final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
const androidDetails = AndroidNotificationDetails( const androidDetails = AndroidNotificationDetails(
@@ -243,6 +244,8 @@ class _HomeScreenState extends State<HomeScreen> {
UILocalNotificationDateInterpretation.absoluteTime, UILocalNotificationDateInterpretation.absoluteTime,
); );
_showSnack('Alarm scheduled.'); _showSnack('Alarm scheduled.');
} else {
_showSnack('Platform not detected, unsure how to show alarm.');
} }
} }