Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit d8ae257b1d34561fa4838556c41050b79033a18a
Author: Clara Fok <clarafok@google.com>
Date: Wed Feb 28 12:47:31 2024
DeepLink query params now allow {argName} values for String types
For arguments of NavType<String>, arg values that are in the form of curly braces around argument name is now allowed as valid values. For all other types, this value is still considered as invalid (or absent of argument value).
Internal tests have been updated to reflect this new change. To be precise:
1. NavControllerRouteTest.kt - tests that are setup with absence of value were passing values of {argName} with StringType. Since this is no longer processed as absence of value, StringType has been changed to IntArrayType.
2. NavDeepLinkTest - likewise as NavControllerRouteTest.kt, with additional new test to assert that {argName} is invalid for non-String types.
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327274038
Relnote: "Query parameters in DeepLink now allows values in the form of curly braces around argument name (i.e. {argName}) as valid values for string-based NavTypes. This contrasts with before where such a value would be considered invalid (or absence of value) for all types."
Change-Id: I183028e2f77d63158a9a567c43da016722397cb8
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
https://android-review.googlesource.com/2982559
Branch: androidx-main
commit d8ae257b1d34561fa4838556c41050b79033a18a
Author: Clara Fok <clarafok@google.com>
Date: Wed Feb 28 12:47:31 2024
DeepLink query params now allow {argName} values for String types
For arguments of NavType<String>, arg values that are in the form of curly braces around argument name is now allowed as valid values. For all other types, this value is still considered as invalid (or absent of argument value).
Internal tests have been updated to reflect this new change. To be precise:
1. NavControllerRouteTest.kt - tests that are setup with absence of value were passing values of {argName} with StringType. Since this is no longer processed as absence of value, StringType has been changed to IntArrayType.
2. NavDeepLinkTest - likewise as NavControllerRouteTest.kt, with additional new test to assert that {argName} is invalid for non-String types.
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327274038
Relnote: "Query parameters in DeepLink now allows values in the form of curly braces around argument name (i.e. {argName}) as valid values for string-based NavTypes. This contrasts with before where such a value would be considered invalid (or absence of value) for all types."
Change-Id: I183028e2f77d63158a9a567c43da016722397cb8
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
il...@google.com <il...@google.com> #3
Fixed internally and available in navigation 2.8.0-alpha05
Description
For example, if I had an action defined similarly to the following example:
```
fragment<MyFragment>("my_fragment_dest_id") {
...
argument("my_arg") {
type = NavType.StringType
}
}
```
I would expect to be able to create an action to that destination that provides a default argument, like the following (or something similar).
```
action("my_action_id") {
destinationId = "my_fragment_dest_id"
argument("my_arg") {
defaultValue = "action_provided_default_value"
}
}
}
```
This seems like something that would be important to keep in parity with the functionality provided by the XML navigation graph resource.