mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-08 17:23:54 +00:00
android, desktop: trim settings reorg diff
- Remove 5 dead strings from base/strings.xml (privacy_and_security, database_passphrase_and_export, settings_section_title_chat_database, settings_section_title_support, settings_section_title_app) — no Kotlin references after the reorg. - Drop the now single-variant CurrentPage enum in NotificationsSettingsView; replace with a direct callback. - Read userDisplayName locally in HelpAndSupportView instead of threading it through SettingsLayout/SettingsView/Preview.
This commit is contained in:
+2
-2
@@ -22,18 +22,18 @@ import dev.icerock.moko.resources.compose.stringResource
|
|||||||
@Composable
|
@Composable
|
||||||
fun HelpAndSupportView(
|
fun HelpAndSupportView(
|
||||||
chatModel: ChatModel,
|
chatModel: ChatModel,
|
||||||
userDisplayName: String?,
|
|
||||||
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
||||||
showCustomModal: (@Composable ModalData.(ChatModel, () -> Unit) -> Unit) -> (() -> Unit),
|
showCustomModal: (@Composable ModalData.(ChatModel, () -> Unit) -> Unit) -> (() -> Unit),
|
||||||
showVersion: () -> Unit,
|
showVersion: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val uriHandler = LocalUriHandler.current
|
val uriHandler = LocalUriHandler.current
|
||||||
val stopped = chatModel.chatRunning.value == false
|
val stopped = chatModel.chatRunning.value == false
|
||||||
|
val userDisplayName = chatModel.currentUser.value?.displayName ?: ""
|
||||||
ColumnWithScrollBar {
|
ColumnWithScrollBar {
|
||||||
AppBarTitle(stringResource(MR.strings.help_and_support))
|
AppBarTitle(stringResource(MR.strings.help_and_support))
|
||||||
|
|
||||||
SectionView(stringResource(MR.strings.settings_section_title_help)) {
|
SectionView(stringResource(MR.strings.settings_section_title_help)) {
|
||||||
SettingsActionItem(painterResource(MR.images.ic_help), stringResource(MR.strings.how_to_use_simplex_chat), showModal { HelpView(userDisplayName ?: "") }, disabled = stopped)
|
SettingsActionItem(painterResource(MR.images.ic_help), stringResource(MR.strings.how_to_use_simplex_chat), showModal { HelpView(userDisplayName) }, disabled = stopped)
|
||||||
SettingsActionItem(painterResource(MR.images.ic_add), stringResource(MR.strings.whats_new), showCustomModal { _, close -> WhatsNewView(viaSettings = true, close = close) }, disabled = stopped)
|
SettingsActionItem(painterResource(MR.images.ic_add), stringResource(MR.strings.whats_new), showCustomModal { _, close -> WhatsNewView(viaSettings = true, close = close) }, disabled = stopped)
|
||||||
}
|
}
|
||||||
SectionDividerSpaced()
|
SectionDividerSpaced()
|
||||||
|
|||||||
+4
-10
@@ -26,24 +26,18 @@ fun NotificationsSettingsView(
|
|||||||
) {
|
) {
|
||||||
NotificationsSettingsLayout(
|
NotificationsSettingsLayout(
|
||||||
notificationsMode = remember { chatModel.controller.appPrefs.notificationsMode.state },
|
notificationsMode = remember { chatModel.controller.appPrefs.notificationsMode.state },
|
||||||
showPage = { page ->
|
showNotificationsMode = {
|
||||||
ModalManager.start.showModalCloseable(true) {
|
ModalManager.start.showModalCloseable(true) {
|
||||||
when (page) {
|
NotificationsModeView(chatModel.controller.appPrefs.notificationsMode.state) { changeNotificationsMode(it, chatModel) }
|
||||||
CurrentPage.NOTIFICATIONS_MODE -> NotificationsModeView(chatModel.controller.appPrefs.notificationsMode.state) { changeNotificationsMode(it, chatModel) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class CurrentPage {
|
|
||||||
NOTIFICATIONS_MODE
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NotificationsSettingsLayout(
|
fun NotificationsSettingsLayout(
|
||||||
notificationsMode: State<NotificationsMode>,
|
notificationsMode: State<NotificationsMode>,
|
||||||
showPage: (CurrentPage) -> Unit,
|
showNotificationsMode: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val modes = remember { notificationModes() }
|
val modes = remember { notificationModes() }
|
||||||
|
|
||||||
@@ -51,7 +45,7 @@ fun NotificationsSettingsLayout(
|
|||||||
AppBarTitle(stringResource(MR.strings.notifications))
|
AppBarTitle(stringResource(MR.strings.notifications))
|
||||||
SectionView(null) {
|
SectionView(null) {
|
||||||
if (appPlatform == AppPlatform.ANDROID) {
|
if (appPlatform == AppPlatform.ANDROID) {
|
||||||
SettingsActionItemWithContent(null, stringResource(MR.strings.settings_notifications_mode_title), { showPage(CurrentPage.NOTIFICATIONS_MODE) }) {
|
SettingsActionItemWithContent(null, stringResource(MR.strings.settings_notifications_mode_title), showNotificationsMode) {
|
||||||
Text(
|
Text(
|
||||||
modes.firstOrNull { it.value == notificationsMode.value }?.title ?: "",
|
modes.firstOrNull { it.value == notificationsMode.value }?.title ?: "",
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
|
|||||||
+1
-5
@@ -33,13 +33,11 @@ import chat.simplex.res.MR
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, close: () -> Unit) {
|
fun SettingsView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, close: () -> Unit) {
|
||||||
val user = chatModel.currentUser.value
|
|
||||||
val stopped = chatModel.chatRunning.value == false
|
val stopped = chatModel.chatRunning.value == false
|
||||||
SettingsLayout(
|
SettingsLayout(
|
||||||
stopped,
|
stopped,
|
||||||
chatModel.chatDbEncrypted.value == true,
|
chatModel.chatDbEncrypted.value == true,
|
||||||
remember { chatModel.controller.appPrefs.storeDBPassphrase.state }.value,
|
remember { chatModel.controller.appPrefs.storeDBPassphrase.state }.value,
|
||||||
user?.displayName,
|
|
||||||
setPerformLA = setPerformLA,
|
setPerformLA = setPerformLA,
|
||||||
showModal = { modalView -> { ModalManager.start.showModal { modalView(chatModel) } } },
|
showModal = { modalView -> { ModalManager.start.showModal { modalView(chatModel) } } },
|
||||||
showSettingsModal = { modalView -> { ModalManager.start.showModal(settings = true, cardScreen = true) { modalView(chatModel) } } },
|
showSettingsModal = { modalView -> { ModalManager.start.showModal(settings = true, cardScreen = true) { modalView(chatModel) } } },
|
||||||
@@ -79,7 +77,6 @@ fun SettingsLayout(
|
|||||||
stopped: Boolean,
|
stopped: Boolean,
|
||||||
encrypted: Boolean,
|
encrypted: Boolean,
|
||||||
passphraseSaved: Boolean,
|
passphraseSaved: Boolean,
|
||||||
userDisplayName: String?,
|
|
||||||
setPerformLA: (Boolean) -> Unit,
|
setPerformLA: (Boolean) -> Unit,
|
||||||
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
||||||
showSettingsModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
showSettingsModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
|
||||||
@@ -103,7 +100,7 @@ fun SettingsLayout(
|
|||||||
SectionDividerSpaced()
|
SectionDividerSpaced()
|
||||||
|
|
||||||
SectionView {
|
SectionView {
|
||||||
SettingsActionItem(painterResource(MR.images.ic_help), stringResource(MR.strings.help_and_support), showSettingsModal { HelpAndSupportView(it, userDisplayName, showModal, showCustomModal, showVersion) })
|
SettingsActionItem(painterResource(MR.images.ic_help), stringResource(MR.strings.help_and_support), showSettingsModal { HelpAndSupportView(it, showModal, showCustomModal, showVersion) })
|
||||||
SettingsActionItem(painterResource(MR.images.ic_ios_share), stringResource(MR.strings.migrate_from_device_to_another_device), { withAuth(generalGetString(MR.strings.auth_open_migration_to_another_device), generalGetString(MR.strings.auth_log_in_using_credential)) { ModalManager.fullscreen.showCustomModal { close -> MigrateFromDeviceView(close) } } }, disabled = stopped)
|
SettingsActionItem(painterResource(MR.images.ic_ios_share), stringResource(MR.strings.migrate_from_device_to_another_device), { withAuth(generalGetString(MR.strings.auth_open_migration_to_another_device), generalGetString(MR.strings.auth_log_in_using_credential)) { ModalManager.fullscreen.showCustomModal { close -> MigrateFromDeviceView(close) } } }, disabled = stopped)
|
||||||
SettingsActionItem(painterResource(MR.images.ic_code), stringResource(MR.strings.advanced_settings), showSettingsModal { AdvancedSettingsView(it, showModal, showSettingsModal, showCustomModal, withAuth) })
|
SettingsActionItem(painterResource(MR.images.ic_code), stringResource(MR.strings.advanced_settings), showSettingsModal { AdvancedSettingsView(it, showModal, showSettingsModal, showCustomModal, withAuth) })
|
||||||
}
|
}
|
||||||
@@ -407,7 +404,6 @@ fun PreviewSettingsLayout() {
|
|||||||
stopped = false,
|
stopped = false,
|
||||||
encrypted = false,
|
encrypted = false,
|
||||||
passphraseSaved = false,
|
passphraseSaved = false,
|
||||||
userDisplayName = "Alice",
|
|
||||||
setPerformLA = { _ -> },
|
setPerformLA = { _ -> },
|
||||||
showModal = { {} },
|
showModal = { {} },
|
||||||
showSettingsModal = { {} },
|
showSettingsModal = { {} },
|
||||||
|
|||||||
@@ -972,7 +972,6 @@
|
|||||||
<string name="your_simplex_contact_address">Your SimpleX address</string>
|
<string name="your_simplex_contact_address">Your SimpleX address</string>
|
||||||
<string name="your_chat_profiles">Your chat profiles</string>
|
<string name="your_chat_profiles">Your chat profiles</string>
|
||||||
<string name="create_chat_profile">Create chat profile</string>
|
<string name="create_chat_profile">Create chat profile</string>
|
||||||
<string name="database_passphrase_and_export">Database passphrase & export</string>
|
|
||||||
<string name="about_simplex_chat">About SimpleX Chat</string>
|
<string name="about_simplex_chat">About SimpleX Chat</string>
|
||||||
<string name="how_to_use_simplex_chat">How to use it</string>
|
<string name="how_to_use_simplex_chat">How to use it</string>
|
||||||
<string name="markdown_help">Markdown help</string>
|
<string name="markdown_help">Markdown help</string>
|
||||||
@@ -1457,7 +1456,6 @@
|
|||||||
<string name="alert_text_fragment_please_report_to_developers">Please report it to the developers.</string>
|
<string name="alert_text_fragment_please_report_to_developers">Please report it to the developers.</string>
|
||||||
|
|
||||||
<!-- Privacy settings -->
|
<!-- Privacy settings -->
|
||||||
<string name="privacy_and_security">Privacy & security</string>
|
|
||||||
<string name="your_privacy">Your privacy</string>
|
<string name="your_privacy">Your privacy</string>
|
||||||
<string name="protect_app_screen">Protect app screen</string>
|
<string name="protect_app_screen">Protect app screen</string>
|
||||||
<string name="encrypt_local_files">Encrypt local files</string>
|
<string name="encrypt_local_files">Encrypt local files</string>
|
||||||
@@ -1539,10 +1537,7 @@
|
|||||||
<!-- Settings sections -->
|
<!-- Settings sections -->
|
||||||
<string name="settings_section_title_you">You</string>
|
<string name="settings_section_title_you">You</string>
|
||||||
<string name="settings_section_title_settings">Settings</string>
|
<string name="settings_section_title_settings">Settings</string>
|
||||||
<string name="settings_section_title_chat_database">Chat database</string>
|
|
||||||
<string name="settings_section_title_help">Help</string>
|
<string name="settings_section_title_help">Help</string>
|
||||||
<string name="settings_section_title_support">Support SimpleX Chat</string>
|
|
||||||
<string name="settings_section_title_app">App</string>
|
|
||||||
<string name="settings_section_title_device">Device</string>
|
<string name="settings_section_title_device">Device</string>
|
||||||
<string name="settings_section_title_chats">Chats</string>
|
<string name="settings_section_title_chats">Chats</string>
|
||||||
<string name="settings_section_title_files">Files</string>
|
<string name="settings_section_title_files">Files</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user