diff --git a/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt b/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt index a795224598..d760efd883 100644 --- a/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt +++ b/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt @@ -22282,7 +22282,7 @@ SPLcom/vitorpamplona/amethyst/AppModules;->getThumbnailDiskCache()Lcom/vitorpamp SPLcom/vitorpamplona/amethyst/AppModules;->getTorManager()Lcom/vitorpamplona/amethyst/ui/tor/TorManager; SPLcom/vitorpamplona/amethyst/AppModules;->getTorPrefs()Lcom/vitorpamplona/amethyst/model/preferences/TorSharedPreferences; SPLcom/vitorpamplona/amethyst/AppModules;->getUiPrefs()Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences; -SPLcom/vitorpamplona/amethyst/AppModules;->getUiState()Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState; +SPLcom/vitorpamplona/amethyst/AppModules;->getUiState()Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState; SPLcom/vitorpamplona/amethyst/AppModules;->getVideoCache()Lcom/vitorpamplona/amethyst/service/playback/diskCache/VideoCache; SPLcom/vitorpamplona/amethyst/AppModules;->httpUsageInterceptor$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Z SPLcom/vitorpamplona/amethyst/AppModules;->httpUsageInterceptor$lambda$1(Lcom/vitorpamplona/amethyst/AppModules;)Z @@ -22301,7 +22301,7 @@ SPLcom/vitorpamplona/amethyst/AppModules;->signerPermissionStore_delegate$lambda SPLcom/vitorpamplona/amethyst/AppModules;->thumbnailDiskCache_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/service/images/ThumbnailDiskCache; SPLcom/vitorpamplona/amethyst/AppModules;->torPrefs_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/model/preferences/TorSharedPreferences; SPLcom/vitorpamplona/amethyst/AppModules;->uiPrefs_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences; -SPLcom/vitorpamplona/amethyst/AppModules;->uiState_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState; +SPLcom/vitorpamplona/amethyst/AppModules;->uiState_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState; SPLcom/vitorpamplona/amethyst/AppModules;->videoCache_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/service/playback/diskCache/VideoCache; Lcom/vitorpamplona/amethyst/AppModules$$ExternalSyntheticLambda0; SPLcom/vitorpamplona/amethyst/AppModules$$ExternalSyntheticLambda0;->(Landroid/content/Context;)V @@ -24832,49 +24832,49 @@ SPLcom/vitorpamplona/amethyst/ui/screen/ComposableSingletons$AccountScreenKt;->l Lcom/vitorpamplona/amethyst/ui/screen/ComposableSingletons$AccountScreenKt$$ExternalSyntheticLambda0; SPLcom/vitorpamplona/amethyst/ui/screen/ComposableSingletons$AccountScreenKt$$ExternalSyntheticLambda0;->()V SPLcom/vitorpamplona/amethyst/ui/screen/ComposableSingletons$AccountScreenKt$$ExternalSyntheticLambda0;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState;->()V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState;->(Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;Lkotlinx/coroutines/flow/StateFlow;Lkotlinx/coroutines/CoroutineScope;)V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$WhenMappings; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showImages$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showProfilePictures$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$showUrlPreview$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1;->(Lkotlinx/coroutines/flow/Flow;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1;->collect(Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$1;->(Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1;Lkotlin/coroutines/Continuation;)V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2;->(Lkotlinx/coroutines/flow/FlowCollector;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2;->emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2$1;->(Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$special$$inlined$map$1$2;Lkotlin/coroutines/Continuation;)V -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState$startVideoPlayback$1$WhenMappings;->()V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState;->()V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState;->(Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;Lkotlinx/coroutines/flow/StateFlow;Lkotlinx/coroutines/CoroutineScope;)V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$WhenMappings; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$WhenMappings;->()V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1;->(Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1$WhenMappings; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showImages$1$WhenMappings;->()V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1;->(Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1$WhenMappings; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showProfilePictures$1$WhenMappings;->()V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1;->(Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1$WhenMappings; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$showUrlPreview$1$WhenMappings;->()V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1;->(Lkotlinx/coroutines/flow/Flow;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1;->collect(Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$1;->(Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1;Lkotlin/coroutines/Continuation;)V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2;->(Lkotlinx/coroutines/flow/FlowCollector;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2;->emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2$1;->(Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$special$$inlined$map$1$2;Lkotlin/coroutines/Continuation;)V +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1;->(Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1$WhenMappings; +SPLcom/vitorpamplona/amethyst/commons/state/UiSettingsState$startVideoPlayback$1$WhenMappings;->()V Lcom/vitorpamplona/amethyst/ui/screen/loggedIn/apps/recommendations/datasource/ProfileAppRecommendationsFilterAssembler; SPLcom/vitorpamplona/amethyst/ui/screen/loggedIn/apps/recommendations/datasource/ProfileAppRecommendationsFilterAssembler;->()V SPLcom/vitorpamplona/amethyst/ui/screen/loggedIn/apps/recommendations/datasource/ProfileAppRecommendationsFilterAssembler;->(Lcom/vitorpamplona/quartz/nip01Core/relay/client/INostrClient;)V diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt index 23a19447e3..4ffb52fa28 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt @@ -56,8 +56,8 @@ import com.vitorpamplona.amethyst.commons.service.http.OnionLocationCache import com.vitorpamplona.amethyst.commons.service.lnurl.OkHttpLnurlEndpointResolver import com.vitorpamplona.amethyst.commons.service.pow.PoWPolicy import com.vitorpamplona.amethyst.commons.service.pow.PoWPublishQueue +import com.vitorpamplona.amethyst.commons.state.UiSettingsState import com.vitorpamplona.amethyst.commons.tor.TorSettings -import com.vitorpamplona.amethyst.commons.ui.screen.UiSettingsState import com.vitorpamplona.amethyst.connectedApps.DataStoreNostrSignerPermissionStore import com.vitorpamplona.amethyst.connectedApps.nip46.DataStoreNip46ClientStore import com.vitorpamplona.amethyst.model.Account diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthComposeHelpers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthComposeHelpers.kt index 6866ab49f0..4ac7462573 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthComposeHelpers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthComposeHelpers.kt @@ -39,7 +39,6 @@ import com.vitorpamplona.amethyst.commons.resources.relay_auth_purpose_read_outb import com.vitorpamplona.amethyst.commons.resources.relay_auth_purpose_read_venue import com.vitorpamplona.amethyst.commons.resources.relay_auth_purpose_send_dm import com.vitorpamplona.amethyst.commons.resources.relay_auth_purpose_thread -import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.HexKey import org.jetbrains.compose.resources.StringResource @@ -51,7 +50,6 @@ import org.jetbrains.compose.resources.StringResource @Composable internal fun LoadRelayAuthUser( pubkey: HexKey, - accountViewModel: AccountViewModel, content: @Composable (User?) -> Unit, ) { var user by remember(pubkey) { mutableStateOf(LocalCache.getUserIfExists(pubkey)) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthPromptHost.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthPromptHost.kt index abd3b5015f..82eefe3b7c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthPromptHost.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/compose/RelayAuthPromptHost.kt @@ -99,6 +99,7 @@ import com.vitorpamplona.amethyst.commons.resources.relay_auth_why_thread import com.vitorpamplona.amethyst.commons.resources.relay_auth_why_thread_with import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.RelayIconFilter import com.vitorpamplona.amethyst.model.nip11RelayInfo.loadRelayInfo @@ -404,8 +405,8 @@ private fun RelayHeader( contentDescription = null, colorFilter = RelayIconFilter, modifier = Modifier.size(34.dp).clip(MaterialTheme.shapes.small), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) Column { Text( @@ -466,7 +467,7 @@ private fun ReasonSentence( InlineTextContent( Placeholder(22.sp, 22.sp, PlaceholderVerticalAlign.TextCenter), ) { - LoadRelayAuthUser(face, accountViewModel) { user -> + LoadRelayAuthUser(face) { user -> if (user != null) ClickableUserPicture(user, 20.dp, accountViewModel) } }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/call/CallWidgets.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/call/CallWidgets.kt index 5fa1ae296f..94e0ca9fcf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/call/CallWidgets.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/call/CallWidgets.kt @@ -193,7 +193,7 @@ fun PeerAvatarCell( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { - LoadUser(baseUserHex = peerPubKey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = peerPubKey) { user -> if (user != null) { ClickableUserPicture( baseUser = user, @@ -235,7 +235,7 @@ fun GroupCallPictures( 0 -> {} 1 -> { - LoadUser(baseUserHex = userList[0], accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = userList[0]) { user -> if (user != null) { ClickableUserPicture( baseUser = user, @@ -350,7 +350,7 @@ fun GroupCallNames( 0 -> {} 1 -> { - LoadUser(baseUserHex = userList[0], accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = userList[0]) { user -> if (user != null) { UsernameDisplay( baseUser = user, @@ -378,7 +378,7 @@ fun GroupCallNames( color = textColor, ) } - LoadUser(baseUserHex = userList[i], accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = userList[i]) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt index 99a3042771..c1029548c3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt @@ -147,7 +147,7 @@ fun DisplayEvent( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(hex, accountViewModel) { + LoadNote(hex) { if (it != null) { DisplayNoteLink(it, hex, additionalChars, accountViewModel, nav) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ConcordInviteCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ConcordInviteCard.kt index ab6f170785..8935486076 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ConcordInviteCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ConcordInviteCard.kt @@ -51,6 +51,7 @@ import com.vitorpamplona.amethyst.commons.resources.concord_invite_card_join import com.vitorpamplona.amethyst.commons.resources.concord_invite_card_subtitle import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.concord.cord05Invites.CommunityInvite @@ -139,8 +140,8 @@ fun ConcordInvitePreviewRow( .size(52.dp) .clip(CircleShape) .border(1.5.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.35f), CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) Column(Modifier.weight(1f)) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RelayGroupCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RelayGroupCard.kt index 7d7ac96c3a..cda380757e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RelayGroupCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RelayGroupCard.kt @@ -56,6 +56,7 @@ import com.vitorpamplona.amethyst.commons.resources.relay_group_open import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.relayGroup.LoadRelayGroupChannel @@ -86,7 +87,7 @@ fun RelayGroupCard( val groupId = remember(invite) { invite.toGroupId() } - LoadRelayGroupChannel(groupId, accountViewModel) { channel -> + LoadRelayGroupChannel(groupId) { channel -> RelayGroupCardContent(channel, invite.code, accountViewModel, nav) } } @@ -148,8 +149,8 @@ private fun RelayGroupCardContent( .size(52.dp) .clip(CircleShape) .border(1.5.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.35f), CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt index 8e08b17b2c..ede5174be2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt @@ -862,7 +862,7 @@ fun TagLink( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(baseUserHex = word.hex, accountViewModel) { + LoadUser(baseUserHex = word.hex) { if (it == null) { Text(text = word.segmentText) } else { @@ -879,7 +879,6 @@ fun TagLink( @Composable fun LoadNote( baseNoteHex: String, - accountViewModel: AccountViewModel, content: @Composable (Note?) -> Unit, ) { var note by @@ -903,7 +902,7 @@ fun TagLink( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = word.hex, accountViewModel) { + LoadNote(baseNoteHex = word.hex) { if (it == null) { Text(text = remember { word.segmentText.toShortDisplay() }) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/bottombars/GroupBottomBarEntries.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/bottombars/GroupBottomBarEntries.kt index 428b2ac946..7b12bb38e1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/bottombars/GroupBottomBarEntries.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/bottombars/GroupBottomBarEntries.kt @@ -42,6 +42,7 @@ import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChann import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.concord_home_title import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.model.nip11RelayInfo.loadRelayInfo import com.vitorpamplona.amethyst.service.relayClient.reqCommand.channel.ChannelFinderFilterAssemblerSubscription @@ -279,8 +280,8 @@ fun GroupEntryAvatar( model = display.model, contentDescription = display.label, modifier = Modifier.size(size).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = false, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt index 7c5ccb1d21..1df6a6cfc4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt @@ -75,6 +75,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncIma import com.vitorpamplona.amethyst.commons.ui.loadPluralStringRes import com.vitorpamplona.amethyst.commons.ui.pluralStringRes import com.vitorpamplona.amethyst.commons.ui.richtext.CreateTextWithEmoji +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.AccountPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.Size10dp @@ -238,8 +239,8 @@ private fun AccountPicture( model = userInfo?.info?.profilePicture(), contentDescription = stringRes(Res.string.profile_image), modifier = AccountPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt index 0ce7435def..a500753e1b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt @@ -121,6 +121,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncIma import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.richtext.CreateTextWithEmoji +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.DividerThickness import com.vitorpamplona.amethyst.commons.ui.theme.DoubleHorzSpacer @@ -315,8 +316,8 @@ fun ProfileContentTemplate( .clip(shape = CircleShape) .border(3.dp, MaterialTheme.colorScheme.onBackground, CircleShape) .clickable(onClick = onClick), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/UserDrawerSearchTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/UserDrawerSearchTopBar.kt index 91144ba5a5..4b3a56e022 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/UserDrawerSearchTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/UserDrawerSearchTopBar.kt @@ -42,6 +42,7 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.ShorterTopAppBar import com.vitorpamplona.amethyst.commons.ui.note.ArrowBackIcon import com.vitorpamplona.amethyst.commons.ui.note.SearchIcon +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.HeaderPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.Size22Modifier @@ -142,8 +143,8 @@ internal fun LoggedInUserPictureDrawer( contentDescription = stringRes(id = Res.string.your_profile_image), modifier = HeaderPictureModifier, contentScale = ContentScale.Crop, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Loaders.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Loaders.kt index a5cda72e5e..ad119a36a4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Loaders.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Loaders.kt @@ -92,7 +92,6 @@ fun LoadDecryptedContentOrNull( @Composable fun LoadAddressableNote( address: Address, - accountViewModel: AccountViewModel, content: @Composable (AddressableNote?) -> Unit, ) { val note by produceState( @@ -150,7 +149,6 @@ fun LoadOts( @Composable fun LoadPublicChatChannel( id: String, - accountViewModel: AccountViewModel, content: @Composable (PublicChatChannel) -> Unit, ) { val channel by produceStateIfNotNull(LocalCache.getPublicChatChannelIfExists(id), id) { @@ -163,7 +161,6 @@ fun LoadPublicChatChannel( @Composable fun LoadEphemeralChatChannel( id: RoomId, - accountViewModel: AccountViewModel, content: @Composable (EphemeralChatChannel) -> Unit, ) { val channel = @@ -177,7 +174,6 @@ fun LoadEphemeralChatChannel( @Composable fun LoadLiveActivityChannel( id: Address, - accountViewModel: AccountViewModel, content: @Composable (LiveActivitiesChannel) -> Unit, ) { val channel = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt index f2b915219f..12c29afce3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt @@ -87,6 +87,7 @@ import com.vitorpamplona.amethyst.commons.ui.note.RepostedIcon import com.vitorpamplona.amethyst.commons.ui.note.ScoreTagSmall import com.vitorpamplona.amethyst.commons.ui.note.ZappedIcon import com.vitorpamplona.amethyst.commons.ui.richtext.InLineIconRenderer +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.commons.ui.theme.HalfTopPadding @@ -806,8 +807,8 @@ fun WatchUserMetadataAndFollowsAndRenderUserProfilePicture( contentDescription = stringRes(id = Res.string.profile_image), modifier = MaterialTheme.colorScheme.profile35dpModifier, contentScale = ContentScale.Crop, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index f4d70e76ea..ee0acbe5e7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -315,7 +315,7 @@ fun DisplayStatusInner( } nostrATag != null -> { - LoadAddressableNote(nostrATag, accountViewModel) { note -> + LoadAddressableNote(nostrATag) { note -> if (note != null) { Spacer(modifier = StdHorzSpacer) IconButton( @@ -339,7 +339,7 @@ fun DisplayStatusInner( } nostrETag != null -> { - LoadNote(baseNoteHex = nostrETag.eventId, accountViewModel) { + LoadNote(baseNoteHex = nostrETag.eventId) { if (it != null) { Spacer(modifier = StdHorzSpacer) IconButton( @@ -363,7 +363,7 @@ fun DisplayStatusInner( } nostrPTag != null -> { - LoadUser(baseUserHex = nostrPTag, accountViewModel) { user -> + LoadUser(baseUserHex = nostrPTag) { user -> if (user != null) { Spacer(modifier = StdHorzSpacer) IconButton( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 771f97e549..08ae330cde 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -96,6 +96,7 @@ import com.vitorpamplona.amethyst.commons.ui.note.RenderCashuMint import com.vitorpamplona.amethyst.commons.ui.note.RenderFedimint import com.vitorpamplona.amethyst.commons.ui.note.RenderMintRecommendation import com.vitorpamplona.amethyst.commons.ui.note.elements.StaleRelayHint +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.state.produceCachedStateAsync import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.DoubleVertSpacer @@ -922,7 +923,7 @@ private fun RenderApprovalIfNeeded( baseNote.event?.communityAddress() } communityAddress?.let { - LoadAddressableNote(it, accountViewModel) { community -> + LoadAddressableNote(it) { community -> if (community != null) { val showApproveButton by observeCommunityApprovalNeedStatus(baseNote, community, accountViewModel) if (showApproveButton == true) { @@ -2427,7 +2428,7 @@ fun RenderAuthorImages( if (noteEvent is ChannelMessageEvent) { val baseChannelHex = noteEvent.channelId() if (baseChannelHex != null) { - LoadPublicChatChannel(baseChannelHex, accountViewModel) { channel -> + LoadPublicChatChannel(baseChannelHex) { channel -> ChannelNotePicture( channel, accountViewModel, @@ -2449,8 +2450,8 @@ private fun ChannelNotePicture( model = model, contentDescription = stringRes(Res.string.group_picture), modifier = MaterialTheme.colorScheme.channelNotePictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 14cf7f0cf5..a74451ba8f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -428,7 +428,7 @@ fun PayReaction( val authorPubkey = baseNote.author?.pubkeyHex ?: return val address = remember(authorPubkey) { PaymentTargetsEvent.createAddress(authorPubkey) } - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> var expanded by remember { mutableStateOf(false) } ClickableBox( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt index 3ac0cae686..bb7b302840 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt @@ -58,6 +58,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.ClickableBox import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.components.util.setText import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.LargeRelayIconModifier import com.vitorpamplona.amethyst.commons.ui.theme.RelayIconFilter @@ -161,9 +162,9 @@ fun RenderRelay( RenderRelayIcon( displayUrl = relayInfo.id ?: relay.url, iconUrl = relayInfo.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, pingInMs = 0, - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadRobohash = LocalDisplaySettings.current.loadRobohash, iconModifier = iconModifier, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt index b85424afa0..7fc4cc5be5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt @@ -359,7 +359,6 @@ private fun EmojiSelector( ) { LoadAddressableNote( accountViewModel.account.emoji.getEmojiPackSelectionAddress(), - accountViewModel, ) { emptyNote -> emptyNote?.let { usersEmojiList -> val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiPackSelectionEvent -> @@ -387,7 +386,7 @@ fun EmojiCollectionGallery( state = listState, ) { itemsIndexed(emojiCollections, key = { _, item -> item }) { _, item -> - LoadAddressableNote(item, accountViewModel) { + LoadAddressableNote(item) { it?.let { WatchAndRenderNote(it, bgColor, accountViewModel, nav, onClick) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UserProfilePicture.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UserProfilePicture.kt index c081bb1e93..753d91f79f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UserProfilePicture.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UserProfilePicture.kt @@ -49,6 +49,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.FollowingIcon import com.vitorpamplona.amethyst.commons.ui.note.ScoreTag +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserContactCardsScore @@ -105,7 +106,7 @@ fun DisplayBlankAuthor( robot = "authornotfound", contentDescription = stringRes(Res.string.unknown_author), modifier = nullModifier, - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) } @@ -117,7 +118,7 @@ fun UserPicture( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(baseUserHex = userHex, accountViewModel) { + LoadUser(baseUserHex = userHex) { if (it != null) { UserPicture( user = it, @@ -241,7 +242,7 @@ fun NonClickableUserPictures( 0 -> {} 1 -> { - LoadUser(baseUserHex = userHexList.first(), accountViewModel) { + LoadUser(baseUserHex = userHexList.first()) { it?.let { BaseUserPicture(it, size, accountViewModel, outerModifier = Modifier) } } } @@ -249,7 +250,7 @@ fun NonClickableUserPictures( 2 -> { val userList = userHexList - LoadUser(baseUserHex = userList[0], accountViewModel) { + LoadUser(baseUserHex = userList[0]) { it?.let { BaseUserPicture( it, @@ -259,7 +260,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[1], accountViewModel) { + LoadUser(baseUserHex = userList[1]) { it?.let { BaseUserPicture( it, @@ -274,7 +275,7 @@ fun NonClickableUserPictures( 3 -> { val userList = userHexList - LoadUser(baseUserHex = userList[0], accountViewModel) { + LoadUser(baseUserHex = userList[0]) { it?.let { BaseUserPicture( it, @@ -284,7 +285,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[1], accountViewModel) { + LoadUser(baseUserHex = userList[1]) { it?.let { BaseUserPicture( it, @@ -294,7 +295,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[2], accountViewModel) { + LoadUser(baseUserHex = userList[2]) { it?.let { BaseUserPicture( it, @@ -309,7 +310,7 @@ fun NonClickableUserPictures( else -> { val userList = userHexList - LoadUser(baseUserHex = userList[0], accountViewModel) { + LoadUser(baseUserHex = userList[0]) { it?.let { BaseUserPicture( it, @@ -319,7 +320,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[1], accountViewModel) { + LoadUser(baseUserHex = userList[1]) { it?.let { BaseUserPicture( it, @@ -329,7 +330,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[2], accountViewModel) { + LoadUser(baseUserHex = userList[2]) { it?.let { BaseUserPicture( it, @@ -339,7 +340,7 @@ fun NonClickableUserPictures( ) } } - LoadUser(baseUserHex = userList[3], accountViewModel) { + LoadUser(baseUserHex = userList[3]) { it?.let { BaseUserPicture( it, @@ -392,7 +393,7 @@ fun BaseUserPicture( outerModifier: Modifier = Modifier.size(size), ) { Box(outerModifier, contentAlignment = Alignment.TopEnd) { - LoadUser(baseUserHex, accountViewModel) { + LoadUser(baseUserHex) { if (it != null) { ObserveAndDrawInnerUserPicture(it, size, accountViewModel, innerModifier) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt index a7d5b10d9b..1687f0a6ea 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt @@ -34,7 +34,6 @@ import kotlinx.collections.immutable.toImmutableList fun WatchAndLoadMyEmojiList(accountViewModel: AccountViewModel) { LoadAddressableNote( EmojiPackSelectionEvent.createAddress(accountViewModel.userProfile().pubkeyHex), - accountViewModel, ) { emptyNote -> emptyNote?.let { usersEmojiList -> val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiPackSelectionEvent -> @@ -42,7 +41,7 @@ fun WatchAndLoadMyEmojiList(accountViewModel: AccountViewModel) { } collections?.forEach { address -> - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> if (note != null) { EventFinderFilterAssemblerSubscription(note, accountViewModel) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/invoice/ClinkOfferPreview.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/invoice/ClinkOfferPreview.kt index fa3759d83b..a0895e6035 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/invoice/ClinkOfferPreview.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/invoice/ClinkOfferPreview.kt @@ -244,7 +244,7 @@ private fun OfferRecipientRow( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(baseUserHex = pubKey, accountViewModel) { user -> + LoadUser(baseUserHex = pubKey) { user -> if (user != null) { Row( verticalAlignment = Alignment.CenterVertically, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt index 191e3daade..15205698c9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt @@ -106,7 +106,6 @@ fun ObserveRelayListForDMs( ) { LoadAddressableNote( ChatMessageRelayListEvent.createAddress(pubkey), - accountViewModel, ) { relayList -> if (relayList != null) { val relayListEvent by observeNoteEvent(relayList, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/ForkInfo.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/ForkInfo.kt index 1c9e541a98..943141e3ee 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/ForkInfo.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/ForkInfo.kt @@ -49,13 +49,13 @@ fun ShowForkInformation( val forkedAddress = remember(noteEvent) { noteEvent.forkFromAddress() } val forkedEvent = remember(noteEvent) { noteEvent.forkFromVersion() } if (forkedAddress != null) { - LoadAddressableNote(forkedAddress, accountViewModel) { addressableNote -> + LoadAddressableNote(forkedAddress) { addressableNote -> if (addressableNote != null) { ForkMark(addressableNote, modifier, accountViewModel, nav) } } } else if (forkedEvent != null) { - LoadNote(forkedEvent, accountViewModel) { event -> + LoadNote(forkedEvent) { event -> if (event != null) { ForkMark(event, modifier, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsImageScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsImageScreen.kt index 9e0ed0fed3..3c37165384 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsImageScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsImageScreen.kt @@ -123,7 +123,7 @@ fun ShareNoteAsImageScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(id, accountViewModel) { note -> + LoadNote(id) { note -> if (note != null) { ShareNoteAsImageScreen(note, accountViewModel, nav) } @@ -142,7 +142,7 @@ fun ShareNoteAsImageFileScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(id, accountViewModel) { note -> + LoadNote(id) { note -> if (note != null) { ShareNoteAsImageFileScreen(note, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsQrScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsQrScreen.kt index 3064770955..70320f2e5d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsQrScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/ShareNoteAsQrScreen.kt @@ -94,7 +94,7 @@ fun ShareNoteAsQrScreen( Scaffold( topBar = { TopBarWithBackButton(stringRes(Res.string.share_as_qr), nav) }, ) { pad -> - LoadNote(id, accountViewModel) { note -> + LoadNote(id) { note -> if (note != null) { ShareNoteAsQrScreenContent(note, accountViewModel, nav, pad) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt index ce0167b863..2369f4f58f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt @@ -585,7 +585,7 @@ private fun RelatedEventRow( val address = remember(aTag) { Address(aTag.kind, aTag.pubKeyHex, aTag.dTag) } val shape = RoundedCornerShape(8.dp) - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> if (note == null) return@LoadAddressableNote val noteState by observeNote(note, accountViewModel) @@ -709,7 +709,7 @@ fun ByAuthorChip( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(baseUserHex = authorHex, accountViewModel = accountViewModel) { author -> + LoadUser(baseUserHex = authorHex) { author -> if (author == null) return@LoadUser Surface( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppRecommendation.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppRecommendation.kt index f41bbd820b..9d11acf61e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppRecommendation.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppRecommendation.kt @@ -85,7 +85,7 @@ fun RenderAppRecommendation( verticalArrangement = Arrangement.spacedBy(8.dp), ) { recommendations.forEach { recommendation -> - LoadAddressableNote(recommendation.address, accountViewModel) { appNote -> + LoadAddressableNote(recommendation.address) { appNote -> appNote?.let { if (it.event == null) { EventFinderFilterAssemblerSubscription(it, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Attestation.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Attestation.kt index 89bdc937bf..9b891d7f10 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Attestation.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Attestation.kt @@ -221,7 +221,7 @@ fun RenderAttestation( if (quotesLeft > 0) { if (aboutAddress != null) { - LoadAddressableNote(aboutAddress, accountViewModel) { + LoadAddressableNote(aboutAddress) { if (it != null) { Spacer(modifier = DoubleVertSpacer) NoteCompose( @@ -238,7 +238,7 @@ fun RenderAttestation( } } } else if (aboutEvent != null) { - LoadNote(aboutEvent, accountViewModel) { + LoadNote(aboutEvent) { if (it != null) { Spacer(modifier = DoubleVertSpacer) NoteCompose( @@ -345,7 +345,7 @@ fun RenderAttestationRequest( if (quotesLeft > 0) { when { aboutAddress != null -> { - LoadAddressableNote(aboutAddress, accountViewModel) { + LoadAddressableNote(aboutAddress) { if (it != null) { Spacer(modifier = DoubleVertSpacer) Text( @@ -369,7 +369,7 @@ fun RenderAttestationRequest( } aboutEvent != null -> { - LoadNote(aboutEvent, accountViewModel) { + LoadNote(aboutEvent) { if (it != null) { Spacer(modifier = DoubleVertSpacer) Text( @@ -393,7 +393,7 @@ fun RenderAttestationRequest( } aboutPubkey != null -> { - LoadUser(aboutPubkey, accountViewModel) { + LoadUser(aboutPubkey) { if (it != null) { Spacer(modifier = DoubleVertSpacer) Text( @@ -458,7 +458,7 @@ fun RenderAttestorRecommendation( ) } - LoadUser(aboutPubKey, accountViewModel) { + LoadUser(aboutPubKey) { if (it != null) { Spacer(modifier = DoubleVertSpacer) UserCompose(it, accountViewModel = accountViewModel, nav = nav) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarRsvpRender.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarRsvpRender.kt index aadf78ffa2..ac30218f78 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarRsvpRender.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarRsvpRender.kt @@ -73,7 +73,7 @@ private fun LoadAppointmentBehind( ) { val address = remember(event) { event.calendarEventAddress() } ?: return - LoadAddressableNote(address, accountViewModel) { appointment -> + LoadAddressableNote(address) { appointment -> if (appointment != null) { EventFinderFilterAssemblerSubscription(appointment, accountViewModel) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Chess.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Chess.kt index d56e7edd8e..7f7c919335 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Chess.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Chess.kt @@ -91,7 +91,7 @@ fun RenderChessGame( ChessGameViewer( pgnContent = event.pgn(), playerContent = { playerHex -> - LoadUser(playerHex, accountViewModel) { user -> + LoadUser(playerHex) { user -> if (user != null) { UserChip(user = user, accountViewModel = accountViewModel, nav = nav) } else { @@ -196,7 +196,7 @@ fun RenderLiveChessChallenge( fontWeight = FontWeight.Bold, ) event.opponentPubkey()?.let { opponentHex -> - LoadUser(opponentHex, accountViewModel) { user -> + LoadUser(opponentHex) { user -> if (user != null) { UserChip(user = user, accountViewModel = accountViewModel, nav = nav) } @@ -313,7 +313,7 @@ fun RenderLiveChessGameEnd( ) event.opponentPubkey()?.let { opponentHex -> - LoadUser(opponentHex, accountViewModel) { user -> + LoadUser(opponentHex) { user -> if (user != null) { UserChip(user = user, accountViewModel = accountViewModel, nav = nav) } @@ -340,7 +340,7 @@ fun RenderLiveChessGameEnd( ChessGameViewer( pgnContent = pgn, playerContent = { playerHex -> - LoadUser(playerHex, accountViewModel) { user -> + LoadUser(playerHex) { user -> if (user != null) { UserChip(user = user, accountViewModel = accountViewModel, nav = nav) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CommunityHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CommunityHeader.kt index 24fc44c863..57712a02a7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CommunityHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CommunityHeader.kt @@ -79,6 +79,7 @@ import com.vitorpamplona.amethyst.commons.resources.quick_action_share import com.vitorpamplona.amethyst.commons.resources.quick_action_share_browser_link import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.commons.ui.theme.ButtonPadding @@ -338,8 +339,8 @@ fun ShortCommunityHeader( contentDescription = stringRes(Res.string.profile_image), contentScale = ContentScale.Crop, modifier = HeaderPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -393,8 +394,8 @@ fun ShortCommunityHeaderNoActions( contentDescription = stringRes(Res.string.profile_image), contentScale = ContentScale.Crop, modifier = HeaderPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt index fab63e5e05..ebdf0422df 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt @@ -182,7 +182,6 @@ private fun EmojiListOptions( ) { LoadAddressableNote( accountViewModel.account.emoji.getEmojiPackSelectionAddress(), - accountViewModel, ) { it?.let { usersEmojiList -> val hasAddedThis by observeNoteAndMap(usersEmojiList, accountViewModel) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/EntityRating.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/EntityRating.kt index 3bba1f9328..af8149cfad 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/EntityRating.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/EntityRating.kt @@ -127,7 +127,7 @@ fun RenderEntityRating( Column(Modifier.fillMaxWidth()) { if (targetAddress != null) { - LoadAddressableNote(targetAddress, accountViewModel) { targetNote -> + LoadAddressableNote(targetAddress) { targetNote -> targetNote?.let { RatedPublicationCard( targetNote = it, @@ -142,7 +142,7 @@ fun RenderEntityRating( // The spec's default mark is `event`, and such a rating names its target by event id // rather than by coordinate. Without this the card printed the raw 64-hex id as its // title, which tells a reader nothing about what was rated. - LoadNote(targetEventId, accountViewModel) { targetNote -> + LoadNote(targetEventId) { targetNote -> if (targetNote != null) { RatedNoteCard(targetNote, mark, accountViewModel, nav) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileStorage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileStorage.kt index 87acaabb24..5b8108f14f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileStorage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileStorage.kt @@ -50,7 +50,7 @@ fun FileStorageHeaderDisplay( val eventHeader = (baseNote.event as? FileStorageHeaderEvent) ?: return val dataEventId = eventHeader.dataEventId() ?: return - LoadNote(baseNoteHex = dataEventId, accountViewModel) { contentNote -> + LoadNote(baseNoteHex = dataEventId) { contentNote -> if (contentNote != null) { ObserverAndRenderNIP95(baseNote, contentNote, roundedCorner, contentScale, accountViewModel) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Geocache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Geocache.kt index 34d39223f1..11b3217698 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Geocache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Geocache.kt @@ -169,7 +169,7 @@ fun RenderGeocacheFoundLog( // Loaded even for an unverified log: the cache's name is what tells a reader in a feed what // was actually found, and "Found it!" on its own says nothing. - LoadAddressableNote(address, accountViewModel) { cacheNote -> + LoadAddressableNote(address) { cacheNote -> if (cacheNote == null) { GeocacheFoundLogCard(noteEvent, showImages, if (hasProof) FoundLogProof.UNKNOWN else FoundLogProof.NONE) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Git.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Git.kt index 07579bc148..002c3ad80f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Git.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Git.kt @@ -451,7 +451,7 @@ private fun RenderGitPatchEvent( val repository = remember(noteEvent) { noteEvent.repositoryAddress() } if (repository != null) { Spacer(modifier = StdVertSpacer) - LoadAddressableNote(repository, accountViewModel) { + LoadAddressableNote(repository) { if (it != null) { RenderShortRepositoryHeader(it, accountViewModel, nav) } @@ -550,7 +550,7 @@ private fun RenderGitIssueEvent( val repository = remember(noteEvent) { noteEvent.repositoryAddress() } if (repository != null) { Spacer(modifier = StdVertSpacer) - LoadAddressableNote(repository, accountViewModel) { + LoadAddressableNote(repository) { if (it != null) { RenderShortRepositoryHeader(it, accountViewModel, nav) } @@ -610,7 +610,7 @@ private fun RenderGitPullRequestEvent( GitCardContainer { val repository = remember(noteEvent) { noteEvent.repositoryAddress() } if (repository != null) { - LoadAddressableNote(repository, accountViewModel) { + LoadAddressableNote(repository) { if (it != null) { RenderShortRepositoryHeader(it, accountViewModel, nav) } @@ -751,7 +751,7 @@ private fun RenderGitPullRequestUpdateEvent( val repository = remember(noteEvent) { noteEvent.repositoryAddress() } if (repository != null) { Spacer(modifier = StdVertSpacer) - LoadAddressableNote(repository, accountViewModel) { + LoadAddressableNote(repository) { if (it != null) { RenderShortRepositoryHeader(it, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/InteractiveStory.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/InteractiveStory.kt index d4a7ab7c01..f3e3d65512 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/InteractiveStory.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/InteractiveStory.kt @@ -79,7 +79,7 @@ fun RenderInteractiveStory( val currentScene = readingState?.currentScene() if (currentScene != null && currentScene != rootEvent.address()) { - LoadAddressableNote(currentScene, accountViewModel) { currentSceneBaseNote -> + LoadAddressableNote(currentScene) { currentSceneBaseNote -> currentSceneBaseNote?.let { val currentSceneEvent by observeNoteEvent(it, accountViewModel) @@ -168,7 +168,7 @@ fun RenderInteractiveStory( if (options.isNotEmpty()) { Column(Modifier.padding(top = 10.dp)) { options.forEach { opt -> - LoadAddressableNote(opt.address, accountViewModel) { note -> + LoadAddressableNote(opt.address) { note -> if (note != null) { EventFinderFilterAssemblerSubscription(note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LiveActivityChatMessage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LiveActivityChatMessage.kt index bb03a0e593..a1c4297b06 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LiveActivityChatMessage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LiveActivityChatMessage.kt @@ -61,7 +61,7 @@ fun RenderLiveActivityChatMessage( } showChannelInfo?.let { - LoadLiveActivityChannel(it, accountViewModel) { + LoadLiveActivityChannel(it) { LiveActivitiesChannelHeader( baseChannel = it, showVideo = false, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MeetingSpace.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MeetingSpace.kt index 1398cd086c..bae3eb41e3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MeetingSpace.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MeetingSpace.kt @@ -340,7 +340,6 @@ private fun ParentMeetingSpaceLink( com.vitorpamplona.amethyst.ui.note.LoadAddressableNote( address = spaceAddress, - accountViewModel = accountViewModel, ) { spaceNote -> spaceNote ?: return@LoadAddressableNote val spaceEvent = spaceNote.event as? MeetingSpaceEvent diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicPlaylist.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicPlaylist.kt index fca84ed76d..d3518bc2f1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicPlaylist.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicPlaylist.kt @@ -260,7 +260,7 @@ fun MusicPlaylistHeader( color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.06f), ) } - LoadAddressableNote(address, accountViewModel) { trackNote -> + LoadAddressableNote(address) { trackNote -> if (trackNote != null) { PlaylistTrackRow( position = index + 1, @@ -678,7 +678,7 @@ private fun RenderMusicPlaylistPreview() { } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { RenderMusicPlaylist( note = it, @@ -710,7 +710,7 @@ private fun RenderMusicPlaylistCollaborativePrivatePreview() { remember(event) { runBlocking { withContext(Dispatchers.IO) { LocalCache.justConsume(event, null, true) } } } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { RenderMusicPlaylist( note = it, @@ -740,7 +740,7 @@ private fun MusicPlaylistCoverPreview() { remember(event) { runBlocking { withContext(Dispatchers.IO) { LocalCache.justConsume(event, null, true) } } } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { MusicPlaylistCover( image = null, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt index b56425eabd..ec896a8963 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt @@ -517,7 +517,7 @@ private fun RenderMusicTrackPreview() { remember(event) { runBlocking { withContext(Dispatchers.IO) { LocalCache.justConsume(event, null, true) } } } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { RenderMusicTrack( note = it, @@ -549,7 +549,7 @@ private fun RenderMusicTrackExplicitPreview() { remember(event) { runBlocking { withContext(Dispatchers.IO) { LocalCache.justConsume(event, null, true) } } } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { RenderMusicTrack( note = it, @@ -571,7 +571,7 @@ private fun MusicTrackCoverPreview() { remember(event) { runBlocking { withContext(Dispatchers.IO) { LocalCache.justConsume(event, null, true) } } } ThemeComparisonColumn { - LoadNote(baseNoteHex = event.address().toValue(), accountViewModel = mockAccountViewModel()) { note -> + LoadNote(baseNoteHex = event.address().toValue()) { note -> note?.let { MusicTrackCover(image = null, note = it, accountViewModel = mockAccountViewModel()) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PodcastPeople.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PodcastPeople.kt index 8f8a2a185a..5e00ab1f3a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PodcastPeople.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PodcastPeople.kt @@ -47,6 +47,7 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.podcast_hosts_and_guests import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.Size5dp import com.vitorpamplona.amethyst.commons.ui.theme.grayText @@ -104,7 +105,7 @@ private fun PersonItem( val pubKey = remember(person) { person.nostrPubKey() } if (pubKey != null) { - LoadUser(pubKey, accountViewModel) { user -> + LoadUser(pubKey) { user -> if (user != null) { NostrPersonCard(user, person.role, accountViewModel, nav) } else { @@ -157,8 +158,8 @@ private fun FreeTextPersonCard( model = person.img, contentDescription = person.name, modifier = Modifier.size(56.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) }, name = { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt index db29a5d3b3..ae654a1f05 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt @@ -319,7 +319,7 @@ internal fun PublicationSectionRow( val address = ref.address if (address != null) { - LoadAddressableNote(address, accountViewModel) { sectionNote -> + LoadAddressableNote(address) { sectionNote -> if (sectionNote != null) { ObservedSectionRow(position, ref, sectionNote, accountViewModel, nav) } else { @@ -327,7 +327,7 @@ internal fun PublicationSectionRow( } } } else if (ref.eventId != null) { - LoadNote(ref.eventId!!, accountViewModel) { sectionNote -> + LoadNote(ref.eventId!!) { sectionNote -> if (sectionNote != null) { ObservedSectionRow(position, ref, sectionNote, accountViewModel, nav) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt index 62a07a7526..73fea0a6e4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt @@ -113,7 +113,7 @@ fun RenderPublicationSection( // A chapter arrived at from a search, a mention or a wikilink has nothing around it to say // what it is a chapter *of*. The index names itself, so show it above the title. noteEvent.publicationAddress()?.let { address -> - LoadAddressableNote(address, accountViewModel) { indexNote -> + LoadAddressableNote(address) { indexNote -> indexNote?.let { PublicationCrumb(it, accountViewModel, nav) } } } @@ -142,7 +142,7 @@ fun RenderPublicationSection( } noteEvent.publicationAddress()?.let { address -> - LoadAddressableNote(address, accountViewModel) { indexNote -> + LoadAddressableNote(address) { indexNote -> indexNote?.let { PublicationPager(noteEvent, it, accountViewModel, nav) } } } @@ -253,11 +253,11 @@ private fun PagerEnd( // The index's own title shows immediately; the neighbour is still observed, because observing // is what fetches it and it carries the better title. if (address != null) { - LoadAddressableNote(address, accountViewModel) { target -> + LoadAddressableNote(address) { target -> target?.let { PagerButton(ref, it, isBack, accountViewModel, nav, modifier) } } } else if (eventId != null) { - LoadNote(eventId, accountViewModel) { target -> + LoadNote(eventId) { target -> target?.let { PagerButton(ref, it, isBack, accountViewModel, nav, modifier) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayGroupMessage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayGroupMessage.kt index ab17537244..a090661335 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayGroupMessage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayGroupMessage.kt @@ -51,6 +51,7 @@ import com.vitorpamplona.amethyst.commons.nip29RelayGroups.ui.RelayNameChip import com.vitorpamplona.amethyst.commons.ui.components.GenericLoadable import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.StdVertSpacer import com.vitorpamplona.amethyst.commons.ui.theme.replyModifier import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserName @@ -135,8 +136,8 @@ fun RelayGroupChannelHeader( model = channel.profilePicture(), contentDescription = channel.toBestDisplayName(), modifier = Modifier.size(28.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) if (dmOther != null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderPostApproval.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderPostApproval.kt index a2dbb2dc01..1936c22fb9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderPostApproval.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderPostApproval.kt @@ -58,7 +58,7 @@ fun RenderPostApproval( Column(Modifier.fillMaxWidth()) { noteEvent.communityAddresses().forEach { tag -> - LoadAddressableNote(tag, accountViewModel) { baseNote -> + LoadAddressableNote(tag) { baseNote -> baseNote?.let { RenderCommunity( baseNote = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCollaboration.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCollaboration.kt index 66f946325d..6eccfe2176 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCollaboration.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCollaboration.kt @@ -82,7 +82,7 @@ fun RenderVideoCollaboration( // quotesLeft guards the recursion: the embedded video can itself credit other work, and // NoteCompose is what decrements it on the way down. if (video != null && quotesLeft > 0) { - LoadAddressableNote(video, accountViewModel) { videoNote -> + LoadAddressableNote(video) { videoNote -> videoNote?.let { NoteCompose( baseNote = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCredits.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCredits.kt index dbc69f86d3..7dd1ebb208 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCredits.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCredits.kt @@ -103,7 +103,7 @@ private fun RenderVideoCredit( ) { when (val target = credit.target) { is CreditTarget.Person -> - LoadUser(target.pubKey, accountViewModel) { user -> + LoadUser(target.pubKey) { user -> // Until the profile arrives there is no name to print, and a hex key in the // credits reads as noise rather than as a person. user?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCurationSet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCurationSet.kt index cd11449ce6..d47478fa3f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCurationSet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RenderVideoCurationSet.kt @@ -169,12 +169,12 @@ private fun VideoListMemberPoster( ) { when (item) { is AddressBookmark -> - LoadAddressableNote(item.address, accountViewModel) { note -> + LoadAddressableNote(item.address) { note -> note?.let { VideoPoster(it, accountViewModel) { nav.nav(Route.Note(addressTag(item.address))) } } } is EventBookmark -> - LoadNote(item.eventId, accountViewModel) { note -> + LoadNote(item.eventId) { note -> note?.let { VideoPoster(it, accountViewModel) { nav.nav(Route.Note(item.eventId)) } } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SnoPalettes.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SnoPalettes.kt index 7072fa516f..06ce9e82d9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SnoPalettes.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SnoPalettes.kt @@ -76,7 +76,7 @@ fun WithSnoPalette( is NEvent -> LoadPaletteNote(entity.hex, accountViewModel, content) is NNote -> LoadPaletteNote(entity.hex, accountViewModel, content) is NAddress -> - LoadAddressableNote(entity.address(), accountViewModel) { note -> + LoadAddressableNote(entity.address()) { note -> content(remember(note?.event) { note?.event?.let { SnoPaletteEventReader.read(it) } }) } // A reference the parser accepted as well-formed but that names nothing @@ -91,7 +91,7 @@ private fun LoadPaletteNote( accountViewModel: AccountViewModel, content: @Composable (SnoPalette?) -> Unit, ) { - LoadNote(hex, accountViewModel) { note -> + LoadNote(hex) { note -> // The kind is deliberately not checked: §1.3b says this format "does // not define a palette kind and does not want one", and a reader that // accepts the shape reads whatever convention wins. An event that is diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt index 2cd4be21e4..2bb1f341e6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt @@ -587,7 +587,7 @@ private fun BundledAssetsList( Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { assetIds.forEach { id -> key(id) { - LoadAssetNote(id, accountViewModel) { assetNote -> + LoadAssetNote(id) { assetNote -> if (assetNote != null) { SoftwareAssetRow(assetNote, accountViewModel) } @@ -600,7 +600,6 @@ private fun BundledAssetsList( @Composable private fun LoadAssetNote( eventId: String, - accountViewModel: AccountViewModel, content: @Composable (Note?) -> Unit, ) { val note by produceState(initialValue = LocalCache.getNoteIfExists(eventId), eventId) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt index e3e7683aff..627d61916c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt @@ -95,7 +95,7 @@ fun RenderTextModificationEvent( } noteEvent.editedNote()?.let { - LoadNote(baseNoteHex = it.eventId, accountViewModel = accountViewModel) { baseOriginalNote -> + LoadNote(baseNoteHex = it.eventId) { baseOriginalNote -> baseOriginalNote?.let { } } @@ -133,7 +133,7 @@ fun RenderTextModificationEvent( } noteEvent.editedNote()?.let { - LoadNote(baseNoteHex = it.eventId, accountViewModel = accountViewModel) { baseNote -> + LoadNote(baseNoteHex = it.eventId) { baseNote -> baseNote?.let { val noteState by observeNote(baseNote, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt index b899bf43a3..c6814f0d7e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt @@ -212,7 +212,7 @@ fun TorrentHeader( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = torrentHex, accountViewModel = accountViewModel) { + LoadNote(baseNoteHex = torrentHex) { if (it != null) { ShortTorrentHeader(it, modifier, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt index 530d1bddf3..4338782fd5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt @@ -213,7 +213,7 @@ private fun WikiArticleRow( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { articleNote -> + LoadAddressableNote(address) { articleNote -> if (articleNote != null) { val article by observeNoteEvent(articleNote, accountViewModel) @@ -238,7 +238,7 @@ private fun WikiVersionRow( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(eventId, accountViewModel) { versionNote -> + LoadNote(eventId) { versionNote -> if (versionNote != null) { val article by observeNoteEvent(versionNote, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/ListItemRows.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/ListItemRows.kt index df811da87b..bf722835da 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/ListItemRows.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/ListItemRows.kt @@ -58,7 +58,7 @@ fun UserMemberRow( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(pubKey, accountViewModel) { user -> + LoadUser(pubKey) { user -> user?.let { Column(modifier = Modifier.fillMaxWidth()) { UserCompose(it, accountViewModel = accountViewModel, nav = nav) @@ -88,7 +88,7 @@ fun BookmarkMemberRow( is AddressBookmark -> AddressMemberRow(item.address, quotesLeft, backgroundColor, accountViewModel, nav) is EventBookmark -> - LoadNote(item.eventId, accountViewModel) { note -> + LoadNote(item.eventId) { note -> note?.let { NoteCompose( baseNote = it, @@ -114,7 +114,7 @@ fun AddressMemberRow( ) { if (quotesLeft <= 0) return - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { NoteCompose( baseNote = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/MuteList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/MuteList.kt index 87008d7ba0..9d1b21782d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/MuteList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/MuteList.kt @@ -95,7 +95,7 @@ private fun MutedThreadRow( ) { if (quotesLeft <= 0) return - LoadNote(eventId, accountViewModel) { note -> + LoadNote(eventId) { note -> note?.let { NoteCompose( baseNote = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 6af3dab4b8..04244170d0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -100,12 +100,12 @@ import com.vitorpamplona.amethyst.commons.service.broadcast.BroadcastTracker import com.vitorpamplona.amethyst.commons.service.http.EmptyRoleBasedHttpClientBuilder import com.vitorpamplona.amethyst.commons.service.http.IRoleBasedHttpClientBuilder import com.vitorpamplona.amethyst.commons.service.pow.PoWCategory +import com.vitorpamplona.amethyst.commons.state.UiSettingsState import com.vitorpamplona.amethyst.commons.tor.TorType import com.vitorpamplona.amethyst.commons.ui.components.UrlPreviewState import com.vitorpamplona.amethyst.commons.ui.components.toasts.ToastManager import com.vitorpamplona.amethyst.commons.ui.loadStringRes import com.vitorpamplona.amethyst.commons.ui.notifications.CardFeedState -import com.vitorpamplona.amethyst.commons.ui.screen.UiSettingsState import com.vitorpamplona.amethyst.commons.ui.state.GenericBaseCache import com.vitorpamplona.amethyst.commons.ui.state.GenericBaseCacheAsync import com.vitorpamplona.amethyst.logTime diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictEventViews.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictEventViews.kt index b845503645..419bd3b2a2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictEventViews.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictEventViews.kt @@ -72,6 +72,7 @@ import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.commons.util.toShortDisplay import com.vitorpamplona.amethyst.service.relayClient.reqCommand.channel.observeChannel @@ -269,7 +270,7 @@ private fun PersonCell( Badge.ADDED -> "+" to tones.added Badge.CHANGED -> "~" to tones.changed } - LoadUser(pubKey, accountViewModel) { user -> + LoadUser(pubKey) { user -> Column( modifier.clip(RoundedCornerShape(12.dp)).clickable { nav.nav(Route.Profile(pubKey)) }.padding(vertical = 4.dp), horizontalAlignment = Alignment.CenterHorizontally, @@ -437,7 +438,7 @@ private fun LazyListScope.muteListItems( if (threads.isNotEmpty()) { item(key = "mute-threads-caption", contentType = "caption") { SectionCaption(stringRes(R.string.backup_entry_thread), Pad.padding(top = 18.dp)) } items(threads, key = { "mute-thread-$it" }, contentType = { "note" }) { id -> - LoadNote(id, accountViewModel) { note -> + LoadNote(id) { note -> if (note != null) { NoteCompose(note, modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp), makeItShort = true, quotesLeft = 1, accountViewModel = accountViewModel, nav = nav) } else { @@ -489,8 +490,8 @@ private fun FacePile( model = observedPicture(pubKey, accountViewModel), contentDescription = null, modifier = Modifier.size(42.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) } } @@ -688,8 +689,8 @@ private fun MiniProfileCard( model = meta.picture, contentDescription = null, modifier = Modifier.size(46.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) } Column(Modifier.offset(y = (-20).dp), verticalArrangement = Arrangement.spacedBy(3.dp)) { @@ -1122,7 +1123,7 @@ private fun GroupTileCard( GroupTileContent(tile, tile.group.name ?: tile.group.groupId, null, accountViewModel, modifier, null) return } - LoadRelayGroupChannel(GroupId(tile.group.groupId, relay), accountViewModel) { channel -> + LoadRelayGroupChannel(GroupId(tile.group.groupId, relay)) { channel -> // Subscribes to the group's relay-signed metadata (even when not joined) and recomposes // when its name or picture arrives. val state by observeChannel(channel, accountViewModel) @@ -1158,8 +1159,8 @@ private fun GroupTileContent( model = picture, contentDescription = null, modifier = Modifier.size(44.dp).clip(RoundedCornerShape(14.dp)), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) Column { Text(name, style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt index 4641c7cf82..55473cce27 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt @@ -65,6 +65,7 @@ import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.commons.util.toShortDisplay import com.vitorpamplona.amethyst.service.relayClient.reqCommand.channel.observeChannel @@ -425,8 +426,8 @@ private fun SpaceTile( model = picture, contentDescription = null, modifier = Modifier.size(48.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) Column { Text(name, style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis) @@ -452,7 +453,7 @@ private fun LazyListScope.publicChatItems( ) { val saved = (conflict.saved as? ChannelListEvent)?.tags?.channels().orEmpty() spaceGrid("chat-", fates(saved, diff.channels) { it.eventId }, { it.eventId }) { tag, fate, modifier -> - LoadPublicChatChannel(tag.eventId, accountViewModel) { channel -> + LoadPublicChatChannel(tag.eventId) { channel -> // Subscribes to the channel's metadata on relays and recomposes when it arrives. val state by observeChannel(channel, accountViewModel) val current = state?.channel ?: channel @@ -508,7 +509,7 @@ private fun AddressableSpaceTile( modifier: Modifier, onClick: () -> Unit, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> val event = if (note != null) { val state by observeNote(note, accountViewModel) @@ -789,7 +790,7 @@ private fun ProviderCell( Text("—", modifier, color = MaterialTheme.colorScheme.placeholderText) return } - LoadUser(pubKey, accountViewModel) { user -> + LoadUser(pubKey) { user -> Row( modifier.clip(RoundedCornerShape(8.dp)).clickable { nav.nav(Route.Profile(pubKey)) }, verticalAlignment = Alignment.CenterVertically, @@ -801,8 +802,8 @@ private fun ProviderCell( model = observedPicture(pubKey, accountViewModel), contentDescription = null, modifier = Modifier.size(22.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) ProvideTextStyle(MaterialTheme.typography.labelMedium.copy(color = if (struck) color else MaterialTheme.colorScheme.onSurface, textDecoration = if (struck) TextDecoration.LineThrough else null)) { if (user != null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictReviewScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictReviewScreen.kt index 1a89df595d..8b5d7b0150 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictReviewScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictReviewScreen.kt @@ -422,7 +422,7 @@ internal fun ReviewEntry( when (item) { is ReviewItem.Person -> PersonEntry(item, accountViewModel, nav) is ReviewItem.Thread -> - LoadNote(item.eventId, accountViewModel) { note -> + LoadNote(item.eventId) { note -> if (note != null) { Column(EntryPadding) { NoteCompose(note, makeItShort = true, quotesLeft = 1, accountViewModel = accountViewModel, nav = nav) @@ -433,7 +433,7 @@ internal fun ReviewEntry( } } is ReviewItem.Addressable -> - LoadAddressableNote(item.address, accountViewModel) { note -> + LoadAddressableNote(item.address) { note -> if (note != null) { Column(EntryPadding) { NoteCompose(note, makeItShort = true, quotesLeft = 1, accountViewModel = accountViewModel, nav = nav) @@ -457,7 +457,7 @@ private fun PersonEntry( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(item.pubKey, accountViewModel) { user -> + LoadUser(item.pubKey) { user -> if (user == null) { TextEntry(item.pubKey.toShortDisplay(), item.detail) } else { @@ -482,7 +482,7 @@ private fun PublicChatEntry( accountViewModel: AccountViewModel, nav: INav, ) { - LoadPublicChatChannel(item.channelId, accountViewModel) { channel -> + LoadPublicChatChannel(item.channelId) { channel -> // Subscribes to the channel's metadata on relays and recomposes when it arrives. val state by observeChannel(channel, accountViewModel) val name = state?.channel?.toBestDisplayName() ?: channel.toBestDisplayName() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/badges/profile/ProfileBadgesScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/badges/profile/ProfileBadgesScreen.kt index d0d166c2b5..ae2a6a0ff8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/badges/profile/ProfileBadgesScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/badges/profile/ProfileBadgesScreen.kt @@ -208,7 +208,7 @@ private fun AwardRow( return } - LoadAddressableNote(defAddr, accountViewModel) { defNote -> + LoadAddressableNote(defAddr) { defNote -> if (defNote == null) { StaticAwardRow( definition = null, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/ArticleBookmarkListManagementScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/ArticleBookmarkListManagementScreen.kt index ad39788817..d1e3f9749c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/ArticleBookmarkListManagementScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/ArticleBookmarkListManagementScreen.kt @@ -59,7 +59,7 @@ fun ArticleBookmarkListManagementScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address = articleAddress, accountViewModel = accountViewModel) { + LoadAddressableNote(address = articleAddress) { it?.let { ListManagementView( modifier = Modifier.fillMaxSize().recalculateWindowInsets(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/PostBookmarkListManagementScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/PostBookmarkListManagementScreen.kt index abe4d003d5..12e2a0860a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/PostBookmarkListManagementScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/membershipManagement/PostBookmarkListManagementScreen.kt @@ -58,7 +58,7 @@ fun PostBookmarkListManagementScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = postId, accountViewModel = accountViewModel) { + LoadNote(baseNoteHex = postId) { it?.let { ListManagementView( modifier = Modifier.fillMaxSize().recalculateWindowInsets(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardScreen.kt index bcd8b3ac64..54ae79e5a1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardScreen.kt @@ -450,7 +450,7 @@ private fun Person( Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) { Text(prefix, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) UserPicture(userHex = hex, size = Size20dp, accountViewModel = accountViewModel, nav = nav) - LoadUser(baseUserHex = hex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = hex) { user -> if (user != null) UsernameDisplay(baseUser = user, fontWeight = FontWeight.Medium, accountViewModel = accountViewModel) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardScreen.kt index f1da2ca54c..2f3505c4ab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardScreen.kt @@ -387,7 +387,7 @@ private fun Person( Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) { Text(prefix, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) UserPicture(userHex = hex, size = Size20dp, accountViewModel = accountViewModel, nav = nav) - LoadUser(baseUserHex = hex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = hex) { user -> if (user != null) { UsernameDisplay(baseUser = user, fontWeight = FontWeight.Medium, accountViewModel = accountViewModel) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardScreen.kt index c4343738e9..42717bf0f3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardScreen.kt @@ -741,7 +741,7 @@ private fun Person( Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) { Text(prefix, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) UserPicture(userHex = hex, size = Size20dp, accountViewModel = accountViewModel, nav = nav) - LoadUser(baseUserHex = hex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = hex) { user -> if (user != null) { UsernameDisplay(baseUser = user, fontWeight = FontWeight.Medium, accountViewModel = accountViewModel) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarEventScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarEventScreen.kt index 5a1070edaf..e9b7f684a2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarEventScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarEventScreen.kt @@ -373,7 +373,7 @@ private fun ParticipantsRow( size = Size30dp, accountViewModel = accountViewModel, ) - LoadUser(baseUserHex = pubKey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = pubKey) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt index 297bd289a8..beece330fa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt @@ -774,7 +774,7 @@ private fun UserRow( nav: INav, trailing: (@Composable () -> Unit)?, ) { - LoadUser(baseUserHex = pubKey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = pubKey) { user -> Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatDeliveryTicks.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatDeliveryTicks.kt index 26ee722473..d5d5e83096 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatDeliveryTicks.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatDeliveryTicks.kt @@ -292,7 +292,7 @@ private fun RecipientDeliveryRow( horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth(), ) { - LoadUser(baseUserHex = recipient.recipient, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = recipient.recipient) { user -> if (user != null) { UserPicture(user, Size20dp, Modifier, accountViewModel, nav) Row(modifier = Modifier.weight(1f)) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatClip.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatClip.kt index 407abdf3fe..493524718c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatClip.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatClip.kt @@ -72,7 +72,7 @@ fun RenderChatClip( Row(verticalAlignment = Alignment.CenterVertically) { UserPicture(authorHex, Size20dp, Modifier, accountViewModel, nav) Spacer(StdHorzSpacer) - LoadUser(baseUserHex = authorHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = authorHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatRaid.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatRaid.kt index c4b61d0849..2d42798e9c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatRaid.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatRaid.kt @@ -84,7 +84,7 @@ fun RenderChatRaid( Row(verticalAlignment = Alignment.CenterVertically) { UserPicture(from.pubKeyHex, Size20dp, Modifier, accountViewModel, nav) Spacer(StdHorzSpacer) - LoadUser(baseUserHex = from.pubKeyHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = from.pubKeyHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, @@ -104,7 +104,7 @@ fun RenderChatRaid( UserPicture(to.pubKeyHex, Size20dp, Modifier, accountViewModel, nav) Spacer(StdHorzSpacer) - LoadUser(baseUserHex = to.pubKeyHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = to.pubKeyHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatScreen.kt index 3d29f92eab..1cb5d049aa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatScreen.kt @@ -69,6 +69,7 @@ import com.vitorpamplona.amethyst.commons.ui.feeds.WatchLifecycleAndUpdateModel import com.vitorpamplona.amethyst.commons.ui.insets.imePaddingSafe import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarExtensibleWithBackButton +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.service.location.LocationState import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserPicture import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold @@ -115,7 +116,7 @@ fun GeohashChatScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadGeohashChannel(geohash, accountViewModel) { channel -> + LoadGeohashChannel(geohash) { channel -> GeohashChatRoom(channel, teleported, accountViewModel, nav) } } @@ -317,8 +318,8 @@ private fun GeohashIdentityAvatar( model = picture, contentDescription = "Posting as yourself — tap to go anonymous, long-press for a nickname", modifier = avatarModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = false, ) } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/LoadGeohashChannel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/LoadGeohashChannel.kt index bca56fbc88..e6aac28ec9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/LoadGeohashChannel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/LoadGeohashChannel.kt @@ -24,7 +24,6 @@ import androidx.compose.runtime.Composable import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.geohashChat.GeohashChatChannel import com.vitorpamplona.amethyst.ui.note.produceStateIfNotNull -import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel /** * Resolves the [GeohashChatChannel] for [geohash] from LocalCache, creating an @@ -35,7 +34,6 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @Composable fun LoadGeohashChannel( geohash: String, - accountViewModel: AccountViewModel, content: @Composable (GeohashChatChannel) -> Unit, ) { val channel = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupIconEditor.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupIconEditor.kt index faa029d834..06b8f8649c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupIconEditor.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupIconEditor.kt @@ -45,6 +45,7 @@ import com.vitorpamplona.amethyst.commons.resources.marmot_change_photo import com.vitorpamplona.amethyst.commons.resources.marmot_group_icon import com.vitorpamplona.amethyst.commons.resources.marmot_remove_photo import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -99,8 +100,8 @@ fun MarmotGroupIconEditor( .size(96.dp) .clip(CircleShape) .let { if (enabled) it.clickable { launcher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } else it }, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) Row( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt index ba58c3bfa8..66c97b3f0d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt @@ -132,6 +132,7 @@ import com.vitorpamplona.amethyst.commons.ui.insets.imePaddingSafe import com.vitorpamplona.amethyst.commons.ui.loadStringRes import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.MediumRelayIconModifier import com.vitorpamplona.amethyst.commons.ui.theme.SuggestionListDefaultHeightChat @@ -760,7 +761,7 @@ fun MemberRow( nav = nav, ) Column(modifier = Modifier.weight(1f)) { - LoadUser(baseUserHex = member.pubkey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = member.pubkey) { user -> val displayName = user?.toBestDisplayName() ?: stringRes(Res.string.marmot_user_fallback_name, member.pubkey.take(16)) val youSuffix = stringRes(Res.string.marmot_member_suffix_you) val adminSuffix = stringRes(Res.string.marmot_member_suffix_admin) @@ -875,7 +876,7 @@ private fun ConfirmRemoveMemberDialog( onDismissRequest = onDismiss, title = { Text(stringRes(Res.string.marmot_remove_member)) }, text = { - LoadUser(baseUserHex = memberPubkey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = memberPubkey) { user -> val name = user?.toBestDisplayName() ?: stringRes(Res.string.marmot_user_fallback_name, memberPubkey.take(16)) Text(stringRes(Res.string.marmot_remove_member_confirm, name)) } @@ -904,7 +905,7 @@ private fun ConfirmGrantAdminDialog( onDismissRequest = onDismiss, title = { Text(stringRes(Res.string.marmot_grant_admin_title)) }, text = { - LoadUser(baseUserHex = memberPubkey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = memberPubkey) { user -> val name = user?.toBestDisplayName() ?: stringRes(Res.string.marmot_user_fallback_name, memberPubkey.take(16)) Text(stringRes(Res.string.marmot_grant_admin_confirm, name)) } @@ -933,7 +934,7 @@ private fun ConfirmRevokeAdminDialog( onDismissRequest = onDismiss, title = { Text(stringRes(Res.string.marmot_revoke_admin_title)) }, text = { - LoadUser(baseUserHex = memberPubkey, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = memberPubkey) { user -> val name = user?.toBestDisplayName() ?: stringRes(Res.string.marmot_user_fallback_name, memberPubkey.take(16)) Text(stringRes(Res.string.marmot_revoke_admin_confirm, name)) } @@ -1025,9 +1026,9 @@ fun GroupRelayTile( RenderRelayIcon( displayUrl = relayInfo.id ?: fallbackUrl, iconUrl = relayInfo.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, pingInMs = 0, - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadRobohash = LocalDisplaySettings.current.loadRobohash, iconModifier = MediumRelayIconModifier, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt index c46d38c24b..4a9c15f240 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt @@ -131,7 +131,6 @@ fun ChatroomView( for (userHex in room.users) { LoadAddressableNote( ChatMessageRelayListEvent.createAddress(userHex), - accountViewModel, ) { note -> if (note != null) { EventFinderFilterAssemblerSubscription(note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/ChatroomHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/ChatroomHeader.kt index 4af0d7cde0..12aa554715 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/ChatroomHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/ChatroomHeader.kt @@ -49,7 +49,7 @@ fun ChatroomHeader( onClick: () -> Unit, ) { if (room.users.size == 1) { - LoadUser(baseUserHex = room.users.first(), accountViewModel) { baseUser -> + LoadUser(baseUserHex = room.users.first()) { baseUser -> if (baseUser != null) { UserChatroomHeader( baseUser = baseUser, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/DmReportWarningCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/DmReportWarningCard.kt index 446bdf449f..a84f4d0f17 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/DmReportWarningCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/DmReportWarningCard.kt @@ -96,7 +96,7 @@ fun DmReportWarningCard( ) { val counterpartHex = room.users.singleOrNull() ?: return - LoadUser(baseUserHex = counterpartHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = counterpartHex) { user -> if (user != null) { val flow = remember(user) { accountViewModel.createUserReportWarningFlow(user) } val state by flow.collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RenderRoomTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RenderRoomTopBar.kt index 34a7d023e3..e9c636c095 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RenderRoomTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RenderRoomTopBar.kt @@ -81,7 +81,7 @@ fun RenderRoomTopBar( if (room.users.size == 1) { TopBarExtensibleWithBackButton( title = { - LoadUser(baseUserHex = room.users.first(), accountViewModel) { baseUser -> + LoadUser(baseUserHex = room.users.first()) { baseUser -> if (baseUser != null) { ClickableUserPicture( baseUser = baseUser, @@ -124,7 +124,7 @@ fun RenderRoomTopBar( } }, extendableRow = { - LoadUser(baseUserHex = room.users.first(), accountViewModel) { + LoadUser(baseUserHex = room.users.first()) { if (it != null) { UserCompose( baseUser = it, @@ -216,7 +216,7 @@ fun GroupMembersHeader( state = rememberLazyListState(), ) { itemsIndexed(list, key = { _, item -> item }) { _, item -> - LoadUser(baseUserHex = item, accountViewModel) { + LoadUser(baseUserHex = item) { if (it != null) { UserCompose( baseUser = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RoomNameOnlyDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RoomNameOnlyDisplay.kt index 5aeb07a68e..363ba6a17e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RoomNameOnlyDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/RoomNameOnlyDisplay.kt @@ -81,14 +81,14 @@ fun DisplayUserSetAsSubject( if (userList.size == 1) { // Regular Design Row { - LoadUser(baseUserHex = userList[0], accountViewModel) { + LoadUser(baseUserHex = userList[0]) { it?.let { UsernameDisplay(it, Modifier.weight(1f), fontWeight = fontWeight, accountViewModel = accountViewModel) } } } } else { Row { userList.take(4).forEachIndexed { index, value -> - LoadUser(baseUserHex = value, accountViewModel) { + LoadUser(baseUserHex = value) { it?.let { ShortUsernameDisplay(baseUser = it, fontWeight = fontWeight, accountViewModel = accountViewModel) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordHomeScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordHomeScreen.kt index 82407fe7ab..d95ba0659d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordHomeScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordHomeScreen.kt @@ -72,6 +72,7 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.bottombars.FabBottomBarP import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.ShorterTopAppBar import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserName @@ -313,8 +314,8 @@ private fun CommunityHeader( model = iconModel, contentDescription = name, modifier = Modifier.size(40.dp).clip(CircleShape).clickable(onClick = onOpen), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) // The identity block — icon *and* name/subtitle — opens the community; the rest of the row and diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMetadataForm.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMetadataForm.kt index ffdc668609..476a3b0bf7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMetadataForm.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMetadataForm.kt @@ -78,6 +78,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncIma import com.vitorpamplona.amethyst.commons.ui.components.util.setText import com.vitorpamplona.amethyst.commons.ui.loadStringRes import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.MediumRelayIconModifier import com.vitorpamplona.amethyst.model.nip11RelayInfo.loadRelayInfo @@ -193,8 +194,8 @@ private fun ConcordIconHero( model = iconModel, contentDescription = displayName.ifBlank { stringRes(Res.string.concord_create_title) }, modifier = Modifier.size(104.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) if (uploading) CircularProgressIndicator(modifier = Modifier.size(36.dp)) @@ -345,8 +346,8 @@ private fun ConcordRelayRow( RenderRelayIcon( displayUrl = relayInfo.id ?: relay.displayUrl(), iconUrl = relayInfo.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, pingInMs = 0, iconModifier = MediumRelayIconModifier, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/ChannelView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/ChannelView.kt index e2535af660..6692e456ba 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/ChannelView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/ChannelView.kt @@ -53,7 +53,7 @@ fun EphemeralChatChannelView( ) { if (channelId == null) return - LoadEphemeralChatChannel(channelId, accountViewModel) { ephem -> + LoadEphemeralChatChannel(channelId) { ephem -> PrepareChannelViewModels( baseChannel = ephem, draft = draft, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/EphemeralChatScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/EphemeralChatScreen.kt index 9e00d294ce..37080d9668 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/EphemeralChatScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/EphemeralChatScreen.kt @@ -51,7 +51,7 @@ fun EphemeralChatScreen( DisappearingScaffold( isInvertedLayout = true, topBar = { - LoadEphemeralChatChannel(channelId, accountViewModel) { + LoadEphemeralChatChannel(channelId) { EphemeralChatTopBar(it, accountViewModel, nav) } }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/LoadEphemeralChatChannel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/LoadEphemeralChatChannel.kt index 1f2858285b..df81acc0fa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/LoadEphemeralChatChannel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/LoadEphemeralChatChannel.kt @@ -24,13 +24,11 @@ import androidx.compose.runtime.Composable import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.emphChat.EphemeralChatChannel import com.vitorpamplona.amethyst.ui.note.produceStateIfNotNull -import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.experimental.ephemChat.chat.RoomId @Composable fun LoadEphemeralChatChannel( id: RoomId, - accountViewModel: AccountViewModel, content: @Composable (EphemeralChatChannel) -> Unit, ) { val channel = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/header/ShortEphemeralChatChannelHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/header/ShortEphemeralChatChannelHeader.kt index da2bce20a3..357f3576cf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/header/ShortEphemeralChatChannelHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/ephemChat/header/ShortEphemeralChatChannelHeader.kt @@ -42,6 +42,7 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.profile_image import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.HeaderPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.Size35dp @@ -103,8 +104,8 @@ private fun DrawRelayIcon( contentDescription = stringRes(Res.string.profile_image), contentScale = ContentScale.Crop, modifier = HeaderPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/ChannelView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/ChannelView.kt index e90c287666..b1721b7f7a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/ChannelView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/ChannelView.kt @@ -53,7 +53,7 @@ fun PublicChatChannelView( ) { if (channelId == null) return - LoadPublicChatChannel(channelId, accountViewModel) { + LoadPublicChatChannel(channelId) { PrepareChannelViewModels( baseChannel = it, draft = draft, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelHeader.kt index fd4340b361..d501a77dff 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelHeader.kt @@ -57,7 +57,7 @@ fun PublicChatChannelHeader( accountViewModel: AccountViewModel, nav: INav, ) { - LoadPublicChatChannel(channelHex, accountViewModel) { + LoadPublicChatChannel(channelHex) { PublicChatChannelHeader( it, sendToChannel, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelScreen.kt index f4dab4e683..da19432246 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/PublicChatChannelScreen.kt @@ -52,7 +52,7 @@ fun PublicChatChannelScreen( DisappearingScaffold( isInvertedLayout = true, topBar = { - LoadPublicChatChannel(channelId, accountViewModel) { + LoadPublicChatChannel(channelId) { PublicChatTopBar(it, accountViewModel, nav) } }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/LongPublicChatChannelHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/LongPublicChatChannelHeader.kt index 4f29ec5f8c..3f2a7a7496 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/LongPublicChatChannelHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/LongPublicChatChannelHeader.kt @@ -53,6 +53,7 @@ import com.vitorpamplona.amethyst.commons.resources.owner import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.richtext.CreateTextWithEmoji +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.DoubleHorzSpacer import com.vitorpamplona.amethyst.commons.ui.theme.Size25dp @@ -94,8 +95,8 @@ fun LongPublicChatChannelHeader( model = it, contentDescription = stringRes(Res.string.channel_image), modifier = MaterialTheme.colorScheme.largeProfilePictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -144,7 +145,7 @@ fun LongPublicChatChannelHeader( } } - LoadNote(baseNoteHex = channel.idHex, accountViewModel) { loadingNote -> + LoadNote(baseNoteHex = channel.idHex) { loadingNote -> loadingNote?.let { note -> Row( lineModifier, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/ShortPublicChatChannelHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/ShortPublicChatChannelHeader.kt index 531c6c4399..3d25da077a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/ShortPublicChatChannelHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/header/ShortPublicChatChannelHeader.kt @@ -43,6 +43,7 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.profile_image import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.HeaderPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.RowColSpacing @@ -72,8 +73,8 @@ fun ShortPublicChatChannelHeader( contentDescription = stringRes(Res.string.profile_image), contentScale = ContentScale.Crop, modifier = HeaderPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -115,7 +116,7 @@ fun ShortChannelActionOptions( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = channel.idHex, accountViewModel) { + LoadNote(baseNoteHex = channel.idHex) { it?.let { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = RowColSpacing) { LikeReaction( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt index ef403698eb..e809b75853 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt @@ -94,7 +94,7 @@ fun ChannelMetadataScreen( if (channelId == null) { ChannelMetadataScreen(null as PublicChatChannel?, accountViewModel, nav) } else { - LoadPublicChatChannel(channelId, accountViewModel) { + LoadPublicChatChannel(channelId) { ChannelMetadataScreen(it, accountViewModel, nav) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ChannelView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ChannelView.kt index 855a71428e..640a432263 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ChannelView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ChannelView.kt @@ -56,7 +56,7 @@ fun LiveActivityChannelView( ) { if (channelId == null) return - LoadLiveActivityChannel(channelId, accountViewModel) { + LoadLiveActivityChannel(channelId) { PrepareChannelViewModels( baseChannel = it, draft = draft, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/LiveActivityChannelScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/LiveActivityChannelScreen.kt index edfc15df6a..3ff4e70d03 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/LiveActivityChannelScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/LiveActivityChannelScreen.kt @@ -52,7 +52,7 @@ fun LiveActivityChannelScreen( DisappearingScaffold( isInvertedLayout = true, topBar = { - LoadLiveActivityChannel(channelId, accountViewModel) { + LoadLiveActivityChannel(channelId) { LaunchedEffect(it.info) { it.info?.streaming()?.let { OnlineChecker.resetIfOfflineToRetry(it) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt index fc6781e7dc..8ff9d9a3fd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt @@ -63,7 +63,7 @@ fun LiveStreamGoalHeader( ) { val goalId = channel.info?.goalEventId() ?: return - LoadNote(baseNoteHex = goalId, accountViewModel = accountViewModel) { goalNote -> + LoadNote(baseNoteHex = goalId) { goalNote -> if (goalNote != null) { GoalHeaderContent(goalNote, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LongLiveActivityChannelHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LongLiveActivityChannelHeader.kt index 8092e4704f..acfaebc195 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LongLiveActivityChannelHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LongLiveActivityChannelHeader.kt @@ -91,7 +91,7 @@ fun LongLiveActivityChannelHeader( RenderSummary(activity, callbackUri, accountViewModel, nav) } - LoadAddressableNote(channel.address, accountViewModel) { loadingNote -> + LoadAddressableNote(channel.address) { loadingNote -> loadingNote?.let { note -> Row( lineModifier, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/LoadRelayGroupChannel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/LoadRelayGroupChannel.kt index 2b0582c4e1..65baa02dab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/LoadRelayGroupChannel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/LoadRelayGroupChannel.kt @@ -24,13 +24,11 @@ import androidx.compose.runtime.Composable import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel import com.vitorpamplona.amethyst.ui.note.produceStateIfNotNull -import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip29RelayGroups.GroupId @Composable fun LoadRelayGroupChannel( id: GroupId, - accountViewModel: AccountViewModel, content: @Composable (RelayGroupChannel) -> Unit, ) { val channel = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelListScreen.kt index 8003a74854..7ce0a5aed3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelListScreen.kt @@ -99,6 +99,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncIma import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarExtensibleWithBackButton import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.warningColor import com.vitorpamplona.amethyst.commons.util.sortedBySnapshot @@ -973,8 +974,8 @@ private fun RelayGroupChannelRow( model = channel.profilePicture(), contentDescription = channel.toBestDisplayName(), modifier = Modifier.size(40.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelView.kt index df589ab915..9a6aec581c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChannelView.kt @@ -88,7 +88,7 @@ fun RelayGroupChannelView( ) { if (channelId == null) return - LoadRelayGroupChannel(channelId, accountViewModel) { group -> + LoadRelayGroupChannel(channelId) { group -> PrepareChannelViewModels( baseChannel = group, draft = draft, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChatScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChatScreen.kt index e65bdc3dde..d6b6f376a1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChatScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupChatScreen.kt @@ -54,7 +54,7 @@ fun RelayGroupChatScreen( DisappearingScaffold( isInvertedLayout = true, topBar = { - LoadRelayGroupChannel(channelId, accountViewModel) { + LoadRelayGroupChannel(channelId) { RelayGroupTopBar(it, inviteCode, accountViewModel, nav) } }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt index 359966439c..afdf3562b4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt @@ -78,6 +78,7 @@ import com.vitorpamplona.amethyst.commons.ui.layouts.rememberFeedContentPadding import com.vitorpamplona.amethyst.commons.ui.navigation.bottombars.FabBottomBarPadded import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.FeedPadding import com.vitorpamplona.amethyst.commons.ui.theme.Size20dp @@ -369,8 +370,8 @@ private fun RelayRailHeader( RenderRelayIcon( displayUrl = host, iconUrl = info.value.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, pingInMs = 0, iconModifier = Modifier.size(Size25dp).clip(CircleShape), ) @@ -520,8 +521,8 @@ private fun RelayGroupRailRowContent( .size(40.dp) .clip(CircleShape) .border(1.5.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.35f), CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = autoPlayGif, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMembersScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMembersScreen.kt index 0b79115fc3..9d9b4b5e5c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMembersScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMembersScreen.kt @@ -127,7 +127,7 @@ fun RelayGroupMembersScreen( val relay = remember(relayUrl) { RelayUrlNormalizer.normalizeOrNull(relayUrl) } ?: return val channelId = remember(id, relay) { GroupId(id, relay) } - LoadRelayGroupChannel(channelId, accountViewModel) { channel -> + LoadRelayGroupChannel(channelId) { channel -> RelayGroupMembers(channel, accountViewModel, nav) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMetadataScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMetadataScreen.kt index ea0795cfb2..ad1cef5f5d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMetadataScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupMetadataScreen.kt @@ -175,7 +175,7 @@ fun RelayGroupEditScreen( val groupId = remember(id, relay) { GroupId(id, relay) } val viewModel: RelayGroupMetadataViewModel = viewModel(key = "RelayGroupEdit:${groupId.toKey()}") - LoadRelayGroupChannel(groupId, accountViewModel) { channel -> + LoadRelayGroupChannel(groupId) { channel -> // Keep the relay-signed metadata fresh while editing so a late load prefills. RelayGroupCardWarmupSubscription(channel, accountViewModel.dataSources().relayGroupCardWarmup, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupParentPicker.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupParentPicker.kt index c8288dcbe0..0fc9ff32be 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupParentPicker.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupParentPicker.kt @@ -77,6 +77,7 @@ import com.vitorpamplona.amethyst.commons.resources.relay_group_parent_top_level import com.vitorpamplona.amethyst.commons.resources.relay_group_section_structure import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.pluralStringRes +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.util.sortedBySnapshot import com.vitorpamplona.amethyst.model.nip11RelayInfo.isRelaySignedRelayGroup @@ -182,8 +183,8 @@ private fun ParentSelectorCard( model = liveParent.profilePicture(), contentDescription = liveParent.toBestDisplayName(), modifier = Modifier.size(46.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = false, ) } else { @@ -263,7 +264,7 @@ private fun ParentGroupPickerSheet( // rejects), so exclude them from the candidate set. val forbidden = remember(selfGroupId, relay) { - descendantIdsOf(accountViewModel, selfGroupId, relay) + selfGroupId + descendantIdsOf(selfGroupId, relay) + selfGroupId } // Re-read the relay's genuine, relay-signed groups whenever a kind-39000 lands. The initial @@ -275,10 +276,10 @@ private fun ParentGroupPickerSheet( relayInfo, forbidden, ) { - value = pickCandidates(accountViewModel, relay, relayInfo, forbidden) + value = pickCandidates(relay, relayInfo, forbidden) LocalCache .observeEvents(Filter(kinds = listOf(GroupMetadataEvent.KIND))) - .collect { value = pickCandidates(accountViewModel, relay, relayInfo, forbidden) } + .collect { value = pickCandidates(relay, relayInfo, forbidden) } } val filtered = @@ -393,8 +394,8 @@ private fun GroupPickRow( model = channel.profilePicture(), contentDescription = channel.toBestDisplayName(), modifier = Modifier.size(46.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = false, ) Column(Modifier.weight(1f)) { @@ -468,7 +469,6 @@ private fun SelectionMark(selected: Boolean) { /** Genuine, relay-signed groups on [relay], minus the forbidden (self + descendant) ids, name-sorted. */ private fun pickCandidates( - accountViewModel: AccountViewModel, relay: NormalizedRelayUrl, relayInfo: Nip11RelayInformation, forbidden: Set, @@ -486,7 +486,6 @@ private fun pickCandidates( * advertised `child` links. Visited-guarded so a malformed cycle can't loop forever. */ private fun descendantIdsOf( - accountViewModel: AccountViewModel, rootId: String, relay: NormalizedRelayUrl, ): Set { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupServerList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupServerList.kt index 9562e675ab..b471fe199c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupServerList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupServerList.kt @@ -39,6 +39,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.relay_group_relay_not_nip29 +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.LargeRelayIconModifier import com.vitorpamplona.amethyst.commons.ui.theme.warningColor @@ -74,8 +75,8 @@ fun RelayGroupServerRow( RenderRelayIcon( displayUrl = host, iconUrl = info?.value?.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, pingInMs = 0, iconModifier = LargeRelayIconModifier, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupSubgroupsBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupSubgroupsBar.kt index c6d4ed9311..0010259629 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupSubgroupsBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupSubgroupsBar.kt @@ -135,7 +135,7 @@ private fun SubgroupChip( accountViewModel: AccountViewModel, nav: INav, ) { - LoadRelayGroupChannel(groupId, accountViewModel) { child -> + LoadRelayGroupChannel(groupId) { child -> val childState by child .flow() .metadata.stateFlow diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupThreadsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupThreadsScreen.kt index 3b956f6d38..d190ffe3eb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupThreadsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupThreadsScreen.kt @@ -111,7 +111,7 @@ fun RelayGroupThreadsScreen( val relay = remember(relayUrl) { RelayUrlNormalizer.normalizeOrNull(relayUrl) } ?: return val channelId = remember(id, relay) { GroupId(id, relay) } - LoadRelayGroupChannel(channelId, accountViewModel) { channel -> + LoadRelayGroupChannel(channelId) { channel -> RelayGroupThreads(channel, accountViewModel, nav) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelFileUploadDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelFileUploadDialog.kt index ec0e05f483..467917ee63 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelFileUploadDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelFileUploadDialog.kt @@ -40,6 +40,7 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.profile_image import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.HeaderPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.Size34dp @@ -73,8 +74,8 @@ fun ChannelFileUploadDialog( contentDescription = stringRes(Res.string.profile_image), contentScale = ContentScale.Crop, modifier = HeaderPictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt index b3e26ae4a5..2bd7b241c0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt @@ -99,6 +99,7 @@ import com.vitorpamplona.amethyst.commons.resources.unpin_conversation import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.HeaderPill +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.AccountPictureModifier import com.vitorpamplona.amethyst.commons.ui.theme.ChatLabelMaxWidth @@ -281,14 +282,14 @@ private fun ChatroomEntry( // ChannelHideMessageEvent/ChannelMuteUserEvent keep falling through to `else`. is ChannelMessageEvent, is ChannelMetadataEvent -> { baseNoteEvent.channelId()?.let { - LoadPublicChatChannel(it, accountViewModel) { channel -> + LoadPublicChatChannel(it) { channel -> ChannelRoomCompose(lastMessage, channel, accountViewModel, nav) } } } is ChannelCreateEvent -> { - LoadPublicChatChannel(baseNoteEvent.id, accountViewModel) { channel -> + LoadPublicChatChannel(baseNoteEvent.id) { channel -> ChannelRoomCompose(lastMessage, channel, accountViewModel, nav) } } @@ -300,7 +301,7 @@ private fun ChatroomEntry( is EphemeralChatEvent -> { baseNoteEvent.roomId()?.let { - LoadEphemeralChatChannel(it, accountViewModel) { channel -> + LoadEphemeralChatChannel(it) { channel -> ChannelRoomCompose(lastMessage, channel, accountViewModel, nav) } } @@ -367,8 +368,8 @@ private fun ChannelRoomCompose( channelLastTime = lastMessage.createdAt(), channelLastContent = "$authorName: $description", hasNewMessages = hasNewMessages, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -427,8 +428,8 @@ private fun ChannelRoomCompose( channelLastTime = lastMessage.createdAt(), channelLastContent = "$authorName: $description", hasNewMessages = (noteEvent?.createdAt ?: Long.MIN_VALUE) > lastReadTime, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -462,8 +463,8 @@ private fun GeohashRoomCompose( channelLastTime = lastMessage.createdAt(), channelLastContent = lastContent, hasNewMessages = (noteEvent?.createdAt ?: Long.MIN_VALUE) > lastReadTime, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -516,8 +517,8 @@ private fun MarmotGroupRoomCompose( channelLastTime = lastMessage.createdAt(), channelLastContent = lastContent, hasNewMessages = (lastMessage.createdAt() ?: Long.MIN_VALUE) > lastReadTime, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -647,8 +648,8 @@ fun RelayGroupRow( channelLastTime = lastTime, channelLastContent = lastContent, hasNewMessages = (lastTime ?: Long.MIN_VALUE) > lastReadTime, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -812,8 +813,8 @@ private fun ConcordRoomCompose( channelLastTime = lastMessage.createdAt(), channelLastContent = lastContent, hasNewMessages = (lastMessage.createdAt() ?: Long.MIN_VALUE) > lastReadTime, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -869,8 +870,8 @@ private fun RelayGroupServerRoomCompose( channelLastTime = row.newestMessage?.createdAt(), channelLastContent = lastContent, hasNewMessages = hasNewMessages, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -920,8 +921,8 @@ private fun ConcordServerRoomCompose( channelLastTime = row.newestMessage?.createdAt(), channelLastContent = lastContent, hasNewMessages = hasNewMessages, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -1014,7 +1015,7 @@ private fun UserRoomCompose( if (counterpartHex != null) { // 1:1 room: resolve the counterpart once and share it between the name and the // report-warning icon below, instead of each doing its own LoadUser. - LoadUser(baseUserHex = counterpartHex, accountViewModel = accountViewModel) { counterpart -> + LoadUser(baseUserHex = counterpartHex) { counterpart -> RoomNameDisplay(room, Modifier.weight(1f), accountViewModel, preloadedUser = counterpart) RoomReportWarningIcon(counterpart, accountViewModel) } @@ -1121,7 +1122,6 @@ private fun RowScope.LastMessagePreview( @Composable fun LoadUser( baseUserHex: String, - accountViewModel: AccountViewModel, content: @Composable (User?) -> Unit, ) { var user by diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/CommunityScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/CommunityScreen.kt index 57fe8ac2b1..f06d203aa1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/CommunityScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/CommunityScreen.kt @@ -78,7 +78,7 @@ fun CommunityScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(aTagHex, accountViewModel) { + LoadAddressableNote(aTagHex) { it?.let { PrepareViewModelsCommunityScreen( note = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt index 39e2d12e8f..5caf54d578 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt @@ -44,7 +44,7 @@ fun NewCommunityNoteButton( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = communityIdHex, accountViewModel) { + LoadNote(baseNoteHex = communityIdHex) { it?.let { NewCommunityNoteButton(it, accountViewModel, nav) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt index f3eadd1b43..0f9b946033 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt @@ -98,6 +98,7 @@ import com.vitorpamplona.amethyst.commons.ui.insets.imePaddingSafe import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.ActionTopBar import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.CreatingTopBar +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.SuggestionListDefaultHeightPage import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog @@ -573,8 +574,8 @@ private fun RelaysSection( Column { BasicRelaySetupInfoClickableRow( item = info, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, onClick = {}, onDelete = { model.removeRelay(entry) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/contactList/ContactListUsersScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/contactList/ContactListUsersScreen.kt index 6a66cbf769..56ae45f75f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/contactList/ContactListUsersScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/contactList/ContactListUsersScreen.kt @@ -57,7 +57,7 @@ fun ContactListUsersScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = noteId, accountViewModel) { note -> + LoadNote(baseNoteHex = noteId) { note -> if (note == null) { Scaffold( topBar = { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/RenderPublicChatChannelThumb.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/RenderPublicChatChannelThumb.kt index 0065dae58c..4623df34fe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/RenderPublicChatChannelThumb.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/RenderPublicChatChannelThumb.kt @@ -81,7 +81,7 @@ fun RenderPublicChatChannelThumb( accountViewModel: AccountViewModel, nav: INav, ) { - LoadPublicChatChannel(baseNote.idHex, accountViewModel) { + LoadPublicChatChannel(baseNote.idHex) { RenderPublicChatChannelThumb(baseNote = baseNote, channel = it, accountViewModel, nav) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt index 75404c3494..246fadcb6d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt @@ -240,7 +240,7 @@ fun RenderLiveActivityThumb( Spacer(modifier = DoubleVertSpacer) baseNote.address()?.let { - LoadLiveActivityChannel(it, accountViewModel) { + LoadLiveActivityChannel(it) { LiveActivitiesChannelHeader( baseChannel = it, showVideo = false, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt index 3ae4bacb3a..5bcbfa664a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt @@ -111,7 +111,7 @@ fun DvmContentDiscoveryScreen( }, accountViewModel = accountViewModel, ) { - LoadNote(baseNoteHex = appDefinitionEventId, accountViewModel = accountViewModel) { note -> + LoadNote(baseNoteHex = appDefinitionEventId) { note -> note?.let { baseNote -> WatchNoteEvent( baseNote, @@ -462,7 +462,7 @@ fun DvmPaymentActions( } } } else if (amount != null) { - LoadNote(baseNoteHex = latestStatus.id, accountViewModel = accountViewModel) { stateNote -> + LoadNote(baseNoteHex = latestStatus.id) { stateNote -> stateNote?.let { ZapDVMButton( baseNote = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmTopBar.kt index 7ab3f9ba55..fb4fff3272 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmTopBar.kt @@ -49,7 +49,7 @@ fun DvmTopBar( ) { MyExtensibleTopAppBar( title = { - LoadNote(baseNoteHex = appDefinitionId, accountViewModel = accountViewModel) { appDefinitionNote -> + LoadNote(baseNoteHex = appDefinitionId) { appDefinitionNote -> if (appDefinitionNote != null) { val card = observeAppDefinition(appDefinitionNote, accountViewModel) @@ -93,7 +93,7 @@ fun DvmTopBar( // The route passes the event's hex id, so LoadNote returns a plain Note, // not the AddressableNote the toggle needs. Derive the AddressableNote // from the loaded AppDefinitionEvent's address() once the event exists. - LoadNote(baseNoteHex = appDefinitionId, accountViewModel = accountViewModel) { appDefinitionNote -> + LoadNote(baseNoteHex = appDefinitionId) { appDefinitionNote -> if (appDefinitionNote != null) { val addressableNote by observeNoteAndMap(appDefinitionNote, accountViewModel) { note -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/list/ListOfEmojiPacksScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/list/ListOfEmojiPacksScreen.kt index 0f4d8dc8e8..3d1af6ad19 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/list/ListOfEmojiPacksScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/list/ListOfEmojiPacksScreen.kt @@ -312,11 +312,10 @@ private fun EmojiListToggleRow( remember(pack, accountViewModel) { Address(EmojiPackEvent.KIND, accountViewModel.account.signer.pubKey, pack.identifier) } - LoadAddressableNote(packAddress, accountViewModel) { + LoadAddressableNote(packAddress) { it?.let { packNote -> LoadAddressableNote( accountViewModel.account.emoji.getEmojiPackSelectionAddress(), - accountViewModel, ) { selectionNote -> selectionNote?.let { usersEmojiList -> val hasAddedThis by observeNoteAndMap(usersEmojiList, accountViewModel) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/EmojiPackSelectionScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/EmojiPackSelectionScreen.kt index fa5a65218e..798e89e207 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/EmojiPackSelectionScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/EmojiPackSelectionScreen.kt @@ -72,7 +72,7 @@ fun EmojiPackSelectionScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address = packAddress, accountViewModel = accountViewModel) { note -> + LoadAddressableNote(address = packAddress) { note -> note?.let { EmojiPackSelectionView( modifier = Modifier.fillMaxSize().recalculateWindowInsets(), @@ -122,7 +122,6 @@ private fun EmojiPackSelectionBody( item { LoadAddressableNote( address = accountViewModel.account.emoji.getEmojiPackSelectionAddress(), - accountViewModel = accountViewModel, ) { selectionNote -> selectionNote?.let { val hasAddedThis by observeNoteAndMap(it, accountViewModel) { currentNote -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt index 132d1f34d7..6f5feccd25 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt @@ -80,7 +80,6 @@ fun MyEmojiListScreen( ) { LoadAddressableNote( address = accountViewModel.account.emoji.getEmojiPackSelectionAddress(), - accountViewModel = accountViewModel, ) { selectionNote -> selectionNote?.let { MyEmojiListView( @@ -162,7 +161,6 @@ private fun MyEmojiListFeed( ) { address -> LoadAddressableNote( address = address, - accountViewModel = accountViewModel, ) { packNote -> packNote?.let { SelectedEmojiPackCard( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt index 92aaaaf86a..5d9412c8fb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt @@ -95,7 +95,7 @@ fun FollowPackFeedScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { + LoadAddressableNote(address) { it?.let { PrepareViewModelsFollowPackScreen( note = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/detail/GeocacheDetailParts.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/detail/GeocacheDetailParts.kt index 97b7d67d03..4bcf6e1d24 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/detail/GeocacheDetailParts.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/detail/GeocacheDetailParts.kt @@ -126,7 +126,7 @@ fun GeocacheOwnerRow( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(listing.pubKey, accountViewModel) { user -> + LoadUser(listing.pubKey) { user -> if (user != null) { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { ClickableUserPicture(user, Size25dp, accountViewModel) @@ -142,7 +142,7 @@ fun GeocacheWinnerStrip( winner: String, accountViewModel: AccountViewModel, ) { - LoadUser(winner, accountViewModel) { user -> + LoadUser(winner) { user -> // LoadUser resolves the User object, not its metadata, so reading the display name off it // left the winner as a hex stub whenever their kind 0 arrived after this composed. // observeUserName asks the relays for the profile and recomposes when it lands. The name @@ -227,7 +227,7 @@ fun GeocacheLogRow( ).padding(vertical = 8.dp), ) { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { - LoadUser(author, accountViewModel) { user -> + LoadUser(author) { user -> if (user != null) { ClickableUserPicture(user, Size25dp, accountViewModel) UsernameDisplay(user, accountViewModel = accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/GeocacheHuntScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/GeocacheHuntScreen.kt index d3e9da2b8f..f1aa5a1344 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/GeocacheHuntScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/GeocacheHuntScreen.kt @@ -217,7 +217,7 @@ private fun GeocacheHuntStop( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { cacheNote -> + LoadAddressableNote(address) { cacheNote -> // A hunt is a list of caches the reader has most likely never fetched, so the note comes // back empty and `cacheNote.event` would stay null forever. observeNoteEvent asks the // relays for it and recomposes this stop when it lands. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/NewGeocacheHuntScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/NewGeocacheHuntScreen.kt index 6512bed293..3b2f7f7ba5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/NewGeocacheHuntScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geocaches/hunt/NewGeocacheHuntScreen.kt @@ -182,7 +182,7 @@ fun NewGeocacheHuntScreen( } model.caches.forEachIndexed { index, address -> - LoadAddressableNote(address, accountViewModel) { cacheNote -> + LoadAddressableNote(address) { cacheNote -> // Same reason as the hunt screen's stops: a cache added by naddr has no event // in the cache yet, so this has to ask the relays and watch rather than read. val listing = cacheNote?.let { observeNoteEvent(it, accountViewModel).value } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitNewIssue.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitNewIssue.kt index 4df69197ca..4142c962af 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitNewIssue.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitNewIssue.kt @@ -68,7 +68,7 @@ fun GitNewIssueScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { GitNewIssueForm(it, accountViewModel, nav) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitRepositoryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitRepositoryScreen.kt index b469200252..f6859edce3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitRepositoryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/gitRepo/GitRepositoryScreen.kt @@ -122,7 +122,7 @@ fun GitRepositoryScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { GitRepositoryHome( note = it, @@ -139,7 +139,7 @@ fun GitRepositoryCodeScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { GitRepositoryCode(it, accountViewModel, nav) } } } @@ -150,7 +150,7 @@ fun GitRepositoryIssuesScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { GitRepositoryIssues(it, accountViewModel, nav) } } } @@ -161,7 +161,7 @@ fun GitRepositoryPullsScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { GitRepositoryPulls(it, accountViewModel, nav) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/AlgoFeedStatusBanner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/AlgoFeedStatusBanner.kt index 4f9b3d670e..ac92ec3436 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/AlgoFeedStatusBanner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/AlgoFeedStatusBanner.kt @@ -108,7 +108,7 @@ private fun SingleAlgoFeedBanner( val feedAddressValue = favFeed.address.toValue() - LoadNote(baseNoteHex = feedAddressValue, accountViewModel = accountViewModel) { feedNote -> + LoadNote(baseNoteHex = feedAddressValue) { feedNote -> val resolvedName by observeNoteAndMap(feedNote ?: return@LoadNote, accountViewModel) { note -> (note.event as? AppDefinitionEvent) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/NewMusicPlaylistScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/NewMusicPlaylistScreen.kt index bb427ee154..8ef8fa212d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/NewMusicPlaylistScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/NewMusicPlaylistScreen.kt @@ -323,7 +323,7 @@ private fun TrackManagementSection( } tracks.forEachIndexed { index, address -> - LoadAddressableNote(address, accountViewModel) { trackNote -> + LoadAddressableNote(address) { trackNote -> EditableTrackRow( position = index + 1, trackNote = trackNote, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/activity/NestActivityContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/activity/NestActivityContent.kt index f1a3bb2726..b6d187044f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/activity/NestActivityContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/activity/NestActivityContent.kt @@ -101,7 +101,7 @@ internal fun NestActivityContent( return } - LoadAddressableNote(parsedAddress, accountViewModel) { addressableNote -> + LoadAddressableNote(parsedAddress) { addressableNote -> if (addressableNote == null) { // Note hasn't resolved yet — relay subscription is in // flight. Render a centered spinner so the user sees that diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestJoinCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestJoinCard.kt index 27b6242818..b3e36b6ded 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestJoinCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestJoinCard.kt @@ -86,7 +86,7 @@ fun NestJoinCard( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(baseChannel.address, accountViewModel) { addressableNote -> + LoadAddressableNote(baseChannel.address) { addressableNote -> addressableNote ?: return@LoadAddressableNote val event = addressableNote.event as? MeetingSpaceEvent ?: return@LoadAddressableNote NestJoinCardContent(event, accountViewModel, nav) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestLobbyScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestLobbyScreen.kt index 47316d842d..cbbcac7877 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestLobbyScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lobby/NestLobbyScreen.kt @@ -127,7 +127,7 @@ fun NestLobbyScreen( nav: INav, ) { val address = remember(addressValue) { Address.parse(addressValue) } ?: return - LoadAddressableNote(address, accountViewModel) { addressableNote -> + LoadAddressableNote(address) { addressableNote -> addressableNote ?: return@LoadAddressableNote val event = addressableNote.event as? MeetingSpaceEvent ?: return@LoadAddressableNote NestLobbyContent(event, addressableNote, accountViewModel, nav) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ShowDonationCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ShowDonationCard.kt index da65f74b1c..75a287d35e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ShowDonationCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ShowDonationCard.kt @@ -38,7 +38,6 @@ fun ShowDonationCard( if (!donated) { LoadNote( BuildConfig.RELEASE_NOTES_ID, - accountViewModel, ) { loadedNoteId -> if (loadedNoteId != null) { ZapTheDevsCard( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ZapTheDevsCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ZapTheDevsCard.kt index 26c85c7ee3..94ec7a0b5c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ZapTheDevsCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/donations/ZapTheDevsCard.kt @@ -118,7 +118,6 @@ fun ZapTheDevsCardPreview() { LoadNote( baseNoteHex = "0465b20da0adf45dd612024d124e1ed384f7ecd2cd7358e77998828e7bf35fa2", - accountViewModel, ) { releaseNote -> if (releaseNote != null) { ThemeComparisonColumn { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/pictures/PictureCardComposePreview.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/pictures/PictureCardComposePreview.kt index c71f3eff20..f07f651977 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/pictures/PictureCardComposePreview.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/pictures/PictureCardComposePreview.kt @@ -99,7 +99,6 @@ private fun PictureCardComposePreview() { LoadNote( baseNoteHex = "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", - accountViewModel = accountViewModel, ) { baseNote -> ThemeComparisonColumn { if (baseNote != null) { @@ -128,7 +127,6 @@ private fun PictureCardComposeNoTitlePreview() { LoadNote( baseNoteHex = "b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3", - accountViewModel = accountViewModel, ) { baseNote -> ThemeComparisonColumn { if (baseNote != null) { @@ -157,7 +155,6 @@ private fun PictureCardComposeMultiImagePreview() { LoadNote( baseNoteHex = "c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4", - accountViewModel = accountViewModel, ) { baseNote -> ThemeComparisonColumn { if (baseNote != null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt index aecc3b5f67..9ce804d10e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt @@ -136,7 +136,7 @@ private fun SupporterRow( modifier = Modifier.weight(1f), ) } else { - LoadUser(entry.bucketKey, accountViewModel) { user -> + LoadUser(entry.bucketKey) { user -> if (user != null) { ClickableUserPicture(user, Size35dp, accountViewModel, onClick = { nav.nav(routeFor(it)) }) UsernameDisplay(user, Modifier.weight(1f), accountViewModel = accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/results/PollResultsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/results/PollResultsScreen.kt index 3a84c47426..05441ae449 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/results/PollResultsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/results/PollResultsScreen.kt @@ -141,7 +141,7 @@ fun PollResultsScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadNote(baseNoteHex = noteId, accountViewModel) { note -> + LoadNote(baseNoteHex = noteId) { note -> if (note == null) { PollResultsScaffold(nav) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/GalleryCardCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/GalleryCardCompose.kt index c41a2b6ab7..ab7322b1a8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/GalleryCardCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/GalleryCardCompose.kt @@ -68,7 +68,7 @@ fun GalleryCardCompose( } if (redirectToEventId != null) { - LoadNote(baseNoteHex = redirectToEventId, accountViewModel = accountViewModel) { baseSourceNote -> + LoadNote(baseNoteHex = redirectToEventId) { baseSourceNote -> if (baseSourceNote != null) { val sourceNote by observeNote(baseSourceNote, accountViewModel) RedirectableGalleryCard( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfilePaymentRailChips.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfilePaymentRailChips.kt index 85eca033f8..775012e84e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfilePaymentRailChips.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfilePaymentRailChips.kt @@ -128,7 +128,7 @@ fun DisplayPaymentRailChips( Bolt12OfferListEvent.createAddress(baseUser.pubkeyHex) } - LoadAddressableNote(targetsAddress, accountViewModel) { targetsNote -> + LoadAddressableNote(targetsAddress) { targetsNote -> val targets = if (targetsNote != null) { EventFinderFilterAssemblerSubscription(targetsNote, accountViewModel) @@ -138,7 +138,7 @@ fun DisplayPaymentRailChips( emptyList() } - LoadAddressableNote(bolt12Address, accountViewModel) { bolt12Note -> + LoadAddressableNote(bolt12Address) { bolt12Note -> val bolt12Offers = if (bolt12Note != null) { EventFinderFilterAssemblerSubscription(bolt12Note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/badges/DisplayBadges.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/badges/DisplayBadges.kt index 238d1815a0..ddb814058a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/badges/DisplayBadges.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/badges/DisplayBadges.kt @@ -74,6 +74,7 @@ import com.vitorpamplona.amethyst.commons.resources.profile_badges_title import com.vitorpamplona.amethyst.commons.ui.components.RobohashAsyncImage import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.EventFinderFilterAssemblerSubscription import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNoteEvent @@ -344,7 +345,7 @@ private fun LoadDefinitionForAward( awardNote.value?.let { note -> val awardEvent by observeNoteEvent(note, accountViewModel) awardEvent?.awardDefinition()?.firstOrNull()?.let { defAddr -> - LoadAddressableNote(defAddr, accountViewModel) { defNote -> + LoadAddressableNote(defAddr) { defNote -> defNote?.let { content(it) } } } @@ -411,7 +412,7 @@ private fun RenderBadgeImage( robot = "badgenotfound", contentDescription = description, modifier = modifier, - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) } else { RobohashFallbackAsyncImage( @@ -419,8 +420,8 @@ private fun RenderBadgeImage( model = image, contentDescription = description, modifier = modifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt index 447e00e743..adaec88edf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt @@ -152,7 +152,7 @@ fun SendPaymentScreen( Scaffold( topBar = { TopBarWithBackButton(stringRes(Res.string.send_payment_title), nav) }, ) { pad -> - LoadUser(baseUserHex = userHex, accountViewModel) { user -> + LoadUser(baseUserHex = userHex) { user -> if (user != null) { UserFinderFilterAssemblerSubscription(user, accountViewModel) SendPaymentLoaded( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/qrcode/ShowQRScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/qrcode/ShowQRScreen.kt index d649af657e..fc0f30163e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/qrcode/ShowQRScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/qrcode/ShowQRScreen.kt @@ -60,6 +60,7 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton import com.vitorpamplona.amethyst.commons.ui.note.ArrowBackIcon import com.vitorpamplona.amethyst.commons.ui.richtext.CreateTextWithEmoji +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.Font14SP import com.vitorpamplona.amethyst.commons.ui.theme.Size10dp @@ -124,7 +125,7 @@ fun ShowQRScreen( nav: INav, startScanning: Boolean = false, ) { - LoadUser(pubkey, accountViewModel) { user -> + LoadUser(pubkey) { user -> if (user != null) { ShowQRScreen( user = user, @@ -242,8 +243,8 @@ fun RenderName( model = userInfo?.info?.profilePicture(), contentDescription = stringRes(Res.string.profile_image), modifier = MaterialTheme.colorScheme.largeProfilePictureModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/redirect/LoadRedirectScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/redirect/LoadRedirectScreen.kt index c768821527..02a3d3cf14 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/redirect/LoadRedirectScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/redirect/LoadRedirectScreen.kt @@ -89,7 +89,7 @@ fun LoadRedirectScreen( ) { CircularProgressIndicator() - LoadNote(eventId, accountViewModel) { note -> + LoadNote(eventId) { note -> Text( // A private id is not something to show a user, and it must not be // copyable off the screen either. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relayauth/RelayAuthSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relayauth/RelayAuthSettingsScreen.kt index 83deb6a5f8..b0bd3b3ed1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relayauth/RelayAuthSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relayauth/RelayAuthSettingsScreen.kt @@ -112,6 +112,7 @@ import com.vitorpamplona.amethyst.commons.resources.relay_info import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.MediumRelayIconModifier import com.vitorpamplona.amethyst.commons.ui.theme.RelayIconFilter @@ -794,7 +795,7 @@ private fun RelayIcon( contentDescription = stringRes(Res.string.relay_info, url), colorFilter = RelayIconFilter, modifier = MediumRelayIconModifier, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt index e3382c8646..a49752d925 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt @@ -158,6 +158,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.CrossfadeIfEnabled import com.vitorpamplona.amethyst.commons.ui.components.appendLink import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.commons.ui.theme.Height25Modifier @@ -856,7 +857,7 @@ private fun DisplayOwnerInformation( accountViewModel: AccountViewModel, nav: INav, ) { - LoadUser(baseUserHex = userHex, accountViewModel) { loadedUser -> + LoadUser(baseUserHex = userHex) { loadedUser -> CrossfadeIfEnabled(loadedUser) { if (it != null) { Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant)) { @@ -890,8 +891,8 @@ private fun RelayHeader( RenderRelayIcon( displayUrl = relay.displayUrl(), iconUrl = relayInfo.icon, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, pingInMs = relayStats.pingInMs, iconModifier = Modifier @@ -1422,7 +1423,7 @@ private fun RelayMonitorReportCard( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth(), ) { - LoadUser(baseUserHex = event.pubKey, accountViewModel) { user -> + LoadUser(baseUserHex = event.pubKey) { user -> if (user != null) { Row( verticalAlignment = Alignment.CenterVertically, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt index b2281985e1..d5f1e6e2af 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt @@ -26,6 +26,7 @@ import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.relays.ui.RelayCountResult import com.vitorpamplona.amethyst.commons.relays.ui.RelayDragState import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -43,8 +44,8 @@ fun BasicRelaySetupInfoDialog( ) { BasicRelaySetupInfoClickableRow( item = item, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, onDelete = onDelete, onClick = { nav.nav(Route.RelayInfo(item.relay.url)) }, nip11CachedRetriever = nip11CachedRetriever, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/ShowRelaySuggestionList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/ShowRelaySuggestionList.kt index dca4068719..3b91761c41 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/ShowRelaySuggestionList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/ShowRelaySuggestionList.kt @@ -27,6 +27,7 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.DividerThickness import com.vitorpamplona.amethyst.commons.ui.theme.HalfVertPadding import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever @@ -49,8 +50,8 @@ fun ShowRelaySuggestionList( suggestions.forEachIndexed { index, relayInfo -> BasicRelaySetupInfoClickableRow( item = relayInfo, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, onClick = { onSelect(relayInfo.relay) }, onDelete = null, nip11CachedRetriever = nip11CachedRetriever, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/subscriptions/ActiveSubscriptionsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/subscriptions/ActiveSubscriptionsScreen.kt index 42fcf0d8e5..d2e0a0496f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/subscriptions/ActiveSubscriptionsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/subscriptions/ActiveSubscriptionsScreen.kt @@ -90,6 +90,7 @@ import com.vitorpamplona.amethyst.commons.resources.marmot_group_fallback_name import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.RelayIconFilter import com.vitorpamplona.amethyst.commons.ui.theme.allGoodColor import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText @@ -475,7 +476,7 @@ private fun EntityBlock( model = resolved.picture, contentDescription = label, modifier = Modifier.size(24.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, loadRobohash = false, ) Spacer(Modifier.width(8.dp)) @@ -522,7 +523,7 @@ private fun RelayLine( contentDescription = relay.displayUrl(), colorFilter = RelayIconFilter, modifier = Modifier.size(20.dp).clip(CircleShape), - loadProfilePicture = accountViewModel.settings.showProfilePictures(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, loadRobohash = false, ) Spacer(Modifier.width(8.dp)) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt index b2c953d106..f165f0cb52 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt @@ -121,6 +121,7 @@ import com.vitorpamplona.amethyst.commons.ui.layouts.rememberFeedContentPadding import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.ClearTextIcon import com.vitorpamplona.amethyst.commons.ui.note.SearchIcon +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings import com.vitorpamplona.amethyst.commons.ui.search.GroupCandidate import com.vitorpamplona.amethyst.commons.ui.search.SEARCH_PICKER_LIMIT import com.vitorpamplona.amethyst.commons.ui.search.SearchFieldState @@ -822,8 +823,8 @@ private fun DisplaySearchResults( ) { _, relayInfo -> BasicRelaySetupInfoClickableRow( item = relayInfo, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, onClick = { nav.nav(Route.RelayInfo(relayInfo.relay.url)) }, onDelete = null, nip11CachedRetriever = Amethyst.instance.nip11Cache, @@ -849,8 +850,8 @@ private fun DisplaySearchResults( channelLastTime = null, channelLastContent = item.summary(), hasNewMessages = false, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -882,8 +883,8 @@ private fun DisplaySearchResults( channelLastTime = null, channelLastContent = stringRes(Res.string.ephemeral_relay_chat), hasNewMessages = false, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() @@ -913,8 +914,8 @@ private fun DisplaySearchResults( channelLastTime = null, channelLastContent = item.summary(), hasNewMessages = false, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), + loadProfilePicture = LocalDisplaySettings.current.showProfilePictures, + loadRobohash = LocalDisplaySettings.current.loadRobohash, autoPlayGif = accountViewModel.settings.autoPlayVideosFlow .collectAsStateWithLifecycle() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt index 64512a87ce..1651960528 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt @@ -81,6 +81,7 @@ import com.vitorpamplona.amethyst.commons.model.FontFamilyType import com.vitorpamplona.amethyst.commons.model.FontSizeType import com.vitorpamplona.amethyst.commons.model.ThemeType import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow +import com.vitorpamplona.amethyst.commons.model.resourceId import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.accent_color import com.vitorpamplona.amethyst.commons.resources.accent_color_description diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NotificationSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NotificationSettingsScreen.kt index eab7fbfaa5..02f18f92e9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NotificationSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NotificationSettingsScreen.kt @@ -215,7 +215,7 @@ private fun AccountParticipationRow( // resolves (and lazily creates) the User behind each npub off the main thread, // then the shared UserPicture / UsernameDisplay observe its live metadata. if (pubkeyHex != null) { - LoadUser(pubkeyHex, accountViewModel) { user -> + LoadUser(pubkeyHex) { user -> if (user != null) { ClickableUserPicture( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ProfileUiSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ProfileUiSettingsScreen.kt index eaabce04cb..1ed130938a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ProfileUiSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ProfileUiSettingsScreen.kt @@ -36,6 +36,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.ProfileGalleryType import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow +import com.vitorpamplona.amethyst.commons.model.resourceId import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.gallery_style import com.vitorpamplona.amethyst.commons.resources.gallery_style_description diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt index 3c0ba84919..0714583d75 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt @@ -41,6 +41,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.WarningType import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.parseWarningType +import com.vitorpamplona.amethyst.commons.model.resourceId import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.blocked_users import com.vitorpamplona.amethyst.commons.resources.filter_spam_from_strangers_explainer diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/softwareapps/SoftwareAppDetailScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/softwareapps/SoftwareAppDetailScreen.kt index fdc0e0cb4b..52869265fc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/softwareapps/SoftwareAppDetailScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/softwareapps/SoftwareAppDetailScreen.kt @@ -110,7 +110,7 @@ fun SoftwareAppDetailScreen( accountViewModel: AccountViewModel, nav: INav, ) { - LoadAddressableNote(address, accountViewModel) { note -> + LoadAddressableNote(address) { note -> note?.let { SoftwareAppDetailScreenContent( note = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index bfcbcefe10..fbd05a0120 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -1272,7 +1272,7 @@ private fun RenderApprovalIfNeeded( baseNote.event?.communityAddress() } communityAddress?.let { - LoadAddressableNote(it, accountViewModel) { community -> + LoadAddressableNote(it) { community -> if (community != null) { val showApproveButton by observeCommunityApprovalNeedStatus(baseNote, community, accountViewModel) if (showApproveButton == true) { @@ -1574,7 +1574,7 @@ private fun RenderWikiHeaderForThreadPreview() { val nav = EmptyNav() - LoadNote(baseNoteHex = "277f982a4cd3f67cc47ad9282176acabee1713848f547d6021e0c155572078e1", accountViewModel = accountViewModel) { baseNote -> + LoadNote(baseNoteHex = "277f982a4cd3f67cc47ad9282176acabee1713848f547d6021e0c155572078e1") { baseNote -> ThemeComparisonColumn { val bg = MaterialTheme.colorScheme.background val backgroundColor = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadScreen.kt index 3fb68d5ffc..994eed7348 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadScreen.kt @@ -53,7 +53,7 @@ fun ThreadScreen( WatchLifecycleAndUpdateModel(feedViewModel) ThreadFilterAssemblerSubscription(noteId, accountViewModel) - LoadNote(noteId, accountViewModel) { + LoadNote(noteId) { if (it != null) { // this will force loading every post from this thread. EventFinderFilterAssemblerSubscription(it, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt index 8d768e7bff..d1413d332e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt @@ -1193,7 +1193,7 @@ private fun HistoryUserName( pubkeyHex: String, accountViewModel: AccountViewModel, ) { - LoadUser(baseUserHex = pubkeyHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = pubkeyHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/OnchainTransactionsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/OnchainTransactionsScreen.kt index bc9ba5694f..69554eea7c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/OnchainTransactionsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/OnchainTransactionsScreen.kt @@ -449,7 +449,7 @@ private fun OnchainCounterpartyName( pubkeyHex: String, accountViewModel: AccountViewModel, ) { - LoadUser(baseUserHex = pubkeyHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = pubkeyHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt index d98103cb23..b01f4380c0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt @@ -403,7 +403,7 @@ private fun TransactionUserName( fallbackName: String?, accountViewModel: AccountViewModel, ) { - LoadUser(baseUserHex = pubkeyHex, accountViewModel = accountViewModel) { user -> + LoadUser(baseUserHex = pubkeyHex) { user -> if (user != null) { UsernameDisplay( baseUser = user, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/WorkoutDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/WorkoutDisplay.kt index 1b0bc4b082..ad005c6a8c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/WorkoutDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/WorkoutDisplay.kt @@ -591,7 +591,7 @@ private fun ExerciseRow( // Resolve the kind-33401 template to show its real title; falls back to the slug // until the template is fetched (the workout event's relay hints drive the fetch). - LoadAddressableNote(address, accountViewModel) { templateNote -> + LoadAddressableNote(address) { templateNote -> val name = if (templateNote != null) { val templateEvent by observeNoteEvent(templateNote, accountViewModel) diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt similarity index 66% rename from commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt rename to commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt index 1246f0b855..eb8ae128e1 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt @@ -21,37 +21,7 @@ package com.vitorpamplona.amethyst.commons.model import androidx.compose.runtime.Stable -import com.vitorpamplona.amethyst.commons.resources.Res -import com.vitorpamplona.amethyst.commons.resources.accent_color_blue -import com.vitorpamplona.amethyst.commons.resources.accent_color_green -import com.vitorpamplona.amethyst.commons.resources.accent_color_orange -import com.vitorpamplona.amethyst.commons.resources.accent_color_pink -import com.vitorpamplona.amethyst.commons.resources.accent_color_purple -import com.vitorpamplona.amethyst.commons.resources.accent_color_red -import com.vitorpamplona.amethyst.commons.resources.connectivity_type_always -import com.vitorpamplona.amethyst.commons.resources.connectivity_type_never -import com.vitorpamplona.amethyst.commons.resources.connectivity_type_unmetered_wifi_only -import com.vitorpamplona.amethyst.commons.resources.content_warning_hide_all_sensitive_content_option -import com.vitorpamplona.amethyst.commons.resources.content_warning_see_warnings_option -import com.vitorpamplona.amethyst.commons.resources.content_warning_show_all_sensitive_content_option -import com.vitorpamplona.amethyst.commons.resources.dark -import com.vitorpamplona.amethyst.commons.resources.font_family_monospace -import com.vitorpamplona.amethyst.commons.resources.font_family_sans_serif -import com.vitorpamplona.amethyst.commons.resources.font_family_serif -import com.vitorpamplona.amethyst.commons.resources.font_family_system -import com.vitorpamplona.amethyst.commons.resources.font_size_huge -import com.vitorpamplona.amethyst.commons.resources.font_size_large -import com.vitorpamplona.amethyst.commons.resources.font_size_normal -import com.vitorpamplona.amethyst.commons.resources.font_size_small -import com.vitorpamplona.amethyst.commons.resources.gallery_type_classic -import com.vitorpamplona.amethyst.commons.resources.gallery_type_modern -import com.vitorpamplona.amethyst.commons.resources.light -import com.vitorpamplona.amethyst.commons.resources.system -import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_complete -import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_performance -import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_simplified import kotlinx.serialization.Serializable -import org.jetbrains.compose.resources.StringResource @Stable @Serializable @@ -98,11 +68,10 @@ data class UiSettings( enum class ThemeType( val screenCode: Int, - val resourceId: StringResource, ) { - SYSTEM(0, Res.string.system), - LIGHT(1, Res.string.light), - DARK(2, Res.string.dark), + SYSTEM(0), + LIGHT(1), + DARK(2), } fun parseThemeType(code: Int?): ThemeType = @@ -115,14 +84,13 @@ fun parseThemeType(code: Int?): ThemeType = enum class AccentColorType( val screenCode: Int, - val resourceId: StringResource, ) { - PURPLE(0, Res.string.accent_color_purple), - BLUE(1, Res.string.accent_color_blue), - GREEN(2, Res.string.accent_color_green), - ORANGE(3, Res.string.accent_color_orange), - RED(4, Res.string.accent_color_red), - PINK(5, Res.string.accent_color_pink), + PURPLE(0), + BLUE(1), + GREEN(2), + ORANGE(3), + RED(4), + PINK(5), } fun parseAccentColorType(screenCode: Int): AccentColorType = @@ -138,12 +106,11 @@ fun parseAccentColorType(screenCode: Int): AccentColorType = enum class FontFamilyType( val screenCode: Int, - val resourceId: StringResource, ) { - SYSTEM(0, Res.string.font_family_system), - SANS_SERIF(1, Res.string.font_family_sans_serif), - SERIF(2, Res.string.font_family_serif), - MONOSPACE(3, Res.string.font_family_monospace), + SYSTEM(0), + SANS_SERIF(1), + SERIF(2), + MONOSPACE(3), } fun parseFontFamilyType(screenCode: Int): FontFamilyType = @@ -158,12 +125,11 @@ fun parseFontFamilyType(screenCode: Int): FontFamilyType = enum class FontSizeType( val scale: Float, val screenCode: Int, - val resourceId: StringResource, ) { - SMALL(0.85f, 0, Res.string.font_size_small), - NORMAL(1.0f, 1, Res.string.font_size_normal), - LARGE(1.15f, 2, Res.string.font_size_large), - HUGE(1.3f, 3, Res.string.font_size_huge), + SMALL(0.85f, 0), + NORMAL(1.0f, 1), + LARGE(1.15f, 2), + HUGE(1.3f, 3), } fun parseFontSizeType(screenCode: Int): FontSizeType = @@ -178,28 +144,25 @@ fun parseFontSizeType(screenCode: Int): FontSizeType = enum class ConnectivityType( val prefCode: Boolean?, val screenCode: Int, - val resourceId: StringResource, ) { - ALWAYS(null, 0, Res.string.connectivity_type_always), - WIFI_ONLY(true, 1, Res.string.connectivity_type_unmetered_wifi_only), - NEVER(false, 2, Res.string.connectivity_type_never), + ALWAYS(null, 0), + WIFI_ONLY(true, 1), + NEVER(false, 2), } enum class FeatureSetType( val screenCode: Int, - val resourceId: StringResource, ) { - COMPLETE(0, Res.string.ui_feature_set_type_complete), - SIMPLIFIED(1, Res.string.ui_feature_set_type_simplified), - PERFORMANCE(2, Res.string.ui_feature_set_type_performance), + COMPLETE(0), + SIMPLIFIED(1), + PERFORMANCE(2), } enum class ProfileGalleryType( val screenCode: Int, - val resourceId: StringResource, ) { - CLASSIC(0, Res.string.gallery_type_classic), - MODERN(1, Res.string.gallery_type_modern), + CLASSIC(0), + MODERN(1), } fun parseConnectivityType(code: Boolean?): ConnectivityType = @@ -236,10 +199,9 @@ fun parseGalleryType(screenCode: Int): ProfileGalleryType = enum class BooleanType( val prefCode: Boolean?, val screenCode: Int, - val reourceId: StringResource, ) { - ALWAYS(null, 0, Res.string.connectivity_type_always), - NEVER(false, 1, Res.string.connectivity_type_never), + ALWAYS(null, 0), + NEVER(false, 1), } fun parseBooleanType(code: Boolean?): BooleanType = @@ -259,11 +221,10 @@ fun parseBooleanType(screenCode: Int): BooleanType = enum class WarningType( val prefCode: Boolean?, val screenCode: Int, - val resourceId: StringResource, ) { - WARN(null, 0, Res.string.content_warning_see_warnings_option), - SHOW(true, 1, Res.string.content_warning_show_all_sensitive_content_option), - HIDE(false, 2, Res.string.content_warning_hide_all_sensitive_content_option), + WARN(null, 0), + SHOW(true, 1), + HIDE(false, 2), } fun parseWarningType(screenCode: Int): WarningType = diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt similarity index 100% rename from commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt rename to commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/state/UiSettingsState.kt similarity index 99% rename from commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt rename to commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/state/UiSettingsState.kt index e5620b83e6..b4edc59b77 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/state/UiSettingsState.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.amethyst.commons.ui.screen +package com.vitorpamplona.amethyst.commons.state import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.commons.model.BooleanType diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsSerializationTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsSerializationTest.kt new file mode 100644 index 0000000000..07f15b4f75 --- /dev/null +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsSerializationTest.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.amethyst.commons.model + +import com.vitorpamplona.quartz.nip01Core.core.JsonMapper +import kotlin.test.Test +import kotlin.test.assertEquals + +/** + * Settings saved by older versions are read back with `JsonMapper.fromJson` (the + * encrypted-preferences fallback in `UiSharedPreferences`). That needs the kotlinx serializer the + * serialization plugin generates, which a module without the plugin silently does not produce. + */ +class UiSettingsSerializationTest { + @Test + fun uiSettingsRoundTripsThroughJson() { + val settings = + UiSettings( + theme = ThemeType.DARK, + featureSet = FeatureSetType.PERFORMANCE, + automaticallyShowProfilePictures = ConnectivityType.WIFI_ONLY, + fontSize = FontSizeType.LARGE, + composeSignature = "sig", + ) + + val json = JsonMapper.toJson(settings) + + assertEquals(settings, JsonMapper.fromJson(json)) + } + + @Test + fun anEmptyObjectDecodesToTheDefaults() { + assertEquals(UiSettings(), JsonMapper.fromJson("{}")) + } +} diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsLabels.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsLabels.kt new file mode 100644 index 0000000000..5a1e45ccb1 --- /dev/null +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsLabels.kt @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.amethyst.commons.model + +import com.vitorpamplona.amethyst.commons.resources.Res +import com.vitorpamplona.amethyst.commons.resources.accent_color_blue +import com.vitorpamplona.amethyst.commons.resources.accent_color_green +import com.vitorpamplona.amethyst.commons.resources.accent_color_orange +import com.vitorpamplona.amethyst.commons.resources.accent_color_pink +import com.vitorpamplona.amethyst.commons.resources.accent_color_purple +import com.vitorpamplona.amethyst.commons.resources.accent_color_red +import com.vitorpamplona.amethyst.commons.resources.connectivity_type_always +import com.vitorpamplona.amethyst.commons.resources.connectivity_type_never +import com.vitorpamplona.amethyst.commons.resources.connectivity_type_unmetered_wifi_only +import com.vitorpamplona.amethyst.commons.resources.content_warning_hide_all_sensitive_content_option +import com.vitorpamplona.amethyst.commons.resources.content_warning_see_warnings_option +import com.vitorpamplona.amethyst.commons.resources.content_warning_show_all_sensitive_content_option +import com.vitorpamplona.amethyst.commons.resources.dark +import com.vitorpamplona.amethyst.commons.resources.font_family_monospace +import com.vitorpamplona.amethyst.commons.resources.font_family_sans_serif +import com.vitorpamplona.amethyst.commons.resources.font_family_serif +import com.vitorpamplona.amethyst.commons.resources.font_family_system +import com.vitorpamplona.amethyst.commons.resources.font_size_huge +import com.vitorpamplona.amethyst.commons.resources.font_size_large +import com.vitorpamplona.amethyst.commons.resources.font_size_normal +import com.vitorpamplona.amethyst.commons.resources.font_size_small +import com.vitorpamplona.amethyst.commons.resources.gallery_type_classic +import com.vitorpamplona.amethyst.commons.resources.gallery_type_modern +import com.vitorpamplona.amethyst.commons.resources.light +import com.vitorpamplona.amethyst.commons.resources.system +import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_complete +import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_performance +import com.vitorpamplona.amethyst.commons.resources.ui_feature_set_type_simplified +import org.jetbrains.compose.resources.StringResource + +// Display labels for the settings enums. The enums live in headless commons; their labels are +// Compose resources, so they are attached here, in the UI module. + +val ThemeType.resourceId: StringResource + get() = + when (this) { + ThemeType.SYSTEM -> Res.string.system + ThemeType.LIGHT -> Res.string.light + ThemeType.DARK -> Res.string.dark + } + +val AccentColorType.resourceId: StringResource + get() = + when (this) { + AccentColorType.PURPLE -> Res.string.accent_color_purple + AccentColorType.BLUE -> Res.string.accent_color_blue + AccentColorType.GREEN -> Res.string.accent_color_green + AccentColorType.ORANGE -> Res.string.accent_color_orange + AccentColorType.RED -> Res.string.accent_color_red + AccentColorType.PINK -> Res.string.accent_color_pink + } + +val FontFamilyType.resourceId: StringResource + get() = + when (this) { + FontFamilyType.SYSTEM -> Res.string.font_family_system + FontFamilyType.SANS_SERIF -> Res.string.font_family_sans_serif + FontFamilyType.SERIF -> Res.string.font_family_serif + FontFamilyType.MONOSPACE -> Res.string.font_family_monospace + } + +val FontSizeType.resourceId: StringResource + get() = + when (this) { + FontSizeType.SMALL -> Res.string.font_size_small + FontSizeType.NORMAL -> Res.string.font_size_normal + FontSizeType.LARGE -> Res.string.font_size_large + FontSizeType.HUGE -> Res.string.font_size_huge + } + +val ConnectivityType.resourceId: StringResource + get() = + when (this) { + ConnectivityType.ALWAYS -> Res.string.connectivity_type_always + ConnectivityType.WIFI_ONLY -> Res.string.connectivity_type_unmetered_wifi_only + ConnectivityType.NEVER -> Res.string.connectivity_type_never + } + +val FeatureSetType.resourceId: StringResource + get() = + when (this) { + FeatureSetType.COMPLETE -> Res.string.ui_feature_set_type_complete + FeatureSetType.SIMPLIFIED -> Res.string.ui_feature_set_type_simplified + FeatureSetType.PERFORMANCE -> Res.string.ui_feature_set_type_performance + } + +val ProfileGalleryType.resourceId: StringResource + get() = + when (this) { + ProfileGalleryType.CLASSIC -> Res.string.gallery_type_classic + ProfileGalleryType.MODERN -> Res.string.gallery_type_modern + } + +val WarningType.resourceId: StringResource + get() = + when (this) { + WarningType.WARN -> Res.string.content_warning_see_warnings_option + WarningType.SHOW -> Res.string.content_warning_show_all_sensitive_content_option + WarningType.HIDE -> Res.string.content_warning_hide_all_sensitive_content_option + } diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt index ef3ffd4222..d70342d600 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt @@ -22,14 +22,15 @@ package com.vitorpamplona.amethyst.commons.ui.screen import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable +import androidx.compose.runtime.compositionLocalOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember -import androidx.compose.runtime.staticCompositionLocalOf import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.model.FeatureSetType +import com.vitorpamplona.amethyst.commons.state.UiSettingsState /** - * The display choices composables read on almost every card, resolved once near the composition + * The display choices avatars read on almost every card, resolved once near the composition * root and handed down through [LocalDisplaySettings], so shared composables do not need the * account's ViewModel to follow them. * @@ -44,15 +45,14 @@ data class DisplaySettings( val performanceMode: Boolean = false, /** Play videos and animated images (GIF/AVIF avatars) without a tap. */ val autoPlayVideos: Boolean = true, - val showUrlPreview: Boolean = true, - val showImages: Boolean = true, - val startVideoPlayback: Boolean = true, ) { /** Robohash fallbacks are skipped in performance mode (a plain face icon instead). */ val loadRobohash: Boolean get() = !performanceMode } -val LocalDisplaySettings = staticCompositionLocalOf { DisplaySettings() } +// Not static: showProfilePictures follows the connection type (Wi-Fi only), so this changes when the +// network does, and only its readers should recompose, not everything under the theme. +val LocalDisplaySettings = compositionLocalOf { DisplaySettings() } /** Collects [settings] into a [DisplaySettings] that follows every change to it. */ @Composable @@ -60,18 +60,12 @@ fun collectDisplaySettings(settings: UiSettingsState): DisplaySettings { val showProfilePictures by settings.showProfilePictures.collectAsStateWithLifecycle() val featureSet by settings.uiSettingsFlow.featureSet.collectAsStateWithLifecycle() val autoPlayVideos by settings.autoPlayVideosFlow.collectAsStateWithLifecycle() - val showUrlPreview by settings.showUrlPreview.collectAsStateWithLifecycle() - val showImages by settings.showImages.collectAsStateWithLifecycle() - val startVideoPlayback by settings.startVideoPlayback.collectAsStateWithLifecycle() - return remember(showProfilePictures, featureSet, autoPlayVideos, showUrlPreview, showImages, startVideoPlayback) { + return remember(showProfilePictures, featureSet, autoPlayVideos) { DisplaySettings( showProfilePictures = showProfilePictures, performanceMode = featureSet == FeatureSetType.PERFORMANCE, autoPlayVideos = autoPlayVideos, - showUrlPreview = showUrlPreview, - showImages = showImages, - startVideoPlayback = startVideoPlayback, ) } } diff --git a/tools/r8-verify/reflection-contract.txt b/tools/r8-verify/reflection-contract.txt index 4d04998fb8..c84b522f9e 100644 --- a/tools/r8-verify/reflection-contract.txt +++ b/tools/r8-verify/reflection-contract.txt @@ -140,14 +140,14 @@ enum com.vitorpamplona.amethyst.commons.tor.TorType INTERNAL # is exactly why it would never be noticed. enum com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcErrorCode RATE_LIMITED NOT_IMPLEMENTED INSUFFICIENT_BALANCE PAYMENT_FAILED QUOTA_EXCEEDED RESTRICTED UNAUTHORIZED INTERNAL UNSUPPORTED_ENCRYPTION BAD_REQUEST NOT_FOUND EXPIRED UNSUPPORTED_PAYMENT_INSTRUCTION UNSUPPORTED_NETWORK OTHER -enum com.vitorpamplona.amethyst.model.ThemeType SYSTEM LIGHT DARK -enum com.vitorpamplona.amethyst.model.BooleanType ALWAYS NEVER -enum com.vitorpamplona.amethyst.model.ConnectivityType ALWAYS NEVER -enum com.vitorpamplona.amethyst.model.FeatureSetType SIMPLIFIED -enum com.vitorpamplona.amethyst.model.FontFamilyType SYSTEM -enum com.vitorpamplona.amethyst.model.FontSizeType NORMAL -enum com.vitorpamplona.amethyst.model.AccentColorType PURPLE -enum com.vitorpamplona.amethyst.model.ProfileGalleryType CLASSIC +enum com.vitorpamplona.amethyst.commons.model.ThemeType SYSTEM LIGHT DARK +enum com.vitorpamplona.amethyst.commons.model.BooleanType ALWAYS NEVER +enum com.vitorpamplona.amethyst.commons.model.ConnectivityType ALWAYS NEVER +enum com.vitorpamplona.amethyst.commons.model.FeatureSetType SIMPLIFIED +enum com.vitorpamplona.amethyst.commons.model.FontFamilyType SYSTEM +enum com.vitorpamplona.amethyst.commons.model.FontSizeType NORMAL +enum com.vitorpamplona.amethyst.commons.model.AccentColorType PURPLE +enum com.vitorpamplona.amethyst.commons.model.ProfileGalleryType CLASSIC enum com.vitorpamplona.quartz.nip05DnsIdentifiers.namecoin.NamecoinBackend enum com.vitorpamplona.quartz.nipACWebRtcCalls.tags.CallType enum com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.concord.ChannelExpand