fix: timer loading — zero duration, start failure, and keepScreenOn sync#10
Merged
Conversation
Owner
Author
|
@copilot resolve the merge conflicts in this pull request |
…bundle - Import audioTTS package module directly instead of relying on window.AndroidTTS bridge - Add 'database' to NativePHP bundled paths so SQLite DB is included on device - Fix countdown label off-by-one (show remaining - 1 during countdown) - Allow cooldown input on last phase (was incorrectly disabled); improve helper text - Add "Demo with no phases" seed program for edge-case testing - Clean up debug logging, debugger statements, and unused imports in Settings/audio - Gitignore AI tooling files (.claude, CLAUDE.md, .agents, etc.)
…boost.json + database watch path
nbucic
force-pushed
the
fix/timer-loading-and-keepscreenon
branch
from
July 16, 2026 20:57
4e53e04 to
19d71fb
Compare
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.
Root cause
When a program has no phases:
Program::totalDuration()returns 0 →programTotalDuration = 0TimerRunner::start()throwsRuntimeException("Program has no phases.")— this exception silently rolls back the Livewire response, so the UI never updates and the Start button appears to do nothingThis can happen when a user creates a program and navigates to the timer without adding any phases.
Changes
TimerScreen::start()— guard against empty phasesInstead of propagating an exception from
TimerRunner::start(), the action now returns early when phases are empty. State is left untouched and the blade renders the "no phases" notice.timer-screen.blade.php— no-phases noticeWhen the timer is idle and
$phasesis empty, the Start button is replaced with an amber warning: "No phases — edit this program to add at least one phase before starting." The Edit button in the secondary row is still shown so the user can fix the program immediately.ProgramEditor::totalDuration()— match timer behaviourThe editor's preview summed every phase's cooldown, including the last phase. But the timer skips the last phase's cooldown (goes straight to
COMPLETEDafter the final rep). This made the preview total higher than the actual run duration for any program with a last-phase cooldown. Fixed to subtract the last phase's cooldown, matchingProgram::totalDuration().TimerScreen::loadProgram()/requestSettings()— forwardkeepScreenOnBoth methods dispatch
settingsLoadedto sync JS audio state, but neither includedkeepScreenOn. Thefix/tts-wakelock-cachingcommit added asettingsLoadedJS handler that readskeepScreenOnto gate wake-lock acquisition. Without it, the wake lock could be stuck in the wrong state whenever a program was loaded or settings were refreshed. Both dispatches now includekeepScreenOn: $this->keepScreenOn.Test plan
https://claude.ai/code/session_018ofANSCtBHs5P8rvvJ9Mh3