From 1f1b6dab807622f245a473e2a5899ba737f19064 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 24 Sep 2026 15:23:59 +0000 Subject: [PATCH 1/2] refactor: share the UI settings and toasts, add LocalDisplaySettings, call LocalCache directly First steps of shrinking AccountViewModel (see the plan in the PR): - UiSettings (the settings enums), UiSettingsFlow and UiSettingsState move to commonsUI (they carry Compose StringResource labels, so not the headless commons). The app's global uiState is unchanged. - New LocalDisplaySettings (showProfilePictures, performance mode, autoPlayVideos, showUrlPreview, showImages, startVideoPlayback), collected from UiSettingsState by collectDisplaySettings() and provided by AmethystTheme, which also derives LocalAnimationsEnabled from it. UserAvatar's loadProfilePicture / loadRobohash / autoPlayGif default to it, so InnerUserPicture no longer reads them from the AccountViewModel and drops that parameter. - ToastManager and the toast message types move to commonsUI. The dialogs that render them stay in the app. - 128 accountViewModel.getNoteIfExists / checkGetOrCreate* / channel lookups in 59 files call LocalCache directly; the 13 AccountViewModel wrappers left without callers are deleted. - Baseline profile entries follow the moved classes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0168wY9t7i9NC5u3svyMxEz6 --- .../components/SelectNotificationProvider.kt | 2 +- .../baselineProfiles/baseline-prof.txt | 422 +++++++++--------- .../com/vitorpamplona/amethyst/AppModules.kt | 4 +- .../amethyst/LocalPreferences.kt | 2 +- .../amethyst/favorites/FavoriteAppLauncher.kt | 2 +- .../model/preferences/UISharedPreferences.kt | 20 +- .../amethyst/napplet/NappletLauncher.kt | 2 +- .../compose/RelayAuthComposeHelpers.kt | 5 +- .../compose/RelayAuthPromptHost.kt | 12 +- .../reqCommand/channel/ChannelObservers.kt | 3 +- .../amethyst/ui/actions/InformationDialog.kt | 4 +- .../ui/broadcast/DisplayBroadcastProgress.kt | 2 +- .../amethyst/ui/components/ClickableRoute.kt | 11 +- .../ui/components/ReusableZapButton.kt | 2 +- .../amethyst/ui/components/RichTextViewer.kt | 4 +- .../components/toasts/DisplayErrorMessages.kt | 13 +- .../components/toasts/multiline/ErrorList.kt | 2 + .../multiline/MultiUserErrorMessageDialog.kt | 1 + .../vitorpamplona/amethyst/ui/note/Loaders.kt | 17 +- .../amethyst/ui/note/ReactionsRow.kt | 2 +- .../amethyst/ui/note/UserProfilePicture.kt | 15 - .../amethyst/ui/note/ZapCustomDialog.kt | 2 +- .../amethyst/ui/note/ZapPollNote.kt | 2 +- .../note/elements/NoteHeaderMarkersPreview.kt | 2 +- .../nip22Comments/CommentPostViewModel.kt | 2 +- .../nip22Comments/GenericCommentPostScreen.kt | 7 +- .../amethyst/ui/note/types/Badge.kt | 4 +- .../amethyst/ui/note/types/Highlight.kt | 13 +- .../ui/note/types/RememberCaptionTracks.kt | 3 +- .../amethyst/ui/note/types/SoftwareApp.kt | 4 +- .../ui/note/types/TextModification.kt | 3 +- .../ui/screen/loggedIn/AccountViewModel.kt | 36 +- .../backups/BackupConflictEventViews.kt | 4 +- .../backups/BackupConflictListViews.kt | 3 +- .../badges/profile/ProfileBadgesScreen.kt | 4 +- .../loggedIn/chats/feed/DrawAuthorInfo.kt | 1 - .../feed/types/RenderBuzzSystemMessage.kt | 5 +- .../chats/geohashChat/LoadGeohashChannel.kt | 5 +- .../chats/marmotGroup/MarmotGroupChatView.kt | 3 +- .../marmotGroup/MarmotGroupListScreen.kt | 3 +- .../marmotGroup/MarmotSystemRowRenderer.kt | 3 +- .../loggedIn/chats/privateDM/ChatroomView.kt | 5 +- .../privateDM/send/ChatNewMessageViewModel.kt | 4 +- .../concord/ConcordChannelListScreen.kt | 2 +- .../concord/ConcordChannelScreen.kt | 2 +- .../concord/ConcordMembersScreen.kt | 3 +- .../ephemChat/EphemeralChatScreen.kt | 5 +- .../ephemChat/LoadEphemeralChatChannel.kt | 5 +- .../PublicChatChannelScreen.kt | 5 +- .../LiveActivityChannelScreen.kt | 5 +- .../header/LiveStreamTopZappers.kt | 5 +- .../relayGroup/BuzzTypingIndicator.kt | 3 +- .../relayGroup/LoadRelayGroupChannel.kt | 5 +- .../relayGroup/RelayGroupChannelListScreen.kt | 4 +- .../relayGroup/RelayGroupChatScreen.kt | 5 +- .../relayGroup/RelayGroupMembersScreen.kt | 3 +- .../relayGroup/RelayGroupParentPicker.kt | 8 +- .../relayGroup/RelayGroupPinnedBar.kt | 3 +- .../send/ChannelNewMessageViewModel.kt | 2 +- .../chats/rooms/ChatroomHeaderCompose.kt | 4 +- .../screen/loggedIn/chess/ChessGameScreen.kt | 5 +- .../screen/loggedIn/chess/ChessLobbyScreen.kt | 13 +- .../contactList/ContactListUsersScreen.kt | 3 +- .../nip23LongForm/LongFormPostScreen.kt | 5 +- .../nip99Classifieds/NewProductScreen.kt | 5 +- .../loggedIn/dvms/DvmHeartbeatObservation.kt | 5 +- .../loggedIn/embed/EmbeddedTabFactory.kt | 2 +- .../loggedIn/embed/EmbeddedTabThemeWatcher.kt | 2 +- .../loggedIn/geohash/GeoHashPostScreen.kt | 7 +- .../loggedIn/hashtag/HashtagPostScreen.kt | 7 +- .../highlights/NewHighlightPostViewModel.kt | 5 +- .../loggedIn/home/ShortNotePostScreen.kt | 13 +- .../loggedIn/home/ShortNotePostViewModel.kt | 4 +- .../loggedIn/home/VoiceReplyViewModel.kt | 3 +- .../room/chat/NestNewMessageViewModel.kt | 2 +- .../ParticipantHostActionsSheet.kt | 2 +- .../nests/room/screen/NestActionBar.kt | 2 +- .../ImportFollowListPickFollowsScreen.kt | 5 +- .../notifications/NotificationScreen.kt | 2 +- .../publicMessages/NewPublicMessageScreen.kt | 5 +- .../loggedIn/podcasts/PodcastAuthors.kt | 4 +- .../screen/loggedIn/polls/PollPostScreen.kt | 3 +- .../profile/header/badges/DisplayBadges.kt | 4 +- .../loggedIn/settings/AppSettingsScreen.kt | 16 +- .../settings/ComposeSettingsScreen.kt | 4 +- .../settings/HomeTabsSettingsScreen.kt | 2 +- .../settings/ProfileUiSettingsScreen.kt | 4 +- .../settings/SecurityFiltersScreen.kt | 4 +- .../ui/screen/loggedIn/url/UrlPostScreen.kt | 7 +- .../suggestion/DetectedWorkoutCarousel.kt | 2 +- .../vitorpamplona/amethyst/ui/theme/Theme.kt | 21 +- .../components/SelectNotificationProvider.kt | 2 +- .../amethyst/commons}/model/UiSettings.kt | 2 +- .../amethyst/commons}/model/UiSettingsFlow.kt | 2 +- .../commons/ui/components/UserAvatar.kt | 10 +- .../ui/components/toasts/ResourceToastMsg.kt | 2 +- .../ui/components/toasts/StringToastMsg.kt | 2 +- .../ui/components/toasts/ThrowableToastMsg.kt | 2 +- .../ui/components/toasts/ToastManager.kt | 6 +- .../commons}/ui/components/toasts/ToastMsg.kt | 2 +- .../toasts/multiline/MultiErrorToastMsg.kt | 4 +- .../commons/ui/screen/DisplaySettings.kt | 77 ++++ .../commons}/ui/screen/UiSettingsState.kt | 12 +- 103 files changed, 556 insertions(+), 469 deletions(-) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/model/UiSettings.kt (99%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/model/UiSettingsFlow.kt (99%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/ResourceToastMsg.kt (95%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/StringToastMsg.kt (95%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/ThrowableToastMsg.kt (95%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/ToastManager.kt (92%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/ToastMsg.kt (94%) rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/components/toasts/multiline/MultiErrorToastMsg.kt (92%) create mode 100644 commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt rename {amethyst/src/main/java/com/vitorpamplona/amethyst => commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons}/ui/screen/UiSettingsState.kt (94%) diff --git a/amethyst/src/fdroid/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt b/amethyst/src/fdroid/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt index 78a6fcd112..114e9c5ee7 100644 --- a/amethyst/src/fdroid/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt +++ b/amethyst/src/fdroid/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt @@ -56,6 +56,7 @@ import com.halilibo.richtext.ui.material3.RichText import com.halilibo.richtext.ui.resolveDefaults import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.error_dialog_button_ok import com.vitorpamplona.amethyst.commons.resources.push_server_explainer @@ -71,7 +72,6 @@ import com.vitorpamplona.amethyst.commons.ui.components.SpinnerSelectionDialog import com.vitorpamplona.amethyst.commons.ui.components.TextSpinner import com.vitorpamplona.amethyst.commons.ui.components.TitleExplainer import com.vitorpamplona.amethyst.commons.ui.stringRes -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.service.notifications.PushDistributorHandler import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SettingsBlockTile import com.vitorpamplona.quartz.utils.Log diff --git a/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt b/amethyst/src/main/generated/baselineProfiles/baseline-prof.txt index 751cfbc406..a795224598 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/ui/screen/UiSettingsState; +SPLcom/vitorpamplona/amethyst/AppModules;->getUiState()Lcom/vitorpamplona/amethyst/commons/ui/screen/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/ui/screen/UiSettingsState; +SPLcom/vitorpamplona/amethyst/AppModules;->uiState_delegate$lambda$0(Lcom/vitorpamplona/amethyst/AppModules;)Lcom/vitorpamplona/amethyst/commons/ui/screen/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 @@ -23107,12 +23107,12 @@ Lcom/vitorpamplona/amethyst/favorites/FavoriteAppsRegistryKt; SPLcom/vitorpamplona/amethyst/favorites/FavoriteAppsRegistryKt;->()V SPLcom/vitorpamplona/amethyst/favorites/FavoriteAppsRegistryKt;->access$getFavoriteAppsDataStore(Landroid/content/Context;)Landroidx/datastore/core/DataStore; SPLcom/vitorpamplona/amethyst/favorites/FavoriteAppsRegistryKt;->getFavoriteAppsDataStore(Landroid/content/Context;)Landroidx/datastore/core/DataStore; -Lcom/vitorpamplona/amethyst/model/AccentColorType; -SPLcom/vitorpamplona/amethyst/model/AccentColorType;->$values()[Lcom/vitorpamplona/amethyst/model/AccentColorType; -SPLcom/vitorpamplona/amethyst/model/AccentColorType;->()V -SPLcom/vitorpamplona/amethyst/model/AccentColorType;->(Ljava/lang/String;III)V -SPLcom/vitorpamplona/amethyst/model/AccentColorType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/AccentColorType; -SPLcom/vitorpamplona/amethyst/model/AccentColorType;->values()[Lcom/vitorpamplona/amethyst/model/AccentColorType; +Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; +SPLcom/vitorpamplona/amethyst/commons/model/AccentColorType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; +SPLcom/vitorpamplona/amethyst/commons/model/AccentColorType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/AccentColorType;->(Ljava/lang/String;III)V +SPLcom/vitorpamplona/amethyst/commons/model/AccentColorType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; +SPLcom/vitorpamplona/amethyst/commons/model/AccentColorType;->values()[Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; Lcom/vitorpamplona/amethyst/model/Account; Lcom/vitorpamplona/amethyst/model/AccountSettings; Lcom/vitorpamplona/amethyst/model/AntiSpamFilter; @@ -23121,44 +23121,44 @@ SPLcom/vitorpamplona/amethyst/model/AntiSpamFilter;->()V Lcom/vitorpamplona/amethyst/model/AntiSpamState; SPLcom/vitorpamplona/amethyst/model/AntiSpamState;->()V SPLcom/vitorpamplona/amethyst/model/AntiSpamState;->(Lcom/vitorpamplona/amethyst/model/AntiSpamFilter;)V -Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/BooleanType;->$values()[Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/BooleanType;->()V -SPLcom/vitorpamplona/amethyst/model/BooleanType;->(Ljava/lang/String;ILjava/lang/Boolean;II)V -SPLcom/vitorpamplona/amethyst/model/BooleanType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/BooleanType;->values()[Lcom/vitorpamplona/amethyst/model/BooleanType; +Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/BooleanType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/BooleanType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/BooleanType;->(Ljava/lang/String;ILjava/lang/Boolean;II)V +SPLcom/vitorpamplona/amethyst/commons/model/BooleanType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/BooleanType;->values()[Lcom/vitorpamplona/amethyst/commons/model/BooleanType; Lcom/vitorpamplona/amethyst/model/CachePruner; SPLcom/vitorpamplona/amethyst/model/CachePruner;->()V SPLcom/vitorpamplona/amethyst/model/CachePruner;->(Lcom/vitorpamplona/amethyst/model/LocalCache;)V Lcom/vitorpamplona/amethyst/model/CacheSearch; SPLcom/vitorpamplona/amethyst/model/CacheSearch;->()V SPLcom/vitorpamplona/amethyst/model/CacheSearch;->(Lcom/vitorpamplona/amethyst/model/LocalCache;)V -Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/ConnectivityType;->$values()[Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/ConnectivityType;->()V -SPLcom/vitorpamplona/amethyst/model/ConnectivityType;->(Ljava/lang/String;ILjava/lang/Boolean;II)V -SPLcom/vitorpamplona/amethyst/model/ConnectivityType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/ConnectivityType;->values()[Lcom/vitorpamplona/amethyst/model/ConnectivityType; +Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/ConnectivityType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/ConnectivityType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/ConnectivityType;->(Ljava/lang/String;ILjava/lang/Boolean;II)V +SPLcom/vitorpamplona/amethyst/commons/model/ConnectivityType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/ConnectivityType;->values()[Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; Lcom/vitorpamplona/amethyst/model/Dao; -Lcom/vitorpamplona/amethyst/model/FeatureSetType; -SPLcom/vitorpamplona/amethyst/model/FeatureSetType;->$values()[Lcom/vitorpamplona/amethyst/model/FeatureSetType; -SPLcom/vitorpamplona/amethyst/model/FeatureSetType;->()V -SPLcom/vitorpamplona/amethyst/model/FeatureSetType;->(Ljava/lang/String;III)V -SPLcom/vitorpamplona/amethyst/model/FeatureSetType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/FeatureSetType; -SPLcom/vitorpamplona/amethyst/model/FeatureSetType;->values()[Lcom/vitorpamplona/amethyst/model/FeatureSetType; -Lcom/vitorpamplona/amethyst/model/FontFamilyType; -SPLcom/vitorpamplona/amethyst/model/FontFamilyType;->$values()[Lcom/vitorpamplona/amethyst/model/FontFamilyType; -SPLcom/vitorpamplona/amethyst/model/FontFamilyType;->()V -SPLcom/vitorpamplona/amethyst/model/FontFamilyType;->(Ljava/lang/String;III)V -SPLcom/vitorpamplona/amethyst/model/FontFamilyType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/FontFamilyType; -SPLcom/vitorpamplona/amethyst/model/FontFamilyType;->values()[Lcom/vitorpamplona/amethyst/model/FontFamilyType; -Lcom/vitorpamplona/amethyst/model/FontSizeType; -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->$values()[Lcom/vitorpamplona/amethyst/model/FontSizeType; -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->()V -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->(Ljava/lang/String;IFII)V -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->getScale()F -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/FontSizeType; -SPLcom/vitorpamplona/amethyst/model/FontSizeType;->values()[Lcom/vitorpamplona/amethyst/model/FontSizeType; +Lcom/vitorpamplona/amethyst/commons/model/FeatureSetType; +SPLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/FeatureSetType; +SPLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;->(Ljava/lang/String;III)V +SPLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/FeatureSetType; +SPLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;->values()[Lcom/vitorpamplona/amethyst/commons/model/FeatureSetType; +Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +SPLcom/vitorpamplona/amethyst/commons/model/FontFamilyType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +SPLcom/vitorpamplona/amethyst/commons/model/FontFamilyType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/FontFamilyType;->(Ljava/lang/String;III)V +SPLcom/vitorpamplona/amethyst/commons/model/FontFamilyType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +SPLcom/vitorpamplona/amethyst/commons/model/FontFamilyType;->values()[Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->(Ljava/lang/String;IFII)V +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->getScale()F +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; +SPLcom/vitorpamplona/amethyst/commons/model/FontSizeType;->values()[Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; Lcom/vitorpamplona/amethyst/model/ILocalCache; Lcom/vitorpamplona/amethyst/model/LocalCache; SPLcom/vitorpamplona/amethyst/model/LocalCache;->()V @@ -23187,119 +23187,119 @@ Lcom/vitorpamplona/amethyst/model/LocalCacheFlow; SPLcom/vitorpamplona/amethyst/model/LocalCacheFlow;->()V SPLcom/vitorpamplona/amethyst/model/LocalCacheFlow;->()V SPLcom/vitorpamplona/amethyst/model/LocalCacheFlow;->getNewEventBundles()Lkotlinx/coroutines/flow/SharedFlow; -Lcom/vitorpamplona/amethyst/model/ProfileGalleryType; -SPLcom/vitorpamplona/amethyst/model/ProfileGalleryType;->$values()[Lcom/vitorpamplona/amethyst/model/ProfileGalleryType; -SPLcom/vitorpamplona/amethyst/model/ProfileGalleryType;->()V -SPLcom/vitorpamplona/amethyst/model/ProfileGalleryType;->(Ljava/lang/String;III)V -SPLcom/vitorpamplona/amethyst/model/ProfileGalleryType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/ProfileGalleryType; -SPLcom/vitorpamplona/amethyst/model/ProfileGalleryType;->values()[Lcom/vitorpamplona/amethyst/model/ProfileGalleryType; -Lcom/vitorpamplona/amethyst/model/ThemeType; -SPLcom/vitorpamplona/amethyst/model/ThemeType;->$values()[Lcom/vitorpamplona/amethyst/model/ThemeType; -SPLcom/vitorpamplona/amethyst/model/ThemeType;->()V -SPLcom/vitorpamplona/amethyst/model/ThemeType;->(Ljava/lang/String;III)V -SPLcom/vitorpamplona/amethyst/model/ThemeType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/model/ThemeType; -SPLcom/vitorpamplona/amethyst/model/ThemeType;->values()[Lcom/vitorpamplona/amethyst/model/ThemeType; -Lcom/vitorpamplona/amethyst/model/UiSettings; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->()V -SPLcom/vitorpamplona/amethyst/model/UiSettings;->(Lcom/vitorpamplona/amethyst/model/ThemeType;Ljava/lang/String;Lcom/vitorpamplona/amethyst/model/ConnectivityType;Lcom/vitorpamplona/amethyst/model/ConnectivityType;Lcom/vitorpamplona/amethyst/model/BooleanType;Lcom/vitorpamplona/amethyst/model/ConnectivityType;Lcom/vitorpamplona/amethyst/model/BooleanType;Lcom/vitorpamplona/amethyst/model/ConnectivityType;ZZLcom/vitorpamplona/amethyst/model/FeatureSetType;Lcom/vitorpamplona/amethyst/model/ProfileGalleryType;Lcom/vitorpamplona/amethyst/model/BooleanType;Lcom/vitorpamplona/amethyst/model/BooleanType;Lcom/vitorpamplona/amethyst/model/BooleanType;ZZZZZZZZLcom/vitorpamplona/amethyst/model/BooleanType;Lcom/vitorpamplona/amethyst/model/AccentColorType;Lcom/vitorpamplona/amethyst/model/FontFamilyType;Lcom/vitorpamplona/amethyst/model/FontSizeType;Ljava/lang/String;Z)V -SPLcom/vitorpamplona/amethyst/model/UiSettings;->equals(Ljava/lang/Object;)Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAccentColor()Lcom/vitorpamplona/amethyst/model/AccentColorType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyCreateDrafts()Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyHideNavigationBars()Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyPlayVideos()Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyProposeAiImprovements()Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyShowImages()Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyShowProfilePictures()Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyShowUrlPreview()Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getAutomaticallyStartPlayback()Lcom/vitorpamplona/amethyst/model/ConnectivityType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getComposeSignature()Ljava/lang/String; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getDontAskForNotificationPermissions()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getDontShowOnchainPublicWarning()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getDontShowPushNotificationSelector()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getFeatureSet()Lcom/vitorpamplona/amethyst/model/FeatureSetType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getFontFamily()Lcom/vitorpamplona/amethyst/model/FontFamilyType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getFontSize()Lcom/vitorpamplona/amethyst/model/FontSizeType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getGallerySet()Lcom/vitorpamplona/amethyst/model/ProfileGalleryType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getPreferredLanguage()Ljava/lang/String; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowHomeConversationsTab()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowHomeEverythingTab()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowHomeNewThreadsTab()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowOnchainWallet()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowProfileAppRecommendations()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowProfileBadges()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowProfileFollowersFeed()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getShowProfileZapReceivedFeed()Z -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getSuggestWorkoutsFromHealthConnect()Lcom/vitorpamplona/amethyst/model/BooleanType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getTheme()Lcom/vitorpamplona/amethyst/model/ThemeType; -SPLcom/vitorpamplona/amethyst/model/UiSettings;->getUseTrackedBroadcasts()Lcom/vitorpamplona/amethyst/model/BooleanType; -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda0; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda0;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda1; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda1;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda10; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda10;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda11; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda11;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda12; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda12;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda13; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda13;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda14; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda14;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda15; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda15;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda2; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda2;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda3; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda3;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda4; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda4;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda5; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda5;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda6; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda6;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda7; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda7;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda8; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda8;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda9; -SPLcom/vitorpamplona/amethyst/model/UiSettings$$ExternalSyntheticLambda9;->()V -Lcom/vitorpamplona/amethyst/model/UiSettings$Companion; -SPLcom/vitorpamplona/amethyst/model/UiSettings$Companion;->()V -SPLcom/vitorpamplona/amethyst/model/UiSettings$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->()V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->(Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;)V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAccentColor()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAutomaticallyPlayVideos()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAutomaticallyShowImages()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAutomaticallyShowProfilePictures()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAutomaticallyShowUrlPreview()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getAutomaticallyStartPlayback()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getFontFamily()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getFontSize()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getPreferredLanguage()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getPropertyWatchFlow()Lkotlinx/coroutines/flow/Flow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->getTheme()Lkotlinx/coroutines/flow/MutableStateFlow; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow;->toSettings()Lcom/vitorpamplona/amethyst/model/UiSettings; -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$Companion; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$Companion;->()V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$Companion;->build(Lcom/vitorpamplona/amethyst/model/UiSettings;)Lcom/vitorpamplona/amethyst/model/UiSettingsFlow; -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1;->([Lkotlinx/coroutines/flow/Flow;)V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1;->collect(Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$1; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$1;->(Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1;Lkotlin/coroutines/Continuation;)V -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$2; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$2;->([Lkotlinx/coroutines/flow/Flow;)V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$2;->invoke()Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$2;->invoke()[Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$3; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$3;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$3;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$3;->invoke(Lkotlinx/coroutines/flow/FlowCollector;[Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/model/UiSettingsFlow$special$$inlined$combine$1$3;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType; +SPLcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType; +SPLcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;->(Ljava/lang/String;III)V +SPLcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType; +SPLcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;->values()[Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType; +Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +SPLcom/vitorpamplona/amethyst/commons/model/ThemeType;->$values()[Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +SPLcom/vitorpamplona/amethyst/commons/model/ThemeType;->()V +SPLcom/vitorpamplona/amethyst/commons/model/ThemeType;->(Ljava/lang/String;III)V +SPLcom/vitorpamplona/amethyst/commons/model/ThemeType;->valueOf(Ljava/lang/String;)Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +SPLcom/vitorpamplona/amethyst/commons/model/ThemeType;->values()[Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +Lcom/vitorpamplona/amethyst/commons/model/UiSettings; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->()V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->(Lcom/vitorpamplona/amethyst/commons/model/ThemeType;Ljava/lang/String;Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;Lcom/vitorpamplona/amethyst/commons/model/BooleanType;Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;Lcom/vitorpamplona/amethyst/commons/model/BooleanType;Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType;ZZLcom/vitorpamplona/amethyst/commons/model/FeatureSetType;Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType;Lcom/vitorpamplona/amethyst/commons/model/BooleanType;Lcom/vitorpamplona/amethyst/commons/model/BooleanType;Lcom/vitorpamplona/amethyst/commons/model/BooleanType;ZZZZZZZZLcom/vitorpamplona/amethyst/commons/model/BooleanType;Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType;Lcom/vitorpamplona/amethyst/commons/model/FontSizeType;Ljava/lang/String;Z)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->equals(Ljava/lang/Object;)Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAccentColor()Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyCreateDrafts()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyHideNavigationBars()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyPlayVideos()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyProposeAiImprovements()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyShowImages()Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyShowProfilePictures()Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyShowUrlPreview()Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getAutomaticallyStartPlayback()Lcom/vitorpamplona/amethyst/commons/model/ConnectivityType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getComposeSignature()Ljava/lang/String; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getDontAskForNotificationPermissions()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getDontShowOnchainPublicWarning()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getDontShowPushNotificationSelector()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getFeatureSet()Lcom/vitorpamplona/amethyst/commons/model/FeatureSetType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getFontFamily()Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getFontSize()Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getGallerySet()Lcom/vitorpamplona/amethyst/commons/model/ProfileGalleryType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getPreferredLanguage()Ljava/lang/String; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowHomeConversationsTab()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowHomeEverythingTab()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowHomeNewThreadsTab()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowOnchainWallet()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowProfileAppRecommendations()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowProfileBadges()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowProfileFollowersFeed()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getShowProfileZapReceivedFeed()Z +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getSuggestWorkoutsFromHealthConnect()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getTheme()Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings;->getUseTrackedBroadcasts()Lcom/vitorpamplona/amethyst/commons/model/BooleanType; +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda0; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda0;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda1; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda1;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda10; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda10;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda11; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda11;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda12; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda12;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda13; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda13;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda14; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda14;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda15; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda15;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda2; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda2;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda3; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda3;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda4; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda4;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda5; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda5;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda6; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda6;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda7; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda7;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda8; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda8;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda9; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$$ExternalSyntheticLambda9;->()V +Lcom/vitorpamplona/amethyst/commons/model/UiSettings$Companion; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$Companion;->()V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettings$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->()V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->(Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;Lkotlinx/coroutines/flow/MutableStateFlow;)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAccentColor()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAutomaticallyPlayVideos()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAutomaticallyShowImages()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAutomaticallyShowProfilePictures()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAutomaticallyShowUrlPreview()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getAutomaticallyStartPlayback()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getFontFamily()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getFontSize()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getPreferredLanguage()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getPropertyWatchFlow()Lkotlinx/coroutines/flow/Flow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->getTheme()Lkotlinx/coroutines/flow/MutableStateFlow; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow;->toSettings()Lcom/vitorpamplona/amethyst/commons/model/UiSettings; +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$Companion; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$Companion;->()V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$Companion;->build(Lcom/vitorpamplona/amethyst/commons/model/UiSettings;)Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow; +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1;->([Lkotlinx/coroutines/flow/Flow;)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1;->collect(Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$1; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$1;->(Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1;Lkotlin/coroutines/Continuation;)V +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$2; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$2;->([Lkotlinx/coroutines/flow/Flow;)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$2;->invoke()Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$2;->invoke()[Ljava/lang/Object; +Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$3; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$3;->(Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$3;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$3;->invoke(Lkotlinx/coroutines/flow/FlowCollector;[Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow$special$$inlined$combine$1$3;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; Lcom/vitorpamplona/amethyst/model/accountsCache/AccountCacheState; SPLcom/vitorpamplona/amethyst/model/accountsCache/AccountCacheState;->()V SPLcom/vitorpamplona/amethyst/model/accountsCache/AccountCacheState;->(Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lcom/vitorpamplona/amethyst/model/LocalCache;Lcom/vitorpamplona/quartz/nip01Core/relay/client/INostrClient;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lcom/vitorpamplona/amethyst/commons/connectedApps/signers/NostrSignerPermissionStore;Lcom/vitorpamplona/amethyst/commons/connectedApps/nip46/Nip46ClientStore;)V @@ -23460,7 +23460,7 @@ SPLcom/vitorpamplona/amethyst/model/preferences/UISharedPreferencesKt;-> SPLcom/vitorpamplona/amethyst/model/preferences/UISharedPreferencesKt;->getSharedPreferencesDataStore(Landroid/content/Context;)Landroidx/datastore/core/DataStore; Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->()V -SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->(Lcom/vitorpamplona/amethyst/model/UiSettings;Landroid/content/Context;Lkotlinx/coroutines/CoroutineScope;)V +SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->(Lcom/vitorpamplona/amethyst/commons/model/UiSettings;Landroid/content/Context;Lkotlinx/coroutines/CoroutineScope;)V SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->access$applyLanguage(Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->access$getUI_ACCENT_COLOR$cp()Landroidx/datastore/preferences/core/Preferences$Key; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->access$getUI_AUTOMATICALLY_CREATE_DRAFTS$cp()Landroidx/datastore/preferences/core/Preferences$Key; @@ -23493,7 +23493,7 @@ SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->access$get SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->access$getUI_USE_TRACKED_BROADCASTS$cp()Landroidx/datastore/preferences/core/Preferences$Key; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->applyLanguage(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->getContext()Landroid/content/Context; -SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->getValue()Lcom/vitorpamplona/amethyst/model/UiSettingsFlow; +SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;->getValue()Lcom/vitorpamplona/amethyst/commons/model/UiSettingsFlow; Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->()V SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -23526,13 +23526,13 @@ SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;-> SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->getUI_SUGGEST_WORKOUTS_FROM_HEALTH_CONNECT()Landroidx/datastore/preferences/core/Preferences$Key; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->getUI_THEME()Landroidx/datastore/preferences/core/Preferences$Key; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->getUI_USE_TRACKED_BROADCASTS()Landroidx/datastore/preferences/core/Preferences$Key; -SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->save(Lcom/vitorpamplona/amethyst/model/UiSettings;Landroid/content/Context;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->save(Lcom/vitorpamplona/amethyst/commons/model/UiSettings;Landroid/content/Context;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;->uiPreferences(Landroid/content/Context;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$1; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$1;->(Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion;Lkotlin/coroutines/Continuation;)V SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2; -SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2;->(Lcom/vitorpamplona/amethyst/model/UiSettings;Lkotlin/coroutines/Continuation;)V +SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2;->(Lcom/vitorpamplona/amethyst/commons/model/UiSettings;Lkotlin/coroutines/Continuation;)V SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2;->invoke(Landroidx/datastore/preferences/core/MutablePreferences;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$Companion$save$2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -23549,7 +23549,7 @@ SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$languageUpda Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->(Lcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences;Lkotlin/coroutines/Continuation;)V SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation; -SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->invoke(Lcom/vitorpamplona/amethyst/model/UiSettings;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->invoke(Lcom/vitorpamplona/amethyst/commons/model/UiSettings;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; SPLcom/vitorpamplona/amethyst/model/preferences/UiSharedPreferences$saving$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; Lcom/vitorpamplona/amethyst/model/privacyOptions/IRoleBasedHttpClientBuilder; @@ -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/ui/screen/UiSettingsState; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState;->()V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState;->(Lcom/vitorpamplona/amethyst/model/UiSettingsFlow;Lkotlinx/coroutines/flow/StateFlow;Lkotlinx/coroutines/CoroutineScope;)V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$WhenMappings; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1;->invoke(Lcom/vitorpamplona/amethyst/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showImages$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1;->invoke(Lcom/vitorpamplona/amethyst/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showProfilePictures$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1;->invoke(Lcom/vitorpamplona/amethyst/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$showUrlPreview$1$WhenMappings;->()V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1;->(Lkotlinx/coroutines/flow/Flow;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1;->collect(Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$1;->(Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1;Lkotlin/coroutines/Continuation;)V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2;->(Lkotlinx/coroutines/flow/FlowCollector;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2;->emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2$1;->(Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$special$$inlined$map$1$2;Lkotlin/coroutines/Continuation;)V -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1;->(Lkotlin/coroutines/Continuation;)V -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1;->invoke(Lcom/vitorpamplona/amethyst/model/ConnectivityType;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1$WhenMappings; -SPLcom/vitorpamplona/amethyst/ui/screen/UiSettingsState$startVideoPlayback$1$WhenMappings;->()V +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/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 @@ -25638,23 +25638,23 @@ Lcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->$r8$lambda$7JAdMf4levt4F3mr6nvsppu__xY(Landroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->$r8$lambda$GsT95FSXMVwriWjqAt3KW-oAPpo(Landroid/view/View;ZLandroidx/compose/material3/ColorScheme;)Lkotlin/Unit; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->()V -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$0(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/model/ThemeType; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$1(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/model/AccentColorType; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$0(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/commons/model/ThemeType; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$1(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/commons/model/AccentColorType; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$10$0(Landroid/view/View;ZLandroidx/compose/material3/ColorScheme;)Lkotlin/Unit; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$2(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/model/FontFamilyType; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$3(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/model/FontSizeType; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$2(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$3(Landroidx/compose/runtime/State;)Lcom/vitorpamplona/amethyst/commons/model/FontSizeType; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$9$0(Landroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme$lambda$9(Landroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme(Lcom/vitorpamplona/amethyst/model/ThemeType;Lcom/vitorpamplona/amethyst/model/AccentColorType;Lcom/vitorpamplona/amethyst/model/FontFamilyType;Lcom/vitorpamplona/amethyst/model/FontSizeType;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme(Lcom/vitorpamplona/amethyst/commons/model/ThemeType;Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType;Lcom/vitorpamplona/amethyst/commons/model/FontSizeType;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->AmethystTheme(Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->accentContainer-DxMtmZc(JZ)J -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->accentPrimary(Lcom/vitorpamplona/amethyst/model/AccentColorType;Z)J -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->accentSecondary(Lcom/vitorpamplona/amethyst/model/AccentColorType;Z)J -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->darkColors(Lcom/vitorpamplona/amethyst/model/AccentColorType;)Landroidx/compose/material3/ColorScheme; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->accentPrimary(Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;Z)J +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->accentSecondary(Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;Z)J +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->darkColors(Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;)Landroidx/compose/material3/ColorScheme; SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->getPlaceholderText(Landroidx/compose/material3/ColorScheme;)J SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->getTransparentBackground(Landroidx/compose/material3/ColorScheme;)J SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->isLight(Landroidx/compose/material3/ColorScheme;)Z -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->lightColors(Lcom/vitorpamplona/amethyst/model/AccentColorType;)Landroidx/compose/material3/ColorScheme; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->lightColors(Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;)Landroidx/compose/material3/ColorScheme; SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->onAccent-8_81llA(J)J SPLcom/vitorpamplona/amethyst/commons/ui/theme/AmethystColorSchemeKt;->onAccentContainer-DxMtmZc(JZ)J Lcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda0; @@ -25669,7 +25669,7 @@ Lcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda3; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda3;->(Landroid/view/View;ZLandroidx/compose/material3/ColorScheme;)V SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda3;->invoke()Ljava/lang/Object; Lcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda4; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda4;->(Lcom/vitorpamplona/amethyst/model/ThemeType;Lcom/vitorpamplona/amethyst/model/AccentColorType;Lcom/vitorpamplona/amethyst/model/FontFamilyType;Lcom/vitorpamplona/amethyst/model/FontSizeType;Lkotlin/jvm/functions/Function2;II)V +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$$ExternalSyntheticLambda4;->(Lcom/vitorpamplona/amethyst/commons/model/ThemeType;Lcom/vitorpamplona/amethyst/commons/model/AccentColorType;Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType;Lcom/vitorpamplona/amethyst/commons/model/FontSizeType;Lkotlin/jvm/functions/Function2;II)V Lcom/vitorpamplona/amethyst/ui/theme/ThemeKt$MarkDownStyleOnDark$1; SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$MarkDownStyleOnDark$1;->()V SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt$MarkDownStyleOnDark$1;->()V @@ -25685,7 +25685,7 @@ SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt;->getDefaultParagraphSpaci SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt;->getFont14SP()J SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt;->getFont17SP()J SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt;->getTypography()Landroidx/compose/material3/Typography; -SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->toFontFamily(Lcom/vitorpamplona/amethyst/model/FontFamilyType;)Landroidx/compose/ui/text/font/FontFamily; +SPLcom/vitorpamplona/amethyst/ui/theme/ThemeKt;->toFontFamily(Lcom/vitorpamplona/amethyst/commons/model/FontFamilyType;)Landroidx/compose/ui/text/font/FontFamily; SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt;->withFontFamily(Landroidx/compose/material3/Typography;Landroidx/compose/ui/text/font/FontFamily;)Landroidx/compose/material3/Typography; Lcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt$$ExternalSyntheticLambda0; SPLcom/vitorpamplona/amethyst/commons/ui/theme/TypeKt$$ExternalSyntheticLambda0;->()V diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt index 00a7fba7f3..23a19447e3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt @@ -28,6 +28,7 @@ import androidx.security.crypto.EncryptedSharedPreferences import coil3.disk.DiskCache import coil3.memory.MemoryCache import com.vitorpamplona.amethyst.commons.model.NoteState +import com.vitorpamplona.amethyst.commons.model.UiSettings import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip03Timestamp.BitcoinExplorerEndpoint import com.vitorpamplona.amethyst.commons.model.nip03Timestamp.IncomingOtsEventVerifier @@ -56,10 +57,10 @@ import com.vitorpamplona.amethyst.commons.service.lnurl.OkHttpLnurlEndpointResol import com.vitorpamplona.amethyst.commons.service.pow.PoWPolicy import com.vitorpamplona.amethyst.commons.service.pow.PoWPublishQueue 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 -import com.vitorpamplona.amethyst.model.UiSettings import com.vitorpamplona.amethyst.model.accountsCache.AccountCacheState import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever import com.vitorpamplona.amethyst.model.preferences.BuzzAttestationPreferences @@ -132,7 +133,6 @@ import com.vitorpamplona.amethyst.service.uploads.nip95.Nip95CacheFactory import com.vitorpamplona.amethyst.ui.resourceCacheInit import com.vitorpamplona.amethyst.ui.screen.AccountSessionManager import com.vitorpamplona.amethyst.ui.screen.AccountState -import com.vitorpamplona.amethyst.ui.screen.UiSettingsState import com.vitorpamplona.amethyst.ui.tor.TorManager import com.vitorpamplona.amethyst.ui.tor.TorService import com.vitorpamplona.quartz.nip01Core.core.Address diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt index a76ebb2365..a0acb8bad9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt @@ -26,6 +26,7 @@ import android.content.SharedPreferences import androidx.compose.runtime.Immutable import androidx.core.content.edit import com.vitorpamplona.amethyst.commons.model.HomeFeedType +import com.vitorpamplona.amethyst.commons.model.UiSettings import com.vitorpamplona.amethyst.commons.model.chats.ChatFeedType import com.vitorpamplona.amethyst.commons.model.clink.ClinkDebitWalletEntry import com.vitorpamplona.amethyst.commons.model.concord.ConcordViewMode @@ -37,7 +38,6 @@ import com.vitorpamplona.amethyst.commons.model.nip47WalletConnect.NwcWalletEntr import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.amethyst.commons.relayauth.RelayAuthPolicy import com.vitorpamplona.amethyst.model.AccountSettings -import com.vitorpamplona.amethyst.model.UiSettings import com.vitorpamplona.amethyst.model.backups.BackupConflictStorage import com.vitorpamplona.amethyst.model.nip60Cashu.CashuPreferences import com.vitorpamplona.amethyst.service.checkNotInMainThread diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/favorites/FavoriteAppLauncher.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/favorites/FavoriteAppLauncher.kt index e4029c8627..cd6fb36b17 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/favorites/FavoriteAppLauncher.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/favorites/FavoriteAppLauncher.kt @@ -27,8 +27,8 @@ import android.os.Bundle import android.widget.Toast import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.favorites.FavoriteApp +import com.vitorpamplona.amethyst.commons.model.ThemeType import com.vitorpamplona.amethyst.commons.model.cache.LocalCache -import com.vitorpamplona.amethyst.model.ThemeType import com.vitorpamplona.amethyst.napplet.NappletLauncher import com.vitorpamplona.amethyst.napplet.NappletWebViewProfiles import com.vitorpamplona.amethyst.napplet.WebAppNetworkRegistry diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/UISharedPreferences.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/UISharedPreferences.kt index 5909a5a3a7..78239e6911 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/UISharedPreferences.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/UISharedPreferences.kt @@ -34,16 +34,16 @@ import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.stringPreferencesKey import androidx.datastore.preferences.preferencesDataStore import com.vitorpamplona.amethyst.LocalPreferences -import com.vitorpamplona.amethyst.model.AccentColorType -import com.vitorpamplona.amethyst.model.BooleanType -import com.vitorpamplona.amethyst.model.ConnectivityType -import com.vitorpamplona.amethyst.model.FeatureSetType -import com.vitorpamplona.amethyst.model.FontFamilyType -import com.vitorpamplona.amethyst.model.FontSizeType -import com.vitorpamplona.amethyst.model.ProfileGalleryType -import com.vitorpamplona.amethyst.model.ThemeType -import com.vitorpamplona.amethyst.model.UiSettings -import com.vitorpamplona.amethyst.model.UiSettingsFlow +import com.vitorpamplona.amethyst.commons.model.AccentColorType +import com.vitorpamplona.amethyst.commons.model.BooleanType +import com.vitorpamplona.amethyst.commons.model.ConnectivityType +import com.vitorpamplona.amethyst.commons.model.FeatureSetType +import com.vitorpamplona.amethyst.commons.model.FontFamilyType +import com.vitorpamplona.amethyst.commons.model.FontSizeType +import com.vitorpamplona.amethyst.commons.model.ProfileGalleryType +import com.vitorpamplona.amethyst.commons.model.ThemeType +import com.vitorpamplona.amethyst.commons.model.UiSettings +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletLauncher.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletLauncher.kt index 382242d133..e4619c6624 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletLauncher.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletLauncher.kt @@ -25,10 +25,10 @@ import android.content.Intent import android.content.res.Configuration import android.os.Bundle import com.vitorpamplona.amethyst.Amethyst +import com.vitorpamplona.amethyst.commons.model.ThemeType import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.napplet.NappletArtifactPolicy import com.vitorpamplona.amethyst.commons.napplet.NappletIdentity -import com.vitorpamplona.amethyst.model.ThemeType import com.vitorpamplona.amethyst.napplethost.HostProfile import com.vitorpamplona.amethyst.napplethost.NappletHostActivity import com.vitorpamplona.amethyst.napplethost.NappletHostContract 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 eed6bfebf5..6866ab49f0 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 @@ -27,6 +27,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.relayauth.AuthPurposeKind import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.relay_auth_purpose_my_inbox @@ -53,9 +54,9 @@ internal fun LoadRelayAuthUser( accountViewModel: AccountViewModel, content: @Composable (User?) -> Unit, ) { - var user by remember(pubkey) { mutableStateOf(accountViewModel.getUserIfExists(pubkey)) } + var user by remember(pubkey) { mutableStateOf(LocalCache.getUserIfExists(pubkey)) } if (user == null) { - LaunchedEffect(pubkey) { user = accountViewModel.checkGetOrCreateUser(pubkey) } + LaunchedEffect(pubkey) { user = LocalCache.checkGetOrCreateUser(pubkey) } } content(user) } 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 4a09f6706a..abd3b5015f 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 @@ -602,9 +602,9 @@ private fun rememberCounterpartyName( pubkey: HexKey, accountViewModel: AccountViewModel, ): String { - var user by remember(pubkey) { mutableStateOf(accountViewModel.getUserIfExists(pubkey)) } + var user by remember(pubkey) { mutableStateOf(LocalCache.getUserIfExists(pubkey)) } if (user == null) { - LaunchedEffect(pubkey) { user = accountViewModel.checkGetOrCreateUser(pubkey) } + LaunchedEffect(pubkey) { user = LocalCache.checkGetOrCreateUser(pubkey) } } val loaded = user ?: return stringRes(Res.string.relay_auth_someone_unloaded) val metadata by observeUserInfo(loaded, accountViewModel) @@ -649,11 +649,11 @@ private fun rememberVenueLabel( ?: when { venueId.length == 64 -> if (kind == AuthPurposeKind.POST_VENUE) { - accountViewModel.checkGetOrCreatePublicChatChannel(venueId) + LocalCache.getOrCreatePublicChatChannel(venueId) } else { LocalCache.getPublicChatChannelIfExists(venueId) } - venueId.startsWith("30311:") -> Address.parse(venueId)?.let { accountViewModel.checkGetOrCreateLiveActivityChannel(it) } + venueId.startsWith("30311:") -> Address.parse(venueId)?.let { LocalCache.getOrCreateLiveChannel(it) } else -> null } } @@ -702,9 +702,9 @@ private fun rememberDisplayName( pubkey: HexKey, accountViewModel: AccountViewModel, ): String { - var user by remember(pubkey) { mutableStateOf(accountViewModel.getUserIfExists(pubkey)) } + var user by remember(pubkey) { mutableStateOf(LocalCache.getUserIfExists(pubkey)) } if (user == null) { - LaunchedEffect(pubkey) { user = accountViewModel.checkGetOrCreateUser(pubkey) } + LaunchedEffect(pubkey) { user = LocalCache.checkGetOrCreateUser(pubkey) } } val loaded = user ?: return stringRes(Res.string.relay_auth_someone_unloaded) // Reading the observed metadata registers a snapshot read, so the name updates when it arrives. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt index 17bbf1e846..d83de98e94 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt @@ -27,6 +27,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.model.Channel import com.vitorpamplona.amethyst.commons.model.ChannelState import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip28PublicChats.PublicChatChannel import com.vitorpamplona.amethyst.commons.model.nip53LiveActivities.LiveActivitiesChannel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -102,7 +103,7 @@ private fun channelToParticipatingUsers( val pKeys = channel.info?.participantKeys() ?: emptyList() pKeys.forEach { - val u = accountViewModel.checkGetOrCreateUser(it) + val u = LocalCache.checkGetOrCreateUser(it) if (u != null) { users.add(u) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt index ed22a29806..32e9e00590 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt @@ -45,12 +45,12 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.copy_stack_to_clipboard import com.vitorpamplona.amethyst.commons.resources.error_dialog_button_ok +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ThrowableToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ThrowableToastMsg2 import com.vitorpamplona.amethyst.commons.ui.components.util.setText import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.Size16dp import com.vitorpamplona.amethyst.commons.ui.theme.StdHorzSpacer -import com.vitorpamplona.amethyst.ui.components.toasts.ThrowableToastMsg -import com.vitorpamplona.amethyst.ui.components.toasts.ThrowableToastMsg2 import kotlinx.coroutines.launch import java.io.PrintWriter import java.io.StringWriter diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/broadcast/DisplayBroadcastProgress.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/broadcast/DisplayBroadcastProgress.kt index 44773b05a0..1c9c1f1772 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/broadcast/DisplayBroadcastProgress.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/broadcast/DisplayBroadcastProgress.kt @@ -38,9 +38,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.Amethyst +import com.vitorpamplona.amethyst.commons.model.BooleanType import com.vitorpamplona.amethyst.commons.service.broadcast.BroadcastEvent import com.vitorpamplona.amethyst.commons.service.pow.PoWJobState -import com.vitorpamplona.amethyst.model.BooleanType import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import kotlinx.collections.immutable.ImmutableList 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 588e74c2ed..99a3042771 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 @@ -43,6 +43,7 @@ import com.vitorpamplona.amethyst.commons.model.EmptyTagList import com.vitorpamplona.amethyst.commons.model.ImmutableListOfLists import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.resources.Res @@ -101,7 +102,7 @@ fun LoadOrCreateNote( content: @Composable (Note?) -> Unit, ) { var note by - remember(event.id) { mutableStateOf(accountViewModel.getNoteIfExists(event.id)) } + remember(event.id) { mutableStateOf(LocalCache.getNoteIfExists(event.id)) } if (note == null) { LaunchedEffect(key1 = event.id) { @@ -224,11 +225,11 @@ private fun DisplayAddress( return } - var noteBase by remember(nip19) { mutableStateOf(accountViewModel.getNoteIfExists(nip19.aTag())) } + var noteBase by remember(nip19) { mutableStateOf(LocalCache.getNoteIfExists(nip19.aTag())) } if (noteBase == null) { LaunchedEffect(key1 = nip19) { - noteBase = accountViewModel.getOrCreateAddressableNote(nip19.address()) + noteBase = LocalCache.getOrCreateAddressableNote(nip19.address()) } } @@ -271,13 +272,13 @@ fun DisplayUser( var userBase by remember(userHex) { mutableStateOf( - accountViewModel.getUserIfExists(userHex), + LocalCache.getUserIfExists(userHex), ) } if (userBase == null) { LaunchedEffect(key1 = userHex) { - userBase = accountViewModel.checkGetOrCreateUser(userHex) + userBase = LocalCache.checkGetOrCreateUser(userHex) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt index 5e801b6926..ca7a265089 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt @@ -57,6 +57,7 @@ import com.vitorpamplona.amethyst.commons.resources.no_wallet_found import com.vitorpamplona.amethyst.commons.resources.no_zap_amount_setup_long_press_to_change import com.vitorpamplona.amethyst.commons.resources.thank_you import com.vitorpamplona.amethyst.commons.ui.components.CrossfadeIfEnabled +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.ZapIcon import com.vitorpamplona.amethyst.commons.ui.note.ZappedIcon @@ -67,7 +68,6 @@ import com.vitorpamplona.amethyst.commons.ui.theme.Size20Modifier import com.vitorpamplona.amethyst.commons.ui.theme.Size35dp import com.vitorpamplona.amethyst.service.ZapPaymentHandler import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.UserFinderFilterAssemblerSubscription -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.ui.note.ObserveZapIcon import com.vitorpamplona.amethyst.ui.note.ZapAmountChoicePopup import com.vitorpamplona.amethyst.ui.note.payViaIntent 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 cec01b06fc..8e08b17b2c 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 @@ -883,11 +883,11 @@ fun LoadNote( content: @Composable (Note?) -> Unit, ) { var note by - remember(baseNoteHex) { mutableStateOf(accountViewModel.getNoteIfExists(baseNoteHex)) } + remember(baseNoteHex) { mutableStateOf(LocalCache.getNoteIfExists(baseNoteHex)) } if (note == null) { LaunchedEffect(key1 = baseNoteHex) { - note = accountViewModel.checkGetOrCreateNote(baseNoteHex) + note = LocalCache.checkGetOrCreateNote(baseNoteHex) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt index 42a28631a6..399c6687e1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt @@ -22,10 +22,16 @@ package com.vitorpamplona.amethyst.ui.components.toasts import androidx.compose.runtime.Composable import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ActionableStringToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ResourceToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.StringToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ThrowableToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ThrowableToastMsg2 +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ToastManager +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.MultiErrorToastMsg import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.ui.actions.InformationDialog -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.MultiErrorToastMsg import com.vitorpamplona.amethyst.ui.components.toasts.multiline.MultiUserErrorMessageDialog import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -40,10 +46,11 @@ fun DisplayErrorMessages( openDialogMsg.value?.let { obj -> when (obj) { is ResourceToastMsg -> { - if (obj.params != null) { + val params = obj.params + if (params != null) { InformationDialog( stringRes(obj.titleResId), - stringRes(obj.resourceId, *obj.params), + stringRes(obj.resourceId, *params), ) { toastManager.clearToasts() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt index b0e8d24ccd..8eebdce932 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt @@ -48,6 +48,8 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.error_dialog_talk_to_user import com.vitorpamplona.amethyst.commons.resources.error_dialog_talk_to_user_name import com.vitorpamplona.amethyst.commons.resources.error_dialog_zap_error +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.MultiErrorToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiUserErrorMessageDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiUserErrorMessageDialog.kt index a681d82254..0777b48775 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiUserErrorMessageDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiUserErrorMessageDialog.kt @@ -34,6 +34,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.error_dialog_button_ok import com.vitorpamplona.amethyst.commons.resources.error_dialog_zap_error +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.MultiErrorToastMsg import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes 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 7a6fbdc5dd..a5cda72e5e 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 @@ -34,6 +34,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.model.AddressableNote import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.emphChat.EphemeralChatChannel import com.vitorpamplona.amethyst.commons.model.nip03Timestamp.earliestOtsVerifiedTime import com.vitorpamplona.amethyst.commons.model.nip28PublicChats.PublicChatChannel @@ -95,10 +96,10 @@ fun LoadAddressableNote( content: @Composable (AddressableNote?) -> Unit, ) { val note by produceState( - accountViewModel.getAddressableNoteIfExists(address), + LocalCache.getAddressableNoteIfExists(address), address, ) { - val newNote = accountViewModel.getOrCreateAddressableNote(address) + val newNote = LocalCache.getOrCreateAddressableNote(address) if (newNote != value) { value = newNote } @@ -152,8 +153,8 @@ fun LoadPublicChatChannel( accountViewModel: AccountViewModel, content: @Composable (PublicChatChannel) -> Unit, ) { - val channel by produceStateIfNotNull(accountViewModel.getPublicChatChannelIfExists(id), id) { - value = accountViewModel.checkGetOrCreatePublicChatChannel(id) + val channel by produceStateIfNotNull(LocalCache.getPublicChatChannelIfExists(id), id) { + value = LocalCache.getOrCreatePublicChatChannel(id) } channel?.let { content(it) } @@ -166,8 +167,8 @@ fun LoadEphemeralChatChannel( content: @Composable (EphemeralChatChannel) -> Unit, ) { val channel = - produceStateIfNotNull(accountViewModel.getEphemeralChatChannelIfExists(id), id) { - value = accountViewModel.checkGetOrCreateEphemeralChatChannel(id) + produceStateIfNotNull(LocalCache.getEphemeralChatChannelIfExists(id), id) { + value = LocalCache.getOrCreateEphemeralChannel(id) } channel.value?.let { content(it) } @@ -180,8 +181,8 @@ fun LoadLiveActivityChannel( content: @Composable (LiveActivitiesChannel) -> Unit, ) { val channel = - produceStateIfNotNull(accountViewModel.getLiveActivityChannelIfExists(id), id) { - value = accountViewModel.checkGetOrCreateLiveActivityChannel(id) + produceStateIfNotNull(LocalCache.getLiveActivityChannelIfExists(id), id) { + value = LocalCache.getOrCreateLiveChannel(id) } channel.value?.let { content(it) } 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 21e93147f4..14cf7f0cf5 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 @@ -154,6 +154,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.AnimatedBorderTextCorner import com.vitorpamplona.amethyst.commons.ui.components.ClickableBox import com.vitorpamplona.amethyst.commons.ui.components.CrossfadeIfEnabled import com.vitorpamplona.amethyst.commons.ui.components.GenericLoadable +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.commons.ui.components.util.setText import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.ChangeReactionIcon @@ -228,7 +229,6 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUse import com.vitorpamplona.amethyst.ui.actions.uploads.FloatingRecordingIndicator import com.vitorpamplona.amethyst.ui.actions.uploads.MAX_VOICE_RECORD_SECONDS import com.vitorpamplona.amethyst.ui.actions.uploads.RecordAudioBox -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.ui.navigation.routes.routeReplyTo import com.vitorpamplona.amethyst.ui.note.elements.ShareOptionsBottomSheet import com.vitorpamplona.amethyst.ui.note.types.EditState 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 f2aeb65dba..c081bb1e93 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 @@ -370,7 +370,6 @@ fun BaseUserPicture( userName = userName, size = size, modifier = innerModifier, - accountViewModel = accountViewModel, ) } @@ -405,7 +404,6 @@ fun BaseUserPicture( userName = null, size = size, modifier = innerModifier, - accountViewModel = accountViewModel, ) } } @@ -433,7 +431,6 @@ fun ObserveAndDrawInnerUserPicture( userName = userProfile?.info?.bestName(), size = size, modifier = innerModifier, - accountViewModel = accountViewModel, ) } @@ -455,7 +452,6 @@ fun ScoreTag55Preview() { userName = PREVIEW_USER_NAME, size = size, modifier = Modifier, - accountViewModel = accountViewModel, ) FollowingIcon(Modifier.size(size.div(3.5f))) ScoreTag(100, size, Modifier.align(Alignment.BottomCenter)) @@ -468,7 +464,6 @@ fun ScoreTag55Preview() { userName = PREVIEW_USER_NAME, size = size, modifier = Modifier, - accountViewModel = accountViewModel, ) FollowingIcon(Modifier.size(size.div(3.5f))) ScoreTag(100, size, Modifier.align(Alignment.BottomCenter)) @@ -481,7 +476,6 @@ fun ScoreTag55Preview() { userName = PREVIEW_USER_NAME, size = size, modifier = Modifier, - accountViewModel = accountViewModel, ) FollowingIcon(Modifier.size(size.div(3.5f))) ScoreTag(100, size, Modifier.align(Alignment.BottomCenter)) @@ -494,7 +488,6 @@ fun ScoreTag55Preview() { userName = PREVIEW_USER_NAME, size = size, modifier = Modifier, - accountViewModel = accountViewModel, ) FollowingIcon(Modifier.size(size.div(3.5f))) ScoreTag(100, size, Modifier.align(Alignment.BottomCenter)) @@ -507,7 +500,6 @@ fun ScoreTag55Preview() { userName = PREVIEW_USER_NAME, size = size, modifier = Modifier, - accountViewModel = accountViewModel, ) FollowingIcon(Modifier.size(size.div(3.5f))) ScoreTag(100, size, Modifier.align(Alignment.BottomCenter)) @@ -534,7 +526,6 @@ fun InnerUserPicture( userName: String?, size: Dp, modifier: Modifier, - accountViewModel: AccountViewModel, ) { UserAvatar( userHex = userHex, @@ -547,12 +538,6 @@ fun InnerUserPicture( } else { stringRes(id = Res.string.profile_image) }, - loadProfilePicture = accountViewModel.settings.showProfilePictures(), - loadRobohash = accountViewModel.settings.isNotPerformanceMode(), - autoPlayGif = - accountViewModel.settings.autoPlayVideosFlow - .collectAsStateWithLifecycle() - .value, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index ed1177b147..75a78c8df2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -99,6 +99,7 @@ import com.vitorpamplona.amethyst.commons.resources.zap_type_private import com.vitorpamplona.amethyst.commons.resources.zap_type_private_explainer import com.vitorpamplona.amethyst.commons.resources.zap_type_public import com.vitorpamplona.amethyst.commons.resources.zap_type_public_explainer +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage 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.TopBarWithBackButton @@ -113,7 +114,6 @@ import com.vitorpamplona.amethyst.commons.ui.theme.ZeroPadding import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.service.ZapPaymentHandler -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.wallet.OnchainZapSendDialog import com.vitorpamplona.quartz.nip01Core.core.Event diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt index 4ca2a10e2b..445efa5a78 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt @@ -89,6 +89,7 @@ import com.vitorpamplona.amethyst.commons.resources.poll_is_closed_explainer import com.vitorpamplona.amethyst.commons.resources.poll_unable_to_vote import com.vitorpamplona.amethyst.commons.resources.read_only_user import com.vitorpamplona.amethyst.commons.resources.zaps +import com.vitorpamplona.amethyst.commons.ui.components.toasts.StringToastMsg import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes @@ -107,7 +108,6 @@ import com.vitorpamplona.amethyst.commons.ui.theme.subtleBorder import com.vitorpamplona.amethyst.service.ZapPaymentHandler import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNoteZaps import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer -import com.vitorpamplona.amethyst.ui.components.toasts.StringToastMsg import com.vitorpamplona.amethyst.ui.navigation.routes.routeToMessage import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt index fb12ae4b2d..00689c692d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt @@ -29,12 +29,12 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.vitorpamplona.amethyst.commons.model.FeatureSetType import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.ui.components.GenericLoadable import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn -import com.vitorpamplona.amethyst.model.FeatureSetType import com.vitorpamplona.amethyst.service.location.CachedReversedGeoLocations import com.vitorpamplona.amethyst.ui.note.FirstUserInfoRow import com.vitorpamplona.amethyst.ui.note.types.EditState diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt index 92e3eeecc1..8afb6da337 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt @@ -721,7 +721,7 @@ open class CommentPostViewModel : if (replyingToEvent is CommunityDefinitionEvent) { replyingToEvent.moderatorKeys().mapNotNull { if (it != replyingToEvent.pubKey) { - accountViewModel.checkGetOrCreateUser(it)?.toPTag() + LocalCache.checkGetOrCreateUser(it)?.toPTag() } else { null } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt index 3fad5f0759..208535d4b4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt @@ -65,6 +65,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.AddressableNote +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.composer.AudienceSelection import com.vitorpamplona.amethyst.commons.nip30CustomEmojis.ui.ShowEmojiSuggestionList import com.vitorpamplona.amethyst.commons.relayClient.communities.CommunityFilterAssemblerSubscription @@ -149,13 +150,13 @@ fun ReplyCommentPostScreen( val context = LocalContext.current LaunchedEffect(postViewModel, accountViewModel) { - replyId?.let { accountViewModel.getNoteIfExists(it) }?.let { + replyId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.reply(it) } - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } - quoteId?.let { accountViewModel.getNoteIfExists(it) }?.let { + quoteId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.quote(it) } message?.ifBlank { null }?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt index 5537e616a4..d90b4644cc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt @@ -315,8 +315,8 @@ fun AcceptBadgeControls( val amAwardee = remember(award, myPubkey) { award.awardeeIds().contains(myPubkey) } if (!amAwardee) return - val newNote = accountViewModel.getOrCreateAddressableNote(ProfileBadgesEvent.createAddress(myPubkey)) - val oldNote = accountViewModel.getOrCreateAddressableNote(AcceptedBadgeSetEvent.createAddress(myPubkey)) + val newNote = LocalCache.getOrCreateAddressableNote(ProfileBadgesEvent.createAddress(myPubkey)) + val oldNote = LocalCache.getOrCreateAddressableNote(AcceptedBadgeSetEvent.createAddress(myPubkey)) val newState by newNote .flow() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Highlight.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Highlight.kt index 39071710d7..2fd5c0428f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Highlight.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Highlight.kt @@ -46,6 +46,7 @@ import com.vitorpamplona.amethyst.commons.model.EmptyTagList import com.vitorpamplona.amethyst.commons.model.ImmutableListOfLists import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.highlights.HighlightQuote import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.model.toImmutableListOfLists @@ -308,23 +309,23 @@ private fun DisplayQuoteAuthor( accountViewModel: AccountViewModel, nav: INav, ) { - var userBase by remember { mutableStateOf(authorHex?.let { accountViewModel.getUserIfExists(it) }) } + var userBase by remember { mutableStateOf(authorHex?.let { LocalCache.getUserIfExists(it) }) } if (userBase == null && authorHex != null) { LaunchedEffect(authorHex) { - userBase = accountViewModel.checkGetOrCreateUser(authorHex) + userBase = LocalCache.checkGetOrCreateUser(authorHex) } } var addressable by remember { - mutableStateOf(postAddress?.let { accountViewModel.getAddressableNoteIfExists(it) }) + mutableStateOf(postAddress?.let { LocalCache.getAddressableNoteIfExists(it) }) } if (addressable == null && postAddress != null) { LaunchedEffect(key1 = postAddress) { val newNote = withContext(Dispatchers.IO) { - accountViewModel.getOrCreateAddressableNote(postAddress) + LocalCache.getOrCreateAddressableNote(postAddress) } if (addressable != newNote) { addressable = newNote @@ -333,14 +334,14 @@ private fun DisplayQuoteAuthor( } var version by remember { - mutableStateOf(postVersion?.let { accountViewModel.getNoteIfExists(it.eventId) }) + mutableStateOf(postVersion?.let { LocalCache.getNoteIfExists(it.eventId) }) } if (version == null && postVersion != null) { LaunchedEffect(key1 = postVersion) { val newNote = withContext(Dispatchers.IO) { - accountViewModel.getOrCreateNote(postVersion.eventId) + LocalCache.getOrCreateNote(postVersion.eventId) } if (version != newNote) { version = newNote diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RememberCaptionTracks.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RememberCaptionTracks.kt index 15402138f7..b122f7fa43 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RememberCaptionTracks.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RememberCaptionTracks.kt @@ -24,6 +24,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.remember +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip71Video.CaptionTrack import com.vitorpamplona.amethyst.commons.model.nip71Video.captionTracks import com.vitorpamplona.amethyst.commons.model.nip71Video.mergeCaptionTracks @@ -60,7 +61,7 @@ fun rememberCaptionTracks( val resolved = refs.pending.map { pending -> key(pending.address.toValue()) { - val note = remember(pending.address) { accountViewModel.getOrCreateAddressableNote(pending.address) } + val note = remember(pending.address) { LocalCache.getOrCreateAddressableNote(pending.address) } val trackEvent by observeNoteEvent(note, accountViewModel) trackEvent?.toCaptionTrack(pending.tag) } 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 83714f95a5..2cd4be21e4 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 @@ -603,9 +603,9 @@ private fun LoadAssetNote( accountViewModel: AccountViewModel, content: @Composable (Note?) -> Unit, ) { - val note by produceState(initialValue = accountViewModel.getNoteIfExists(eventId), eventId) { + val note by produceState(initialValue = LocalCache.getNoteIfExists(eventId), eventId) { if (value == null) { - value = accountViewModel.checkGetOrCreateNote(eventId) + value = LocalCache.checkGetOrCreateNote(eventId) } } content(note) 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 593c22c8b4..e3e7683aff 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 @@ -45,6 +45,7 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.sp import com.vitorpamplona.amethyst.commons.model.EmptyTagList import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.accept_the_suggestion @@ -88,7 +89,7 @@ fun RenderTextModificationEvent( val isAuthorTheLoggedUser = remember { val authorOfTheOriginalNote = - noteEvent.editedNote()?.let { accountViewModel.getNoteIfExists(it.eventId)?.author?.pubkeyHex ?: it.author } + noteEvent.editedNote()?.let { LocalCache.getNoteIfExists(it.eventId)?.author?.pubkeyHex ?: it.author } mutableStateOf(accountViewModel.isLoggedUser(authorOfTheOriginalNote)) } 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 57381f76b9..6af3dab4b8 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 @@ -46,18 +46,17 @@ import com.vitorpamplona.amethyst.commons.model.AddressableNote import com.vitorpamplona.amethyst.commons.model.Dao import com.vitorpamplona.amethyst.commons.model.LiveHiddenUsers import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.backups.ReplaceableBackupConflict import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.concord.ConcordChannel import com.vitorpamplona.amethyst.commons.model.emphChat.EphemeralChatChannel -import com.vitorpamplona.amethyst.commons.model.geohashChat.GeohashChatChannel import com.vitorpamplona.amethyst.commons.model.navigation.BottomBarEntry import com.vitorpamplona.amethyst.commons.model.navigation.NavBarItem import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.nip28PublicChats.PublicChatChannel import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel -import com.vitorpamplona.amethyst.commons.model.nip53LiveActivities.LiveActivitiesChannel import com.vitorpamplona.amethyst.commons.model.nip56Reports.UserReportWarningState import com.vitorpamplona.amethyst.commons.model.nip56Reports.dmReportWarningFor import com.vitorpamplona.amethyst.commons.model.observables.CreatedAtComparator @@ -103,15 +102,16 @@ import com.vitorpamplona.amethyst.commons.service.http.IRoleBasedHttpClientBuild import com.vitorpamplona.amethyst.commons.service.pow.PoWCategory 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 import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.amethyst.model.LatestKeyPackageOwner -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.model.UrlCachedPreviewer import com.vitorpamplona.amethyst.model.privacyOptions.RoleBasedHttpClientBuilder import com.vitorpamplona.amethyst.service.ClinkDebitPayer @@ -127,13 +127,11 @@ import com.vitorpamplona.amethyst.service.pow.powKindLabelRes import com.vitorpamplona.amethyst.service.relayClient.reqCommand.RelaySubscriptionsCoordinator import com.vitorpamplona.amethyst.ui.actions.MediaSaverToDisk import com.vitorpamplona.amethyst.ui.actions.NewMessageTagger -import com.vitorpamplona.amethyst.ui.components.toasts.ToastManager import com.vitorpamplona.amethyst.ui.note.ZapAmountCommentNotification import com.vitorpamplona.amethyst.ui.note.ZapraiserStatus import com.vitorpamplona.amethyst.ui.note.payViaIntent import com.vitorpamplona.amethyst.ui.note.showAmount import com.vitorpamplona.amethyst.ui.note.showAmountInteger -import com.vitorpamplona.amethyst.ui.screen.UiSettingsState import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.marmotGroup.send.MarmotGroupIconChange import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.marmotGroup.send.MarmotGroupIconUpload import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.marmotGroup.send.MarmotGroupIconUploader @@ -146,7 +144,6 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.wallet.ReloadMintRequest import com.vitorpamplona.amethyst.ui.tor.TorSettingsFlow import com.vitorpamplona.quartz.experimental.clink.debits.DebitResponse import com.vitorpamplona.quartz.experimental.clink.pointers.NDebit -import com.vitorpamplona.quartz.experimental.ephemChat.chat.RoomId import com.vitorpamplona.quartz.experimental.interactiveStories.InteractiveStoryBaseEvent import com.vitorpamplona.quartz.experimental.interactiveStories.InteractiveStoryReadingStateEvent import com.vitorpamplona.quartz.marmot.appComponents.EncryptedMediaReferenceV2 @@ -195,7 +192,6 @@ import com.vitorpamplona.quartz.nip19Bech32.entities.NPub import com.vitorpamplona.quartz.nip19Bech32.entities.NRelay import com.vitorpamplona.quartz.nip19Bech32.entities.NSec import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip29RelayGroups.GroupId import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip47WalletConnect.rpc.IErrorResponseLike @@ -2266,32 +2262,6 @@ class AccountViewModel( override fun getOrCreateAddressableNote(address: Address): AddressableNote = LocalCache.getOrCreateAddressableNote(address) - fun getAddressableNoteIfExists(key: String): AddressableNote? = LocalCache.getAddressableNoteIfExists(key) - - fun getAddressableNoteIfExists(key: Address): AddressableNote? = LocalCache.getAddressableNoteIfExists(key) - - fun checkGetOrCreatePublicChatChannel(key: HexKey): PublicChatChannel = LocalCache.getOrCreatePublicChatChannel(key) - - fun checkGetOrCreateLiveActivityChannel(key: Address): LiveActivitiesChannel = LocalCache.getOrCreateLiveChannel(key) - - fun checkGetOrCreateEphemeralChatChannel(key: RoomId): EphemeralChatChannel = LocalCache.getOrCreateEphemeralChannel(key) - - fun getPublicChatChannelIfExists(hex: HexKey) = LocalCache.getPublicChatChannelIfExists(hex) - - fun getEphemeralChatChannelIfExists(key: RoomId) = LocalCache.getEphemeralChatChannelIfExists(key) - - fun checkGetOrCreateGeohashChannel(geohash: String): GeohashChatChannel = LocalCache.getOrCreateGeohashChannel(geohash) - - fun getGeohashChannelIfExists(geohash: String) = LocalCache.getGeohashChannelIfExists(geohash) - - fun checkGetOrCreateRelayGroupChannel(key: GroupId): RelayGroupChannel = LocalCache.getOrCreateRelayGroupChannel(key) - - fun getRelayGroupChannelIfExists(key: GroupId) = LocalCache.getRelayGroupChannelIfExists(key) - - fun getRelayGroupChannelsOnRelay(relay: NormalizedRelayUrl) = LocalCache.getRelayGroupChannelsOnRelay(relay) - - fun getLiveActivityChannelIfExists(key: Address) = LocalCache.getLiveActivityChannelIfExists(key) - fun loadParticipants( participants: List, onReady: (ImmutableList>) -> Unit, 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 9c552c4f0f..b845503645 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 @@ -515,9 +515,9 @@ internal fun observedUserInfo( pubKey: HexKey, accountViewModel: AccountViewModel, ): UserMetadata? { - var user by remember(pubKey) { mutableStateOf(accountViewModel.getUserIfExists(pubKey)) } + var user by remember(pubKey) { mutableStateOf(LocalCache.getUserIfExists(pubKey)) } if (user == null) { - LaunchedEffect(pubKey) { user = accountViewModel.checkGetOrCreateUser(pubKey) } + LaunchedEffect(pubKey) { user = LocalCache.checkGetOrCreateUser(pubKey) } } val loaded = user ?: return null val info by observeUserInfo(loaded, accountViewModel) 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 b8f7dca79e..4641c7cf82 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 @@ -60,6 +60,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbol import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.backups.BackupEventType import com.vitorpamplona.amethyst.commons.model.backups.ReplaceableBackupConflict +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.navigation.routeFor import com.vitorpamplona.amethyst.commons.ui.components.RobohashFallbackAsyncImage @@ -492,7 +493,7 @@ private fun LazyListScope.favoriteFeedItems( val saved = (conflict.saved as? FavoriteAlgoFeedsListEvent)?.publicFavoriteAlgoFeeds().orEmpty() spaceGrid("feed-", fates(saved, diff.feeds) { it.address }, { it.address.toValue() }) { bookmark, fate, modifier -> AddressableSpaceTile(bookmark.address, fate, accountViewModel, modifier) { - nav.nav { accountViewModel.getAddressableNoteIfExists(bookmark.address)?.let { routeFor(it, accountViewModel.account) } } + nav.nav { LocalCache.getAddressableNoteIfExists(bookmark.address)?.let { routeFor(it, accountViewModel.account) } } } } privateItemsCard(diff.privateItems) 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 df7ba7bea0..d0d166c2b5 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 @@ -86,8 +86,8 @@ fun ProfileBadgesScreen( // historic awards land in cache while this screen is open. ProfileBadgesFilterAssemblerSubscription(accountViewModel) - val newNote = accountViewModel.getOrCreateAddressableNote(ProfileBadgesEvent.createAddress(myPubkey)) - val oldNote = accountViewModel.getOrCreateAddressableNote(AcceptedBadgeSetEvent.createAddress(myPubkey)) + val newNote = LocalCache.getOrCreateAddressableNote(ProfileBadgesEvent.createAddress(myPubkey)) + val oldNote = LocalCache.getOrCreateAddressableNote(AcceptedBadgeSetEvent.createAddress(myPubkey)) val newState by newNote .flow() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/DrawAuthorInfo.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/DrawAuthorInfo.kt index 84ebcb66d7..38541c96f9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/DrawAuthorInfo.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/DrawAuthorInfo.kt @@ -103,7 +103,6 @@ private fun WatchAndDisplayUser( userName = displayName, size = Size20dp, modifier = Modifier, - accountViewModel = accountViewModel, ) WatchUserFollows(author.pubkeyHex, accountViewModel) { newFollowingState -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderBuzzSystemMessage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderBuzzSystemMessage.kt index 67e4a081ac..47f30f5858 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderBuzzSystemMessage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderBuzzSystemMessage.kt @@ -28,6 +28,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import com.vitorpamplona.amethyst.commons.chats.ui.ChatSystemMessage import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.buzz_system_channel_archived @@ -219,10 +220,10 @@ fun observeUserNameByHex( ): String { if (pubkey == null) return "" - var user by remember(pubkey) { mutableStateOf(accountViewModel.getUserIfExists(pubkey)) } + var user by remember(pubkey) { mutableStateOf(LocalCache.getUserIfExists(pubkey)) } if (user == null) { - LaunchedEffect(pubkey) { user = accountViewModel.checkGetOrCreateUser(pubkey) } + LaunchedEffect(pubkey) { user = LocalCache.checkGetOrCreateUser(pubkey) } } val loaded = user ?: return remember(pubkey) { pubkey.take(8) } 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 ffc2f6a685..bca56fbc88 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 @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.geohashChat 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 @@ -38,8 +39,8 @@ fun LoadGeohashChannel( content: @Composable (GeohashChatChannel) -> Unit, ) { val channel = - produceStateIfNotNull(accountViewModel.getGeohashChannelIfExists(geohash), geohash) { - value = accountViewModel.checkGetOrCreateGeohashChannel(geohash) + produceStateIfNotNull(LocalCache.getGeohashChannelIfExists(geohash), geohash) { + value = LocalCache.getOrCreateGeohashChannel(geohash) } channel.value?.let { content(it) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupChatView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupChatView.kt index 96d1f7c04f..1a480a9adc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupChatView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupChatView.kt @@ -49,6 +49,7 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.chats.ui.ThinSendButton +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.marmot_group_composer_disbanding import com.vitorpamplona.amethyst.commons.resources.marmot_group_composer_leaving @@ -121,7 +122,7 @@ fun MarmotGroupChatView( // landed in LocalCache. checkGetOrCreateNote is a no-op for unknown ids. if (replyToInnerNote != null) { LaunchedEffect(replyToInnerNote) { - val parent = accountViewModel.checkGetOrCreateNote(replyToInnerNote) + val parent = LocalCache.checkGetOrCreateNote(replyToInnerNote) if (parent != null) { newMessageModel.reply(parent) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupListScreen.kt index df8c893e5d..4c8d52184f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupListScreen.kt @@ -59,6 +59,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.chats.ui.ChatUnreadBadge import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.marmotGroups.MarmotGroupChatroom import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.resources.Res @@ -329,7 +330,7 @@ fun MarmotGroupListItem( previewEvent ?.pubKey ?.takeIf { it != myPubKey } - ?.let { accountViewModel.getUserIfExists(it) } + ?.let { LocalCache.getUserIfExists(it) } val senderName = if (senderUser != null) { observeUserInfo(senderUser, accountViewModel).value?.info?.bestName() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotSystemRowRenderer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotSystemRowRenderer.kt index 1442015c2a..6f7a2c9adf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotSystemRowRenderer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotSystemRowRenderer.kt @@ -33,6 +33,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.marmot_system_admin_added import com.vitorpamplona.amethyst.commons.resources.marmot_system_admin_added_passive @@ -167,7 +168,7 @@ class MarmotSystemRowRenderer( /** A known display name, or a short key when the account is a stranger. */ @Composable private fun displayName(pubkeyHex: String): String { - val user = accountViewModel.getUserIfExists(pubkeyHex) + val user = LocalCache.getUserIfExists(pubkeyHex) return user?.toBestDisplayName() ?: pubkeyHex.take(8) } } 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 78c91bea19..c46d38c24b 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 @@ -40,6 +40,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.feeds.FeedContentState import com.vitorpamplona.amethyst.commons.feeds.FeedState +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.privateChatLastReadRoute import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.chats_history_proto_nip04 @@ -106,7 +107,7 @@ fun ChatroomView( if (replyToNote != null) { LaunchedEffect(key1 = replyToNote, newPostModel, accountViewModel) { - val replyNote = accountViewModel.checkGetOrCreateNote(replyToNote) + val replyNote = LocalCache.checkGetOrCreateNote(replyToNote) if (replyNote != null) { newPostModel.reply(replyNote) } @@ -114,7 +115,7 @@ fun ChatroomView( } if (editFromDraft != null) { LaunchedEffect(editFromDraft, newPostModel, accountViewModel) { - val draftNote = accountViewModel.checkGetOrCreateNote(editFromDraft) + val draftNote = LocalCache.checkGetOrCreateNote(editFromDraft) if (draftNote != null) { newPostModel.editFromDraft(draftNote) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt index ad9e3471ea..3bb0e5dce0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt @@ -407,7 +407,7 @@ class ChatNewMessageViewModel : } if (replyId != null) { - replyTo.value = accountViewModel.checkGetOrCreateNote(replyId) + replyTo.value = LocalCache.checkGetOrCreateNote(replyId) } } else if (draftEvent is PrivateDmEvent) { val recipientNPub = draftEvent.verifiedRecipientPubKey()?.let { Hex.decode(it).toNpub() } @@ -415,7 +415,7 @@ class ChatNewMessageViewModel : val replyId = draftEvent.replyTo() if (replyId != null) { - replyTo.value = accountViewModel.checkGetOrCreateNote(replyId) + replyTo.value = LocalCache.checkGetOrCreateNote(replyId) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelListScreen.kt index 8a3250abb0..3075b9a87a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelListScreen.kt @@ -589,7 +589,7 @@ private fun rememberConcordDisplayName( hex: HexKey, accountViewModel: AccountViewModel, ): String { - val user = remember(hex) { accountViewModel.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } + val user = remember(hex) { LocalCache.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } val name by observeUserName(user, accountViewModel) return name } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelScreen.kt index e921ea0531..fc1c1f025b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordChannelScreen.kt @@ -392,7 +392,7 @@ private fun rememberTypistName( hex: String, accountViewModel: AccountViewModel, ): String { - val user = remember(hex) { accountViewModel.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } + val user = remember(hex) { LocalCache.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } val info by observeUserInfo(user, accountViewModel) return info?.info?.bestName() ?: remember(user) { user.pubkeyDisplayHex() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMembersScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMembersScreen.kt index a2bf94ddc7..d09ff1be8d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMembersScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/ConcordMembersScreen.kt @@ -57,6 +57,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.concord.ConcordMembership import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.back @@ -250,7 +251,7 @@ private fun ConcordMemberRow( accountViewModel: AccountViewModel, nav: INav, ) { - val user = remember(entry.pubkey) { accountViewModel.checkGetOrCreateUser(entry.pubkey) } + val user = remember(entry.pubkey) { LocalCache.checkGetOrCreateUser(entry.pubkey) } val isOwnerTarget = entry.membership == ConcordMembership.OWNER val isBanned = entry.membership == ConcordMembership.BANNED val isAdmin = entry.membership == ConcordMembership.ADMIN 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 2e88e40e26..9e00d294ce 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 @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -44,8 +45,8 @@ fun EphemeralChatScreen( ) { val relay = remember(relayUrl) { RelayUrlNormalizer.normalizeOrNull(relayUrl) } ?: return val channelId = remember(id, relay) { RoomId(id, relay) } - val draft = remember(draftId) { draftId?.let { accountViewModel.getNoteIfExists(it) } } - val replyTo = remember(replyToId) { replyToId?.let { accountViewModel.checkGetOrCreateNote(it) } } + val draft = remember(draftId) { draftId?.let { LocalCache.getNoteIfExists(it) } } + val replyTo = remember(replyToId) { replyToId?.let { LocalCache.checkGetOrCreateNote(it) } } DisappearingScaffold( isInvertedLayout = true, 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 51af13e271..1f2858285b 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 @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.ephemChat 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 @@ -33,8 +34,8 @@ fun LoadEphemeralChatChannel( content: @Composable (EphemeralChatChannel) -> Unit, ) { val channel = - produceStateIfNotNull(accountViewModel.getEphemeralChatChannelIfExists(id), id) { - value = accountViewModel.checkGetOrCreateEphemeralChatChannel(id) + produceStateIfNotNull(LocalCache.getEphemeralChatChannelIfExists(id), id) { + value = LocalCache.getOrCreateEphemeralChannel(id) } channel.value?.let { content(it) } 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 1461c1fe7c..f4dab4e683 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 @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold @@ -44,8 +45,8 @@ fun PublicChatChannelScreen( ) { if (channelId == null) return - val draft = remember(draftId) { draftId?.let { accountViewModel.getNoteIfExists(it) } } - val replyTo = remember(replyToId) { replyToId?.let { accountViewModel.checkGetOrCreateNote(it) } } + val draft = remember(draftId) { draftId?.let { LocalCache.getNoteIfExists(it) } } + val replyTo = remember(replyToId) { replyToId?.let { LocalCache.checkGetOrCreateNote(it) } } val selfRoute = remember(channelId) { Route.PublicChatChannel(channelId) } DisappearingScaffold( 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 2ce86fc6ca..edfc15df6a 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 @@ -26,6 +26,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.service.OnlineChecker import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold @@ -45,8 +46,8 @@ fun LiveActivityChannelScreen( ) { if (channelId == null) return - val draft = remember(draftId) { draftId?.let { accountViewModel.getNoteIfExists(it) } } - val replyTo = remember(replyToId) { replyToId?.let { accountViewModel.checkGetOrCreateNote(it) } } + val draft = remember(draftId) { draftId?.let { LocalCache.getNoteIfExists(it) } } + val replyTo = remember(replyToId) { replyToId?.let { LocalCache.checkGetOrCreateNote(it) } } DisappearingScaffold( isInvertedLayout = true, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamTopZappers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamTopZappers.kt index e933a5ea41..9744b58ed0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamTopZappers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamTopZappers.kt @@ -48,6 +48,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.nip53LiveActivities.LiveActivitiesChannel import com.vitorpamplona.amethyst.commons.nip53LiveActivities.TopZapperEntry @@ -92,11 +93,11 @@ fun LiveStreamTopZappers( val goalId = channel.info?.goalEventId() if (goalId != null) { var goalNoteHolder by remember(goalId) { - mutableStateOf(accountViewModel.getNoteIfExists(goalId)) + mutableStateOf(LocalCache.getNoteIfExists(goalId)) } LaunchedEffect(goalId) { if (goalNoteHolder == null) { - goalNoteHolder = accountViewModel.checkGetOrCreateNote(goalId) + goalNoteHolder = LocalCache.checkGetOrCreateNote(goalId) } topZappersVm.setGoalNote(goalNoteHolder) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/BuzzTypingIndicator.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/BuzzTypingIndicator.kt index 5779fd3a09..9e5dc3bd1e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/BuzzTypingIndicator.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/BuzzTypingIndicator.kt @@ -56,6 +56,7 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.model.buzz.BuzzTypingState +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.buzz_typing_many import com.vitorpamplona.amethyst.commons.resources.buzz_typing_one @@ -184,7 +185,7 @@ private fun rememberTypistName( hex: HexKey, accountViewModel: AccountViewModel, ): String { - val user = remember(hex) { accountViewModel.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } + val user = remember(hex) { LocalCache.checkGetOrCreateUser(hex) } ?: return remember(hex) { hex.take(8) } val info by observeUserInfo(user, accountViewModel) return info?.info?.bestName() ?: remember(user) { user.pubkeyDisplayHex() } } 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 0704bd9195..2b0582c4e1 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 @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.relayGroup 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 @@ -33,8 +34,8 @@ fun LoadRelayGroupChannel( content: @Composable (RelayGroupChannel) -> Unit, ) { val channel = - produceStateIfNotNull(accountViewModel.getRelayGroupChannelIfExists(id), id) { - value = accountViewModel.checkGetOrCreateRelayGroupChannel(id) + produceStateIfNotNull(LocalCache.getRelayGroupChannelIfExists(id), id) { + value = LocalCache.getOrCreateRelayGroupChannel(id) } channel.value?.let { content(it) } 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 72c810d975..8003a74854 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 @@ -210,12 +210,12 @@ fun RelayGroupChannelListScreen( // so the first frame doesn't reshuffle when the first emission arrives. // remember the seed so the per-relay cache scan + sort runs once (on first composition / relay // change), not on every recomposition — produceState evaluates its initialValue argument eagerly. - val initialChannels = remember(relay) { accountViewModel.getRelayGroupChannelsOnRelay(relay).sortedBySnapshot { it.toBestDisplayName().lowercase() } } + val initialChannels = remember(relay) { LocalCache.getRelayGroupChannelsOnRelay(relay).sortedBySnapshot { it.toBestDisplayName().lowercase() } } val allChannels by produceState(initialValue = initialChannels, relay) { LocalCache .observeEvents(Filter(kinds = listOf(GroupMetadataEvent.KIND))) .collect { - value = accountViewModel.getRelayGroupChannelsOnRelay(relay).sortedBySnapshot { it.toBestDisplayName().lowercase() } + value = LocalCache.getRelayGroupChannelsOnRelay(relay).sortedBySnapshot { it.toBestDisplayName().lowercase() } } } 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 a10b1932ea..e65bdc3dde 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 @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold @@ -46,8 +47,8 @@ fun RelayGroupChatScreen( ) { val relay = remember(relayUrl) { RelayUrlNormalizer.normalizeOrNull(relayUrl) } ?: return val channelId = remember(id, relay) { GroupId(id, relay) } - val draft = remember(draftId) { draftId?.let { accountViewModel.getNoteIfExists(it) } } - val replyTo = remember(replyToId) { replyToId?.let { accountViewModel.checkGetOrCreateNote(it) } } + val draft = remember(draftId) { draftId?.let { LocalCache.getNoteIfExists(it) } } + val replyTo = remember(replyToId) { replyToId?.let { LocalCache.checkGetOrCreateNote(it) } } val selfRoute = remember(id, relayUrl) { Route.RelayGroup(id, relayUrl) } DisappearingScaffold( 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 c8bd0df5ca..0b79115fc3 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 @@ -68,6 +68,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.buzz.BuzzAgentActivityState import com.vitorpamplona.amethyst.commons.model.buzz.BuzzRelayDialect +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupMembership @@ -352,7 +353,7 @@ private fun RelayGroupMemberRow( // Create-or-get (never a one-shot null): UsernameDisplay observes the user's // metadata flow, so the name fills in when the kind:0 arrives instead of being // stuck on truncated hex forever. - val user = remember(entry.pubkey) { accountViewModel.checkGetOrCreateUser(entry.pubkey) } + val user = remember(entry.pubkey) { LocalCache.checkGetOrCreateUser(entry.pubkey) } var menuOpen by remember { mutableStateOf(false) } var confirmRemove by remember { mutableStateOf(false) } 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 627c5face7..c8288dcbe0 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 @@ -152,7 +152,7 @@ private fun ParentSelectorCard( // yet), warm its single 39000, and observe it so the name/picture fill in as they arrive. val liveParent: RelayGroupChannel? = parentId?.let { id -> - val channel = remember(id, relay) { accountViewModel.checkGetOrCreateRelayGroupChannel(GroupId(id, relay)) } + val channel = remember(id, relay) { LocalCache.getOrCreateRelayGroupChannel(GroupId(id, relay)) } RelayGroupCardWarmupSubscription(channel, accountViewModel.dataSources().relayGroupCardWarmup, accountViewModel) val state by channel .flow() @@ -473,7 +473,7 @@ private fun pickCandidates( relayInfo: Nip11RelayInformation, forbidden: Set, ): List = - accountViewModel + LocalCache .getRelayGroupChannelsOnRelay(relay) .asSequence() .filter { it.groupId.id !in forbidden } @@ -492,11 +492,11 @@ private fun descendantIdsOf( ): Set { val result = mutableSetOf() val queue = ArrayDeque() - accountViewModel.getRelayGroupChannelIfExists(GroupId(rootId, relay))?.childGroupIds()?.let { queue.addAll(it) } + LocalCache.getRelayGroupChannelIfExists(GroupId(rootId, relay))?.childGroupIds()?.let { queue.addAll(it) } while (queue.isNotEmpty()) { val id = queue.removeFirst() if (!result.add(id)) continue - accountViewModel.getRelayGroupChannelIfExists(GroupId(id, relay))?.childGroupIds()?.let { queue.addAll(it) } + LocalCache.getRelayGroupChannelIfExists(GroupId(id, relay))?.childGroupIds()?.let { queue.addAll(it) } } return result } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupPinnedBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupPinnedBar.kt index 12bee2e615..b4fb5f5abb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupPinnedBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupPinnedBar.kt @@ -45,6 +45,7 @@ import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.relay_group_pinned_content_description @@ -76,7 +77,7 @@ fun RelayGroupPinnedBar( val safeIndex = index.coerceIn(0, pinnedIds.lastIndex) val currentId = pinnedIds[safeIndex] - val note = remember(currentId) { accountViewModel.checkGetOrCreateNote(currentId) } ?: return + val note = remember(currentId) { LocalCache.checkGetOrCreateNote(currentId) } ?: return // Fetch + observe the pinned message so its author and content fill in once it loads. val noteState by observeNote(note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt index 043b16cef0..993ee2c827 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt @@ -375,7 +375,7 @@ open class ChannelNewMessageViewModel : (draftEvent as? ChannelMessageEvent) ?: (draftEvent as? LiveActivitiesChatMessageEvent) threadedDraft?.reply()?.eventId?.let { replyId -> - replyTo.value = accountViewModel.checkGetOrCreateNote(replyId) + replyTo.value = LocalCache.checkGetOrCreateNote(replyId) } message.setTextAndPlaceCursorAtEnd(draftEvent.content) 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 299a69bf9d..b3e26ae4a5 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 @@ -1125,11 +1125,11 @@ fun LoadUser( content: @Composable (User?) -> Unit, ) { var user by - remember(baseUserHex) { mutableStateOf(accountViewModel.getUserIfExists(baseUserHex)) } + remember(baseUserHex) { mutableStateOf(LocalCache.getUserIfExists(baseUserHex)) } if (user == null) { LaunchedEffect(key1 = baseUserHex) { - user = accountViewModel.checkGetOrCreateUser(baseUserHex) + user = LocalCache.checkGetOrCreateUser(baseUserHex) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessGameScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessGameScreen.kt index 10eadd3e19..d013cb4f1c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessGameScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessGameScreen.kt @@ -60,6 +60,7 @@ import androidx.fragment.app.FragmentActivity import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.nip64Chess.ChessBroadcastStatus import com.vitorpamplona.amethyst.commons.nip64Chess.ui.ChessBroadcastBanner @@ -306,7 +307,7 @@ fun ChessGameScreen( // Resolve opponent display name and avatar val opponentUser = remember(gameState.opponentPubkey) { - accountViewModel.checkGetOrCreateUser(gameState.opponentPubkey) + LocalCache.checkGetOrCreateUser(gameState.opponentPubkey) } val opponentDisplayName = remember(gameState.opponentPubkey) { @@ -320,7 +321,7 @@ fun ChessGameScreen( // Resolve player display name and avatar val playerUser = remember(gameState.playerPubkey) { - accountViewModel.checkGetOrCreateUser(gameState.playerPubkey) + LocalCache.checkGetOrCreateUser(gameState.playerPubkey) } val playerDisplayName = remember(gameState.playerPubkey) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt index 639ad50264..811cbb1c66 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt @@ -60,6 +60,7 @@ import androidx.fragment.app.FragmentActivity import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.nip64Chess.ChessChallenge import com.vitorpamplona.amethyst.commons.nip64Chess.ui.ActiveGameCard @@ -306,7 +307,7 @@ fun ChessLobbyContent( val userPubkey = accountViewModel.account.userProfile().pubkeyHex val currentUser = remember(userPubkey) { - accountViewModel.checkGetOrCreateUser(userPubkey) + LocalCache.checkGetOrCreateUser(userPubkey) } val hasContent = @@ -375,7 +376,7 @@ fun ChessLobbyContent( items(activeGames.entries.toList(), key = { "active-${it.key}" }) { (gameId, state) -> val opponent = remember(state.opponentPubkey) { - accountViewModel.checkGetOrCreateUser(state.opponentPubkey) + LocalCache.checkGetOrCreateUser(state.opponentPubkey) } val displayName = opponent?.toBestDisplayName() ?: state.opponentPubkey.take(8) ActiveGameCard( @@ -411,7 +412,7 @@ fun ChessLobbyContent( items(outgoingChallenges, key = { "outgoing-${it.eventId}" }) { challenge -> val opponentUser = remember(challenge.opponentPubkey) { - challenge.opponentPubkey?.let { accountViewModel.checkGetOrCreateUser(it) } + challenge.opponentPubkey?.let { LocalCache.checkGetOrCreateUser(it) } } val opponentName = opponentUser?.toBestDisplayName() @@ -476,7 +477,7 @@ fun ChessLobbyContent( val displayName = remember(challenge.challengerPubkey, challenge.challengerDisplayName) { challenge.challengerDisplayName - ?: accountViewModel.checkGetOrCreateUser(challenge.challengerPubkey)?.toBestDisplayName() + ?: LocalCache.checkGetOrCreateUser(challenge.challengerPubkey)?.toBestDisplayName() ?: challenge.challengerPubkey.take(8) } ChallengeCard( @@ -513,7 +514,7 @@ fun ChessLobbyContent( val displayName = remember(challenge.challengerPubkey, challenge.challengerDisplayName) { challenge.challengerDisplayName - ?: accountViewModel.checkGetOrCreateUser(challenge.challengerPubkey)?.toBestDisplayName() + ?: LocalCache.checkGetOrCreateUser(challenge.challengerPubkey)?.toBestDisplayName() ?: challenge.challengerPubkey.take(8) } ChallengeCard( @@ -587,7 +588,7 @@ fun ChessLobbyContent( if (game.whitePubkey == userPubkey) game.blackPubkey else game.whitePubkey val opponentUser = remember(opponentPubkey) { - accountViewModel.checkGetOrCreateUser(opponentPubkey) + LocalCache.checkGetOrCreateUser(opponentPubkey) } val opponentName = opponentUser?.toBestDisplayName() 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 ea7869932e..6a66cbf769 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 @@ -33,6 +33,7 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.contact_list_screen_title import com.vitorpamplona.amethyst.commons.resources.contact_list_screen_title_with_count @@ -78,7 +79,7 @@ fun ContactListUsersScreen( event ?.verifiedFollowKeySet() ?.filter { !accountViewModel.account.isHidden(it) } - ?.mapNotNull { accountViewModel.checkGetOrCreateUser(it) } + ?.mapNotNull { LocalCache.checkGetOrCreateUser(it) } ?.sortedByDescending { accountViewModel.account.isKnown(it.pubkeyHex) } ?.toPersistentList() ?: persistentListOf() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt index 2545f6e935..2ece98c9c1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt @@ -81,6 +81,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.EmptyTagList +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.nip30CustomEmojis.ui.ShowEmojiSuggestionList import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.add_a_tag @@ -156,8 +157,8 @@ fun LongFormPostScreen( postViewModel.init(accountViewModel) LaunchedEffect(postViewModel, accountViewModel) { - val draft = draftId?.let { accountViewModel.getNoteIfExists(it) } - val version = versionId?.let { accountViewModel.getNoteIfExists(it) } + val draft = draftId?.let { LocalCache.getNoteIfExists(it) } + val version = versionId?.let { LocalCache.getNoteIfExists(it) } postViewModel.load(draft, version) if (draftId == null && versionId == null) { postViewModel.applySignature() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt index a3ffe17186..d92f87629f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt @@ -44,6 +44,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.core.net.toUri import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.nip30CustomEmojis.ui.ShowEmojiSuggestionList import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.description @@ -111,10 +112,10 @@ fun NewProductScreen( LaunchedEffect(postViewModel, accountViewModel) { postViewModel.reloadRelaySet() - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } - quoteId?.let { accountViewModel.getNoteIfExists(it) }?.let { + quoteId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.quote(it) } message?.ifBlank { null }?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmHeartbeatObservation.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmHeartbeatObservation.kt index 2d95606f37..5f9ae8e46e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmHeartbeatObservation.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmHeartbeatObservation.kt @@ -40,6 +40,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip90DVMs.DvmHeartbeatRegistry import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.dvm_offline_banner @@ -72,11 +73,11 @@ fun rememberDvmHeartbeatFresh( var heartbeatNote by remember(heartbeatAddressTag) { - mutableStateOf(accountViewModel.getNoteIfExists(heartbeatAddressTag)) + mutableStateOf(LocalCache.getNoteIfExists(heartbeatAddressTag)) } LaunchedEffect(heartbeatAddressTag) { if (heartbeatNote == null) { - heartbeatNote = accountViewModel.checkGetOrCreateNote(heartbeatAddressTag) + heartbeatNote = LocalCache.checkGetOrCreateNote(heartbeatAddressTag) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabFactory.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabFactory.kt index fab2842f38..8422c85477 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabFactory.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabFactory.kt @@ -27,9 +27,9 @@ import android.os.Bundle import androidx.annotation.RequiresApi import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.favorites.FavoriteApp +import com.vitorpamplona.amethyst.commons.model.ThemeType import com.vitorpamplona.amethyst.commons.tor.TorType import com.vitorpamplona.amethyst.favorites.FavoriteAppLauncher -import com.vitorpamplona.amethyst.model.ThemeType import com.vitorpamplona.amethyst.napplet.WebAppNetworkRegistry import com.vitorpamplona.amethyst.napplethost.NappletHostContract import com.vitorpamplona.amethyst.ui.screen.loggedIn.browser.EmbeddedWebAppController diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabThemeWatcher.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabThemeWatcher.kt index 9c0ddcf11a..d3e8c770f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabThemeWatcher.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/EmbeddedTabThemeWatcher.kt @@ -30,7 +30,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.Amethyst -import com.vitorpamplona.amethyst.model.ThemeType +import com.vitorpamplona.amethyst.commons.model.ThemeType /** * Keeps the warm embedded tabs in sync with the app's DARK/LIGHT theme. An embed WebView resolves its diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/GeoHashPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/GeoHashPostScreen.kt index 8860ebac00..2b0eaf0089 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/GeoHashPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/GeoHashPostScreen.kt @@ -26,6 +26,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.platform.LocalContext import androidx.core.net.toUri import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia import com.vitorpamplona.amethyst.ui.navigation.navs.Nav import com.vitorpamplona.amethyst.ui.note.nip22Comments.CommentPostViewModel @@ -57,13 +58,13 @@ fun GeoHashPostScreen( geohash?.let { postViewModel.newPostFor(GeohashId(it)) } - replyId?.let { accountViewModel.getNoteIfExists(it) }?.let { + replyId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.reply(it) } - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } - quoteId?.let { accountViewModel.getNoteIfExists(it) }?.let { + quoteId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.quote(it) } message?.ifBlank { null }?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/HashtagPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/HashtagPostScreen.kt index c752fb9b01..b1eb0e449b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/HashtagPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/HashtagPostScreen.kt @@ -26,6 +26,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.platform.LocalContext import androidx.core.net.toUri import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia import com.vitorpamplona.amethyst.ui.navigation.navs.Nav import com.vitorpamplona.amethyst.ui.note.nip22Comments.CommentPostViewModel @@ -57,13 +58,13 @@ fun HashtagPostScreen( hashtag?.let { postViewModel.newPostFor(HashtagId(it)) } - replyId?.let { accountViewModel.getNoteIfExists(it) }?.let { + replyId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.reply(it) } - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } - quoteId?.let { accountViewModel.getNoteIfExists(it) }?.let { + quoteId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.quote(it) } message?.ifBlank { null }?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/highlights/NewHighlightPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/highlights/NewHighlightPostViewModel.kt index 19882e082c..573cbbe5da 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/highlights/NewHighlightPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/highlights/NewHighlightPostViewModel.kt @@ -29,6 +29,7 @@ import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip30CustomEmojis.EmojiPackState.EmojiMedia import com.vitorpamplona.amethyst.commons.model.nip30CustomEmojis.EmojiSuggestionState import com.vitorpamplona.amethyst.commons.ui.note.creators.messagefield.IMessageField @@ -134,8 +135,8 @@ class NewHighlightPostViewModel : if (accountViewModel != null) { originalNote = when { - !sourceAddress.isNullOrBlank() -> Address.parse(sourceAddress)?.let { accountViewModel.getOrCreateAddressableNote(it) } - !sourceEventId.isNullOrBlank() -> accountViewModel.getOrCreateNote(sourceEventId) + !sourceAddress.isNullOrBlank() -> Address.parse(sourceAddress)?.let { LocalCache.getOrCreateAddressableNote(it) } + !sourceEventId.isNullOrBlank() -> LocalCache.getOrCreateNote(sourceEventId) else -> null } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt index e97012e2ce..142a83683e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt @@ -81,6 +81,8 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.BooleanType +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.composer.AudienceSelection import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.nip30CustomEmojis.ui.ShowEmojiSuggestionList @@ -135,7 +137,6 @@ import com.vitorpamplona.amethyst.commons.ui.theme.SuggestionListDefaultHeightPa import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.commons.ui.theme.replyModifier -import com.vitorpamplona.amethyst.model.BooleanType import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog import com.vitorpamplona.amethyst.ui.actions.mediaServers.FileServerSelectionRow import com.vitorpamplona.amethyst.ui.actions.uploads.MAX_VOICE_RECORD_SECONDS @@ -217,11 +218,11 @@ fun ShortNotePostScreen( } LaunchedEffect(postViewModel, accountViewModel) { - val baseReplyTo = baseReplyToId?.let { accountViewModel.getNoteIfExists(it) } - val quote = quoteId?.let { accountViewModel.getNoteIfExists(it) } - val fork = forkId?.let { accountViewModel.getNoteIfExists(it) } - val version = versionId?.let { accountViewModel.getNoteIfExists(it) } - val draft = draftId?.let { accountViewModel.getNoteIfExists(it) } + val baseReplyTo = baseReplyToId?.let { LocalCache.getNoteIfExists(it) } + val quote = quoteId?.let { LocalCache.getNoteIfExists(it) } + val fork = forkId?.let { LocalCache.getNoteIfExists(it) } + val version = versionId?.let { LocalCache.getNoteIfExists(it) } + val draft = draftId?.let { LocalCache.getNoteIfExists(it) } postViewModel.load(baseReplyTo, quote, fork, version, draft) message?.ifBlank { null }?.let { postViewModel.message.setTextAndPlaceCursorAtEnd(it) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt index 72bc69b916..625d16fd37 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt @@ -35,6 +35,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.model.AddressableNote +import com.vitorpamplona.amethyst.commons.model.BooleanType import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.cache.LocalCache @@ -69,7 +70,6 @@ import com.vitorpamplona.amethyst.commons.ui.text.onUiThread import com.vitorpamplona.amethyst.commons.ui.text.replaceCurrentWord import com.vitorpamplona.amethyst.commons.ui.text.setTextAndPlaceCursorAtBeginning import com.vitorpamplona.amethyst.model.Account -import com.vitorpamplona.amethyst.model.BooleanType import com.vitorpamplona.amethyst.model.accountsCache.AccountCacheState import com.vitorpamplona.amethyst.service.ai.WritingAssistantFactory import com.vitorpamplona.amethyst.service.location.LocationState @@ -1506,7 +1506,7 @@ open class ShortNotePostViewModel : val tags = prepareETagsAsReplyTo(replyingTo, forkingFrom) // fixes wrong tags from previous clients tags.forEach { - val note = accountViewModel.getNoteIfExists(it.eventId) + val note = LocalCache.getNoteIfExists(it.eventId) val ourAuthor = note?.author?.pubkeyHex val ourHint = note?.relayHintUrl() if (it.author == null || it.author?.isBlank() == true) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt index 2e912fd133..c1b223f5fb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt @@ -28,6 +28,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.model.Note +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.mediaServers.ServerName import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.error @@ -115,7 +116,7 @@ class VoiceReplyViewModel : ViewModel() { duration: Int, amplitudesJson: String, ) { - replyToNote = accountViewModel.getNoteIfExists(replyToNoteId) + replyToNote = LocalCache.getNoteIfExists(replyToNoteId) val amplitudes = try { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt index e55351ddbc..b72f99f4b1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt @@ -293,7 +293,7 @@ open class NestNewMessageViewModel : if (draftEvent as? LiveActivitiesChatMessageEvent != null) { val replyId = draftEvent.reply()?.eventId if (replyId != null) { - replyTo.value = accountViewModel.checkGetOrCreateNote(replyId) + replyTo.value = LocalCache.checkGetOrCreateNote(replyId) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/participants/ParticipantHostActionsSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/participants/ParticipantHostActionsSheet.kt index 0ddbf3547c..8714898475 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/participants/ParticipantHostActionsSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/participants/ParticipantHostActionsSheet.kt @@ -82,12 +82,12 @@ import com.vitorpamplona.amethyst.commons.resources.nest_promote_speaker import com.vitorpamplona.amethyst.commons.resources.nest_toast_host_action_failed_template_null import com.vitorpamplona.amethyst.commons.resources.nest_toast_host_action_failed_title import com.vitorpamplona.amethyst.commons.resources.no_wallet_found +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.viewmodels.NestViewModel import com.vitorpamplona.amethyst.commons.viewmodels.RoomSpeakerCatalog import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserInfo import com.vitorpamplona.amethyst.ui.MainActivity -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.note.ZapCustomDialog import com.vitorpamplona.amethyst.ui.note.payViaIntent diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt index 066ad00d60..f01f0b7500 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt @@ -90,13 +90,13 @@ import com.vitorpamplona.amethyst.commons.resources.nest_reconnecting import com.vitorpamplona.amethyst.commons.resources.nest_talk import com.vitorpamplona.amethyst.commons.resources.no_wallet_found import com.vitorpamplona.amethyst.commons.resources.zap_description +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.viewmodels.BroadcastUiState import com.vitorpamplona.amethyst.commons.viewmodels.ConnectionUiState import com.vitorpamplona.amethyst.commons.viewmodels.NestUiState import com.vitorpamplona.amethyst.commons.viewmodels.NestViewModel -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage import com.vitorpamplona.amethyst.ui.note.ZapAmountChoicePopup import com.vitorpamplona.amethyst.ui.note.ZapCustomDialog import com.vitorpamplona.amethyst.ui.note.payViaIntent diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/newUser/ImportFollowListPickFollowsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/newUser/ImportFollowListPickFollowsScreen.kt index db63f47a19..4ab3f4ce13 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/newUser/ImportFollowListPickFollowsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/newUser/ImportFollowListPickFollowsScreen.kt @@ -55,6 +55,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.AddressableNote import com.vitorpamplona.amethyst.commons.model.User +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.accounts_found @@ -85,7 +86,7 @@ fun ImportFollowListPickFollowsScreen( ) { val contactListNote = remember(userHex) { - accountViewModel.getOrCreateAddressableNote(ContactListEvent.createAddress(userHex)) + LocalCache.getOrCreateAddressableNote(ContactListEvent.createAddress(userHex)) } Scaffold( @@ -137,7 +138,7 @@ fun DisplayFollowList( ?.unverifiedFollowKeySet() ?.toSet() ?.mapNotNull { - accountViewModel.checkGetOrCreateUser(it) + LocalCache.checkGetOrCreateUser(it) }?.toPersistentList() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationScreen.kt index f7227a9362..cd772a90de 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationScreen.kt @@ -32,6 +32,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.notification_tab_everyone @@ -44,7 +45,6 @@ import com.vitorpamplona.amethyst.commons.ui.feeds.rememberForeverPagerState import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.TabRowHeight -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.ui.components.SelectNotificationProvider import com.vitorpamplona.amethyst.ui.feeds.WatchScrollToTop import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageScreen.kt index 22770a5c52..febe2b7ffe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageScreen.kt @@ -53,6 +53,7 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.nip30CustomEmojis.ui.ShowEmojiSuggestionList import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.messages_new_message_to @@ -128,10 +129,10 @@ fun NewPublicMessageScreen( to?.let { postViewModel.load(it) } - replyId?.let { accountViewModel.getNoteIfExists(it) }?.let { + replyId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.reply(it) } - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastAuthors.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastAuthors.kt index e5b4c014ea..65b4ceb89f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastAuthors.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastAuthors.kt @@ -91,10 +91,10 @@ private fun PodcastAuthorRow( accountViewModel: AccountViewModel, nav: INav, ) { - var user by remember(author.pubKey) { mutableStateOf(accountViewModel.getUserIfExists(author.pubKey)) } + var user by remember(author.pubKey) { mutableStateOf(LocalCache.getUserIfExists(author.pubKey)) } if (user == null) { LaunchedEffect(author.pubKey) { - user = accountViewModel.checkGetOrCreateUser(author.pubKey) + user = LocalCache.checkGetOrCreateUser(author.pubKey) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/PollPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/PollPostScreen.kt index 102f0dc38d..38eacaafdc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/PollPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/polls/PollPostScreen.kt @@ -25,6 +25,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.ui.navigation.navs.Nav import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.NewPostScreenInner @@ -44,7 +45,7 @@ fun PollPostScreen( postViewModel.init(accountViewModel) LaunchedEffect(postViewModel, accountViewModel) { - val draft = draftId?.let { accountViewModel.getNoteIfExists(it) } + val draft = draftId?.let { LocalCache.getNoteIfExists(it) } postViewModel.load(null, null, null, null, draft) message?.ifBlank { null }?.let { postViewModel.message.setTextAndPlaceCursorAtEnd(it) 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 37e2865fe1..238d1815a0 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 @@ -107,8 +107,8 @@ fun DisplayBadges( val oldDesign = AcceptedBadgeSetEvent.createAddress(baseUser.pubkeyHex) val newDesign = ProfileBadgesEvent.createAddress(baseUser.pubkeyHex) - val oldNote = accountViewModel.getOrCreateAddressableNote(oldDesign) - val newNote = accountViewModel.getOrCreateAddressableNote(newDesign) + val oldNote = LocalCache.getOrCreateAddressableNote(oldDesign) + val newNote = LocalCache.getOrCreateAddressableNote(newDesign) WatchAndRenderBadgeList(baseUser, oldNote, newNote, accountViewModel, nav) } 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 4f580033c9..64512a87ce 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 @@ -73,6 +73,14 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbol import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.AccentColorType +import com.vitorpamplona.amethyst.commons.model.BooleanType +import com.vitorpamplona.amethyst.commons.model.ConnectivityType +import com.vitorpamplona.amethyst.commons.model.FeatureSetType +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.resources.Res import com.vitorpamplona.amethyst.commons.resources.accent_color import com.vitorpamplona.amethyst.commons.resources.accent_color_description @@ -122,14 +130,6 @@ import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonRow import com.vitorpamplona.amethyst.commons.ui.theme.contentColorOnAccent import com.vitorpamplona.amethyst.commons.ui.theme.isLight -import com.vitorpamplona.amethyst.model.AccentColorType -import com.vitorpamplona.amethyst.model.BooleanType -import com.vitorpamplona.amethyst.model.ConnectivityType -import com.vitorpamplona.amethyst.model.FeatureSetType -import com.vitorpamplona.amethyst.model.FontFamilyType -import com.vitorpamplona.amethyst.model.FontSizeType -import com.vitorpamplona.amethyst.model.ThemeType -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.previewColor import com.vitorpamplona.amethyst.ui.theme.toFontFamily diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ComposeSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ComposeSettingsScreen.kt index 933b81c1ee..3f0691f2b7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ComposeSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/ComposeSettingsScreen.kt @@ -45,6 +45,8 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbol import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.BooleanType +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.add_client_tag_explainer import com.vitorpamplona.amethyst.commons.resources.add_client_tag_title @@ -96,8 +98,6 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackBu import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn import com.vitorpamplona.amethyst.model.AccountPoWPreferences -import com.vitorpamplona.amethyst.model.BooleanType -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.service.ai.WritingAssistantFactory import com.vitorpamplona.amethyst.service.pow.deviceHashesPerSecond import com.vitorpamplona.amethyst.service.pow.loadApproxDuration diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/HomeTabsSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/HomeTabsSettingsScreen.kt index 838ca8b799..ba83376d7a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/HomeTabsSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/HomeTabsSettingsScreen.kt @@ -36,6 +36,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbol import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.model.HomeFeedType +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.conversations import com.vitorpamplona.amethyst.commons.resources.home_content_type_articles @@ -72,7 +73,6 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonRow -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import org.jetbrains.compose.resources.StringResource 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 e533d60817..eaabce04cb 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 @@ -34,6 +34,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp 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.resources.Res import com.vitorpamplona.amethyst.commons.resources.gallery_style import com.vitorpamplona.amethyst.commons.resources.gallery_style_description @@ -50,8 +52,6 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonRow -import com.vitorpamplona.amethyst.model.ProfileGalleryType -import com.vitorpamplona.amethyst.model.UiSettingsFlow import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel 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 0e38c36ff5..3c0ba84919 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 @@ -38,7 +38,9 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle 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.resources.Res import com.vitorpamplona.amethyst.commons.resources.blocked_users import com.vitorpamplona.amethyst.commons.resources.filter_spam_from_strangers_explainer @@ -65,8 +67,6 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn -import com.vitorpamplona.amethyst.model.WarningType -import com.vitorpamplona.amethyst.model.parseWarningType import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/url/UrlPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/url/UrlPostScreen.kt index 5a2cdbba51..cb8b3032c1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/url/UrlPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/url/UrlPostScreen.kt @@ -26,6 +26,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.platform.LocalContext import androidx.core.net.toUri import androidx.lifecycle.viewmodel.compose.viewModel +import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia import com.vitorpamplona.amethyst.ui.navigation.navs.Nav import com.vitorpamplona.amethyst.ui.note.nip22Comments.CommentPostViewModel @@ -59,13 +60,13 @@ fun UrlPostScreen( postViewModel.newPostFor(UrlId(normalizedUrl)) } } - replyId?.let { accountViewModel.getNoteIfExists(it) }?.let { + replyId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.reply(it) } - draftId?.let { accountViewModel.getNoteIfExists(it) }?.let { + draftId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.editFromDraft(it) } - quoteId?.let { accountViewModel.getNoteIfExists(it) }?.let { + quoteId?.let { LocalCache.getNoteIfExists(it) }?.let { postViewModel.quote(it) } message?.ifBlank { null }?.let { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/suggestion/DetectedWorkoutCarousel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/suggestion/DetectedWorkoutCarousel.kt index fb28dfd9fd..ffc23b3d25 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/suggestion/DetectedWorkoutCarousel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/workouts/suggestion/DetectedWorkoutCarousel.kt @@ -60,6 +60,7 @@ import com.vitorpamplona.amethyst.commons.fitness.TrainingLog import com.vitorpamplona.amethyst.commons.fitness.WorkoutOrigin import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.commons.model.BooleanType import com.vitorpamplona.amethyst.commons.model.navigation.Route import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.workout_from_health_connect @@ -71,7 +72,6 @@ import com.vitorpamplona.amethyst.commons.resources.workout_suggestion_connect_t import com.vitorpamplona.amethyst.commons.resources.workout_suggestion_distance_km import com.vitorpamplona.amethyst.commons.ui.pluralStringRes import com.vitorpamplona.amethyst.commons.ui.stringRes -import com.vitorpamplona.amethyst.model.BooleanType import com.vitorpamplona.amethyst.service.workouts.health.HealthConnectManager import com.vitorpamplona.amethyst.service.workouts.health.publishedWorkoutsOf import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt index 78ea2ecf9d..5521b8f719 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt @@ -44,8 +44,15 @@ import com.patrykandpatrick.vico.compose.common.VicoTheme import com.patrykandpatrick.vico.compose.common.VicoTheme.CandlestickCartesianLayerColors import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.commons.icons.symbols.ProvideAppIcons +import com.vitorpamplona.amethyst.commons.model.AccentColorType +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.ui.components.LocalAnimationsEnabled import com.vitorpamplona.amethyst.commons.ui.components.LocalProfilePictureCache +import com.vitorpamplona.amethyst.commons.ui.screen.DisplaySettings +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings +import com.vitorpamplona.amethyst.commons.ui.screen.collectDisplaySettings import com.vitorpamplona.amethyst.commons.ui.theme.AccentBlueDark import com.vitorpamplona.amethyst.commons.ui.theme.AccentBlueLight import com.vitorpamplona.amethyst.commons.ui.theme.AccentGreenDark @@ -66,11 +73,6 @@ import com.vitorpamplona.amethyst.commons.ui.theme.amethystLightColorScheme import com.vitorpamplona.amethyst.commons.ui.theme.isLight import com.vitorpamplona.amethyst.commons.ui.theme.transparentBackground import com.vitorpamplona.amethyst.commons.ui.theme.withFontFamily -import com.vitorpamplona.amethyst.model.AccentColorType -import com.vitorpamplona.amethyst.model.FeatureSetType -import com.vitorpamplona.amethyst.model.FontFamilyType -import com.vitorpamplona.amethyst.model.FontSizeType -import com.vitorpamplona.amethyst.model.ThemeType // The accent color (primary/secondary/tertiary) is user-selectable in Settings -> Accent Color. // Purple keeps the original Amethyst look (purple primary + teal secondary). Every other accent @@ -148,9 +150,9 @@ fun AmethystTheme(content: @Composable () -> Unit) { val accentColor by uiPrefs.accentColor.collectAsStateWithLifecycle() val fontFamily by uiPrefs.fontFamily.collectAsStateWithLifecycle() val fontSize by uiPrefs.fontSize.collectAsStateWithLifecycle() - val featureSet by uiPrefs.featureSet.collectAsStateWithLifecycle() + val displaySettings = collectDisplaySettings(Amethyst.instance.uiState) - AmethystTheme(theme, accentColor, fontFamily, fontSize, animationsEnabled = featureSet != FeatureSetType.PERFORMANCE, content = content) + AmethystTheme(theme, accentColor, fontFamily, fontSize, displaySettings, content) } @Composable @@ -159,7 +161,7 @@ fun AmethystTheme( accentColor: AccentColorType = AccentColorType.PURPLE, fontFamily: FontFamilyType = FontFamilyType.SYSTEM, fontSize: FontSizeType = FontSizeType.NORMAL, - animationsEnabled: Boolean = true, + displaySettings: DisplaySettings = DisplaySettings(), content: @Composable () -> Unit, ) { // Deliberately no UiModeManager.nightMode write: changing the device night mode needs @@ -196,8 +198,9 @@ fun AmethystTheme( LocalDensity provides scaledDensity, // ImageLoaderSetup registers the avatar thumbnail cache and the local Blossom bridge. LocalProfilePictureCache provides true, + LocalDisplaySettings provides displaySettings, // Performance mode turns decorative animations (crossfades) off app-wide. - LocalAnimationsEnabled provides animationsEnabled, + LocalAnimationsEnabled provides !displaySettings.performanceMode, LocalTextStyle provides LocalTextStyle.current.merge(TextStyle(fontFamily = resolvedFontFamily)), content = content, ) diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt index dc32830cc4..0915fcb2d2 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/SelectNotificationProvider.kt @@ -29,7 +29,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.google.accompanist.permissions.ExperimentalPermissionsApi import com.google.accompanist.permissions.isGranted import com.google.accompanist.permissions.rememberPermissionState -import com.vitorpamplona.amethyst.model.UiSettingsFlow +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow @OptIn(ExperimentalPermissionsApi::class) @Composable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettings.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt similarity index 99% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettings.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt index 159afa0514..1246f0b855 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettings.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.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.model +package com.vitorpamplona.amethyst.commons.model import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.commons.resources.Res diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettingsFlow.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt similarity index 99% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettingsFlow.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt index d2528689c2..6a0870cfa8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/UiSettingsFlow.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.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.model +package com.vitorpamplona.amethyst.commons.model import androidx.compose.runtime.Stable import kotlinx.coroutines.flow.Flow diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/UserAvatar.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/UserAvatar.kt index 1e294c544f..a8d470f9f7 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/UserAvatar.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/UserAvatar.kt @@ -30,6 +30,7 @@ import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.Dp +import com.vitorpamplona.amethyst.commons.ui.screen.LocalDisplaySettings /** * Wrapper class for profile picture URLs that signals Coil to use the thumbnail @@ -58,7 +59,8 @@ val LocalProfilePictureCache = staticCompositionLocalOf { false } * @param size Size of the avatar (both width and height) * @param modifier Additional modifiers to apply * @param contentDescription Accessibility description - * @param loadProfilePicture Whether to load the profile picture (false = show robohash only) + * @param loadProfilePicture Whether to load the profile picture (false = show robohash only). + * Defaults to the user's display settings ([LocalDisplaySettings]), as do the next two. * @param loadRobohash Whether to generate robohash (false = show generic icon) * @param autoPlayGif Whether animated (GIF/AVIF) pictures play. Only Android can animate them; * desktop shows their first frame either way. @@ -74,9 +76,9 @@ fun UserAvatar( size: Dp, modifier: Modifier = Modifier, contentDescription: String? = null, - loadProfilePicture: Boolean = true, - loadRobohash: Boolean = true, - autoPlayGif: Boolean = true, + loadProfilePicture: Boolean = LocalDisplaySettings.current.showProfilePictures, + loadRobohash: Boolean = LocalDisplaySettings.current.loadRobohash, + autoPlayGif: Boolean = LocalDisplaySettings.current.autoPlayVideos, badge: @Composable (BoxScope.() -> Unit)? = null, ) { if (badge != null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ResourceToastMsg.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ResourceToastMsg.kt similarity index 95% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ResourceToastMsg.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ResourceToastMsg.kt index e8a3c263c8..11b62ccb8d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ResourceToastMsg.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ResourceToastMsg.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.ui.components.toasts +package com.vitorpamplona.amethyst.commons.ui.components.toasts import androidx.compose.runtime.Immutable import org.jetbrains.compose.resources.StringResource diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/StringToastMsg.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/StringToastMsg.kt similarity index 95% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/StringToastMsg.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/StringToastMsg.kt index 9a50a24425..ecfdd7a0c2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/StringToastMsg.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/StringToastMsg.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.ui.components.toasts +package com.vitorpamplona.amethyst.commons.ui.components.toasts import androidx.compose.runtime.Immutable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ThrowableToastMsg.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ThrowableToastMsg.kt similarity index 95% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ThrowableToastMsg.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ThrowableToastMsg.kt index 2d7f77f9f3..8236773234 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ThrowableToastMsg.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ThrowableToastMsg.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.ui.components.toasts +package com.vitorpamplona.amethyst.commons.ui.components.toasts import androidx.compose.runtime.Immutable import org.jetbrains.compose.resources.StringResource diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastManager.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastManager.kt similarity index 92% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastManager.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastManager.kt index 2e30e70d17..9d95a7b633 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastManager.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastManager.kt @@ -18,12 +18,12 @@ * 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.ui.components.toasts +package com.vitorpamplona.amethyst.commons.ui.components.toasts import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.commons.model.User -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.MultiErrorToastMsg -import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.MultiErrorToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline.UserBasedErrorMessage import kotlinx.coroutines.flow.MutableStateFlow import org.jetbrains.compose.resources.StringResource diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastMsg.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastMsg.kt similarity index 94% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastMsg.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastMsg.kt index b57e7a4ac6..91e73080bd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/ToastMsg.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/ToastMsg.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.ui.components.toasts +package com.vitorpamplona.amethyst.commons.ui.components.toasts import androidx.compose.runtime.Immutable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiErrorToastMsg.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/multiline/MultiErrorToastMsg.kt similarity index 92% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiErrorToastMsg.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/multiline/MultiErrorToastMsg.kt index 2d7c34bf76..644d8a7e3e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/MultiErrorToastMsg.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/toasts/multiline/MultiErrorToastMsg.kt @@ -18,11 +18,11 @@ * 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.ui.components.toasts.multiline +package com.vitorpamplona.amethyst.commons.ui.components.toasts.multiline import androidx.compose.runtime.Immutable import com.vitorpamplona.amethyst.commons.model.User -import com.vitorpamplona.amethyst.ui.components.toasts.ToastMsg +import com.vitorpamplona.amethyst.commons.ui.components.toasts.ToastMsg import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.update import org.jetbrains.compose.resources.StringResource 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 new file mode 100644 index 0000000000..ef3ffd4222 --- /dev/null +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/DisplaySettings.kt @@ -0,0 +1,77 @@ +/* + * 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.ui.screen + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +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 + +/** + * The display choices composables 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. + * + * The defaults are what a front end without these settings (previews, desktop today) gets: + * everything on. + */ +@Immutable +data class DisplaySettings( + /** Load profile pictures (off on metered connections when the user asked for WIFI_ONLY). */ + val showProfilePictures: Boolean = true, + /** Performance mode: skip robohashes, crossfades and other decoration. */ + 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() } + +/** Collects [settings] into a [DisplaySettings] that follows every change to it. */ +@Composable +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) { + DisplaySettings( + showProfilePictures = showProfilePictures, + performanceMode = featureSet == FeatureSetType.PERFORMANCE, + autoPlayVideos = autoPlayVideos, + showUrlPreview = showUrlPreview, + showImages = showImages, + startVideoPlayback = startVideoPlayback, + ) + } +} diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UiSettingsState.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt similarity index 94% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UiSettingsState.kt rename to commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt index ea6ed3fce7..e5620b83e6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UiSettingsState.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/UiSettingsState.kt @@ -18,14 +18,14 @@ * 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.ui.screen +package com.vitorpamplona.amethyst.commons.ui.screen import androidx.compose.runtime.Stable -import com.vitorpamplona.amethyst.model.BooleanType -import com.vitorpamplona.amethyst.model.ConnectivityType -import com.vitorpamplona.amethyst.model.FeatureSetType -import com.vitorpamplona.amethyst.model.ProfileGalleryType -import com.vitorpamplona.amethyst.model.UiSettingsFlow +import com.vitorpamplona.amethyst.commons.model.BooleanType +import com.vitorpamplona.amethyst.commons.model.ConnectivityType +import com.vitorpamplona.amethyst.commons.model.FeatureSetType +import com.vitorpamplona.amethyst.commons.model.ProfileGalleryType +import com.vitorpamplona.amethyst.commons.model.UiSettingsFlow import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow From c3f60fd8afbf4755cfb798b6be822e6df1bba3db Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 24 Sep 2026 15:51:48 +0000 Subject: [PATCH 2/2] fix: address the audit of the shared UI settings and display locals - UiSettings (enums) and UiSettingsFlow move on to headless commons, and UiSettingsState to commons.state. Their StringResource labels become `resourceId` extension properties in commonsUI (the TorType pattern). commons applies the serialization plugin, so UiSettings gets its kotlinx serializer back: in commonsUI it had none, and the encrypted-preferences fallback (JsonMapper.fromJson) would silently drop a user's old settings. New UiSettingsSerializationTest round-trips it. - tools/r8-verify/reflection-contract.txt names the eight persisted settings enums by their new package; the release check would fail. - LocalDisplaySettings is a compositionLocalOf: it follows Wi-Fi/metered changes, and as a static local it recomposed everything under the theme. It drops the three fields nothing read. - The remaining avatar sites (drawer, account switcher, top bar, group cards, ...) read LocalDisplaySettings instead of a one-off snapshot of accountViewModel.settings, so they follow setting changes like the feed. - 13 loaders left with an unused accountViewModel parameter after the LocalCache switch drop it (206 call sites). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0168wY9t7i9NC5u3svyMxEz6 --- .../baselineProfiles/baseline-prof.txt | 90 ++++++------- .../com/vitorpamplona/amethyst/AppModules.kt | 2 +- .../compose/RelayAuthComposeHelpers.kt | 2 - .../compose/RelayAuthPromptHost.kt | 7 +- .../amethyst/ui/call/CallWidgets.kt | 8 +- .../amethyst/ui/components/ClickableRoute.kt | 2 +- .../ui/components/ConcordInviteCard.kt | 5 +- .../amethyst/ui/components/RelayGroupCard.kt | 7 +- .../amethyst/ui/components/RichTextViewer.kt | 5 +- .../bottombars/GroupBottomBarEntries.kt | 5 +- .../drawer/AccountSwitchBottomSheet.kt | 5 +- .../ui/navigation/drawer/DrawerContent.kt | 5 +- .../topbars/UserDrawerSearchTopBar.kt | 5 +- .../vitorpamplona/amethyst/ui/note/Loaders.kt | 4 - .../amethyst/ui/note/MultiSetCompose.kt | 5 +- .../ui/note/NIP05VerificationDisplay.kt | 6 +- .../amethyst/ui/note/NoteCompose.kt | 9 +- .../amethyst/ui/note/ReactionsRow.kt | 2 +- .../amethyst/ui/note/RelayListRow.kt | 5 +- .../ui/note/UpdateReactionTypeDialog.kt | 3 +- .../amethyst/ui/note/UserProfilePicture.kt | 27 ++-- .../WatchAndLoadMyEmojiList.kt | 3 +- .../creators/invoice/ClinkOfferPreview.kt | 2 +- .../note/elements/AddInboxRelayForDMCard.kt | 1 - .../amethyst/ui/note/elements/ForkInfo.kt | 4 +- .../ui/note/share/ShareNoteAsImageScreen.kt | 4 +- .../ui/note/share/ShareNoteAsQrScreen.kt | 2 +- .../amethyst/ui/note/types/AppDefinition.kt | 4 +- .../ui/note/types/AppRecommendation.kt | 2 +- .../amethyst/ui/note/types/Attestation.kt | 12 +- .../ui/note/types/CalendarRsvpRender.kt | 2 +- .../amethyst/ui/note/types/Chess.kt | 8 +- .../amethyst/ui/note/types/CommunityHeader.kt | 9 +- .../amethyst/ui/note/types/Emoji.kt | 1 - .../amethyst/ui/note/types/EntityRating.kt | 4 +- .../amethyst/ui/note/types/FileStorage.kt | 2 +- .../amethyst/ui/note/types/Geocache.kt | 2 +- .../amethyst/ui/note/types/Git.kt | 8 +- .../ui/note/types/InteractiveStory.kt | 4 +- .../ui/note/types/LiveActivityChatMessage.kt | 2 +- .../amethyst/ui/note/types/MeetingSpace.kt | 1 - .../amethyst/ui/note/types/MusicPlaylist.kt | 8 +- .../amethyst/ui/note/types/MusicTrack.kt | 6 +- .../amethyst/ui/note/types/PodcastPeople.kt | 7 +- .../amethyst/ui/note/types/Publication.kt | 4 +- .../ui/note/types/PublicationSection.kt | 8 +- .../ui/note/types/RelayGroupMessage.kt | 5 +- .../ui/note/types/RenderPostApproval.kt | 2 +- .../ui/note/types/RenderVideoCollaboration.kt | 2 +- .../ui/note/types/RenderVideoCredits.kt | 2 +- .../ui/note/types/RenderVideoCurationSet.kt | 4 +- .../amethyst/ui/note/types/SnoPalettes.kt | 4 +- .../amethyst/ui/note/types/SoftwareApp.kt | 3 +- .../ui/note/types/TextModification.kt | 4 +- .../amethyst/ui/note/types/TorrentComment.kt | 2 +- .../ui/note/types/WikiCollaboration.kt | 4 +- .../ui/note/types/lists/ListItemRows.kt | 6 +- .../amethyst/ui/note/types/lists/MuteList.kt | 2 +- .../ui/screen/loggedIn/AccountViewModel.kt | 2 +- .../backups/BackupConflictEventViews.kt | 19 +-- .../backups/BackupConflictListViews.kt | 15 ++- .../backups/BackupConflictReviewScreen.kt | 8 +- .../badges/profile/ProfileBadgesScreen.kt | 2 +- .../ArticleBookmarkListManagementScreen.kt | 2 +- .../PostBookmarkListManagementScreen.kt | 2 +- .../loggedIn/buzz/AgentWorkBoardScreen.kt | 2 +- .../ui/screen/loggedIn/buzz/JobBoardScreen.kt | 2 +- .../loggedIn/buzz/WorkflowRunBoardScreen.kt | 2 +- .../create/NewCalendarEventScreen.kt | 2 +- .../detail/CalendarEventDetailScreen.kt | 2 +- .../loggedIn/chats/feed/ChatDeliveryTicks.kt | 2 +- .../chats/feed/types/RenderChatClip.kt | 2 +- .../chats/feed/types/RenderChatRaid.kt | 4 +- .../chats/geohashChat/GeohashChatScreen.kt | 7 +- .../chats/geohashChat/LoadGeohashChannel.kt | 2 - .../marmotGroup/MarmotGroupIconEditor.kt | 5 +- .../marmotGroup/MarmotGroupInfoScreen.kt | 13 +- .../loggedIn/chats/privateDM/ChatroomView.kt | 1 - .../chats/privateDM/header/ChatroomHeader.kt | 2 +- .../privateDM/header/DmReportWarningCard.kt | 2 +- .../privateDM/header/RenderRoomTopBar.kt | 6 +- .../privateDM/header/RoomNameOnlyDisplay.kt | 4 +- .../concord/ConcordHomeScreen.kt | 5 +- .../concord/ConcordMetadataForm.kt | 9 +- .../publicChannels/ephemChat/ChannelView.kt | 2 +- .../ephemChat/EphemeralChatScreen.kt | 2 +- .../ephemChat/LoadEphemeralChatChannel.kt | 2 - .../header/ShortEphemeralChatChannelHeader.kt | 5 +- .../nip28PublicChat/ChannelView.kt | 2 +- .../PublicChatChannelHeader.kt | 2 +- .../PublicChatChannelScreen.kt | 2 +- .../header/LongPublicChatChannelHeader.kt | 7 +- .../header/ShortPublicChatChannelHeader.kt | 7 +- .../metadata/ChannelMetadataScreen.kt | 2 +- .../nip53LiveActivities/ChannelView.kt | 2 +- .../LiveActivityChannelScreen.kt | 2 +- .../header/LiveStreamGoalHeader.kt | 2 +- .../header/LongLiveActivityChannelHeader.kt | 2 +- .../relayGroup/LoadRelayGroupChannel.kt | 2 - .../relayGroup/RelayGroupChannelListScreen.kt | 5 +- .../relayGroup/RelayGroupChannelView.kt | 2 +- .../relayGroup/RelayGroupChatScreen.kt | 2 +- .../relayGroup/RelayGroupDiscoveryScreen.kt | 9 +- .../relayGroup/RelayGroupMembersScreen.kt | 2 +- .../relayGroup/RelayGroupMetadataScreen.kt | 2 +- .../relayGroup/RelayGroupParentPicker.kt | 17 ++- .../relayGroup/RelayGroupServerList.kt | 5 +- .../relayGroup/RelayGroupSubgroupsBar.kt | 2 +- .../relayGroup/RelayGroupThreadsScreen.kt | 2 +- .../send/ChannelFileUploadDialog.kt | 5 +- .../chats/rooms/ChatroomHeaderCompose.kt | 42 +++--- .../loggedIn/communities/CommunityScreen.kt | 2 +- .../communities/NewCommunityNoteButton.kt | 2 +- .../newCommunity/NewCommunityScreen.kt | 5 +- .../contactList/ContactListUsersScreen.kt | 2 +- .../RenderPublicChatChannelThumb.kt | 2 +- .../nip53LiveActivities/LiveActivityCard.kt | 2 +- .../dvms/DvmContentDiscoveryScreen.kt | 4 +- .../ui/screen/loggedIn/dvms/DvmTopBar.kt | 4 +- .../emojipacks/list/ListOfEmojiPacksScreen.kt | 3 +- .../EmojiPackSelectionScreen.kt | 3 +- .../membershipManagement/MyEmojiListScreen.kt | 2 - .../followPacks/feed/FollowPackFeedScreen.kt | 2 +- .../geocaches/detail/GeocacheDetailParts.kt | 6 +- .../geocaches/hunt/GeocacheHuntScreen.kt | 2 +- .../geocaches/hunt/NewGeocacheHuntScreen.kt | 2 +- .../ui/screen/loggedIn/gitRepo/GitNewIssue.kt | 2 +- .../loggedIn/gitRepo/GitRepositoryScreen.kt | 8 +- .../loggedIn/home/AlgoFeedStatusBanner.kt | 2 +- .../loggedIn/music/NewMusicPlaylistScreen.kt | 2 +- .../room/activity/NestActivityContent.kt | 2 +- .../loggedIn/nests/room/lobby/NestJoinCard.kt | 2 +- .../nests/room/lobby/NestLobbyScreen.kt | 2 +- .../donations/ShowDonationCard.kt | 1 - .../notifications/donations/ZapTheDevsCard.kt | 1 - .../pictures/PictureCardComposePreview.kt | 3 - .../loggedIn/podcasts/PodcastTopSupporters.kt | 2 +- .../polls/results/PollResultsScreen.kt | 2 +- .../profile/gallery/GalleryCardCompose.kt | 2 +- .../profile/header/ProfilePaymentRailChips.kt | 4 +- .../profile/header/badges/DisplayBadges.kt | 9 +- .../profile/payment/SendPaymentScreen.kt | 2 +- .../ui/screen/loggedIn/qrcode/ShowQRScreen.kt | 7 +- .../loggedIn/redirect/LoadRedirectScreen.kt | 2 +- .../relayauth/RelayAuthSettingsScreen.kt | 5 +- .../loggedIn/relays/RelayInformationScreen.kt | 9 +- .../common/BasicRelaySetupInfoDialog.kt | 5 +- .../relays/common/ShowRelaySuggestionList.kt | 5 +- .../ActiveSubscriptionsScreen.kt | 5 +- .../ui/screen/loggedIn/search/SearchScreen.kt | 17 +-- .../loggedIn/settings/AppSettingsScreen.kt | 1 + .../settings/NotificationSettingsScreen.kt | 2 +- .../settings/ProfileUiSettingsScreen.kt | 1 + .../settings/SecurityFiltersScreen.kt | 1 + .../softwareapps/SoftwareAppDetailScreen.kt | 2 +- .../loggedIn/threadview/ThreadFeedView.kt | 4 +- .../loggedIn/threadview/ThreadScreen.kt | 2 +- .../loggedIn/wallet/CashuWalletScreen.kt | 2 +- .../wallet/OnchainTransactionsScreen.kt | 2 +- .../wallet/WalletTransactionsScreen.kt | 2 +- .../loggedIn/workouts/WorkoutDisplay.kt | 2 +- .../amethyst/commons/model/UiSettings.kt | 99 +++++--------- .../amethyst/commons/model/UiSettingsFlow.kt | 0 .../commons/state}/UiSettingsState.kt | 2 +- .../model/UiSettingsSerializationTest.kt | 53 ++++++++ .../commons/model/UiSettingsLabels.kt | 123 ++++++++++++++++++ .../commons/ui/screen/DisplaySettings.kt | 20 +-- tools/r8-verify/reflection-contract.txt | 16 +-- 168 files changed, 620 insertions(+), 479 deletions(-) rename {commonsUI => commons}/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettings.kt (66%) rename {commonsUI => commons}/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsFlow.kt (100%) rename {commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen => commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/state}/UiSettingsState.kt (99%) create mode 100644 commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsSerializationTest.kt create mode 100644 commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/UiSettingsLabels.kt 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