Modern Apps git

← Modern-Apps.git

email: convert raw Scaffolds to shared AppScaffold/DetailScaffold

Commit
fe971752d0e0db49670b62b84e700f40f14d4913
Author
vayun-mathur <[email protected]>
When
2026-08-16 02:54 UTC (3 months ago)
Parents
12a18df
Replace androidx/library raw Scaffold+TopAppBar boilerplate with the shared
AppScaffold (free-form/list/viewer screens) and DetailScaffold (scrolling
settings). Preserves titles, nav-icon style, actions, FAB, bottomBar and
snackbar; removes hand-rolled top bars. Skips widget/EmailWidget.kt (Glance).

Diff

email/src/main/java/com/vayunmathur/email/ui/AddAccountScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/AddAccountScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/AddAccountScreen.ktindex c77daf2023..e7c344590f 100644--- a/email/src/main/java/com/vayunmathur/email/ui/AddAccountScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/AddAccountScreen.kt@@ -53,18 +53,14 @@ fun AddAccountScreen(      androidx.activity.compose.BackHandler(enabled = selectedProvider != null) { selectedProviderId = null } -    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text(if (selectedProvider == null) stringResource(R.string.add_account) else selectedProvider.displayName) },-                navigationIcon = {-                    val backTarget: (() -> Unit)? = when {-                        selectedProvider != null -> ({ selectedProviderId = null })-                        else -> onBack-                    }-                    if (backTarget != null) { IconNavigation(backTarget) }-                },-            )+    AppScaffold(+        title = if (selectedProvider == null) stringResource(R.string.add_account) else selectedProvider.displayName,+        navigationIcon = {+            val backTarget: (() -> Unit)? = when {+                selectedProvider != null -> ({ selectedProviderId = null })+                else -> onBack+            }+            if (backTarget != null) { IconNavigation(backTarget) }         },     ) { padding ->         Box(Modifier.padding(padding).fillMaxSize()) {
email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.ktindex 0a1d4b54f7..a86a74dba8 100644--- a/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt@@ -183,85 +183,81 @@ fun ComposerScreen(         }     } -    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text(stringResource(R.string.compose)) },-                navigationIcon = { IconNavigation(onBack) },-                actions = {-                    IconButton(onClick = { attachmentLauncher.launch("*/*") }) {-                        IconAttachment()-                    }-                    IconButton(onClick = {-                        // Prefer new photo picker-                        try {-                            pickVisualLauncher.launch(androidx.activity.result.PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))-                        } catch (_: Exception) {-                            inlineFallbackLauncher.launch("image/*")-                        }-                    }) {-                        com.vayunmathur.library.ui.IconImage()-                    }-                    Box {-                        TextButton(onClick = { showSchedule = true }, enabled = fromAccount != null) {-                            Text(stringResource(R.string.later))-                        }-                        DropdownMenu(expanded = showSchedule, onDismissRequest = { showSchedule = false }) {-                            val schedule = { at: Long ->-                                showSchedule = false-                                fromAccount?.let { acc ->-                                    viewModel.scheduleSend(-                                        account = acc, to = to, subject = subject,-                                        body = bodyController.html,-                                        asHtml = true,-                                        cc = cc.ifBlank { null }, bcc = bcc.ifBlank { null },-                                        attachments = attachments,-                                        inlineImages = bodyController.toInlineAttachments(),-                                        inReplyTo = inReplyTo,-                                        references = references, scheduledAt = at,-                                    ) { currentDraftId?.let { viewModel.deleteDraft(it) } }-                                    AppMessages.show(resources.getString(R.string.scheduled))-                                    onBack()-                                }-                            }-                            DropdownMenuItem(text = { Text(stringResource(R.string.in_1_hour)) }, onClick = { schedule(System.currentTimeMillis() + 3_600_000L) })-                            DropdownMenuItem(text = { Text(stringResource(R.string.this_evening_6_pm)) }, onClick = { schedule(scheduleTime(18, sameDay = true)) })-                            DropdownMenuItem(text = { Text(stringResource(R.string.tomorrow_8_am)) }, onClick = { schedule(scheduleTime(8, sameDay = false)) })+    AppScaffold(+        title = stringResource(R.string.compose),+        onNavigateBack = onBack,+        actions = {+            IconButton(onClick = { attachmentLauncher.launch("*/*") }) {+                IconAttachment()+            }+            IconButton(onClick = {+                // Prefer new photo picker+                try {+                    pickVisualLauncher.launch(androidx.activity.result.PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))+                } catch (_: Exception) {+                    inlineFallbackLauncher.launch("image/*")+                }+            }) {+                com.vayunmathur.library.ui.IconImage()+            }+            Box {+                TextButton(onClick = { showSchedule = true }, enabled = fromAccount != null) {+                    Text(stringResource(R.string.later))+                }+                DropdownMenu(expanded = showSchedule, onDismissRequest = { showSchedule = false }) {+                    val schedule = { at: Long ->+                        showSchedule = false+                        fromAccount?.let { acc ->+                            viewModel.scheduleSend(+                                account = acc, to = to, subject = subject,+                                body = bodyController.html,+                                asHtml = true,+                                cc = cc.ifBlank { null }, bcc = bcc.ifBlank { null },+                                attachments = attachments,+                                inlineImages = bodyController.toInlineAttachments(),+                                inReplyTo = inReplyTo,+                                references = references, scheduledAt = at,+                            ) { currentDraftId?.let { viewModel.deleteDraft(it) } }+                            AppMessages.show(resources.getString(R.string.scheduled))+                            onBack()                         }                     }-                    IconButton(onClick = {-                        val acc = fromAccount ?: return@IconButton-                        sending = true-                        viewModel.sendEmailFrom(-                            account = acc,-                            to = to,-                            subject = subject,-                            body = bodyController.html,-                            asHtml = true,-                            cc = cc.ifBlank { null },-                            bcc = bcc.ifBlank { null },-                            attachments = attachments,-                            inlineImages = bodyController.toInlineAttachments(),-                            inReplyTo = inReplyTo,-                            references = references,-                            onSuccess = {-                                sending = false-                                currentDraftId?.let { viewModel.deleteDraft(it) }-                                AppMessages.show(resources.getString(R.string.message_sent))-                                onBack()-                            },-                            onError = { err ->-                                sending = false-                                AppMessages.show(resources.getString(R.string.saved_to_outbox, err))-                                onBack()-                            }-                        )-                    }, enabled = !sending && fromAccount != null) {-                        if (sending) CircularProgressIndicator(modifier = Modifier.size(24.dp))-                        else IconSend()-                    }+                    DropdownMenuItem(text = { Text(stringResource(R.string.in_1_hour)) }, onClick = { schedule(System.currentTimeMillis() + 3_600_000L) })+                    DropdownMenuItem(text = { Text(stringResource(R.string.this_evening_6_pm)) }, onClick = { schedule(scheduleTime(18, sameDay = true)) })+                    DropdownMenuItem(text = { Text(stringResource(R.string.tomorrow_8_am)) }, onClick = { schedule(scheduleTime(8, sameDay = false)) })                 }-            )+            }+            IconButton(onClick = {+                val acc = fromAccount ?: return@IconButton+                sending = true+                viewModel.sendEmailFrom(+                    account = acc,+                    to = to,+                    subject = subject,+                    body = bodyController.html,+                    asHtml = true,+                    cc = cc.ifBlank { null },+                    bcc = bcc.ifBlank { null },+                    attachments = attachments,+                    inlineImages = bodyController.toInlineAttachments(),+                    inReplyTo = inReplyTo,+                    references = references,+                    onSuccess = {+                        sending = false+                        currentDraftId?.let { viewModel.deleteDraft(it) }+                        AppMessages.show(resources.getString(R.string.message_sent))+                        onBack()+                    },+                    onError = { err ->+                        sending = false+                        AppMessages.show(resources.getString(R.string.saved_to_outbox, err))+                        onBack()+                    }+                )+            }, enabled = !sending && fromAccount != null) {+                if (sending) CircularProgressIndicator(modifier = Modifier.size(24.dp))+                else IconSend()+            }         },         bottomBar = {             // Always show formatting toolbar? Per plan, only when focused, but now scrollable and more buttons@@ -275,7 +271,7 @@ fun ComposerScreen(                         }                     })             }-        }+        },     ) { padding ->         Column(modifier = Modifier.padding(padding).padding(horizontal = 16.dp, vertical = 8.dp).fillMaxSize(), verticalArrangement = Arrangement.spacedBy(4.dp)) {             Surface(
email/src/main/java/com/vayunmathur/email/ui/DraftsScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/DraftsScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/DraftsScreen.ktindex 1731302979..9de81607d1 100644--- a/email/src/main/java/com/vayunmathur/email/ui/DraftsScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/DraftsScreen.kt@@ -20,13 +20,9 @@ fun DraftsScreen(     onOpenDraft: (Long) -> Unit, ) {     val drafts by viewModel.drafts.collectAsStateWithLifecycle(emptyList())-    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text(stringResource(R.string.drafts)) },-                navigationIcon = { IconNavigation(onBack) },-            )-        }+    AppScaffold(+        title = stringResource(R.string.drafts),+        onNavigateBack = onBack,     ) { padding ->         if (drafts.isEmpty()) {             EmptyState(
email/src/main/java/com/vayunmathur/email/ui/EmlViewerScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/EmlViewerScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/EmlViewerScreen.ktindex 4a02b65e96..8f43bec77b 100644--- a/email/src/main/java/com/vayunmathur/email/ui/EmlViewerScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/EmlViewerScreen.kt@@ -10,17 +10,16 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.* import com.vayunmathur.library.util.AppMessages+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.ExperimentalMaterial3Api import com.vayunmathur.library.ui.HorizontalDivider import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.library.ui.TopAppBar import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color@@ -72,24 +71,20 @@ fun EmlViewerScreen(         loading = false     } -    Scaffold(-        topBar = {-            TopAppBar(-                title = {-                    val t = parsed?.message?.subject ?: uriString.substringAfterLast('/').substringAfterLast("%2F")-                    Text(t.ifBlank { stringResource(R.string.e_mail_file) }, maxLines = 1)-                },-                navigationIcon = { IconNavigation(onBack) },-                actions = {-                    val msg = parsed?.message-                    if (msg != null) {-                        IconButton(onClick = { onComposeForward("Fwd: ${msg.subject}", msg.body ?: "") }) {-                            IconForward()-                        }-                    }+    AppScaffold(+        title = {+            val t = parsed?.message?.subject ?: uriString.substringAfterLast('/').substringAfterLast("%2F")+            Text(t.ifBlank { stringResource(R.string.e_mail_file) }, maxLines = 1)+        },+        onNavigateBack = onBack,+        actions = {+            val msg = parsed?.message+            if (msg != null) {+                IconButton(onClick = { onComposeForward("Fwd: ${msg.subject}", msg.body ?: "") }) {+                    IconForward()                 }-            )-        }+            }+        },     ) { padding ->         when {             loading -> {
email/src/main/java/com/vayunmathur/email/ui/MessageListScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/MessageListScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/MessageListScreen.ktindex 2ee7d1692d..18a9fbf8a5 100644--- a/email/src/main/java/com/vayunmathur/email/ui/MessageListScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/MessageListScreen.kt@@ -41,6 +41,7 @@ import com.vayunmathur.email.data.senderDisplayName import com.vayunmathur.email.platform.EmailViewModel import com.vayunmathur.email.platform.MessageListActions import com.vayunmathur.email.platform.MessageListUiState+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.CardDefaults import com.vayunmathur.library.ui.CircularProgressIndicator@@ -61,12 +62,10 @@ import com.vayunmathur.library.ui.LinearProgressIndicator import com.vayunmathur.library.ui.ListItem import com.vayunmathur.library.ui.ListItemDefaults import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.SnackbarHost import com.vayunmathur.library.ui.SnackbarHostState import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text-import com.vayunmathur.library.ui.TopAppBar  @Composable fun MessageListPage(@@ -141,42 +140,44 @@ fun MessageListScreen(         }     } -    Scaffold(-        snackbarHost = { SnackbarHost(snackbarHostState) },-        topBar = {-            if (state.selectedUids.isNotEmpty()) {-                TopAppBar(-                    title = { Text(stringResource(R.string.selected_count, state.selectedUids.size)) },-                    navigationIcon = { IconButton(onClick = { actions.clearSelection() }) { IconClose() } },-                    actions = {-                        IconButton(onClick = {-                            val account = state.selectedAccountEmail ?: state.messages.firstOrNull { it.id in state.selectedUids }?.accountEmail ?: return@IconButton-                            actions.bulkMarkAsRead(account, state.selectedUids.toList(), true)-                        }) { IconMarkRead() }-                        IconButton(onClick = {-                            val account = state.selectedAccountEmail ?: state.messages.firstOrNull { it.id in state.selectedUids }?.accountEmail ?: return@IconButton-                            actions.bulkMarkAsRead(account, state.selectedUids.toList(), false)-                        }) { IconMarkUnread() }-                    }-                )-            } else if (isSearching) {-                TopAppBar(-                    title = { CommonSearchBar(value = state.searchQuery, onValueChange = { actions.setSearchQuery(it) }, padding = PaddingValues(0.dp)) },-                    navigationIcon = { IconNavigation { isSearching = false; actions.setSearchQuery("") } }-                )-            } else {-                TopAppBar(-                    title = { Text(if (state.selectedAccountEmail == null) stringResource(R.string.unified_inbox) else state.selectedFolderName) },-                    navigationIcon = { IconButton(onClick = onOpenDrawer) { IconMenu() } },-                    actions = { IconButton(onClick = { isSearching = true }) { IconSearch() } }-                )+    val selectionActive = state.selectedUids.isNotEmpty()+    AppScaffold(+        title = {+            when {+                selectionActive -> Text(stringResource(R.string.selected_count, state.selectedUids.size))+                isSearching -> CommonSearchBar(value = state.searchQuery, onValueChange = { actions.setSearchQuery(it) }, padding = PaddingValues(0.dp))+                else -> Text(if (state.selectedAccountEmail == null) stringResource(R.string.unified_inbox) else state.selectedFolderName)+            }+        },+        navigationIcon = {+            when {+                selectionActive -> IconButton(onClick = { actions.clearSelection() }) { IconClose() }+                isSearching -> IconNavigation { isSearching = false; actions.setSearchQuery("") }+                else -> IconButton(onClick = onOpenDrawer) { IconMenu() }+            }+        },+        actions = {+            when {+                selectionActive -> {+                    IconButton(onClick = {+                        val account = state.selectedAccountEmail ?: state.messages.firstOrNull { it.id in state.selectedUids }?.accountEmail ?: return@IconButton+                        actions.bulkMarkAsRead(account, state.selectedUids.toList(), true)+                    }) { IconMarkRead() }+                    IconButton(onClick = {+                        val account = state.selectedAccountEmail ?: state.messages.firstOrNull { it.id in state.selectedUids }?.accountEmail ?: return@IconButton+                        actions.bulkMarkAsRead(account, state.selectedUids.toList(), false)+                    }) { IconMarkUnread() }+                }+                isSearching -> {}+                else -> IconButton(onClick = { isSearching = true }) { IconSearch() }             }         },         floatingActionButton = {-            if (state.selectedUids.isEmpty()) {+            if (!selectionActive) {                 FloatingActionButton(onClick = onComposeClick) { IconAdd() }             }-        }+        },+        snackbarHost = { SnackbarHost(snackbarHostState) },     ) { padding ->         Column(modifier = Modifier.padding(padding).fillMaxSize()) {             Box(modifier = Modifier.fillMaxWidth().height(2.dp)) {
email/src/main/java/com/vayunmathur/email/ui/MessageThreadScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/MessageThreadScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/MessageThreadScreen.ktindex d7e6f10c0c..83e7d67039 100644--- a/email/src/main/java/com/vayunmathur/email/ui/MessageThreadScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/MessageThreadScreen.kt@@ -46,6 +46,7 @@ import com.vayunmathur.email.platform.EmlUtils import com.vayunmathur.email.platform.MessageThreadActions import com.vayunmathur.email.data.UnsubscribeMethod import com.vayunmathur.library.ui.AlertDialog+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.DropdownMenu import com.vayunmathur.library.ui.DropdownMenuItem@@ -68,11 +69,9 @@ import com.vayunmathur.library.ui.IconUndo import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.ModalBottomSheet import com.vayunmathur.library.ui.OutlinedButton-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.library.ui.TopAppBar import com.vayunmathur.library.ui.contentColorOn import com.vayunmathur.library.ui.rememberModalBottomSheetState import com.vayunmathur.library.util.AppMessages@@ -120,7 +119,10 @@ fun MessageThreadScreen(             hasMarkedAsRead = true         }     }-    Scaffold(topBar = { TopAppBar(title = { Text(messages.firstOrNull()?.subject ?: stringResource(R.string.conversation)) }, navigationIcon = { IconNavigation(onBack) }) }) { padding ->+    AppScaffold(+        title = messages.firstOrNull()?.subject ?: stringResource(R.string.conversation),+        onNavigateBack = onBack,+    ) { padding ->         LazyColumn(modifier = Modifier.padding(padding).fillMaxSize(), contentPadding = PaddingValues(bottom = 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {             items(messages, key = { "${it.accountEmail}|${it.folderName}|${it.id}" }) { msg ->                 MessageItem(msg = msg, actions = actions, onBack = onBack, onReply = onReply, onForward = onForward, onCompose = onCompose, onExportEml = { toExport ->
email/src/main/java/com/vayunmathur/email/ui/OutboxScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/OutboxScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/OutboxScreen.ktindex 527e9a5650..724d22ec28 100644--- a/email/src/main/java/com/vayunmathur/email/ui/OutboxScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/OutboxScreen.kt@@ -32,20 +32,16 @@ fun OutboxScreen(     val context = LocalContext.current     val resources = LocalResources.current -    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text(stringResource(R.string.outbox)) },-                navigationIcon = { IconNavigation(onBack) },-                actions = {-                    if (outbox.isNotEmpty()) {-                        TextButton(onClick = {-                            viewModel.sendOutboxNow(context)-                            AppMessages.show(resources.getQuantityString(R.plurals.retrying_pending_messages, outbox.size, outbox.size))-                        }) { Text(stringResource(R.string.send_now)) }-                    }-                },-            )+    AppScaffold(+        title = stringResource(R.string.outbox),+        onNavigateBack = onBack,+        actions = {+            if (outbox.isNotEmpty()) {+                TextButton(onClick = {+                    viewModel.sendOutboxNow(context)+                    AppMessages.show(resources.getQuantityString(R.plurals.retrying_pending_messages, outbox.size, outbox.size))+                }) { Text(stringResource(R.string.send_now)) }+            }         },     ) { padding ->         if (outbox.isEmpty()) {
email/src/main/java/com/vayunmathur/email/ui/SettingsScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/SettingsScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/SettingsScreen.ktindex 638fed0433..1c81103559 100644--- a/email/src/main/java/com/vayunmathur/email/ui/SettingsScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/SettingsScreen.kt@@ -25,75 +25,62 @@ fun SettingsScreen(viewModel: EmailViewModel, onBack: () -> Unit) {     val accounts by viewModel.accounts.collectAsStateWithLifecycle(emptyList())     val context = LocalContext.current     val resources = LocalResources.current-    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text(stringResource(UiR.string.settings)) },-                navigationIcon = { IconNavigation(onBack) },-            )-        }-    ) { padding ->-        Column(-            modifier = Modifier-                .padding(padding)-                .padding(16.dp)-                .fillMaxSize()-                .verticalScroll(rememberScrollState()),-            verticalArrangement = Arrangement.spacedBy(16.dp),-        ) {-            val settings = remember(context) { com.vayunmathur.email.data.EmailSettings.get(context) }-            val loadRemoteImages by settings.loadRemoteImages.collectAsStateWithLifecycle()-            Text(stringResource(R.string.reading), style = MaterialTheme.typography.titleMedium)-            com.vayunmathur.library.ui.SettingsSwitchRow(-                title = stringResource(R.string.load_remote_images),-                supportingText = stringResource(R.string.load_remote_images_summary),-                checked = loadRemoteImages,-                onCheckedChange = { settings.setLoadRemoteImages(it) },-            )-            HorizontalDivider()+    DetailScaffold(+        title = stringResource(UiR.string.settings),+        onNavigateBack = onBack,+    ) {+        val settings = remember(context) { com.vayunmathur.email.data.EmailSettings.get(context) }+        val loadRemoteImages by settings.loadRemoteImages.collectAsStateWithLifecycle()+        Text(stringResource(R.string.reading), style = MaterialTheme.typography.titleMedium)+        com.vayunmathur.library.ui.SettingsSwitchRow(+            title = stringResource(R.string.load_remote_images),+            supportingText = stringResource(R.string.load_remote_images_summary),+            checked = loadRemoteImages,+            onCheckedChange = { settings.setLoadRemoteImages(it) },+        )+        HorizontalDivider() -            Text(stringResource(R.string.signatures), style = MaterialTheme.typography.titleMedium)-            if (accounts.isEmpty()) {-                Text(stringResource(R.string.select_account))-            }-            accounts.forEach { acc ->-                var sig by remember(acc.email) { mutableStateOf(acc.signature) }-                Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {-                    Text(acc.email, style = MaterialTheme.typography.labelLarge)-                    OutlinedTextField(-                        value = sig,-                        onValueChange = { sig = it },-                        modifier = Modifier.fillMaxWidth(),-                        minLines = 3,-                        placeholder = { Text(stringResource(R.string.your_signature)) },-                    )-                    Button(-                        onClick = {-                            viewModel.setSignature(acc.email, sig)-                            AppMessages.show(resources.getString(R.string.signature_saved))-                        },-                        modifier = Modifier.align(Alignment.End),-                    ) {-                        Text(stringResource(UiR.string.save))-                    }+        Text(stringResource(R.string.signatures), style = MaterialTheme.typography.titleMedium)+        if (accounts.isEmpty()) {+            Text(stringResource(R.string.select_account))+        }+        accounts.forEach { acc ->+            var sig by remember(acc.email) { mutableStateOf(acc.signature) }+            Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {+                Text(acc.email, style = MaterialTheme.typography.labelLarge)+                OutlinedTextField(+                    value = sig,+                    onValueChange = { sig = it },+                    modifier = Modifier.fillMaxWidth(),+                    minLines = 3,+                    placeholder = { Text(stringResource(R.string.your_signature)) },+                )+                Button(+                    onClick = {+                        viewModel.setSignature(acc.email, sig)+                        AppMessages.show(resources.getString(R.string.signature_saved))+                    },+                    modifier = Modifier.align(Alignment.End),+                ) {+                    Text(stringResource(UiR.string.save))                 }-                HorizontalDivider()             }+            HorizontalDivider()+        } -            val blocked by viewModel.blockedSenders.collectAsStateWithLifecycle(emptyList())-            Text(stringResource(R.string.blocked_senders), style = MaterialTheme.typography.titleMedium)-            if (blocked.isEmpty()) {-                Text(stringResource(R.string.none), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)-            }-            blocked.forEach { b ->-                ListItem(-                    content = { Text(b.address) },-                    trailingContent = {-                        TextButton(onClick = { viewModel.unblockSender(b.address) }) { Text(stringResource(R.string.unblock)) }-                    },-                )-                HorizontalDivider()-            }+        val blocked by viewModel.blockedSenders.collectAsStateWithLifecycle(emptyList())+        Text(stringResource(R.string.blocked_senders), style = MaterialTheme.typography.titleMedium)+        if (blocked.isEmpty()) {+            Text(stringResource(R.string.none), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+        }+        blocked.forEach { b ->+            ListItem(+                content = { Text(b.address) },+                trailingContent = {+                    TextButton(onClick = { viewModel.unblockSender(b.address) }) { Text(stringResource(R.string.unblock)) }+                },+            )+            HorizontalDivider()         }     } }\ No newline at end of file