fix: show time until the event (not the reminder) in the save countdown#1241
Closed
MiMoHo wants to merge 1 commit into
Closed
fix: show time until the event (not the reminder) in the save countdown#1241MiMoHo wants to merge 1 commit into
MiMoHo wants to merge 1 commit into
Conversation
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 FossifyOrg#1073
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change(s)
What changed and why
When saving an event that has at least one notification reminder,
Context.scheduleNextEventReminder()picks the next reminder time(curEvent.getEventStartTS() - curReminder) * 1000Land passes it toContext.scheduleEventIn()asnotifyAtMillis. InsidescheduleEventIn, the "time remaining" toast was computed from the notification/alarm time rather than the event start:So the toast counted down to the reminder, not the event. Example: an event 2 hours away with a "10 minutes before" reminder showed "1 hour, 50 minutes" instead of "2 hours".
This changes only the toast computation to use the event start time:
Both
getNowSeconds()andevent.getEventStartTS()are already imported/used in this file, so no new imports are needed. Scheduling behaviour and thenotifyAtMillis < nowguard are deliberately left untouched, so the snooze / reschedule path (rescheduleReminder) is unaffected. On this code pathsecondsTillEventis guaranteed positive becausescheduleNextEventReminderonly callsscheduleEventInwhencurEvent.getEventStartTS() - curReminder > nowwith a non-negative reminder offset, so start > now.Tests performed
detekt,lint, unit tests and the build all pass locally (CI-equivalent).getEventStartTS() - getNowSeconds()) instead of the next reminder time.Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).Coded with Opus 4.8 ultracode.