Skip to content

Return alarm screen home when no active schedule exists #363

Description

@jjoonleo

Alarm No-Schedule Fallback Plan

Goal

Ensure /alarmScreen returns to /home when opened while the schedule state is already notExists, instead of showing a loading spinner indefinitely.

Context

  • SRD: if no active schedule exists, alarm should fall back through notExists handling and navigate home.
  • Current AlarmScreen listener only navigates when the previous state was not notExists and the current state becomes notExists.
  • If /alarmScreen is opened while ScheduleBloc.state.status is already notExists, the listener does not fire and the builder shows the loading scaffold.
  • This can happen after a stale notification, deleted schedule, or already-ended schedule.

Decisions

  • Treat an already-notExists state on alarm entry as terminal for the alarm route.
  • Navigate home after build, not synchronously inside build.
  • Preserve finish-result navigation when _navigateAfterFinish is pending.

Steps

  1. Add a post-frame fallback in AlarmScreen when current state is notExists and no finish navigation is pending.
  2. Keep the existing listener for transitions into notExists.
  3. Add a widget test that pumps /alarmScreen with initial ScheduleState.notExists() and expects navigation to /home.
  4. Add a stale-notification-style test where subscription emits null while already notExists.

Validation

  • Run flutter test test/presentation/alarm/screens/preparation_flow_widget_test.dart.
  • Confirm finish flow still navigates to /earlyLate when pending finish data exists.

Open Questions

  • None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions