Skip to content

feat: end encounter and reset session (#40)#78

Merged
gwillish merged 3 commits intomainfrom
feat/end-and-reset-encounter
Apr 18, 2026
Merged

feat: end encounter and reset session (#40)#78
gwillish merged 3 commits intomainfrom
feat/end-and-reset-encounter

Conversation

@gwillish
Copy link
Copy Markdown
Owner

@gwillish gwillish commented Apr 18, 2026

Summary

  • Runner: replaced the in-place "Reset Session" button with "End Encounter", which calls dismiss() and returns to the builder while leaving the session intact in SessionRegistry
  • Builder: added a "Reset Session" secondary toolbar button that appears only when an active session exists (sessionRegistry.sessions[draft.id] != nil); tapping it shows a confirmationDialog, and confirming clears the registry entry and deletes the persisted .session.json file
  • After reset, tapping "Run Encounter" starts a fresh session from scratch; the EncounterDefinition (roster, players, notes) is unchanged

Closes #40

Test plan

  • Run an encounter, tap "End Encounter" → returns to builder; tap "Run Encounter" again → resumes the same session
  • Run an encounter, tap "End Encounter" → builder shows "Reset Session" in the toolbar menu
  • Tap "Reset Session", confirm → session cleared; tap "Run Encounter" → new session starts from scratch (all HP/stress reset)
  • Tap "Reset Session", cancel → session still active
  • Check that the encounter definition (adversary roster, players, notes) is unchanged after reset
  • Unit tests pass: xcodebuild test -scheme Encounter -destination 'platform=macOS'

- Runner: replace in-place Reset Session with End Encounter, which
  dismisses back to the builder while keeping the session in the registry
- Builder: add Reset Session (destructive, confirmation dialog) that
  appears only when an active session exists; clears registry + deletes
  persisted file on confirm
- Runner: restore Reset Session UX (confirmation dialog, clear + delete + dismiss)
- Builder: stable ToolbarItem wrapper for conditional Reset Session button
- Builder: remove role:.destructive from toolbar trigger (keep only on dialog button)
- Builder/Runner: add accessibilityIdentifier to confirmation dialog destructive buttons
- Builder: remove redundant explicit Cancel button from confirmationDialog
- Tests: unit test for combined clearSession + delete flow
- Tests: UI tests for End Encounter, Reset from runner, Reset from builder
- Tests: tapEndEncounter and tapResetSessionFromRunner helpers in EncounterUITestCase
…ests (#78)

iOS 26 exposes confirmationDialog action buttons in two places in the AX
tree simultaneously, causing XCUITest to fail with "multiple matching
elements" when tapping by identifier alone.
@gwillish gwillish merged commit 9d3ce95 into main Apr 18, 2026
gwillish added a commit that referenced this pull request Apr 18, 2026
- Runner: restore Reset Session UX (confirmation dialog, clear + delete + dismiss)
- Builder: stable ToolbarItem wrapper for conditional Reset Session button
- Builder: remove role:.destructive from toolbar trigger (keep only on dialog button)
- Builder/Runner: add accessibilityIdentifier to confirmation dialog destructive buttons
- Builder: remove redundant explicit Cancel button from confirmationDialog
- Tests: unit test for combined clearSession + delete flow
- Tests: UI tests for End Encounter, Reset from runner, Reset from builder
- Tests: tapEndEncounter and tapResetSessionFromRunner helpers in EncounterUITestCase
@gwillish gwillish deleted the feat/end-and-reset-encounter branch April 18, 2026 21:04
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.

End and reset encounter

1 participant