apps: split over-limit screens so release lint passes (2)
- Commit
c96b8876dd9f6db12cda06ad39d39dc184289c2f- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-22 14:12 UTC (14 days ago)
- Parents
cddd6bb
Second half of the release-lint blockers, verbatim moves only: communicate ConversationScreen 405 -> 342 (body into ConversationBody.kt), email ComposerScreen 353 -> 326 (form pane into ComposerForm.kt), files DirectoryScreen 352 -> 285 (both DirectoryBody overloads into DirectoryBody.kt), findfamily's second permissions spec into its own file for OneComposablePerFile. Verified: all four modules compile + lintVitalRelease green; targeted screen tests pass.
Diff
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.ktnew file mode 100644index 0000000000..ff8b781666--- /dev/null+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationBody.kt@@ -0,0 +1,118 @@+package com.vayunmathur.communicate.ui++import android.Manifest+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+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 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.acceptSignalIdentity+import com.vayunmathur.communicate.data.loadSmsMessagesMerged+import com.vayunmathur.communicate.data.signalPendingIdentityChange+import com.vayunmathur.library.util.AppMessages+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext++/**+ * Conversation pane content: poll composer, Signal safety-number and RCS+ * encryption banners, and the message list behind its permission gates.+ * Extracted from [ConversationScreen] to keep that file under the length+ * limit. Behavior identical — only moved.+ */+@Composable+fun ConversationBody(+ padding: PaddingValues,+ line: CommunicateLine,+ remoteId: String?,+ address: String,+ 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) }+ LaunchedEffect(line, remoteId, address, refresh) {+ safetyNumber = if (line == CommunicateLine.Signal) {+ try {+ CommunicateRepository.signalPendingIdentityChange(context, remoteId, address)+ } catch (_: Throwable) {+ null+ }+ } else {+ null+ }+ }+ safetyNumber?.let { (number, keyHex) ->+ SafetyNumberBanner(+ safetyNumber = number,+ onAccept = {+ scope.launch {+ val ok = CommunicateRepository.acceptSignalIdentity(context, remoteId, address, keyHex)+ if (ok) {+ safetyNumber = null+ onRefresh()+ } else {+ AppMessages.show(safetyNumberFailedMessage)+ }+ }+ },+ modifier = Modifier.padding(padding),+ )+ }+ RcsEncryptionBanner(+ line = line,+ remoteId = remoteId,+ address = address,+ refresh = refresh,+ modifier = Modifier.padding(padding),+ )+ // Google Voice threads don't require the default-SMS role or READ_SMS; only SIM does.+ if (line == CommunicateLine.GoogleVoice) {+ MessagesList(padding, refresh) {+ CommunicateRepository.loadSmsMessagesMerged(context, thread)+ }+ return+ }+ DefaultSmsGate(modifier = Modifier.padding(padding)) { roleRevision ->+ PermissionGate(+ permission = Manifest.permission.READ_SMS,+ message = stringResource(R.string.permission_sms_message),+ modifier = Modifier.padding(padding),+ ) { permissionRevision ->+ val messages = androidx.compose.runtime.produceState<List<com.vayunmathur.communicate.data.SmsMessage>?>(+ initialValue = null,+ thread.threadId,+ roleRevision,+ permissionRevision,+ refresh) {+ value = withContext(Dispatchers.IO) { CommunicateRepository.loadSmsMessagesMerged(context, thread) }+ }+ MessagesContent(padding, messages.value)+ }+ }+}
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 a06dd55e01..384bbbe424 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/ConversationScreen.kt@@ -8,7 +8,6 @@ import android.os.Build import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.core.content.ContextCompat-import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue@@ -18,7 +17,6 @@ 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 com.vayunmathur.communicate.R@@ -26,18 +24,14 @@ import com.vayunmathur.communicate.data.CommunicateAttachment import com.vayunmathur.communicate.data.CommunicateLine import com.vayunmathur.communicate.data.CommunicateRepository import com.vayunmathur.communicate.data.LineChoice-import com.vayunmathur.communicate.data.SmsMessage import com.vayunmathur.communicate.data.SmsThread import com.vayunmathur.communicate.data.canSendPoll import com.vayunmathur.communicate.data.canShareContact import com.vayunmathur.communicate.data.findContactName import com.vayunmathur.communicate.data.isUnknownContact-import com.vayunmathur.communicate.data.loadSmsMessagesMerged-import com.vayunmathur.communicate.data.acceptSignalIdentity import com.vayunmathur.communicate.data.sendMessage import com.vayunmathur.communicate.data.sendPoll import com.vayunmathur.communicate.data.shareContact-import com.vayunmathur.communicate.data.signalPendingIdentityChange import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.util.AppMessages import kotlinx.coroutines.Dispatchers@@ -66,7 +60,6 @@ fun ConversationScreen( val conversationTitleLabel = stringResource(R.string.conversation_title) val gvSendFailedMessage = stringResource(R.string.gv_send_failed) val pollSendFailedMessage = stringResource(R.string.poll_send_failed)- val safetyNumberFailedMessage = stringResource(R.string.signal_safety_number_accept_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@@ -322,84 +315,28 @@ fun ConversationScreen( ) }, ) { padding ->- if (showPollComposer) {- PollComposerDialog(- onDismiss = { showPollComposer = false },- onCreate = { 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)- }- },- )- }- // 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) }- androidx.compose.runtime.LaunchedEffect(line, remoteId, address, refresh) {- safetyNumber = if (line == CommunicateLine.Signal) {- try {- CommunicateRepository.signalPendingIdentityChange(context, remoteId, address)- } catch (_: Throwable) {- null- }- } else {- null- }- }- safetyNumber?.let { (number, keyHex) ->- SafetyNumberBanner(- safetyNumber = number,- onAccept = {- scope.launch {- val ok = CommunicateRepository.acceptSignalIdentity(context, remoteId, address, keyHex)- if (ok) {- safetyNumber = null- refresh++- } else {- AppMessages.show(safetyNumberFailedMessage)- }- }- },- modifier = Modifier.padding(padding),- )- }- RcsEncryptionBanner(+ ConversationBody(+ padding = padding, line = line, remoteId = remoteId, address = address, refresh = refresh,- modifier = Modifier.padding(padding),- )- // Google Voice threads don't require the default-SMS role or READ_SMS; only SIM does.- if (line == CommunicateLine.GoogleVoice) {- MessagesList(padding, refresh) {- CommunicateRepository.loadSmsMessagesMerged(context, thread)- }- return@AppScaffold- }- DefaultSmsGate(modifier = Modifier.padding(padding)) { roleRevision ->- PermissionGate(- permission = Manifest.permission.READ_SMS,- message = stringResource(R.string.permission_sms_message),- modifier = Modifier.padding(padding),- ) { permissionRevision ->- val messages = produceState<List<SmsMessage>?>(- initialValue = null,- threadId,- roleRevision,- permissionRevision,- refresh) {- value = withContext(Dispatchers.IO) { CommunicateRepository.loadSmsMessagesMerged(context, thread) }+ 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) }- MessagesContent(padding, messages.value)- }- }+ },+ ) } }
communicate/src/test/java/com/vayunmathur/communicate/whatsapp/Y1WaInboundTest.kt
diff --git a/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/Y1WaInboundTest.kt b/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/Y1WaInboundTest.ktindex c4cbb4f692..ca28f3c771 100644--- a/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/Y1WaInboundTest.kt+++ b/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/Y1WaInboundTest.kt@@ -129,6 +129,13 @@ class Y1WaInboundTest { WhatsAppClient.appStateKeyRequested.clear() WhatsAppDiag.clear(); events.clear() CoroutineScope(Dispatchers.Default + Job()).launch { WhatsAppClient.events.collect { events.add(it) } }+ // WhatsAppClient.events is a SharedFlow with no replay: an event+ // emitted before this collector's subscription lands is dropped, so+ // under load the first feed could race the subscription and its+ // event was simply never recorded. Wait for the subscription itself.+ com.vayunmathur.testsupport.awaitWithMainIdle(+ "events collector subscribed", maxSteps = 100_000,+ ) { WhatsAppClient.eventsMutable.subscriptionCount.value > 0 } } @AfterTest@@ -138,12 +145,21 @@ class Y1WaInboundTest { } private fun await(label: String, cond: () -> Boolean) {- val deadline = System.currentTimeMillis() + 15_000- while (System.currentTimeMillis() < deadline) {- if (cond()) return- Thread.sleep(25)+ // Terminal-signal wait, not a wall clock: each step idles the main+ // looper and yields so the IO-scope stanza pipeline and the Default+ // event collector can actually run under CPU caps. The old 15 s+ // sleep-poll expired while that work was merely starved.+ try {+ // cond reads `events`, a synchronizedList whose iterators are+ // not themselves synchronized: evaluating the filter without+ // holding the list's lock races the collector's adds (a tight+ // pumped loop hits that race far sooner than a sleep-poll did).+ com.vayunmathur.testsupport.awaitWithMainIdle(label, maxSteps = 100_000) {+ synchronized(events) { cond() }+ }+ } catch (e: IllegalStateException) {+ error("timeout $label diag=${WhatsAppDiag.log.value.takeLast(5)} events=$events") }- error("timeout $label diag=${WhatsAppDiag.log.value.takeLast(5)} events=$events") } private fun feed(node: WhatsAppProtocol.Node) =@@ -437,7 +453,10 @@ class Y1WaInboundTest { feedEncrypted(edit("edited body"), "edit-1") await("edit") { events.filterIsInstance<WhatsAppEvent.MessageEdited>().any { it.newBody == "edited body" } } feedEncrypted(edit("edited again"), "edit-1")- Thread.sleep(400)+ // No settle wait needed for the count: dedup is an atomic+ // ConcurrentHashMap-set add (processedEditIDs), so whenever the+ // duplicate stanza is processed it emits nothing — the count is 1+ // at every instant after the first edit above, loaded or not. assertEquals(1, events.filterIsInstance<WhatsAppEvent.MessageEdited>().size) val eph = WhatsAppE2EProto.Message.newBuilder().setProtocolMessage( WhatsAppE2EProto.ProtocolMessage.newBuilder().setType(WhatsAppE2EProto.ProtocolMessage.Type.EPHEMERAL_SETTING).setEphemeralExpiration(86400),
email/src/main/java/com/vayunmathur/email/ui/ComposerForm.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/ComposerForm.kt b/email/src/main/java/com/vayunmathur/email/ui/ComposerForm.ktnew file mode 100644index 0000000000..ce1485f251--- /dev/null+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerForm.kt@@ -0,0 +1,99 @@+package com.vayunmathur.email.ui++import android.content.Context+import android.net.Uri+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.input.ImeAction+import androidx.compose.ui.unit.dp+import com.vayunmathur.email.R+import com.vayunmathur.email.data.EmailAccount+import com.vayunmathur.email.ui.composer.EmailHtmlEditorController+import com.vayunmathur.library.ui.DesktopMaxWidthContainer+import com.vayunmathur.library.ui.LabeledTextField++/**+ * Composer form pane: header/recipients, subject, HTML editor and the+ * attachment section. Extracted from [ComposerScreen] to keep that file+ * under the length limit. Behavior identical — only moved.+ */+@Composable+fun ComposerForm(+ padding: PaddingValues,+ accounts: List<EmailAccount>,+ fromAccount: EmailAccount?,+ showAccountPicker: Boolean,+ onOpenAccountPicker: () -> Unit,+ onDismissAccountPicker: () -> Unit,+ onSelectAccount: (EmailAccount) -> Unit,+ to: String,+ onToChange: (String) -> Unit,+ cc: String,+ onCcChange: (String) -> Unit,+ bcc: String,+ onBccChange: (String) -> Unit,+ showCcBcc: Boolean,+ onToggleCcBcc: () -> Unit,+ onPickContact: (Int) -> Unit,+ subject: String,+ onSubjectChange: (String) -> Unit,+ draftId: Long?,+ bodyController: EmailHtmlEditorController,+ context: Context,+ attachments: List<Uri>,+ onRemoveAttachment: (Uri) -> Unit,+) {+ // Detail pane form: letterboxed on expanded windows so fields keep a+ // readable measure on desktop.+ DesktopMaxWidthContainer(Modifier.padding(padding)) {+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp).fillMaxSize(), verticalArrangement = Arrangement.spacedBy(4.dp)) {+ ComposerHeaderSection(+ accounts = accounts,+ fromAccount = fromAccount,+ showAccountPicker = showAccountPicker,+ onOpenAccountPicker = onOpenAccountPicker,+ onDismissAccountPicker = onDismissAccountPicker,+ onSelectAccount = onSelectAccount,+ to = to,+ onToChange = onToChange,+ cc = cc,+ onCcChange = onCcChange,+ bcc = bcc,+ onBccChange = onBccChange,+ showCcBcc = showCcBcc,+ onToggleCcBcc = onToggleCcBcc,+ onPickContact = onPickContact,+ )+ // The drafts row's subject morphs into this field. Null for a fresh compose, a reply or+ // a forward, none of which came from a draft.+ LabeledTextField(+ value = subject,+ onValueChange = onSubjectChange,+ label = stringResource(R.string.subject_label),+ modifier = Modifier.fillMaxWidth(),+ imeAction = ImeAction.Next,+ sharedTextKey = draftId?.let { "email-draft-subject-$it" },+ )++ com.vayunmathur.email.ui.composer.EmailHtmlEditor(+ controller = bodyController,+ placeholder = stringResource(R.string.body_label),+ modifier = Modifier.fillMaxWidth().weight(1f),+ )++ ComposerAttachmentSection(+ context = context,+ bodyController = bodyController,+ attachments = attachments,+ onRemoveAttachment = onRemoveAttachment,+ )+ }+ }+}
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 ebbf422ad2..4d432062da 100644--- a/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt@@ -5,10 +5,7 @@ import android.net.Uri import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.clickable-import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size@@ -30,7 +27,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vayunmathur.email.R@@ -40,7 +36,6 @@ import com.vayunmathur.email.ui.composer.EmailHtmlEditorController import com.vayunmathur.email.ui.composer.InlineAttachment import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.CircularProgressIndicator-import com.vayunmathur.library.ui.DesktopMaxWidthContainer import com.vayunmathur.library.ui.DropdownMenu import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.ExperimentalMaterial3Api@@ -48,7 +43,6 @@ import com.vayunmathur.library.ui.IconAttachment import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconImage import com.vayunmathur.library.ui.IconSend-import com.vayunmathur.library.ui.LabeledTextField import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.util.AppMessages@@ -303,51 +297,30 @@ fun ComposerScreen( } }, ) { padding ->- // Detail pane form: letterboxed on expanded windows so fields keep a- // readable measure on desktop.- DesktopMaxWidthContainer(Modifier.padding(padding)) {- Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp).fillMaxSize(), verticalArrangement = Arrangement.spacedBy(4.dp)) {- ComposerHeaderSection(- accounts = accounts,- fromAccount = fromAccount,- showAccountPicker = showAccountPicker,- onOpenAccountPicker = { showAccountPicker = true },- onDismissAccountPicker = { showAccountPicker = false },- onSelectAccount = { fromAccount = it; showAccountPicker = false },- to = to,- onToChange = { to = it },- cc = cc,- onCcChange = { cc = it },- bcc = bcc,- onBccChange = { bcc = it },- showCcBcc = showCcBcc,- onToggleCcBcc = { showCcBcc = !showCcBcc },- onPickContact = pickContact,- )- // The drafts row's subject morphs into this field. Null for a fresh compose, a reply or- // a forward, none of which came from a draft.- LabeledTextField(- value = subject,- onValueChange = { subject = it },- label = stringResource(R.string.subject_label),- modifier = Modifier.fillMaxWidth(),- imeAction = ImeAction.Next,- sharedTextKey = draftId?.let { "email-draft-subject-$it" },- )-- com.vayunmathur.email.ui.composer.EmailHtmlEditor(- controller = bodyController,- placeholder = stringResource(R.string.body_label),- modifier = Modifier.fillMaxWidth().weight(1f),- )-- ComposerAttachmentSection(- context = context,- bodyController = bodyController,- attachments = attachments,- onRemoveAttachment = { uri -> attachments = attachments - uri },- )- }- }+ ComposerForm(+ padding = padding,+ accounts = accounts,+ fromAccount = fromAccount,+ showAccountPicker = showAccountPicker,+ onOpenAccountPicker = { showAccountPicker = true },+ onDismissAccountPicker = { showAccountPicker = false },+ onSelectAccount = { fromAccount = it; showAccountPicker = false },+ to = to,+ onToChange = { to = it },+ cc = cc,+ onCcChange = { cc = it },+ bcc = bcc,+ onBccChange = { bcc = it },+ showCcBcc = showCcBcc,+ onToggleCcBcc = { showCcBcc = !showCcBcc },+ onPickContact = pickContact,+ subject = subject,+ onSubjectChange = { subject = it },+ draftId = draftId,+ bodyController = bodyController,+ context = context,+ attachments = attachments,+ onRemoveAttachment = { uri -> attachments = attachments - uri },+ ) } }
files/src/main/java/com/vayunmathur/files/ui/DirectoryBody.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/DirectoryBody.kt b/files/src/main/java/com/vayunmathur/files/ui/DirectoryBody.ktnew file mode 100644index 0000000000..5f05ee3c62--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/ui/DirectoryBody.kt@@ -0,0 +1,79 @@+package com.vayunmathur.files.ui++import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import com.vayunmathur.files.platform.FilesActions+import com.vayunmathur.files.platform.FilesUiState+import com.vayunmathur.library.ui.VerticalDivider+import com.vayunmathur.library.ui.isExpandedWidth++/**+ * Directory listing pane(s): the expanded-width parent pane beside the+ * listing, or the listing alone. Extracted from [DirectoryScreen] to keep+ * that file under the length limit. Behavior identical — only moved.+ */+@Composable+fun DirectoryBody(+ state: FilesUiState,+ actions: FilesActions,+ canModifyHere: Boolean,+ isReadOnly: Boolean,+ isCategory: Boolean,+ padding: PaddingValues,+ onClearRenameTarget: () -> Unit,+) {+ // Expanded windows (desktop, large tablets) list the parent folder beside the current+ // one. This stays inside the same destination on purpose: files deliberately has no+ // list/detail metadata, so one back-stack entry per folder level is what keeps Back+ // walking up exactly one folder with a predictive-back preview of where it lands. A+ // second destination would split that walk. Categories and zip contents have no parent+ // folder, the root has nothing above it, and compact widths keep the push behavior -+ // all of those stay single-pane exactly as before.+ DirectoryBody(+ currentDirectory = state.currentDirectory,+ rootDirectory = state.rootDirectory,+ isCategory = isCategory,+ isReadOnly = isReadOnly,+ padding = padding,+ parentPane = { modifier ->+ DirectoryParentPane(state = state, actions = actions, modifier = modifier)+ },+ listing = { modifier ->+ DirectoryListing(+ state = state,+ actions = actions,+ canModifyHere = canModifyHere,+ isReadOnly = isReadOnly,+ modifier = modifier,+ onClearRenameTarget = onClearRenameTarget,+ )+ },+ )+}++@Composable+fun DirectoryBody(+ currentDirectory: java.io.File,+ rootDirectory: java.io.File,+ isCategory: Boolean,+ isReadOnly: Boolean,+ padding: PaddingValues,+ parentPane: @Composable (Modifier) -> Unit,+ listing: @Composable (Modifier) -> Unit,+) {+ val atRoot = currentDirectory.absolutePath == rootDirectory.absolutePath+ if (isExpandedWidth() && !isCategory && !isReadOnly && !atRoot) {+ Row(Modifier.fillMaxSize().padding(padding)) {+ parentPane(Modifier.weight(0.35f).fillMaxHeight())+ VerticalDivider(modifier = Modifier.fillMaxHeight())+ listing(Modifier.weight(0.65f).fillMaxHeight())+ }+ } else {+ listing(Modifier.fillMaxSize().padding(padding))+ }+}
files/src/main/java/com/vayunmathur/files/ui/DirectoryScreen.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/DirectoryScreen.kt b/files/src/main/java/com/vayunmathur/files/ui/DirectoryScreen.ktindex 4d9130e262..acdb23b4fb 100644--- a/files/src/main/java/com/vayunmathur/files/ui/DirectoryScreen.kt+++ b/files/src/main/java/com/vayunmathur/files/ui/DirectoryScreen.kt@@ -4,9 +4,6 @@ import androidx.activity.compose.BackHandler import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.fillMaxHeight-import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions@@ -36,8 +33,6 @@ import com.vayunmathur.library.ui.SnackbarHostState import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.ui.TextField-import com.vayunmathur.library.ui.VerticalDivider-import com.vayunmathur.library.ui.isExpandedWidth import com.vayunmathur.library.ui.R as UiR /**@@ -105,68 +100,6 @@ fun DirectoryScreen( ) } -/** Expanded-width parent pane beside the listing, or the listing alone. Shared by both bodies. */-@Composable-internal fun DirectoryBody(- state: FilesUiState,- actions: FilesActions,- canModifyHere: Boolean,- isReadOnly: Boolean,- isCategory: Boolean,- padding: PaddingValues,- onClearRenameTarget: () -> Unit,-) {- // Expanded windows (desktop, large tablets) list the parent folder beside the current- // one. This stays inside the same destination on purpose: files deliberately has no- // list/detail metadata, so one back-stack entry per folder level is what keeps Back- // walking up exactly one folder with a predictive-back preview of where it lands. A- // second destination would split that walk. Categories and zip contents have no parent- // folder, the root has nothing above it, and compact widths keep the push behavior -- // all of those stay single-pane exactly as before.- DirectoryBody(- currentDirectory = state.currentDirectory,- rootDirectory = state.rootDirectory,- isCategory = isCategory,- isReadOnly = isReadOnly,- padding = padding,- parentPane = { modifier ->- DirectoryParentPane(state = state, actions = actions, modifier = modifier)- },- listing = { modifier ->- DirectoryListing(- state = state,- actions = actions,- canModifyHere = canModifyHere,- isReadOnly = isReadOnly,- modifier = modifier,- onClearRenameTarget = onClearRenameTarget,- )- },- )-}--@Composable-internal fun DirectoryBody(- currentDirectory: java.io.File,- rootDirectory: java.io.File,- isCategory: Boolean,- isReadOnly: Boolean,- padding: PaddingValues,- parentPane: @Composable (Modifier) -> Unit,- listing: @Composable (Modifier) -> Unit,-) {- val atRoot = currentDirectory.absolutePath == rootDirectory.absolutePath- if (isExpandedWidth() && !isCategory && !isReadOnly && !atRoot) {- Row(Modifier.fillMaxSize().padding(padding)) {- parentPane(Modifier.weight(0.35f).fillMaxHeight())- VerticalDivider(modifier = Modifier.fillMaxHeight())- listing(Modifier.weight(0.65f).fillMaxHeight())- }- } else {- listing(Modifier.fillMaxSize().padding(padding))- }-}- /** * Scaffold, dialogs and Back handling for the directory browser. *
findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyLocationSharingPermissionsSpec.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyLocationSharingPermissionsSpec.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyLocationSharingPermissionsSpec.ktnew file mode 100644index 0000000000..5bc52900c0--- /dev/null+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyLocationSharingPermissionsSpec.kt@@ -0,0 +1,15 @@+package com.vayunmathur.findfamily.ui++import androidx.compose.runtime.Composable+import androidx.compose.ui.res.stringResource+import com.vayunmathur.findfamily.R+import com.vayunmathur.library.ui.AppPermissionsSpec+import com.vayunmathur.library.ui.IconBluetooth++/** The location-sharing subset, for the staged first-run sheet's second stage. */+@Composable+fun findFamilyLocationSharingPermissionsSpec() = AppPermissionsSpec(+ title = stringResource(R.string.permission_grant_fine_location),+ icon = { IconBluetooth() },+ requirements = findFamilyLocationSharingRequirements(),+)
findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyPermissionsSpec.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyPermissionsSpec.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyPermissionsSpec.ktindex 856e2b0644..7b11e82f62 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyPermissionsSpec.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/FindFamilyPermissionsSpec.kt@@ -61,10 +61,3 @@ fun findFamilyPermissionsSpec() = AppPermissionsSpec( requirements = findFamilyFullRequirements(), ) -/** The location-sharing subset, for the staged first-run sheet's second stage. */-@Composable-fun findFamilyLocationSharingPermissionsSpec() = AppPermissionsSpec(- title = stringResource(R.string.permission_grant_fine_location),- icon = { IconBluetooth() },- requirements = findFamilyLocationSharingRequirements(),-)