Refactor: Introduce FullScreenContainedLoader and use rememberUpdatedState

This commit introduces `FullScreenContainedLoader` and replaces usages of `FullScreenLoader` where appropriate.

It also updates several composables to use `rememberUpdatedState` for lambda parameters to ensure the latest versions are used.

Additionally, the following changes are included:
- Add a setting to show/hide the attachment button in the chat input bar.
- Implement navigation to `PhotoViewScreen` when a photo attachment is clicked in a message.
- Add "Copy link" and "Copy image" actions to `PhotoViewScreen`.
- Remove unused settings and their corresponding logic from `SettingsViewModel` and `UserSettings`.
This commit is contained in:
2025-06-24 14:44:51 +03:00
parent c1e76e1c60
commit 3dae1fe101
29 changed files with 406 additions and 192 deletions
@@ -201,24 +201,12 @@ class SettingsViewModelImpl(
userSettings.onAppLanguageChanged(newLanguage)
}
SettingsKeys.DEFAULT_VALUE_FEATURES_FAST_TEXT -> {
val newText = newValue as? String ?: SettingsKeys.DEFAULT_VALUE_FEATURES_FAST_TEXT
userSettings.onFastTextChanged(newText)
}
SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS -> {
val isUsing = newValue as? Boolean
?: SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS
userSettings.onSendOnlineStatusChanged(isUsing)
}
SettingsKeys.KEY_DEBUG_SHOW_CRASH_ALERT -> {
val show = newValue as? Boolean ?: SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
userSettings.onShowAlertAfterCrashChanged(show)
}
SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND -> {
val inBackground = newValue as? Boolean
?: SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND
@@ -240,17 +228,6 @@ class SettingsViewModelImpl(
userSettings.onUseBlurChanged(isUsing)
}
SettingsKeys.KEY_SHOW_EMOJI_BUTTON -> {
val show = newValue as? Boolean ?: SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
userSettings.onShowEmojiButtonChanged(show)
}
SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES -> {
val show = newValue as? Boolean
?: SettingsKeys.DEFAULT_SHOW_TIME_IN_ACTION_MESSAGES
userSettings.onShowTimeInActionMessagesChanged(show)
}
SettingsKeys.KEY_USE_SYSTEM_FONT -> {
val use = newValue as? Boolean ?: SettingsKeys.DEFAULT_USE_SYSTEM_FONT
userSettings.onUseSystemFontChanged(use)
@@ -302,6 +279,12 @@ class SettingsViewModelImpl(
text = UiText.Resource(UiR.string.settings_general_show_emoji_button_summary),
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
)
val generalShowAttachmentButton = SettingsItem.Switch(
key = SettingsKeys.KEY_SHOW_ATTACHMENT_BUTTON,
title = UiText.Resource(UiR.string.settings_general_show_attachment_button_title),
text = UiText.Resource(UiR.string.settings_general_show_attachment_button_summary),
defaultValue = SettingsKeys.DEFAULT_VALUE_SHOW_ATTACHMENT_BUTTON
)
val generalEnableHaptic = SettingsItem.Switch(
key = SettingsKeys.KEY_ENABLE_HAPTIC,
defaultValue = SettingsKeys.DEFAULT_ENABLE_HAPTIC,
@@ -476,6 +459,7 @@ class SettingsViewModelImpl(
generalTitle,
generalUseContactNames,
generalShowEmojiButton,
generalShowAttachmentButton,
generalEnableHaptic
)
val appearanceList = listOf(