Status Update
Comments
il...@google.com <il...@google.com> #2
I'd expect that you'd want to pass in the reference ID itself - ?descriptionId=100230131
, not ?descriptionId=R.string.foo
, correct? If it is the former (and you're passing the generated ID itself), then yes, I suspect this is something that should be supported.
Parsing an R.string.foo
is not in scope (and has some terrible implications when it comes to namespaced resources that I'd rather not get into).
pa...@nearside.com <pa...@nearside.com> #3
Apologies, you're right - meant to write it as an interpolated string - ?description=${R.string.foo}
.
Passing R.string.foo
sounds like a nightmare for everyone involved, definitely not asking for that! 😅
il...@google.com <il...@google.com> #4
Okay, thanks for clarifying.
I've marked this as part of our androidx-bug-bounty
hotlist and would be happy to review
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 15eea2e1593617abaa29f32ec7ad1b394e5975c3
Author: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
Date: Tue Feb 09 23:09:48 2021
[GH] Navigation: Allow parsing a `NavType#ReferenceType` from String
If Bundle contents can be extracted as a Reference, allow parsing the Bundle contents as a Reference.
When navigating via deeplink URI, the user is required to string-ify navigation arguments in order to append them to the URI as query parameters. This PR supports retrieving a Reference type from a Bundle
## Proposed Changes
- replace `NavType#ReferenceType::parseValue`'s method functionality with `Integer.parseInt`
## Testing
Updated `NavTypeTest` to validate that reference types can be inserted and retrieved from a Bundle.
Test: /gradlew test connectedCheck
## Issues Fixed
Fixes:
This is an imported pull request from
Resolves #127
Github-Pr-Head-Sha: 78179a9e7dfe156d647a7e30992fd82aaa40a7ad
GitOrigin-RevId: edf5410d3277740bdb4033bce59655e9c8df960a
Change-Id: I80f4d03a07b04756cd7ea1f3cf43688a115116e4
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
A navigation/navigation-common/src/androidTest/res/values/ids.xml
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.java
Description
Component used: Navigation Version used: 2.3.3 (latest) Devices/Android versions reproduced on: n/a
setup:
reference
?description=R.string.foo
R.string.foo
in order to create a URIResult:
The workaround is obviously to change the nav arg type to String and call
getString
, but it's a weird limitation for sibling-module navigation.