Skip to content

Commit

Permalink
fix implicit tomorrow intent
Browse files Browse the repository at this point in the history
  • Loading branch information
Théophile Delmas committed Dec 21, 2023
1 parent 89ba9c4 commit 6f159b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/rooster/rooster/AlarmHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ class AlarmHandler {
var closestAlarm: Alarm? = null
var timeDifference: Long = Long.MAX_VALUE
val dayFormat = SimpleDateFormat("EEEE", Locale.getDefault())
val today: String = dayFormat.format(currentTime.time)

for (alarm in alarms) {
val alarmTime = Calendar.getInstance()
alarmTime.timeInMillis = alarm.calculatedTime
val alarmDay: String = dayFormat.format(alarmTime.time)
if (alarm.enabled &&
(alarm.getDayEnabled(today) ||
(alarm.getDayEnabled(alarmDay) ||
(!alarm.monday && !alarm.tuesday && !alarm.wednesday && !alarm.thursday && !alarm.friday && !alarm.saturday && !alarm.sunday))) {
val alarmTime = Calendar.getInstance()
alarmTime.timeInMillis = alarm.calculatedTime
val alarmMillis = alarmTime.timeInMillis

// Calculate the time difference between current time and alarm time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class AlarmclockReceiver : BroadcastReceiver() {
alarmHandler.setNextAlarm(context)
}, delay)
} else if (intent != null && "android.intent.action.BOOT_COMPLETED" == intent.action) {
// Retrieve saved alarms from persistent storage
alarmHandler.setNextAlarm(context)
}
}
Expand Down

0 comments on commit 6f159b7

Please sign in to comment.