Modern Apps git

← Modern-Apps.git

communicate: dev-only lines move behind a variant seam; :communicate-dev created

Commit
c0b83032549a5b6a8a922331fd791ba012298e9a
Author
Vayun Mathur <[email protected]>
When
2026-12-01 15:53 UTC (4 days ago)
Parents
9ef8267
Stage 1 of the owner-ordered extraction. Findings: DEV_BUILD
gating was three Feature objects with ~150 call sites and
release relied purely on R8 stripping compiled dev code.
An application module cannot be depended on, so the viable
direction is :communicate -> devImplementation(
:communicate-dev) plus a variant seam (the reverse of the
original sketch).

:communicate-dev exists as an Android library (excluded from
the repo line count by owner decision, per the Phase-0
ratchet). The three Feature gates and the 15 registration/
RCS screens move src/main -> src/dev byte-identical;
src/release carries enabled=false stubs and Google-Voice-
only registration entries, so release no longer compiles
dev UI at all (stronger than R8 stripping). A .gitignore
negation keeps src/release tracked. Routes stay host-side,
so the registration wizards remain route sub-stacks in dev
and are simply unreachable in release.

Verified by the agent: compileDev/compileReleaseKotlin,
assembleDev (155 MB) and assembleRelease (34 MB) with a DEX
probe (dev APK contains the registration screens and
communicatedev; release none), communicate + communicate-dev
lint, 549 targeted tests + the ui test package. The FULL
:communicate:testDevUnitTest run produced nothing within an
hour under shared-box contention and is explicitly
UNVERIFIED — re-run pending. The data trees (36k lines),
repository extensions, protos and both Rust crates stay in
src/main for Stage 2 behind the same seam (blocking
couplings: SecretSealer, the shared in-app call registry,
host models). This commit's CommunicateNavGraph also
carries the co-resident dialog-refactor hunks that were
already in that file (verified compiling together).

Diff

communicate-dev/AGENTS.md
diff --git a/communicate-dev/AGENTS.md b/communicate-dev/AGENTS.mdnew file mode 100644index 0000000000..b93067f754--- /dev/null+++ b/communicate-dev/AGENTS.md@@ -0,0 +1,32 @@+# AGENTS.md — communicate-dev/ (':communicate-dev')++> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `communicate-dev/` + `communicate/`.++- Gradle: :communicate-dev / dir: communicate-dev/+- Module type: Android library (`common-conventions-library`); it is not an app and has no `applicationId`, launcher icon, or store metadata.+- Host: `:communicate` links this module only from its `dev` variant (`devImplementation`). Release builds do not compile, link, or package it.+- This module is dev-build-only by owner decision and is excluded from the repo line count for `:communicate`.+- Package names under `com.vayunmathur.communicate.*` are kept where JNI symbol names (Rust crates `communicate_signal` / `communicate_mls`), protobuf/wire formats, Room schemas, and persisted DataStore/auth formats freeze them. The library namespace (`com.vayunmathur.communicatedev`) only names this module's own R/resources.+- Entry files: none in this module yet. The host's registration entries live in `communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt` (dev variant) with a Google-Voice-only release counterpart in `communicate/src/release/`; the three line feature gates likewise live in `communicate/src/dev/` (on) and `communicate/src/release/` (off).+- Deps: :library, :library:ui, :library:log, :library:network, :library:image, :library:room, :library:aosp-stubs (compileOnly)++## Overview+**Purpose:** Owns the dev-only messaging lines of Communicate — WhatsApp, Signal, and RCS (data, transports, crypto, registration UI, and sync services) — so those lines do not count against or ship in the `:communicate` release app. Dev builds of `:communicate` gain the lines through this module; release behaviour is unchanged.+**Key features:**+- WhatsApp primary client line (Noise + Double Ratchet), Signal line (libsignal + Rust protocol), and RCS line (SIP/MSRP + MLS E2EE) for dev builds+- Registration wizard screens for the three lines (route sub-stacks owned by the host's `Route`)+- Line sync foreground services, declared in this module's manifest so they merge only into dev builds+**Architecture / data-flow:** Host (`:communicate`, dev variant) links this module via `devImplementation`. The per-line data/transports (`communicate/data/<line>/`), Rust crates, and protobuf sources still live in the host in the current stage and move here next; unified conversation models, the repository facade, the in-call registry, and notification spaces stay in the host. Registration UI and the line feature gates are already variant-segregated in the host (`src/dev` real, `src/release` stubs), which is the seam the remaining move follows.+**Gotchas:**+- Never add this module as an `implementation` dependency of `:communicate`; it is `devImplementation` only. A release APK containing these classes is a regression.+- `:library:aosp-stubs` is `compileOnly` only — it must never be packaged.+- Registration wizards are host route sub-stacks (`Route.WhatsAppRegistration`, `Route.SignalRegistration`, RCS routes); step state stays in route arguments, not in held selection state.+- RingRTC is the only WebRTC distribution allowed on the classpath; never add another WebRTC dependency.++## Verify (this module only)+```+./gradlew :communicate-dev:compileDebugKotlin+./gradlew :communicate-dev:lint+./gradlew :communicate:compileDevKotlin+./gradlew :communicate:compileReleaseKotlin+```
communicate-dev/build.gradle.kts
diff --git a/communicate-dev/build.gradle.kts b/communicate-dev/build.gradle.ktsnew file mode 100644index 0000000000..17d234de2f--- /dev/null+++ b/communicate-dev/build.gradle.kts@@ -0,0 +1,44 @@+plugins {+    id("common-conventions-library")+    id("com.google.devtools.ksp")+}++// No unit tests in this module yet (they move with the line code);+// the shared test-resources source dir alone otherwise makes the+// test task fail with "no tests discovered".+tasks.withType<org.gradle.api.tasks.testing.Test>().configureEach {+    failOnNoDiscoveredTests = false+}++// Dev-build-only companion library for :communicate (see AGENTS.md).+// The host app links this module only from its `dev` variant+// (`devImplementation`), so nothing in here is compiled or packaged+// into release builds. Package names under+// com.vayunmathur.communicate.* are kept where JNI symbol names and+// wire/persisted formats freeze them.++dependencies {+    // Shared repo libraries the dev lines use (mirrors :communicate).+    implementation(project(":library"))+    implementation(project(":library:ui"))+    implementation(project(":library:log"))+    implementation(project(":library:network"))+    implementation(project(":library:image"))+    implementation(project(":library:room"))++    // Compile-only framework @SystemApi RCS stubs; never packaged.+    compileOnly(project(":library:aosp-stubs"))++    implementation(libs.ringrtc.android)+    implementation(libs.libsignal.android)+    implementation(libs.protobuf.java)+    implementation(libs.libphonenumber)+    implementation(libs.kotlinx.serialization.json)+    implementation(libs.androidx.datastore.preferences)++    testImplementation(libs.robolectric)+    testImplementation(libs.androidx.test.core)+    testImplementation(libs.kotlin.reflect)+    testImplementation(libs.androidx.sqlite.bundled.jvm)+    testImplementation(project(":library:aosp-stubs"))+}
communicate-dev/src/main/AndroidManifest.xml
diff --git a/communicate-dev/src/main/AndroidManifest.xml b/communicate-dev/src/main/AndroidManifest.xmlnew file mode 100644index 0000000000..25c95bee79--- /dev/null+++ b/communicate-dev/src/main/AndroidManifest.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<manifest xmlns:android="http://schemas.android.com/apk/res/android">++    <!-- No components yet. The dev lines' sync services are declared+         here when their classes move into this module, so they merge+         only into dev builds of the host app. -->++</manifest>
communicate/.gitignore
diff --git a/communicate/.gitignore b/communicate/.gitignoreindex dd449725e1..cec705ad62 100644--- a/communicate/.gitignore+++ b/communicate/.gitignore@@ -1 +1,5 @@ *.md+# The release variant source set (src/release/) holds the dev-line+# stubs; the root `release/` ignore must not swallow it.+!src/release/+!src/release/**
communicate/build.gradle.kts
diff --git a/communicate/build.gradle.kts b/communicate/build.gradle.ktsindex 7812fa5957..47276264e8 100644--- a/communicate/build.gradle.kts+++ b/communicate/build.gradle.kts@@ -44,6 +44,11 @@ android {  dependencies {     coreLibraryDesugaring(libs.desugar.jdk.libs)+    // Dev-only line library (WhatsApp/Signal/RCS). Linked only into the+    // dev variant, so release builds neither compile nor package it.+    // `dev` is a repo-custom build type, so there is no static+    // `devImplementation` accessor; use add() like the convention does.+    add("devImplementation", project(":communicate-dev")) }  // ----------------------------------------------------------------
communicate/src/dev/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt
diff --git a/communicate/src/dev/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt b/communicate/src/dev/java/com/vayunmathur/communicate/data/rcs/RcsFeature.ktnew file mode 100644index 0000000000..dcc141f156--- /dev/null+++ b/communicate/src/dev/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt@@ -0,0 +1,13 @@+package com.vayunmathur.communicate.data.rcs++/**+ * Single on/off gate for the experimental **RCS single-registration** line.+ *+ * This is the `dev` variant source: the line is present, so the gate is+ * always on here. The `release` variant source of this same object has+ * `enabled = false`, and the dev-only RCS code is not compiled into+ * release at all.+ */+object RcsFeature {+    val enabled: Boolean = true+}
communicate/src/dev/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt
diff --git a/communicate/src/dev/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt b/communicate/src/dev/java/com/vayunmathur/communicate/data/signal/SignalFeature.ktnew file mode 100644index 0000000000..46ff5c74e0--- /dev/null+++ b/communicate/src/dev/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt@@ -0,0 +1,13 @@+package com.vayunmathur.communicate.data.signal++/**+ * Single on/off gate for the experimental **Signal** primary client feature.+ *+ * This is the `dev` variant source: the line is present, so the gate is+ * always on here. The `release` variant source of this same object has+ * `enabled = false`, and the dev-only Signal code is not compiled into+ * release at all.+ */+object SignalFeature {+    val enabled: Boolean = true+}
communicate/src/dev/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt
diff --git a/communicate/src/dev/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt b/communicate/src/dev/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.ktnew file mode 100644index 0000000000..d9a7887b6d--- /dev/null+++ b/communicate/src/dev/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt@@ -0,0 +1,17 @@+package com.vayunmathur.communicate.data.whatsapp++/**+ * Single on/off gate for the experimental **WhatsApp primary client** feature.+ *+ * This is the `dev` variant source: the line is present, so the gate is+ * always on here. The `release` variant source of this same object has+ * `enabled = false`, and the dev-only WhatsApp code is not compiled into+ * release at all, so the release variant never registers, connects, or+ * exposes WhatsApp UI/lines.+ *+ * WhatsApp is an unofficial primary-client reimplementation and carries real ToS/ban risk (a live+ * test number was banned with `violation_type:15`), so it must not ship in the release variant.+ */+object WhatsAppFeature {+    val enabled: Boolean = true+}
communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt
diff --git a/communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.ktnew file mode 100644index 0000000000..349aef5f25--- /dev/null+++ b/communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt@@ -0,0 +1,140 @@+package com.vayunmathur.communicate.ui++import com.vayunmathur.communicate.Route+import com.vayunmathur.communicate.ui.googlevoice.GoogleVoiceSignInScreen+import com.vayunmathur.communicate.ui.rcs.RcsRegistrationScreen+import com.vayunmathur.communicate.ui.signal.SignalRegistrationCaptchaScreen+import com.vayunmathur.communicate.ui.signal.SignalRegistrationCodeScreen+import com.vayunmathur.communicate.ui.signal.SignalRegistrationDoneScreen+import com.vayunmathur.communicate.ui.signal.SignalRegistrationNumberScreen+import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationCodeScreen+import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationDoneScreen+import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationNumberScreen+import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationPinScreen+import com.vayunmathur.library.util.EntryProviderScope+import com.vayunmathur.library.util.ListDetailPage+import com.vayunmathur.library.util.NavBackStack++/**+ * Replaces the WhatsApp registration steps on the stack with Done.+ *+ * Done is the terminal step: leaving it must exit registration (as the+ * single-screen flow's Done/Back buttons did), not step back into the+ * code/PIN steps for an already-registered number.+ */+internal fun NavBackStack<Route>.showWhatsAppRegistrationDone(cc: String, number: String) {+    while (backStack.lastOrNull() is Route.WhatsAppRegistration) pop()+    add(Route.WhatsAppRegistration.Done(cc, number))+}++/** Replaces the Signal registration steps on the stack with Done; see [showWhatsAppRegistrationDone]. */+internal fun NavBackStack<Route>.showSignalRegistrationDone(cc: String, number: String) {+    while (backStack.lastOrNull() is Route.SignalRegistration) pop()+    add(Route.SignalRegistration.Done(cc, number))+}++fun EntryProviderScope<Route>.registrationEntries(backStack: NavBackStack<Route>) {+    entry<Route.GoogleVoiceSignIn>(metadata = ListDetailPage()) {+        GoogleVoiceSignInScreen(+            onBack = { backStack.pop() },+            onSignedIn = { backStack.pop() },+        )+    }+    entry<Route.WhatsAppRegistration.Number>(metadata = ListDetailPage()) {+        WhatsAppRegistrationNumberScreen(+            onBack = { backStack.pop() },+            onCodeRequested = { cc, number ->+                backStack.add(Route.WhatsAppRegistration.Code(cc, number))+            },+        )+    }+    entry<Route.WhatsAppRegistration.Code>(metadata = ListDetailPage()) { route ->+        WhatsAppRegistrationCodeScreen(+            cc = route.cc,+            number = route.number,+            onBack = { backStack.pop() },+            onPinRequired = { cc, number ->+                backStack.add(Route.WhatsAppRegistration.Pin(cc, number))+            },+            onVerified = { cc, number -> backStack.showWhatsAppRegistrationDone(cc, number) },+        )+    }+    entry<Route.WhatsAppRegistration.Pin>(metadata = ListDetailPage()) { route ->+        WhatsAppRegistrationPinScreen(+            cc = route.cc,+            number = route.number,+            onBack = { backStack.pop() },+            onVerified = { cc, number -> backStack.showWhatsAppRegistrationDone(cc, number) },+        )+    }+    entry<Route.WhatsAppRegistration.Done>(metadata = ListDetailPage()) {+        WhatsAppRegistrationDoneScreen(+            onBack = { backStack.pop() },+            onRegistered = { backStack.pop() },+        )+    }+    entry<Route.WhatsAppBackupImport>(metadata = ListDetailPage()) {+        com.vayunmathur.communicate.ui.whatsapp.WhatsAppBackupImportScreen(+            onBack = { backStack.pop() },+        )+    }+    entry<Route.SignalRegistration.Number>(metadata = ListDetailPage()) {+        SignalRegistrationNumberScreen(+            onBack = { backStack.pop() },+            onCaptchaRequired = { cc, number, transport ->+                backStack.add(Route.SignalRegistration.Captcha(cc, number, transport))+            },+            onCodeRequested = { cc, number ->+                backStack.add(Route.SignalRegistration.Code(cc, number))+            },+        )+    }+    entry<Route.SignalRegistration.Captcha>(metadata = ListDetailPage()) { route ->+        SignalRegistrationCaptchaScreen(+            cc = route.cc,+            number = route.number,+            transport = route.transport,+            onBack = { backStack.pop() },+            // Replace (not push) the captcha, so Code's Back/Change-number+            // lands on Number as the single-screen flow's buttons did.+            onCodeRequested = { cc, number ->+                backStack.setLast(Route.SignalRegistration.Code(cc, number))+            },+            onCaptchaRejected = { backStack.pop() },+        )+    }+    entry<Route.SignalRegistration.Code>(metadata = ListDetailPage()) { route ->+        SignalRegistrationCodeScreen(+            cc = route.cc,+            number = route.number,+            onBack = { backStack.pop() },+            onVerified = { cc, number -> backStack.showSignalRegistrationDone(cc, number) },+        )+    }+    entry<Route.SignalRegistration.Done>(metadata = ListDetailPage()) {+        SignalRegistrationDoneScreen(+            onBack = { backStack.pop() },+            onRegistered = { backStack.pop() },+        )+    }+    entry<Route.RcsStatus>(metadata = ListDetailPage()) {+        RcsRegistrationScreen(+            onBack = { backStack.pop() },+        )+    }+}++fun EntryProviderScope<Route>.rcsConversationEntries(backStack: NavBackStack<Route>) {+    entry<Route.RcsVerify>(metadata = ListDetailPage()) { route ->+        com.vayunmathur.communicate.ui.rcs.RcsVerifyScreen(+            peerE164 = route.peerE164,+            onBack = { backStack.pop() },+        )+    }+    entry<Route.RcsGroupMembers>(metadata = ListDetailPage()) { route ->+        com.vayunmathur.communicate.ui.rcs.RcsGroupMembersScreen(+            conversationId = route.conversationId,+            onBack = { backStack.pop() },+        )+    }+}
communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsGroupMembersScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsGroupMembersScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsGroupMembersScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsGroupMembersScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsGroupMembersScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsRegistrationScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsRegistrationScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsRegistrationScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsRegistrationScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsRegistrationScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsVerifyScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsVerifyScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsVerifyScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/rcs/RcsVerifyScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/rcs/RcsVerifyScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalCaptchaScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalCaptchaScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalCaptchaScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalCaptchaScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalCaptchaScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCaptchaScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCaptchaScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCaptchaScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCaptchaScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCaptchaScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCodeScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCodeScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCodeScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCodeScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationCodeScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationDoneScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationDoneScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationDoneScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationDoneScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationDoneScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationNumberScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationNumberScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationNumberScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationNumberScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationNumberScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationStepScaffold.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationStepScaffold.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationStepScaffold.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationStepScaffold.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/signal/SignalRegistrationStepScaffold.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppBackupImportScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppBackupImportScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppBackupImportScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppBackupImportScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppBackupImportScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationCodeScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationCodeScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationCodeScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationCodeScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationCodeScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationDoneScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationDoneScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationDoneScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationDoneScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationDoneScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationNumberScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationNumberScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationNumberScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationNumberScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationNumberScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationPinScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationPinScreen.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationPinScreen.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationPinScreen.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationPinScreen.kt
communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationStepScaffold.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationStepScaffold.kt b/communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationStepScaffold.ktsimilarity index 100%rename from communicate/src/main/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationStepScaffold.ktrename to communicate/src/dev/java/com/vayunmathur/communicate/ui/whatsapp/WhatsAppRegistrationStepScaffold.kt
communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsFeature.ktdeleted file mode 100644index 05378d4c80..0000000000--- a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt+++ /dev/null@@ -1,14 +0,0 @@-package com.vayunmathur.communicate.data.rcs--import com.vayunmathur.communicate.BuildConfig--/**- * Single on/off gate for the experimental **RCS single-registration** line.- *- * Mirrors [com.vayunmathur.communicate.data.whatsapp.WhatsAppFeature]: backed by- * [BuildConfig.DEV_BUILD] (`true` for `assembleDev`/`assembleDebug`, `false` for release).- * All `if (RcsFeature.enabled)` branches are stripped from release by R8.- */-object RcsFeature {-    val enabled: Boolean get() = BuildConfig.DEV_BUILD-}
communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalFeature.ktdeleted file mode 100644index e0f452b64a..0000000000--- a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt+++ /dev/null@@ -1,14 +0,0 @@-package com.vayunmathur.communicate.data.signal--import com.vayunmathur.communicate.BuildConfig--/**- * Single on/off gate for the experimental **Signal** primary client feature.- *- * Mirrors [com.vayunmathur.communicate.data.whatsapp.WhatsAppFeature]: backed by- * [BuildConfig.DEV_BUILD] (`true` for `assembleDev`/`assembleDebug`, `false` for release).- * All `if (SignalFeature.enabled)` branches are stripped from release by R8.- */-object SignalFeature {-    val enabled: Boolean get() = BuildConfig.DEV_BUILD-}
communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.ktdeleted file mode 100644index cc70c01b4a..0000000000--- a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt+++ /dev/null@@ -1,18 +0,0 @@-package com.vayunmathur.communicate.data.whatsapp--import com.vayunmathur.communicate.BuildConfig--/**- * Single on/off gate for the experimental **WhatsApp primary client** feature.- *- * Backed by [BuildConfig.DEV_BUILD], which is `true` for `assembleDev`/`assembleDebug` and `false`- * for `assembleRelease`. Because it's a compile-time constant, every `if (WhatsAppFeature.enabled)`- * branch (and everything it reaches) is stripped from release builds by R8, so the release variant- * never registers, connects, or exposes WhatsApp UI/lines.- *- * WhatsApp is an unofficial primary-client reimplementation and carries real ToS/ban risk (a live- * test number was banned with `violation_type:15`), so it must not ship in the release variant.- */-object WhatsAppFeature {-    val enabled: Boolean get() = BuildConfig.DEV_BUILD-}
communicate/src/main/java/com/vayunmathur/communicate/ui/CommunicateNavGraph.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/ui/CommunicateNavGraph.kt b/communicate/src/main/java/com/vayunmathur/communicate/ui/CommunicateNavGraph.ktindex 141716d316..cfa44ac498 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/ui/CommunicateNavGraph.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/ui/CommunicateNavGraph.kt@@ -6,16 +6,6 @@ import com.vayunmathur.communicate.data.call.InAppCallRegistry import com.vayunmathur.communicate.data.rcs.RcsFeature import com.vayunmathur.communicate.data.signal.SignalFeature import com.vayunmathur.communicate.ui.call.InAppCallScreen-import com.vayunmathur.communicate.ui.googlevoice.GoogleVoiceSignInScreen-import com.vayunmathur.communicate.ui.rcs.RcsRegistrationScreen-import com.vayunmathur.communicate.ui.signal.SignalRegistrationCaptchaScreen-import com.vayunmathur.communicate.ui.signal.SignalRegistrationCodeScreen-import com.vayunmathur.communicate.ui.signal.SignalRegistrationDoneScreen-import com.vayunmathur.communicate.ui.signal.SignalRegistrationNumberScreen-import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationCodeScreen-import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationDoneScreen-import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationNumberScreen-import com.vayunmathur.communicate.ui.whatsapp.WhatsAppRegistrationPinScreen import com.vayunmathur.library.util.EntryProviderScope import com.vayunmathur.library.util.FullscreenPage import com.vayunmathur.library.util.ListDetailPage@@ -28,45 +18,70 @@ import com.vayunmathur.library.util.SiblingPage @Composable fun CommunicateNavGraph(backStack: NavBackStack<Route>) {     MainNavigation(backStack) {-        coreEntries(backStack)+        // Opening a thread, shared by the Messages list and the NewMessage+        // dialog: a picker share (regular share target, no conversation+        // chosen) seeds the first thread opened after it; consume so later+        // opens are plain. Re-tapping another thread replaces the detail+        // instead of stacking Conversation on Conversation.+        val openThread: (com.vayunmathur.communicate.data.SmsThread) -> Unit = { thread ->+            val pendingShare = com.vayunmathur.communicate.intents.PendingShare.consume()+            val route = Route.Conversation(+                threadId = thread.threadId,+                address = thread.address,+                line = thread.line,+                remoteId = thread.remoteId,+                subscriptionId = thread.subscriptionId,+                isGroup = thread.isGroup,+                participants = thread.participants,+                groupTitle = thread.groupTitle,+                sharedText = pendingShare?.body,+                sharedAttachmentUris = pendingShare?.sharedAttachmentUris.orEmpty(),+            )+            if (backStack.backStack.lastOrNull() is Route.Conversation) backStack.setLast(route)+            else backStack.add(route)+        }+        coreEntries(backStack, openThread)         registrationEntries(backStack)         conversationEntries(backStack)         callEntries(backStack)+        dialogEntries(backStack, openThread)     } } -fun EntryProviderScope<Route>.coreEntries(backStack: NavBackStack<Route>) {+fun EntryProviderScope<Route>.coreEntries(+    backStack: NavBackStack<Route>,+    onOpenThread: (com.vayunmathur.communicate.data.SmsThread) -> Unit,+) {     entry<Route.Messages>(metadata = ListPage() + SiblingPage()) {         MessagesScreen(-            onOpenThread = { thread ->-                // A picker share (regular share target, no conversation chosen)-                // seeds the first thread opened after it; consume so later opens are plain.-                val pendingShare = com.vayunmathur.communicate.intents.PendingShare.consume()-                val route = Route.Conversation(-                    threadId = thread.threadId,-                    address = thread.address,-                    line = thread.line,-                    remoteId = thread.remoteId,-                    subscriptionId = thread.subscriptionId,-                    isGroup = thread.isGroup,-                    participants = thread.participants,-                    groupTitle = thread.groupTitle,-                    sharedText = pendingShare?.body,-                    sharedAttachmentUris = pendingShare?.sharedAttachmentUris.orEmpty(),+            onOpenThread = onOpenThread,+            onOpenAccounts = { backStack.add(Route.Accounts) },+            onNewMessage = { backStack.add(Route.NewMessageDialog) },+            onDeleteConversationRequest = { thread ->+                backStack.add(+                    Route.DeleteConversationDialog(+                        threadId = thread.threadId,+                        address = thread.address,+                        line = thread.line,+                        remoteId = thread.remoteId,+                        subscriptionId = thread.subscriptionId,+                        isGroup = thread.isGroup,+                        participants = thread.participants,+                        groupTitle = thread.groupTitle,+                    ),                 )-                // Re-tapping another thread replaces the detail instead of stacking-                // Conversation on Conversation.-                if (backStack.last() is Route.Conversation) backStack.setLast(route)-                else backStack.add(route)             },-            onOpenAccounts = { backStack.add(Route.Accounts) },         )     }     entry<Route.Dialer>(metadata = SiblingPage()) {         DialerScreen()     }     entry<Route.CallLogs>(metadata = SiblingPage()) {-        CallLogsScreen()+        CallLogsScreen(+            onDeleteCallLogRequest = { entry ->+                backStack.add(Route.DeleteCallLogDialog(entryId = entry.id, line = entry.line))+            },+        )     }     entry<Route.Accounts>(metadata = ListDetailPage()) {         AccountsScreen(@@ -96,128 +111,8 @@ fun EntryProviderScope<Route>.coreEntries(backStack: NavBackStack<Route>) {     } } -/**- * Replaces the WhatsApp registration steps on the stack with Done.- *- * Done is the terminal step: leaving it must exit registration (as the- * single-screen flow's Done/Back buttons did), not step back into the- * code/PIN steps for an already-registered number.- */-internal fun NavBackStack<Route>.showWhatsAppRegistrationDone(cc: String, number: String) {-    while (backStack.lastOrNull() is Route.WhatsAppRegistration) pop()-    add(Route.WhatsAppRegistration.Done(cc, number))-}--/** Replaces the Signal registration steps on the stack with Done; see [showWhatsAppRegistrationDone]. */-internal fun NavBackStack<Route>.showSignalRegistrationDone(cc: String, number: String) {-    while (backStack.lastOrNull() is Route.SignalRegistration) pop()-    add(Route.SignalRegistration.Done(cc, number))-}--fun EntryProviderScope<Route>.registrationEntries(backStack: NavBackStack<Route>) {-    entry<Route.GoogleVoiceSignIn>(metadata = ListDetailPage()) {-        GoogleVoiceSignInScreen(-            onBack = { backStack.pop() },-            onSignedIn = { backStack.pop() },-        )-    }-    entry<Route.WhatsAppRegistration.Number>(metadata = ListDetailPage()) {-        WhatsAppRegistrationNumberScreen(-            onBack = { backStack.pop() },-            onCodeRequested = { cc, number ->-                backStack.add(Route.WhatsAppRegistration.Code(cc, number))-            },-        )-    }-    entry<Route.WhatsAppRegistration.Code>(metadata = ListDetailPage()) { route ->-        WhatsAppRegistrationCodeScreen(-            cc = route.cc,-            number = route.number,-            onBack = { backStack.pop() },-            onPinRequired = { cc, number ->-                backStack.add(Route.WhatsAppRegistration.Pin(cc, number))-            },-            onVerified = { cc, number -> backStack.showWhatsAppRegistrationDone(cc, number) },-        )-    }-    entry<Route.WhatsAppRegistration.Pin>(metadata = ListDetailPage()) { route ->-        WhatsAppRegistrationPinScreen(-            cc = route.cc,-            number = route.number,-            onBack = { backStack.pop() },-            onVerified = { cc, number -> backStack.showWhatsAppRegistrationDone(cc, number) },-        )-    }-    entry<Route.WhatsAppRegistration.Done>(metadata = ListDetailPage()) {-        WhatsAppRegistrationDoneScreen(-            onBack = { backStack.pop() },-            onRegistered = { backStack.pop() },-        )-    }-    entry<Route.WhatsAppBackupImport>(metadata = ListDetailPage()) {-        com.vayunmathur.communicate.ui.whatsapp.WhatsAppBackupImportScreen(-            onBack = { backStack.pop() },-        )-    }-    entry<Route.SignalRegistration.Number>(metadata = ListDetailPage()) {-        SignalRegistrationNumberScreen(-            onBack = { backStack.pop() },-            onCaptchaRequired = { cc, number, transport ->-                backStack.add(Route.SignalRegistration.Captcha(cc, number, transport))-            },-            onCodeRequested = { cc, number ->-                backStack.add(Route.SignalRegistration.Code(cc, number))-            },-        )-    }-    entry<Route.SignalRegistration.Captcha>(metadata = ListDetailPage()) { route ->-        SignalRegistrationCaptchaScreen(-            cc = route.cc,-            number = route.number,-            transport = route.transport,-            onBack = { backStack.pop() },-            // Replace (not push) the captcha, so Code's Back/Change-number-            // lands on Number as the single-screen flow's buttons did.-            onCodeRequested = { cc, number ->-                backStack.setLast(Route.SignalRegistration.Code(cc, number))-            },-            onCaptchaRejected = { backStack.pop() },-        )-    }-    entry<Route.SignalRegistration.Code>(metadata = ListDetailPage()) { route ->-        SignalRegistrationCodeScreen(-            cc = route.cc,-            number = route.number,-            onBack = { backStack.pop() },-            onVerified = { cc, number -> backStack.showSignalRegistrationDone(cc, number) },-        )-    }-    entry<Route.SignalRegistration.Done>(metadata = ListDetailPage()) {-        SignalRegistrationDoneScreen(-            onBack = { backStack.pop() },-            onRegistered = { backStack.pop() },-        )-    }-    entry<Route.RcsStatus>(metadata = ListDetailPage()) {-        RcsRegistrationScreen(-            onBack = { backStack.pop() },-        )-    }-}- fun EntryProviderScope<Route>.conversationEntries(backStack: NavBackStack<Route>) {-    entry<Route.RcsVerify>(metadata = ListDetailPage()) { route ->-        com.vayunmathur.communicate.ui.rcs.RcsVerifyScreen(-            peerE164 = route.peerE164,-            onBack = { backStack.pop() },-        )-    }-    entry<Route.RcsGroupMembers>(metadata = ListDetailPage()) { route ->-        com.vayunmathur.communicate.ui.rcs.RcsGroupMembersScreen(-            conversationId = route.conversationId,-            onBack = { backStack.pop() },-        )-    }+    rcsConversationEntries(backStack)     entry<Route.Conversation>(metadata = ListDetailPage() + MorphPage()) { route ->         ConversationScreen(             threadId = route.threadId,@@ -233,6 +128,30 @@ fun EntryProviderScope<Route>.conversationEntries(backStack: NavBackStack<Route>             onBack = { backStack.pop() },             onOpenRcsVerify = { peer -> backStack.add(Route.RcsVerify(peer)) },             onOpenRcsGroupMembers = { cid -> backStack.add(Route.RcsGroupMembers(cid)) },+            onOpenPollComposer = {+                backStack.add(+                    Route.PollComposerDialog(+                        threadId = route.threadId,+                        address = route.address,+                        line = route.line,+                        remoteId = route.remoteId,+                    ),+                )+            },+            onDeleteConversationRequest = {+                backStack.add(+                    Route.DeleteConversationDialog(+                        threadId = route.threadId,+                        address = route.address,+                        line = route.line,+                        remoteId = route.remoteId,+                        subscriptionId = route.subscriptionId,+                        isGroup = route.isGroup,+                        participants = route.participants,+                        groupTitle = route.groupTitle,+                    ),+                )+            },         )     } }
communicate/src/release/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt
diff --git a/communicate/src/release/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt b/communicate/src/release/java/com/vayunmathur/communicate/data/rcs/RcsFeature.ktnew file mode 100644index 0000000000..717b563357--- /dev/null+++ b/communicate/src/release/java/com/vayunmathur/communicate/data/rcs/RcsFeature.kt@@ -0,0 +1,11 @@+package com.vayunmathur.communicate.data.rcs++/**+ * Single on/off gate for the experimental **RCS single-registration** line.+ *+ * This is the `release` variant source: the dev-only RCS line is not+ * compiled into release, so the gate is always off here.+ */+object RcsFeature {+    val enabled: Boolean = false+}
communicate/src/release/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt
diff --git a/communicate/src/release/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt b/communicate/src/release/java/com/vayunmathur/communicate/data/signal/SignalFeature.ktnew file mode 100644index 0000000000..7485d130e3--- /dev/null+++ b/communicate/src/release/java/com/vayunmathur/communicate/data/signal/SignalFeature.kt@@ -0,0 +1,11 @@+package com.vayunmathur.communicate.data.signal++/**+ * Single on/off gate for the experimental **Signal** primary client feature.+ *+ * This is the `release` variant source: the dev-only Signal line is not+ * compiled into release, so the gate is always off here.+ */+object SignalFeature {+    val enabled: Boolean = false+}
communicate/src/release/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt
diff --git a/communicate/src/release/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt b/communicate/src/release/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.ktnew file mode 100644index 0000000000..5e51ebe2fc--- /dev/null+++ b/communicate/src/release/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppFeature.kt@@ -0,0 +1,12 @@+package com.vayunmathur.communicate.data.whatsapp++/**+ * Single on/off gate for the experimental **WhatsApp primary client** feature.+ *+ * This is the `release` variant source: the dev-only WhatsApp line is not+ * compiled into release, so the gate is always off here and every+ * `if (WhatsAppFeature.enabled)` branch in shared code is dead.+ */+object WhatsAppFeature {+    val enabled: Boolean = false+}
communicate/src/release/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt
diff --git a/communicate/src/release/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt b/communicate/src/release/java/com/vayunmathur/communicate/ui/RegistrationEntries.ktnew file mode 100644index 0000000000..0e47813c89--- /dev/null+++ b/communicate/src/release/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt@@ -0,0 +1,26 @@+package com.vayunmathur.communicate.ui++import com.vayunmathur.communicate.Route+import com.vayunmathur.communicate.ui.googlevoice.GoogleVoiceSignInScreen+import com.vayunmathur.library.util.EntryProviderScope+import com.vayunmathur.library.util.ListDetailPage+import com.vayunmathur.library.util.NavBackStack++/**+ * Release variant: only the Google Voice sign-in entry is registered.+ * The WhatsApp, Signal, and RCS registration routes exist in the shared+ * [Route] type but are never pushed in release (their accounts-screen+ * actions are gated by the release `Feature` objects, which are off),+ * and their screens are not compiled into this variant.+ */+fun EntryProviderScope<Route>.registrationEntries(backStack: NavBackStack<Route>) {+    entry<Route.GoogleVoiceSignIn>(metadata = ListDetailPage()) {+        GoogleVoiceSignInScreen(+            onBack = { backStack.pop() },+            onSignedIn = { backStack.pop() },+        )+    }+}++/** Release variant: no RCS conversation entries (the RCS line is dev-only). */+fun EntryProviderScope<Route>.rcsConversationEntries(backStack: NavBackStack<Route>) = Unit
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex 0dfe7a8922..7a1817cfdb 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -162,6 +162,7 @@ include(":fooddelivery") include(":measure") include(":taxi") include(":communicate")+include(":communicate-dev") include(":communicate-wear") include(":euicc") include(":globalesim")