Status Update
Comments
lo...@gmail.com <lo...@gmail.com> #2
Hi. Thanks for reporting this. Fixed in alpha-04
cl...@google.com <cl...@google.com> #3
Branch: androidx-main
commit e782987543a9f8ccd485e970ddc74564b24378db
Author: Vighnesh Raut <vighnesh.raut13@gmail.com>
Date: Mon Jan 02 15:27:40 2023
fix: tab row crashes when only 1 tab is added
Bug:
Test: Added unit test
Change-Id: I6381dbac304fc1d69d3708c6655f8b595668e93f
M tv/tv-material/src/androidTest/java/androidx/tv/material/TabRowTest.kt
M tv/tv-material/src/main/java/androidx/tv/material/TabRow.kt
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.tv:tv-material:1.0.0-alpha04
ba...@gocity.com <ba...@gocity.com> #6
I think this fix has broken some other deeplinks.
I have the following defined in my NavHost file:
composable<Screen.AttractionDetail>(deepLinks = listOf(navDeepLink<Screen.AttractionDetail>(basePath = "gocity:/attraction"))) ...
@Serializable
data class AttractionDetail(val id: String, val hideBookmark: Boolean = false) : Screen
In one of my UI tests I have this code:
deeplinkNavigator("gocity:/attraction/$attractionId")
With 2.8.7 this works fine but as soon as I upgrade to 2.8.8 the deeplink no longer opens the AttractionDetail screen.
I've experimented with changing the data class to be val hideBookmark: Boolean?
and to using uriPattern
instead of basePath
but I can't get this deeplink to work in 2.8.8
cl...@google.com <cl...@google.com> #7
@Serializable
sealed interface Screen {
@Serializable
data class AttractionDetail(val id: String, val hideBookmark: Boolean = false) : Screen
}
controller.graph =
controller.createGraph(startDestination = "start") {
...
composable<Screen.AttractionDetail> { deepLink(navDeepLink<Screen.AttractionDetail>("gocity:/attraction")) }
}
val request = NavDeepLinkRequest(Uri.parse("gocity:/attraction/13"), null, null)
val handled = controller.handleDeepLink(request)
Can you file a separate bug and attach a repro?
e....@gmail.com <e....@gmail.com> #8
I also had problem after updating to version 2.8.8.
Explicitly setting action
to Intent.ACTION_VIEW
in the Deep Link builder now may be required if your intent filter for deeplink schema has android.intent.action.VIEW
.
At least that's how I solved the issue that I got after using version 2.8.8.
See example:
Manifest:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="company"
android:host="app"
android:pathPattern="/.*" />
</intent-filter>
In broadcast receiver:
//...
val deepLinkUri = NavDeepLinks.progressDeepLink.uriPattern
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(deepLinkUri) //
).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
`package` = context.packageName
}
val pendingIntent = PendingIntent.getActivity(
context,
0,
intent,
PendingIntent.FLAG_IMMUTABLE
)
//...
Definition of DeepLink using builder:
val progressDeepLink = navDeepLink {
uriPattern = "$BASE/${Path.PROGRESS}"
action = Intent.ACTION_VIEW
}
Compose Navigation Graph Builder:
navigation<LimitsDirection>(
deepLinks = listOf(NavDeepLinks.limitsDeepLink)
) {
LimitsScreen(viewModel = limitsViewModel)
}
I hope that helps you.
Also, may be this fix requires some update for documentation and/or guides
Description
If a NavGraph has multiple NavDestinations, each with a deeplink that share the same action i.e.
Deeplink "https://example.com/2 " would actually match with
https://completelyDifferentUrl.com
rather than the exact matchhttps://example.com/{id}
.We would expect deeplink to match with the url that has a better path + argument match.