screenshots: filter out dupes & used stable id

This commit is contained in:
Rahul Patel
2026-05-19 22:49:38 +05:30
parent 8c51175312
commit fa0e3c53d1

View File

@@ -40,6 +40,7 @@ fun ScreenshotScreen(
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfoV2() windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfoV2()
) { ) {
val app by viewModel.app.collectAsStateWithLifecycle() val app by viewModel.app.collectAsStateWithLifecycle()
val screenshots = app?.screenshots ?: emptyList()
val topAppBarTitle = when { val topAppBarTitle = when {
windowAdaptiveInfo.isWindowCompact -> app!!.displayName windowAdaptiveInfo.isWindowCompact -> app!!.displayName
@@ -48,7 +49,7 @@ fun ScreenshotScreen(
ScreenContent( ScreenContent(
topAppBarTitle = topAppBarTitle, topAppBarTitle = topAppBarTitle,
screenshots = app!!.screenshots, screenshots = screenshots.distinctBy { it.url },
index = index index = index
) )
} }
@@ -79,7 +80,8 @@ private fun ScreenContent(
modifier = Modifier modifier = Modifier
.padding(paddingValues) .padding(paddingValues)
.fillMaxSize(), .fillMaxSize(),
state = pagerState state = pagerState,
key = { screenshots[it].url }
) { page -> ) { page ->
val artwork = screenshots[page] val artwork = screenshots[page]
ScreenshotListItem( ScreenshotListItem(