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:
Narasimha-sc
2026-05-23 15:31:28 +00:00
parent 4cf683dda1
commit 442a368c9f
4 changed files with 7 additions and 22 deletions
@@ -22,18 +22,18 @@ import dev.icerock.moko.resources.compose.stringResource
@Composable
fun HelpAndSupportView(
chatModel: ChatModel,
userDisplayName: String?,
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
showCustomModal: (@Composable ModalData.(ChatModel, () -> Unit) -> Unit) -> (() -> Unit),
showVersion: () -> Unit,
) {
val uriHandler = LocalUriHandler.current
val stopped = chatModel.chatRunning.value == false
val userDisplayName = chatModel.currentUser.value?.displayName ?: ""
ColumnWithScrollBar {
AppBarTitle(stringResource(MR.strings.help_and_support))
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)
}
SectionDividerSpaced()
@@ -26,24 +26,18 @@ fun NotificationsSettingsView(
) {
NotificationsSettingsLayout(
notificationsMode = remember { chatModel.controller.appPrefs.notificationsMode.state },
showPage = { page ->
showNotificationsMode = {
ModalManager.start.showModalCloseable(true) {
when (page) {
CurrentPage.NOTIFICATIONS_MODE -> NotificationsModeView(chatModel.controller.appPrefs.notificationsMode.state) { changeNotificationsMode(it, chatModel) }
}
NotificationsModeView(chatModel.controller.appPrefs.notificationsMode.state) { changeNotificationsMode(it, chatModel) }
}
},
)
}
enum class CurrentPage {
NOTIFICATIONS_MODE
}
@Composable
fun NotificationsSettingsLayout(
notificationsMode: State<NotificationsMode>,
showPage: (CurrentPage) -> Unit,
showNotificationsMode: () -> Unit,
) {
val modes = remember { notificationModes() }
@@ -51,7 +45,7 @@ fun NotificationsSettingsLayout(
AppBarTitle(stringResource(MR.strings.notifications))
SectionView(null) {
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(
modes.firstOrNull { it.value == notificationsMode.value }?.title ?: "",
maxLines = 1,
@@ -33,13 +33,11 @@ import chat.simplex.res.MR
@Composable
fun SettingsView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, close: () -> Unit) {
val user = chatModel.currentUser.value
val stopped = chatModel.chatRunning.value == false
SettingsLayout(
stopped,
chatModel.chatDbEncrypted.value == true,
remember { chatModel.controller.appPrefs.storeDBPassphrase.state }.value,
user?.displayName,
setPerformLA = setPerformLA,
showModal = { modalView -> { ModalManager.start.showModal { modalView(chatModel) } } },
showSettingsModal = { modalView -> { ModalManager.start.showModal(settings = true, cardScreen = true) { modalView(chatModel) } } },
@@ -79,7 +77,6 @@ fun SettingsLayout(
stopped: Boolean,
encrypted: Boolean,
passphraseSaved: Boolean,
userDisplayName: String?,
setPerformLA: (Boolean) -> Unit,
showModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
showSettingsModal: (@Composable (ChatModel) -> Unit) -> (() -> Unit),
@@ -103,7 +100,7 @@ fun SettingsLayout(
SectionDividerSpaced()
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_code), stringResource(MR.strings.advanced_settings), showSettingsModal { AdvancedSettingsView(it, showModal, showSettingsModal, showCustomModal, withAuth) })
}
@@ -407,7 +404,6 @@ fun PreviewSettingsLayout() {
stopped = false,
encrypted = false,
passphraseSaved = false,
userDisplayName = "Alice",
setPerformLA = { _ -> },
showModal = { {} },
showSettingsModal = { {} },
@@ -972,7 +972,6 @@
<string name="your_simplex_contact_address">Your SimpleX address</string>
<string name="your_chat_profiles">Your chat profiles</string>
<string name="create_chat_profile">Create chat profile</string>
<string name="database_passphrase_and_export">Database passphrase &amp; export</string>
<string name="about_simplex_chat">About SimpleX Chat</string>
<string name="how_to_use_simplex_chat">How to use it</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>
<!-- Privacy settings -->
<string name="privacy_and_security">Privacy &amp; security</string>
<string name="your_privacy">Your privacy</string>
<string name="protect_app_screen">Protect app screen</string>
<string name="encrypt_local_files">Encrypt local files</string>
@@ -1539,10 +1537,7 @@
<!-- Settings sections -->
<string name="settings_section_title_you">You</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_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_chats">Chats</string>
<string name="settings_section_title_files">Files</string>