Modern Apps git

← Modern-Apps.git

communicate: new-message, delete and poll dialogs are routes

Commit
a8875374e036615171ed3b85813cc2c5249a51c7
Author
Vayun Mathur <[email protected]>
When
2026-12-01 20:06 UTC (4 days ago)
Parents
43fd5a8
DialogsAsRoutes batch for communicate (fixes a broken
HEAD the communicate-dev extraction left behind: the
committed CommunicateDialogEntries referenced
Route.NewMessageDialog while the Route definitions and
screen rewiring sat uncommitted, so
:communicate:compileReleaseKotlin failed on a clean
tree with Unresolved reference NewMessageDialog — this
broke ./install all).

Route gains the dialog destinations (new message,
delete conversation, delete call log, poll composer)
with DialogPage() entries; Messages/Conversation/CallLogs
screens push them instead of holding pending-delete /
show-dialog state (MessagesScreen sheds ~200 lines of
inline dialog hosting); captures added/updated in
MetadataPreviews for the dialog routes. Verified:
:communicate:compileReleaseKotlin green,
:communicate:testDevUnitTest green (run on the main
tree with this batch), :communicate-dev:rustFileLength
green after the test-file split in 43fd5a804.

Diff

communicate/src/main/java/com/vayunmathur/communicate/Route.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/Route.kt b/communicate/src/main/java/com/vayunmathur/communicate/Route.ktindex 4060449ebd..20a8d08fb1 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/Route.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/Route.kt@@ -4,6 +4,21 @@ import com.vayunmathur.communicate.data.CommunicateLine import com.vayunmathur.library.util.NavKey import kotlinx.serialization.Serializable +// SCREENSHOT COVERAGE EXCEPTION: Accounts: reads Keystore-sealed DataStore line sessions; no stateless slice for Layoutlib+// SCREENSHOT COVERAGE EXCEPTION: GoogleVoiceSignIn: WebView sign-in page; Layoutlib cannot render the live voice.google.com WebView+// SCREENSHOT COVERAGE EXCEPTION: WhatsAppRegistration.Number: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: WhatsAppRegistration.Code: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: WhatsAppRegistration.Pin: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: WhatsAppRegistration.Done: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: WhatsAppBackupImport: backup import reads the SAF picker and encrypted backup state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: SignalRegistration.Number: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: SignalRegistration.Captcha: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: SignalRegistration.Code: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: SignalRegistration.Done: registration wizard reads Keystore-sealed session and provider state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: RcsStatus: RCS provisioning screen reads live SIP/provisioning state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: RcsVerify: safety-number screen loads peer keys from RCS session state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: RcsGroupMembers: group member list loads from RCS session state; no stateless slice+// SCREENSHOT COVERAGE EXCEPTION: Call: live WebRTC/telecom call surface (mic/camera); the car in-call template is the renderable in-call capture /** Navigation routes for the communicate app (type-safe back stack keys). */ sealed interface Route : NavKey {     /** The conversation list tab (home). Sibling of [Dialer] and [CallLogs]. */@@ -81,6 +96,51 @@ sealed interface Route : NavKey {      */     @Serializable data object Call : Route +    /**+     * New-message / new-group picker dialog (FAB on [Messages]). A dialog+     * destination (`DialogPage()`), not picker state inside the list screen:+     * the line/recipient selection happens inside the dialog and the chosen+     * thread is opened by popping this and pushing [Conversation].+     */+    @Serializable data object NewMessageDialog : Route++    /**+     * Delete-conversation confirmation dialog for one thread. The thread+     * identity travels in the arguments (never as `pendingDelete` state in+     * the list/conversation screen that asked), so Back, process death and+     * screenshots all see which conversation is being deleted.+     */+    @Serializable+    data class DeleteConversationDialog(+        val threadId: Long,+        val address: String,+        val line: CommunicateLine = CommunicateLine.Sim,+        val remoteId: String? = null,+        val subscriptionId: Int? = null,+        val isGroup: Boolean = false,+        val participants: List<String> = emptyList(),+        val groupTitle: String? = null,+    ) : Route++    /** Delete-call-log confirmation dialog for the entry with [entryId] on [line]. */+    @Serializable+    data class DeleteCallLogDialog(+        val entryId: Long,+        val line: CommunicateLine = CommunicateLine.Sim,+    ) : Route++    /**+     * Poll composer dialog over the conversation identified by the+     * arguments. Creating the poll sends on that conversation and pops.+     */+    @Serializable+    data class PollComposerDialog(+        val threadId: Long,+        val address: String,+        val line: CommunicateLine = CommunicateLine.Sim,+        val remoteId: String? = null,+    ) : Route+     /** One open conversation: its thread, peer address and line. */     @Serializable     data class Conversation(
communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsContent.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsContent.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsContent.ktindex 7311f81259..6685a4b7a9 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsContent.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsContent.kt@@ -47,9 +47,12 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext  /**- * Call-log list, stateless: rows plus the delete-confirm dialog. Split out so- * screenshot previews can render entries without the call-log provider, the- * polling tick, or the permission gates above.+ * Call-log list, stateless: rows only. Split out so screenshot previews can+ * render entries without the call-log provider, the polling tick, or the+ * permission gates above. Deleting is navigation: [onDelete] asks the host+ * to push the `DeleteCallLogDialog` route for the entry — the confirmation+ * (and the delete itself) lives in that dialog destination, never in+ * `pendingDelete` state here.  */ @Composable fun CallLogsContent(@@ -58,7 +61,6 @@ fun CallLogsContent(     onCall: (CommunicateCallLogEntry) -> Unit,     onDelete: (CommunicateCallLogEntry) -> Unit, ) {-    var pendingDelete by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf<CommunicateCallLogEntry?>(null) }     LazyColumn(         modifier = modifier             .fillMaxSize(),@@ -68,25 +70,10 @@ fun CallLogsContent(             CallLogRow(                 entry = entry,                 onClick = { onCall(entry) },-                onDelete = { pendingDelete = entry },+                onDelete = { onDelete(entry) },             )         }     }-    val toDelete = pendingDelete-    if (toDelete != null) {-        com.vayunmathur.library.ui.ConfirmDialog(-            title = stringResource(R.string.delete_call_log_title),-            message = stringResource(R.string.delete_call_log_message),-            confirmLabel = stringResource(com.vayunmathur.library.ui.R.string.delete),-            dismissLabel = stringResource(com.vayunmathur.library.ui.R.string.cancel),-            destructive = true,-            onConfirm = {-                pendingDelete = null-                onDelete(toDelete)-            },-            onDismiss = { pendingDelete = null },-        )-    } }  @Composable
communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsScreen.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsScreen.ktindex 19bfb2a0a9..6c9c67e709 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsScreen.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/CallLogsScreen.kt@@ -47,12 +47,14 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext  @Composable-fun CallLogsScreen() {+fun CallLogsScreen(+    onDeleteCallLogRequest: (CommunicateCallLogEntry) -> Unit = {},+) {     val context = LocalContext.current-    val deleteFailedMessage = stringResource(R.string.delete_failed)-    val scope = androidx.compose.runtime.rememberCoroutineScope()     var tick by androidx.compose.runtime.remember { androidx.compose.runtime.mutableIntStateOf(0) }-    var pendingDelete by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf<CommunicateCallLogEntry?>(null) }+    // Deleting happens in the DeleteCallLogDialog route; it reports back+    // here so the list reloads.+    com.vayunmathur.library.util.ResultEffect<Long>(RESULT_CALL_LOG_DELETED) { tick++ }     var isRefreshing by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(false) }     AppScaffold(         title = stringResource(R.string.call_logs_title),@@ -84,14 +86,7 @@ fun CallLogsScreen() {                             entries = rows,                             modifier = Modifier.padding(padding),                             onCall = { CommunicateRepository.placeCall(context, it.phoneNumber) },-                            onDelete = { toDelete ->-                                scope.launch {-                                    val ok = withContext(Dispatchers.IO) { CommunicateRepository.deleteCallLog(-                                        context,-                                        toDelete) }-                                    if (ok) tick++ else AppMessages.show(deleteFailedMessage)-                                }-                            },+                            onDelete = onDeleteCallLogRequest,                         )                     }                 }
communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.ktindex ff8b781666..9ea7081fdd 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.kt@@ -26,8 +26,9 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext  /**- * Conversation pane content: poll composer, Signal safety-number and RCS+ * Conversation pane content: Signal safety-number and RCS  * encryption banners, and the message list behind its permission gates.+ * (The poll composer is the `PollComposerDialog` route, pushed over this.)  * Extracted from [ConversationScreen] to keep that file under the length  * limit. Behavior identical — only moved.  */@@ -40,19 +41,10 @@ fun ConversationBody(     refresh: Int,     onRefresh: () -> Unit,     thread: SmsThread,-    showPollComposer: Boolean,-    onDismissPollComposer: () -> Unit,-    onCreatePoll: (String, List<String>) -> Unit, ) {     val context = LocalContext.current     val scope = rememberCoroutineScope()     val safetyNumberFailedMessage = stringResource(R.string.signal_safety_number_accept_failed)-    if (showPollComposer) {-        PollComposerDialog(-            onDismiss = onDismissPollComposer,-            onCreate = onCreatePoll,-        )-    }     // A changed Signal identity key blocks sending until the user verifies it, so the warning has to     // be in front of them here rather than only in a notification.     var safetyNumber by remember(remoteId, address) { mutableStateOf<Pair<String, String>?>(null) }
communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationMessagesList.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationMessagesList.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationMessagesList.ktindex 66b55a5694..2293caaa46 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationMessagesList.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationMessagesList.kt@@ -18,7 +18,6 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.vayunmathur.communicate.R import com.vayunmathur.communicate.data.SmsMessage-import com.vayunmathur.communicate.data.signal.SignalSafetyNumber import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.IconSms import com.vayunmathur.library.ui.MaterialTheme@@ -79,7 +78,7 @@ internal fun SafetyNumberBanner(             Text(stringResource(R.string.signal_safety_number_verify_prompt))             Spacer(Modifier.height(8.dp))             Text(-                SignalSafetyNumber.format(safetyNumber),+                formatSignalSafetyNumber(safetyNumber),                 style = MaterialTheme.typography.bodyLarge,                 fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace,             )
communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.ktindex 384bbbe424..c944e7e6c0 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt@@ -30,7 +30,6 @@ import com.vayunmathur.communicate.data.canShareContact import com.vayunmathur.communicate.data.findContactName import com.vayunmathur.communicate.data.isUnknownContact import com.vayunmathur.communicate.data.sendMessage-import com.vayunmathur.communicate.data.sendPoll import com.vayunmathur.communicate.data.shareContact import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.util.AppMessages@@ -53,13 +52,14 @@ fun ConversationScreen(     initialAttachmentUris: List<String> = emptyList(),     onBack: () -> Unit,     onOpenRcsVerify: (String) -> Unit = {}, onOpenRcsGroupMembers: (String) -> Unit = {},+    onOpenPollComposer: () -> Unit = {},+    onDeleteConversationRequest: () -> Unit = {}, ) {     val context = LocalContext.current     val simLineLabel = stringResource(R.string.account_sim)     val contactShareFailedMessage = stringResource(R.string.contact_share_failed)     val conversationTitleLabel = stringResource(R.string.conversation_title)     val gvSendFailedMessage = stringResource(R.string.gv_send_failed)-    val pollSendFailedMessage = stringResource(R.string.poll_send_failed)     val scope = rememberCoroutineScope()     // Contextual notification ask (todo/files pattern: system request only at first     // use, never on first frame): after the first successful send the user has shown@@ -132,8 +132,8 @@ fun ConversationScreen(                 ?: LineChoice.Sim(subscriptionId ?: -1, simLineLabel)         }     }-    // Poll composer and contact picker, offered only on lines that support them.-    var showPollComposer by remember { mutableStateOf(false) }+    // Contact picker, offered only on lines that support it. (The poll+    // composer is a dialog route, opened via onOpenPollComposer.)     val contactPicker = rememberLauncherForActivityResult(         ActivityResultContracts.PickContact(),     ) { uri ->@@ -251,6 +251,7 @@ fun ConversationScreen(                 onBack = onBack,                 onOpenRcsVerify = onOpenRcsVerify,                 onOpenRcsGroupMembers = onOpenRcsGroupMembers,+                onDeleteConversationRequest = onDeleteConversationRequest,             )         },         bottomBar = {@@ -268,7 +269,7 @@ fun ConversationScreen(                 onAttachMedia = { attachmentPicker.launch(arrayOf("image/*", "video/*")) },                 onAttachFile = { attachmentPicker.launch(arrayOf("*/*")) },                 onCreatePoll = if (CommunicateRepository.canSendPoll(line)) {-                    { showPollComposer = true }+                    onOpenPollComposer                 } else {                     null                 },@@ -323,20 +324,6 @@ fun ConversationScreen(             refresh = refresh,             onRefresh = { refresh++ },             thread = thread,-            showPollComposer = showPollComposer,-            onDismissPollComposer = { showPollComposer = false },-            onCreatePoll = { question, options ->-                scope.launch {-                    val ok = CommunicateRepository.sendPoll(-                        context = context,-                        line = line,-                        conversationId = remoteId ?: address,-                        question = question,-                        options = options,-                    )-                    if (ok) refresh++ else AppMessages.show(pollSendFailedMessage)-                }-            },         )     } }
communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesListContent.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesListContent.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesListContent.ktindex 0ed81be6d2..2592e4f935 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesListContent.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesListContent.kt@@ -23,15 +23,9 @@ import com.vayunmathur.communicate.R import com.vayunmathur.communicate.data.CommunicateLine import com.vayunmathur.communicate.data.CommunicateRepository import com.vayunmathur.communicate.data.SmsThread-import com.vayunmathur.communicate.data.createEncryptedRcsGroup-import com.vayunmathur.communicate.data.createSignalGroup-import com.vayunmathur.communicate.data.createWhatsAppGroup import com.vayunmathur.communicate.data.deleteConversation-import com.vayunmathur.communicate.data.rcs.RcsSessionManager-import com.vayunmathur.communicate.data.rcs.hostGroupFocus import com.vayunmathur.communicate.data.getOrCreateSmsGroupThreadId import com.vayunmathur.communicate.data.getOrCreateSmsThreadId-import com.vayunmathur.communicate.data.isWhatsAppConnected import com.vayunmathur.communicate.data.loadSmsThreadsMerged import com.vayunmathur.communicate.data.stableThreadId import com.vayunmathur.library.ui.EmptyState@@ -48,9 +42,12 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext  /**- * The thread list, stateless: rows plus the delete-confirm dialog. Split out so- * screenshot previews can render threads without the SMS provider, the polling- * loop, or the permission gates above.+ * The thread list, stateless: rows only. Split out so screenshot previews+ * can render threads without the SMS provider, the polling loop, or the+ * permission gates above. Deleting is navigation: [onDeleteThread] asks the+ * host to push the `DeleteConversationDialog` route for the thread — the+ * confirmation (and the delete itself) lives in that dialog destination,+ * never in `pendingDelete` state here.  */ @Composable fun MessagesListContent(@@ -59,7 +56,6 @@ fun MessagesListContent(     onOpenThread: (SmsThread) -> Unit,     onDeleteThread: (SmsThread) -> Unit, ) {-    var pendingDelete by remember { mutableStateOf<SmsThread?>(null) }     LazyColumn(         modifier = modifier             .fillMaxSize(),@@ -69,24 +65,9 @@ fun MessagesListContent(             MessageThreadRow(                 thread = thread,                 onClick = { onOpenThread(thread) },-                onDelete = { pendingDelete = thread },+                onDelete = { onDeleteThread(thread) },             )             HorizontalDivider(Modifier.padding(horizontal = 16.dp))         }     }-    val toDelete = pendingDelete-    if (toDelete != null) {-        com.vayunmathur.library.ui.ConfirmDialog(-            title = stringResource(R.string.delete_conversation_title),-            message = stringResource(R.string.delete_conversation_message),-            confirmLabel = stringResource(com.vayunmathur.library.ui.R.string.delete),-            dismissLabel = stringResource(com.vayunmathur.library.ui.R.string.cancel),-            destructive = true,-            onConfirm = {-                pendingDelete = null-                onDeleteThread(toDelete)-            },-            onDismiss = { pendingDelete = null },-        )-    } }
communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesScreen.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesScreen.ktindex 656217e45c..b5b2b093d3 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesScreen.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/MessagesScreen.kt@@ -1,11 +1,7 @@ package com.vayunmathur.communicate.ui  import android.Manifest-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.lazy.LazyColumn-import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue@@ -13,27 +9,15 @@ import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.produceState import androidx.compose.runtime.remember-import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.communicate.R-import com.vayunmathur.communicate.data.CommunicateLine import com.vayunmathur.communicate.data.CommunicateRepository import com.vayunmathur.communicate.data.SmsThread-import com.vayunmathur.communicate.data.createEncryptedRcsGroup-import com.vayunmathur.communicate.data.createSignalGroup-import com.vayunmathur.communicate.data.createWhatsAppGroup-import com.vayunmathur.communicate.data.deleteConversation-import com.vayunmathur.communicate.data.rcs.RcsSessionManager-import com.vayunmathur.communicate.data.rcs.hostGroupFocus-import com.vayunmathur.communicate.data.getOrCreateSmsGroupThreadId-import com.vayunmathur.communicate.data.getOrCreateSmsThreadId-import com.vayunmathur.communicate.data.isWhatsAppConnected import com.vayunmathur.communicate.data.loadSmsThreadsMerged-import com.vayunmathur.communicate.data.stableThreadId import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.FloatingActionButton import com.vayunmathur.library.ui.HorizontalDivider@@ -42,183 +26,23 @@ import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconPerson import com.vayunmathur.library.ui.IconSms import com.vayunmathur.library.ui.AppScaffold-import com.vayunmathur.library.util.AppMessages import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.launch import kotlinx.coroutines.withContext  @Composable-fun MessagesScreen(onOpenThread: (SmsThread) -> Unit, onOpenAccounts: () -> Unit) {+fun MessagesScreen(+    onOpenThread: (SmsThread) -> Unit,+    onOpenAccounts: () -> Unit,+    onNewMessage: () -> Unit = {},+    onDeleteConversationRequest: (SmsThread) -> Unit = {},+) {     val context = LocalContext.current-    val rcsEncryptedFailedMessage = stringResource(R.string.rcs_encrypted_failed)-    val deleteFailedMessage = stringResource(R.string.delete_failed)-    val lineChoices = rememberLineChoices()-    val scope = rememberCoroutineScope()-    var showPicker by remember { mutableStateOf(false) }     // #735: PermissionGate reads checkSelfPermission during composition with no     // resume trigger, so granting SMS from Settings never recomposes the gate     // (stuck on empty state until restart). resumeRevision forces the gate to     // re-check + reloads threads. Scoped to this screen only.     val resumeRevision = rememberResumeRevision() -    if (showPicker) {-        NewMessagePicker(-            choices = lineChoices,-            onDismiss = { showPicker = false },-            onCompose = { choice, number ->-                showPicker = false-                val sim = choice as? com.vayunmathur.communicate.data.LineChoice.Sim-                val threadId = if (sim != null) {-                    CommunicateRepository.getOrCreateSmsThreadId(context, number)-                        ?: CommunicateRepository.stableThreadId(number)-                } else {-                    CommunicateRepository.stableThreadId(number)-                }-                onOpenThread(-                    SmsThread(-                        threadId = threadId,-                        address = number,-                        displayName = null,-                        snippet = "",-                        timestampMillis = System.currentTimeMillis(),-                        unreadCount = 0,-                        line = choice.category,-                        remoteId = null,-                        subscriptionId = sim?.subscriptionId,-                    ),-                )-            },-            onCreateGroup = { choice, subject, contacts, encrypted ->-                showPicker = false-                scope.launch {-                    when (choice.category) {-                        CommunicateLine.WhatsApp -> {-                            if (!CommunicateRepository.isWhatsAppConnected()) {-                                AppMessages.show(-                                        "WhatsApp isn't connected — the number may be logged out or banned. " +-                                            "Re-register in Accounts.",-                                    )-                                return@launch-                            }-                            val groupJid = withContext(Dispatchers.IO) {-                                CommunicateRepository.createWhatsAppGroup(context, subject, contacts)-                            }-                            if (groupJid == null) {-                                AppMessages.show("Couldn't create the group (server rejected it)")-                            } else {-                                onOpenThread(-                                    SmsThread(-                                        threadId = CommunicateRepository.stableThreadId(groupJid),-                                        address = groupJid,-                                        displayName = subject.ifBlank { null },-                                        snippet = "",-                                        timestampMillis = System.currentTimeMillis(),-                                        unreadCount = 0,-                                        line = CommunicateLine.WhatsApp,-                                        remoteId = groupJid,-                                        isGroup = true,-                                        participants = contacts,-                                        groupTitle = subject.ifBlank { null },-                                    ),-                                )-                            }-                        }-                        CommunicateLine.Signal -> {-                            val groupId = withContext(Dispatchers.IO) {-                                CommunicateRepository.createSignalGroup(context, subject, contacts)-                            }-                            if (groupId == null) {-                                AppMessages.show("Couldn't create the Signal group (server rejected it)")-                            } else {-                                onOpenThread(-                                    SmsThread(-                                        threadId = CommunicateRepository.stableThreadId(groupId),-                                        address = groupId,-                                        displayName = subject.ifBlank { null },-                                        snippet = "",-                                        timestampMillis = System.currentTimeMillis(),-                                        unreadCount = 0,-                                        line = CommunicateLine.Signal,-                                        remoteId = groupId,-                                        isGroup = true,-                                        participants = contacts,-                                        groupTitle = subject.ifBlank { null },-                                    ),-                                )-                            }-                        }-                        CommunicateLine.Sim -> {-                            val sim = choice as? com.vayunmathur.communicate.data.LineChoice.Sim-                            val groupThreadId = withContext(Dispatchers.IO) {-                                CommunicateRepository.getOrCreateSmsGroupThreadId(context, contacts)-                            }-                            if (groupThreadId == null) {-                                AppMessages.show("Couldn't create the group thread")-                            } else {-                                onOpenThread(-                                    SmsThread(-                                        threadId = groupThreadId,-                                        address = contacts.joinToString(", "),-                                        displayName = subject.ifBlank { null },-                                        snippet = "",-                                        timestampMillis = System.currentTimeMillis(),-                                        unreadCount = 0,-                                        line = CommunicateLine.Sim,-                                        remoteId = null,-                                        subscriptionId = sim?.subscriptionId,-                                        isGroup = true,-                                        participants = contacts,-                                        groupTitle = subject.ifBlank { null },-                                    ),-                                )-                            }-                        }-                        CommunicateLine.Rcs -> {-                            val groupId = "rcs-group:${contacts.sorted().joinToString(",")}"-                            val thread = SmsThread(-                                threadId = CommunicateRepository.stableThreadId(groupId),-                                address = groupId,-                                displayName = subject.ifBlank { null },-                                snippet = "",-                                timestampMillis = System.currentTimeMillis(),-                                unreadCount = 0,-                                line = CommunicateLine.Rcs,-                                remoteId = groupId,-                                isGroup = true,-                                participants = contacts,-                                groupTitle = subject.ifBlank { null },-                            )-                            if (encrypted &&-                                com.vayunmathur.communicate.data.rcs.RcsFeature.enabled &&-                                com.vayunmathur.communicate.data.rcs.e2e.RustMlsCrypto.isAvailable-                            ) {-                                // Encrypted group: set up MLS now (fast path) or park-                                // for key arrival (slow path). Thread opens either-                                // way; the banner shows the pending state.-                                val ok = withContext(Dispatchers.IO) {-                                    CommunicateRepository.createEncryptedRcsGroup(context, groupId, contacts)-                                }-                                if (!ok) {-                                    AppMessages.show(rcsEncryptedFailedMessage)-                                }-                            } else if (com.vayunmathur.communicate.data.rcs.RcsFeature.enabled) {-                                // Plaintext group: host the conference focus so-                                // members' clients can join (REFER) and their-                                // messages relay through us. Best-effort — the-                                // thread still opens for 1:1 fan-out sends.-                                withContext(Dispatchers.IO) {-                                    RcsSessionManager.hostGroupFocus(groupId, subject, contacts)-                                }-                            }-                            onOpenThread(thread)-                        }-                        else -> AppMessages.show("Groups aren't supported on this line")-                    }-                }-            },-        )-    }-     var isRefreshing by remember { mutableStateOf(false) }     AppScaffold(         title = stringResource(R.string.messages_title),@@ -228,8 +52,8 @@ fun MessagesScreen(onOpenThread: (SmsThread) -> Unit, onOpenAccounts: () -> Unit         },         floatingActionButton = {             FloatingActionButton(onClick = {-                // Open the contact picker to choose a recipient + line.-                showPicker = true+                // Open the contact picker dialog route to choose a recipient + line.+                onNewMessage()             }) {                 IconAdd()             }@@ -248,6 +72,9 @@ fun MessagesScreen(onOpenThread: (SmsThread) -> Unit, onOpenAccounts: () -> Unit                 // granting SMS from Settings returns via resume with no permission-callback                 // re-fire, so without this the gate keeps its stale denial until restart.                 var tick by remember { mutableIntStateOf(0) }+                // Deleting happens in the DeleteConversationDialog route; it+                // reports back here so the list reloads without polling lag.+                com.vayunmathur.library.util.ResultEffect<Long>(RESULT_CONVERSATION_DELETED) { tick++ }                 LaunchedEffect(roleRevision, permissionRevision, resumeRevision) {                     while (true) {                         kotlinx.coroutines.delay(15_000)@@ -310,14 +137,7 @@ fun MessagesScreen(onOpenThread: (SmsThread) -> Unit, onOpenAccounts: () -> Unit                             threads = rows,                             modifier = Modifier.padding(padding),                             onOpenThread = onOpenThread,-                            onDeleteThread = { toDelete ->-                                scope.launch {-                                    val ok = withContext(Dispatchers.IO) {-                                        CommunicateRepository.deleteConversation(context, toDelete)-                                    }-                                    if (ok) tick++ else AppMessages.show(deleteFailedMessage)-                                }-                            },+                            onDeleteThread = onDeleteConversationRequest,                         )                     }                 }
communicate/src/screenshotTest/kotlin/com/vayunmathur/communicate/ui/MetadataPreviews.kt
diff --git a/communicate/src/screenshotTest/kotlin/com/vayunmathur/communicate/ui/MetadataPreviews.kt b/communicate/src/screenshotTest/kotlin/com/vayunmathur/communicate/ui/MetadataPreviews.ktindex 09100e4621..06c25abea3 100644--- a/communicate/src/screenshotTest/kotlin/com/vayunmathur/communicate/ui/MetadataPreviews.kt+++ b/communicate/src/screenshotTest/kotlin/com/vayunmathur/communicate/ui/MetadataPreviews.kt@@ -39,13 +39,18 @@ private const val EXPANDED = "spec:width=1280dp,height=800dp,dpi=240"  *  * Coverage: the four tabs and `Conversation` (primary detail, via its stateless  * message-list + composer slices) on phone, plus Messages (main) on large-tablet;- * the car templates are in CarMetadataPreviews.- * Exceptions: `Accounts` and the WhatsApp/Signal/RCS/Google-Voice registration+ * the car templates are in CarMetadataPreviews. The dialog routes+ * (`NewMessageDialog`, `DeleteConversationDialog`, `DeleteCallLogDialog`,+ * `PollComposerDialog`) are captured like any other route.+ * Exceptions (declared per route in `Route.kt` for the+ * `RouteScreenshotCoverage` lint): `Accounts` and the WhatsApp/Signal/RCS/Google-Voice registration  * wizards read Keystore-sealed DataStore line sessions and provider state — there is  * no stateless slice and Layoutlib has no AndroidKeyStore session to show.  * `Call` is a live WebRTC/telecom call (mic/camera/video surface, global call  * registry): like `camera`'s viewfinder it cannot be rendered in Layoutlib; the car  * in-call template in CarMetadataPreviews is the renderable in-call surface.+ * `4-voicemail` captures the (currently unrouted) VoicemailScreen slice; it+ * names no Route and is listed as a non-route capture by the coverage lint.  */ class MetadataPreviews { @@ -214,6 +219,50 @@ class MetadataPreviews {         ChromePreview(selectedTab = 0)     } +    @PreviewTest+    @Preview(name = "9-delete-conversation-dialog", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun Preview9DeleteConversationDialog() {+        DynamicTheme(darkTheme = true) {+            DeleteConversationDialogContent(onConfirm = {}, onDismiss = {})+        }+    }++    @PreviewTest+    @Preview(name = "10-delete-call-log-dialog", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun Preview10DeleteCallLogDialog() {+        DynamicTheme(darkTheme = true) {+            DeleteCallLogDialogContent(onConfirm = {}, onDismiss = {})+        }+    }++    @PreviewTest+    @Preview(name = "11-poll-composer-dialog", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun Preview11PollComposerDialog() {+        DynamicTheme(darkTheme = true) {+            PollComposerDialog(onDismiss = {}, onCreate = { _, _ -> })+        }+    }++    @PreviewTest+    @Preview(name = "12-new-message-dialog", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun Preview12NewMessageDialog() {+        DynamicTheme(darkTheme = true) {+            NewMessagePicker(+                choices = listOf(+                    com.vayunmathur.communicate.data.LineChoice.Sim(-1, "SIM"),+                    com.vayunmathur.communicate.data.LineChoice.WhatsApp,+                ),+                onDismiss = {},+                onCompose = { _, _ -> },+                onCreateGroup = { _, _, _, _ -> },+            )+        }+    }+     @Composable     private fun MessagesContent() {         MessagesListContent(