Skip to content

android: When opening a notification, "back" should not leave the account's context #1210

Open
@chrisbobbe

Description

@chrisbobbe

From beta feedback:

Steps to reproduce:

  • have at least two servers configured in the app
  • use the app on one server, then switch away from it
  • receive a notification for the other server
  • tap the notification to open zulip
  • hit the back button

Expected behavior: the back button should go to rhe next level up on the server that the notification came from. (For instance, if browsing a topic it should go up to the stream, or similar.)

Observed behavior: the back button goes to a view of the other server.


If the app is showing UI for Account A and you open a notification for Account B, we push a message-list route for Account B onto the nav stack that's supposed to belong to Account A. This means the "back" button will take you out of Account B's context, which can be confusing.

When we navigate on opening a notification, we should switch to a new nav stack for the notification's account (if different) before pushing the message-list route.

(The iOS counterpart is covered by #1147, for navigating at all when a notification is tapped.)

Implementation

Probably we want to call HomePage.navigate

  /// Navigate to [HomePage], ensuring that its route is at the root level.
  static void navigate(BuildContext context, {required int accountId}) {
    final navigator = Navigator.of(context);
    navigator.popUntil((route) => route.isFirst);
    unawaited(navigator.pushReplacement(
      HomePage.buildRoute(accountId: accountId)));
  }

—and then push the result of MessageListPage.buildRoute after that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-AndroidIssues specific to Android, or requiring Android-specific worka-notificationsbeta feedbackThings beta users have specifically asked for

    Type

    No type

    Projects

    • Status

      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions