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] #2231

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 13, 2023

BugWPB-4294 [Android] Tapping on notification does not forward the user to the according conversation when another conversation is open

Cherry pick from the original PR:


⚠️ Conflicts during cherry-pick:


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 github-actions bot added the cherry-pick PR is cherry-picking changes from another banch label Sep 13, 2023
@AndroidBob
Copy link
Collaborator

Build 744 succeeded.

The build produced the following APK's:

@github-actions
Copy link
Contributor Author

Test Results

600 tests  ±0   599 ✔️ ±0   7m 44s ⏱️ + 1m 35s
  85 suites ±0       1 💤 ±0 
  85 files   ±0       0 ±0 

Results for commit 3d1eaf2. ± Comparison against base commit fd815b3.

@github-actions
Copy link
Contributor Author

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

@AndroidBob
Copy link
Collaborator

Build 755 succeeded.

The build produced the following APK's:

@MohamadJaara MohamadJaara added this pull request to the merge queue Sep 13, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 13, 2023
@saleniuk saleniuk added this pull request to the merge queue Sep 13, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 13, 2023
@MohamadJaara MohamadJaara added this pull request to the merge queue Sep 14, 2023
Merged via the queue into develop with commit fbe29fd Sep 14, 2023
14 checks passed
@MohamadJaara MohamadJaara deleted the fix/conversation_notification_navigation-cherry-pick branch September 14, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch size/XS
Projects
None yet
4 participants