Merge pull request #1067 from android/ben/itemstate

Remove redundant mutable state in NewsFeed
pull/1073/head
Ben Trengrove 12 months ago committed by GitHub
commit e62d70bf5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,9 +30,6 @@ import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells
import androidx.compose.foundation.lazy.staggeredgrid.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
@ -64,9 +61,6 @@ fun LazyStaggeredGridScope.newsFeed(
key = { it.id },
contentType = { "newsFeedItem" },
) { userNewsResource ->
val resourceUrl by remember {
mutableStateOf(Uri.parse(userNewsResource.url))
}
val context = LocalContext.current
val analyticsHelper = LocalAnalyticsHelper.current
val backgroundColor = MaterialTheme.colorScheme.background.toArgb()
@ -79,7 +73,8 @@ fun LazyStaggeredGridScope.newsFeed(
analyticsHelper.logNewsResourceOpened(
newsResourceId = userNewsResource.id,
)
launchCustomChromeTab(context, resourceUrl, backgroundColor)
launchCustomChromeTab(context, Uri.parse(userNewsResource.url), backgroundColor)
onNewsResourceViewed(userNewsResource.id)
},
hasBeenViewed = userNewsResource.hasBeenViewed,

Loading…
Cancel
Save