Performance: Avoids creating a SharedSettings ViewModel on Galery

This commit is contained in:
Vitor Pamplona
2025-04-01 18:49:26 -04:00
parent 3089524a1f
commit a530ced594

View File

@@ -41,7 +41,6 @@ import com.vitorpamplona.amethyst.ui.feeds.FeedState
import com.vitorpamplona.amethyst.ui.feeds.LoadingFeed import com.vitorpamplona.amethyst.ui.feeds.LoadingFeed
import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.INav
import com.vitorpamplona.amethyst.ui.screen.FeedViewModel import com.vitorpamplona.amethyst.ui.screen.FeedViewModel
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.theme.FeedPadding import com.vitorpamplona.amethyst.ui.theme.FeedPadding
@@ -89,14 +88,13 @@ private fun GalleryFeedLoaded(
nav: INav, nav: INav,
) { ) {
val items by loaded.feed.collectAsStateWithLifecycle() val items by loaded.feed.collectAsStateWithLifecycle()
val sharedPreferencesViewModel: SharedPreferencesViewModel = viewModel()
sharedPreferencesViewModel.init() val ratio =
if (accountViewModel.settings.modernGalleryStyle.value) {
var ratio = 1.0f 0.8f
if (sharedPreferencesViewModel.sharedPrefs.modernGalleryStyle.value) { } else {
ratio = 0.8f 1.0f
} }
LazyVerticalGrid( LazyVerticalGrid(
columns = GridCells.Fixed(3), columns = GridCells.Fixed(3),