From 05eee6a971d1804d8960e9bce6feade18ae076b8 Mon Sep 17 00:00:00 2001 From: MiMoHo <37556964+MiMoHo@users.noreply.github.com> Date: Fri, 3 Jul 2026 20:59:56 +0200 Subject: [PATCH] fix: show time until event in save-event countdown toast When saving an event that has a notification reminder, scheduleEventIn computed the countdown toast from the alarm/notification time (newNotifyAtMillis - now) instead of the event start time, so it showed the time until the reminder rather than the time until the event. Compute the remaining time from event.getEventStartTS() - getNowSeconds() so the toast counts down to the event start. Scheduling behaviour and the notifyAtMillis < now guard are left untouched, so the snooze path is unaffected. Closes #1073 --- CHANGELOG.md | 2 ++ .../main/kotlin/org/fossify/calendar/extensions/Context.kt | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a6fc1f1..051d2cdc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated holiday data ### Fixed +- Fixed the save-event countdown to show time until the event instead of time until the reminder ([#1073]) - Fixed event text readability on colored backgrounds ([#1065]) - Fixed invisible current time indicator in weekly view ([#99]) - Fixed stuck zoom level in weekly view on some devices ([#621]) @@ -252,6 +253,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#1019]: https://github.com/FossifyOrg/Calendar/issues/1019 [#1024]: https://github.com/FossifyOrg/Calendar/issues/1024 [#1065]: https://github.com/FossifyOrg/Calendar/issues/1065 +[#1073]: https://github.com/FossifyOrg/Calendar/issues/1073 [#1157]: https://github.com/FossifyOrg/Calendar/issues/1157 [Unreleased]: https://github.com/FossifyOrg/Calendar/compare/1.10.3...HEAD 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..a2cd3b217 100644 --- a/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/org/fossify/calendar/extensions/Context.kt @@ -243,10 +243,10 @@ fun Context.scheduleEventIn(notifyAtMillis: Long, event: Event, showToasts: Bool val newNotifyAtMillis = notifyAtMillis + 1000 if (showToasts) { - val secondsTillNotification = (newNotifyAtMillis - now) / 1000 + val secondsTillEvent = event.getEventStartTS() - getNowSeconds() val msg = String.format( getString(org.fossify.commons.R.string.time_remaining), - formatSecondsToTimeString(secondsTillNotification.toInt()) + formatSecondsToTimeString(secondsTillEvent.toInt()) ) toast(msg) }