Skip to content

fix: post-call navigation after cold start#629

Merged
torlando-tech merged 2 commits intotorlando-tech:mainfrom
MatthieuTexier:fix/audio-call-exit-onboarding
Mar 9, 2026
Merged

fix: post-call navigation after cold start#629
torlando-tech merged 2 commits intotorlando-tech:mainfrom
MatthieuTexier:fix/audio-call-exit-onboarding

Conversation

@MatthieuTexier
Copy link
Copy Markdown
Contributor

Summary

  • fix audio call exit navigation when Columba is opened directly into a call flow from a cold start
  • avoid returning to the welcome/setup screen after the call ends when onboarding was already completed
  • reuse the same exit fallback for active and incoming call screens

Testing

  • verified that opening Columba on an audio call and ending the call now returns to Chats instead of the setup screen

@MatthieuTexier MatthieuTexier changed the title Fix post-call navigation after cold start fix: post-call navigation after cold start Mar 8, 2026
@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR fixes a navigation regression on cold start where ending an audio call (either active or declined incoming) would land the user on the Welcome/setup screen instead of Chats, even when onboarding had already been completed.

The fix introduces a shared exitCallFlow lambda inside ColumbaNavigation that:

  1. Attempts a normal popBackStack().
  2. Detects the problematic case (!popped — nothing to pop — or the previous entry is Welcome) and, when onboarding is complete, replaces it with an explicit navigation to Chats, clearing Welcome from the back stack.

This replaces two independent bare navController.popBackStack() calls on VoiceCallScreen.onEndCall and IncomingCallScreen.onCallDeclined, unifying the exit path and making future changes easier.

Key changes:

  • New exitCallFlow lambda at line 632 consolidates post-call navigation logic.
  • VoiceCallScreen.onEndCall and IncomingCallScreen.onCallDeclined both now delegate to exitCallFlow.
  • One edge case worth addressing: when popBackStack() returns false (call screen is the only entry) and Welcome is not in the back stack, the popUpTo(Welcome) is a no-op — the call screen would not be cleared before navigating to Chats, potentially leaving it reachable via the back button.

Confidence Score: 3/5

  • The PR fixes the primary cold-start navigation bug but has a real edge case that could leave a stale call screen on the back stack.
  • The fix correctly addresses the main cold-start navigation issue (preventing return to Welcome/setup when onboarding is complete), and the shared exitCallFlow lambda is a good consolidation. However, there is a genuine edge case: when popBackStack() returns false and Welcome is not in the back stack, the popUpTo(Welcome) operation becomes a no-op, leaving the call screen on the stack beneath Chats. This could cause unexpected back navigation behavior in specific cold-start scenarios. The suggested fix in the review comment is straightforward and should be applied before shipping.
  • app/src/main/java/com/lxmf/messenger/MainActivity.kt — the exitCallFlow lambda (lines 632-643) should be updated to handle the case when popBackStack() returns false and Welcome is not in the back stack.

Sequence Diagram

sequenceDiagram
    participant User
    participant NavController
    participant IncomingCallScreen
    participant VoiceCallScreen
    participant Chats

    Note over NavController: Cold Start — onboarding complete<br/>startDestination may be Welcome (state not yet loaded)

    NavController->>NavController: push Welcome (startDestination)
    NavController->>IncomingCallScreen: navigate("incoming_call/{id}")

    alt Call Declined
        User->>IncomingCallScreen: decline
        IncomingCallScreen->>NavController: exitCallFlow()
        NavController->>NavController: popBackStack() → lands on Welcome
        NavController->>Chats: navigate(Chats) { popUpTo(Welcome, inclusive=true) }
    else Call Answered
        User->>IncomingCallScreen: answer
        IncomingCallScreen->>VoiceCallScreen: navigate("voice_call/{hash}") { popUpTo(incoming_call, inclusive=true) }
        User->>VoiceCallScreen: end call
        VoiceCallScreen->>NavController: exitCallFlow()
        NavController->>NavController: popBackStack() → lands on Welcome
        NavController->>Chats: navigate(Chats) { popUpTo(Welcome, inclusive=true) }
    end
Loading

Last reviewed commit: 0c2a27e

@torlando-tech torlando-tech merged commit 7663729 into torlando-tech:main Mar 9, 2026
13 checks passed
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.

2 participants