diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5f0c34b..0d877d407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Countdown to event start instead of to the reminder ([#1073]) + ## [1.10.3] - 2026-02-14 ### Changed - Updated translations @@ -237,6 +240,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#1003]: https://github.com/FossifyOrg/Calendar/issues/1003 [#1019]: https://github.com/FossifyOrg/Calendar/issues/1019 [#1024]: https://github.com/FossifyOrg/Calendar/issues/1024 +[#1073]: https://github.com/FossifyOrg/Calendar/issues/1073 [Unreleased]: https://github.com/FossifyOrg/Calendar/compare/1.10.3...HEAD [1.10.3]: https://github.com/FossifyOrg/Calendar/compare/1.10.2...1.10.3 diff --git a/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt b/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt index f9dd6af1e..031b4eff0 100644 --- a/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt @@ -233,26 +233,25 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) { } fun Context.scheduleEventIn(notifyAtMillis: Long, event: Event, showToasts: Boolean) { - val now = System.currentTimeMillis() - if (notifyAtMillis < now) { + val now = System.currentTimeMillis() / 1000 + if (event.getEventStartTS() < now) { if (showToasts) { toast(org.fossify.commons.R.string.saving) } return } - val newNotifyAtMillis = notifyAtMillis + 1000 if (showToasts) { - val secondsTillNotification = (newNotifyAtMillis - now) / 1000 + val secondsTillEvent = event.getEventStartTS() - now val msg = String.format( getString(org.fossify.commons.R.string.time_remaining), - formatSecondsToTimeString(secondsTillNotification.toInt()) + formatSecondsToTimeString(secondsTillEvent.toInt()) ) toast(msg) } val pendingIntent = getNotificationIntent(event) - setExactAlarm(newNotifyAtMillis, pendingIntent) + setExactAlarm(notifyAtMillis + 1000, pendingIntent) } // hide the actual notification from the top bar