Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
We have logic to match exact deep links, since you have a path argument maybe this doesn't fall within that case.
But definitely feel free to upload a pull request with tests for this particular test case and we can work it out there.
[Deleted User] <[Deleted User]> #3
I've created
I not sure about names picked for test functions.
[Deleted User] <[Deleted User]> #4
When will you have time to review this pull request? This change is important for our project.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 4eea9cb436ba82a6f61ff97a69bbe7c393df0132
Author: Osip Fatkullin <osip.fatkullin@gmail.com>
Date: Thu Apr 15 09:34:16 2021
[GH] [Navigation] Make deep link path arguments to not include slash
## Proposed Changes
Slash is used for URI path splitting. Arguments should not include more than one path section.
I purpose to replace `(.+?)` with `([^/]+?)` in resulting regexp.
## Testing
Added corresponing tests to `NavDestinationAndroidTest`
Test: ./gradlew test connectedCheck
## Issues Fixed
Fixes: [ b/184072811 ](https://issuetracker.google.com/issues/184072811 )
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/153 .
Resolves #153
Github-Pr-Head-Sha: f16861bc1f6b0bbba03e752cc378aa795a8522e7
GitOrigin-RevId: 5da0cf583393bce4f68ab11305f1bab3d89f0480
Change-Id: I9f147ead04b611febd2a3214cf8736b5a9afcc65
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
https://android-review.googlesource.com/1676867
Branch: androidx-main
commit 4eea9cb436ba82a6f61ff97a69bbe7c393df0132
Author: Osip Fatkullin <osip.fatkullin@gmail.com>
Date: Thu Apr 15 09:34:16 2021
[GH] [Navigation] Make deep link path arguments to not include slash
## Proposed Changes
Slash is used for URI path splitting. Arguments should not include more than one path section.
I purpose to replace `(.+?)` with `([^/]+?)` in resulting regexp.
## Testing
Added corresponing tests to `NavDestinationAndroidTest`
Test: ./gradlew test connectedCheck
## Issues Fixed
Fixes: [
This is an imported pull request from
Resolves #153
Github-Pr-Head-Sha: f16861bc1f6b0bbba03e752cc378aa795a8522e7
GitOrigin-RevId: 5da0cf583393bce4f68ab11305f1bab3d89f0480
Change-Id: I9f147ead04b611febd2a3214cf8736b5a9afcc65
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
Description
Artifact used: androidx.navigation:navigation-fragment-ktx:2.3.4
Version used: 2.3.4
Theme used: N/A
Devices/Android versions reproduced on: Any
Problem
We have the following navigation graph:
Here are declared two deep links patterns:
myapp://profiles/{userId}/
myapp://profiles/{userId}/details/
But the second deep link will never be handled because these deep links are "equal" for navigation when it tries to find the best matching deep link. In this case, NavGraph will always use first matching NavDestination (profileFragment).
For example link
myapp://profiles/u2/details/
will be handled asmyapp://profils/{userId}/
whereuserId = u2/details
.There is a workaround - remove ending slash in second pattern to make patterns tails not matching:
myapp://profiles/{userId}/
myapp://profiles/{userId}/details
It works but it is not obvious.
Purposed solution
Make arguments to not include
/
character.In resulting regexp:
^\Qmyapp://profiles/\E(.+?)\Q/\E($|(\?(.)*))
Replace:
(.+?)
With:
([^/]+?)
If this solution is right, I can create pull request on GitHub.