Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not switching to proper conversation when navigating from notification [WPB-4294] #2211

Merged
merged 4 commits into from
Sep 13, 2023

Conversation

saleniuk
Copy link
Contributor


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Tapping on notification does not forward the user to the according conversation when another conversation is open.

Causes (Optional)

Compose destinations library has two interfaces containing route parameter that can't be used interchangeably.
Route is used to define destinations and its route is always a template with arguments placeholders, like the native compose navigation uses, for example: conversation_screen/{conversationId}. As documentation states: Route instances are not suited to navigate to unless they're also Direction.
Direction also has a route parameter, but it's the specific route with filled proper arguments, like conversation_screen/id123456 as it's used when navigating. So, route parameters of both types shouldn't be compared.
Because it couldn't compare it properly, it couldn't find the destination of the same type in the back stack. Together with launchSingleTop set to true, when we have already a destination of type ConverstationScreen at the top of the back stack, it won't be replaced with a new one, thus when opening another ConversationScreen it still keeps the previous one on screen and ignores the new one.

Solutions

Instead of comparing full routes, extract the base of each route, which is unique for each destination, and then compare only that part to find the specific destination type in the back stack.

Testing

How to Test

Open conversation A, receive notification for conversation B, click on that notification - the app should open the conversation B screen.


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 11, 2023

Test Results

587 tests   586 ✔️  5m 18s ⏱️
  84 suites      1 💤
  84 files        0

Results for commit 77bd655.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 688 succeeded.

The build produced the following APK's:

@saleniuk saleniuk requested review from a team, yamilmedina, alexandreferris, MohamadJaara, Garzas and trOnk12 and removed request for a team and trOnk12 September 12, 2023 07:49
@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 733 succeeded.

The build produced the following APK's:

@saleniuk saleniuk merged commit 0107a02 into release/candidate Sep 13, 2023
13 checks passed
@saleniuk saleniuk deleted the fix/conversation_notification_navigation branch September 13, 2023 07:49
github-actions bot pushed a commit that referenced this pull request Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants