Skip to content

feat(app): confirm before closing the main window - #448

Open
cartpauj wants to merge 1 commit into
developfrom
feat/436-confirm-before-close
Open

cartpauj wants to merge 1 commit into
developfrom
feat/436-confirm-before-close

Conversation

@cartpauj

@cartpauj cartpauj commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #436

What

Clicking the window's X, pressing Alt+F4, or using Window → Close now asks before Ultra Tracker shuts down:

Are you sure you want to quit Ultra Tracker?
Your data is saved.
When Ultra Tracker is opened again, the RFID reader will need to be reconnected. ← only while an RFID reader is connected
Reconnect to OpenSplitTime when you reopen the app. ← only while signed in to OpenSplitTime
[Quit] [Cancel]

Cancel is the default and the cancel button, so Enter or Esc keeps the app open.

No prompt for deliberate quits:

  • the updater's Restart and update, and Cmd+Q on macOS (both go through before-quit)
  • Windows logging off or shutting down (session-end on the window), so the prompt never blocks a shutdown

How

  • New src/main/lib/confirm-close.ts: confirmBeforeClosing(window) hooks the window's close event and uses a synchronous showMessageBoxSync, so a double-click on X can't stack two prompts
  • The detail line checks GetRFIDStatus() and OpenSplitTime getAuthStatus() at the moment the prompt opens
  • createWindow calls it for the main window
  • README and in-app Help each get a sentence about the prompt

Tests

confirm-close.test.ts (9 tests): cancel keeps the window, quit calls app.quit, Cancel is the default, before-quit and session-end skip the prompt, and the detail wording with and without RFID and OST. index.test.ts checks the main window is wired up. The full src/main suite passes (813 tests).

The prompt and its wording were reviewed in the app. The RFID, OpenSplitTime, updater, and shutdown paths are covered by the tests only.

🤖 Generated with Claude Code

A stray click on the window's X shut Ultra Tracker down mid-event,
dropping the RFID connection. Closing the window now asks first, with
Cancel as the default. Deliberate quits (menu quit, the updater's
restart, OS shutdown) skip the prompt.

The prompt notes the RFID reader and OpenSplitTime only when they are
connected, since each needs reconnecting after a restart.

Closes #436

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cartpauj cartpauj self-assigned this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Program Close Warning pop up

1 participant