Repository navigation
fix(universalical): skip app when no events today - #984
Merged
Merged
Conversation
The ICS API always returns the next event, even one days away, so `if not event` almost never matched and "Skip When Events Are Done" never fired. Instead the calendar frame rendered "DONE FOR THE DAY :-)". Derive the skipped state from the event detail: skip when the next event is neither today nor in progress. In-progress events stay visible so multi-day all-day events are not hidden once they have started.
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.
Problem
"Skip When Events Are Done" never skips. With no events left today the app still renders
DONE FOR THE DAY :-).The ICS parsing endpoint always returns the next event, even one days away:
{"data":{"name":"New moon 12:52am","detail":{"isToday":false,"isTomorrow":false,"isThisWeek":true,"inProgress":false,"isAllDay":true}}}So
if not event:inmain()is effectively dead code —eventis only falsy when the calendar has no future events at all. Every other case falls through tobuild_calendar_frame, wherehasEventisFalseandget_calendar_bottomrendersDONE_TEXT.Fix
Derive "done for the day" from the event detail instead of the event itself:
inProgressis part of the condition so multi-day all-day events stay on screen after they have started (they reportisToday: false).detailis also hoisted into a local, which removes the unguardedevent["detail"]["inProgress"]access.Verification
Rendered against a local mock of the endpoint (
pixletv0.55.1):skip_when_donefalseDONE FOR THE DAY :-)(previous behavior, kept)truetruetruepixlet lintandpixlet checkpass.Behavior change worth noting: skip now also applies when Show Expanded Time Window would otherwise preview a future event, per the toggle's wording ("Skip app when events are done for the day").