Fixed
Status Update
Comments
il...@google.com <il...@google.com>
cl...@google.com <cl...@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
ap...@google.com <ap...@google.com> #3
Fixed internally and available in navigation 2.8.0-alpha05
cl...@google.com <cl...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.8.0-alpha05
androidx.navigation:navigation-runtime:2.8.0-alpha05
na...@google.com <na...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.7.5
na...@google.com <na...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.8.0-alpha01
Description
Component used: Navigation
Version used:
If this is a bug in the library, we would appreciate if you could attach:
Issue:
Hi, I just encountered a weird behaviour which can be reproduced every time. My setup looks like this, Single Activity with Compose Navigation, some screens are locked to portrait orientation, some can be used in every orientation, e.g. to display images or videos.
Orientation is set like this while navigating:
ScreenA
is locked to portrait,ScreenB
can be used in every orientation. IfScreenB
is used in landscape mode, while navigating back an orientation change is requested which leads to activity recreation. I think because of the activity recreationScreenBViewModel.onCleared
is not called...How to reproduce?
ScreenBViewModel.onCleared
is not calledYou can just search the logs for "ScreenBViewModel", an info gets logged for init and onCleared of
ScreenBViewModel
. IfScreenB
doesn't change its orientationonCleared
is called as expected.Expected behaviour:
For step 5
ScreenBViewModel.onCleared
is calledDo you have any recommendations for a temporary workaround or any suggestions how orientation changes can be forced without losing the
onCleared
call?Let me know if you need more info.
Best regards ✌️