Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(android): hold a link to open the message menu, and pick tabs and the Bots tile as the iPhone does

leepokaib93094fa8a18
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/AgentSettingsScreenTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/AgentSettingsScreenTest.kt
index 728ce491..5502ae02 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/AgentSettingsScreenTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/AgentSettingsScreenTest.kt
@@ -17,25 +17,27 @@ class AgentSettingsScreenTest {
@get:Rule val compose = createComposeRule()
private val online = AppState(previewComputer, loading = false,
actualConnection = LinkState.Ready(HostRoute.Direct))
- private val model = hasContentDescription("Model:", substring = true)
@Composable private fun Picker(state: AppState, backend: String, selected: String?, choose: (String?) -> Unit, load: suspend (String) -> AgentModels) =
AgentModelPicker(state, load, backend, selected, emptyMap(), false, null, { id, _ -> choose(id) }, {})
+ private fun showing(text: String) = compose.onAllNodesWithText(text).fetchSemanticsNodes().isNotEmpty()
+
@Test fun hostModelsRetainAnUnknownOverrideAndFoldTheRecommendedDefault() {
var selected by mutableStateOf<String?>("old-model")
compose.setContent { Hosted { Picker(online, "agent", selected, { selected = it }) {
AgentModels(listOf(AgentModel("auto", "Default (recommended)"), AgentModel("host-model", "Host model", "From this agent")))
} } }
- compose.waitUntil { compose.onAllNodes(model).fetchSemanticsNodes().size == 1 }
- compose.onNodeWithContentDescription("Model: old-model").performClick()
+ // The picker is one summary row ("agent · model") that unfolds into the model list.
+ compose.onNodeWithText("agent · old-model").assertIsDisplayed().performClick()
+ compose.waitUntil { showing("Host model") }
compose.onAllNodesWithText("Default (recommended)").assertCountEquals(1)
compose.onNodeWithText("Default (recommended)").performClick()
assertNull(selected)
- compose.onNodeWithContentDescription("Model: Default (recommended)").performClick()
+ compose.onNodeWithText("Default").performClick()
+ compose.onNodeWithContentDescription("Refresh model list").assertIsDisplayed()
compose.onNodeWithText("Host model").performClick()
assertEquals("host-model", selected)
- compose.onNodeWithContentDescription("Refresh model list").assertIsDisplayed()
}
@Test fun aLateCancelledModelDiscoveryCannotReplaceAnotherAgentsCatalog() {
@@ -50,9 +52,10 @@ class AgentSettingsScreenTest {
} } }
compose.waitUntil { started.get() }
compose.onNodeWithText("Switch agent").performClick()
- compose.waitUntil { compose.onAllNodes(model).fetchSemanticsNodes().size == 1 }
+ compose.onNodeWithText("new · Default").performClick()
+ compose.waitUntil { showing("new advertised model") }
compose.waitUntil(3_000) { returned.get() }
- compose.onNode(model).performClick()
+ compose.waitForIdle()
compose.onNodeWithText("new advertised model").assertIsDisplayed()
compose.onNodeWithText("old advertised model").assertDoesNotExist()
}
@@ -62,9 +65,9 @@ class AgentSettingsScreenTest {
compose.setContent { Hosted { Picker(online.copy(actualConnection = LinkState.Connecting), "agent", selected, { selected = it }) {
fail("Offline must not query models"); AgentModels(emptyList())
} } }
+ compose.onNodeWithText("agent · my-model").performClick()
compose.onNodeWithText("Connect to this computer to load its models. You can still enter a model ID.").assertIsDisplayed()
compose.onNodeWithContentDescription("Retry model list").assertIsDisplayed()
- compose.onNode(model).assertDoesNotExist()
compose.onNode(hasSetTextAction() and hasText("my-model")).performTextReplacement("saved-model")
assertEquals("saved-model", selected)
}
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/AppUpdatesTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/AppUpdatesTest.kt
new file mode 100644
index 00000000..ce8b679e
--- /dev/null
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/AppUpdatesTest.kt
@@ -0,0 +1,55 @@
+package com.codync.android
+
+import androidx.compose.ui.test.*
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.core.content.edit
+import androidx.test.platform.app.InstrumentationRegistry
+import com.codync.android.core.HostRoute
+import com.codync.android.core.LinkState
+import com.codync.android.core.VersionMismatch
+import com.google.android.play.core.appupdate.testing.FakeAppUpdateManager
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Rule
+import org.junit.Test
+
+/** What Google Play says about this app, through Play's own stand-in (a debug build isn't installed from Play). */
+class AppUpdatesTest {
+ @get:Rule val compose = createComposeRule()
+ private val context = InstrumentationRegistry.getInstrumentation().targetContext
+
+ private fun play(versionCode: Int?) = runBlocking {
+ AppUpdates.ask(FakeAppUpdateManager(context).apply { versionCode?.let(::setUpdateAvailable) })
+ }
+
+ @After fun nothingNewer() {
+ play(null)
+ context.getSharedPreferences("codync-updates", android.content.Context.MODE_PRIVATE).edit { clear() }
+ }
+
+ @Test fun aNewerReleaseOnGooglePlayShowsAReminderUntilDismissed() {
+ play(99_000_000)
+ compose.setContent { Hosted { AppUpdateReminder() } }
+ compose.onNodeWithText("Codync 99.0.0 is available").assertIsDisplayed()
+ compose.onNodeWithText("You have $APP_RELEASE.").assertIsDisplayed()
+ compose.onNodeWithContentDescription("Dismiss").performClick()
+ compose.onNodeWithText("Codync 99.0.0 is available").assertDoesNotExist()
+ }
+
+ @Test fun nothingNewerOnGooglePlayShowsNoReminder() {
+ play(null)
+ compose.setContent { Hosted { AppUpdateReminder() } }
+ compose.onNodeWithText("is available", substring = true).assertDoesNotExist()
+ }
+
+ @Test fun updateCodyncWaitsWhileGooglePlayLacksTheVersionTheComputerNeeds() {
+ val state = AppState(previewComputer, loading = false, actualConnection = LinkState.Ready(HostRoute.Direct))
+ play(null) // Play has only this release; the computer needs a newer one.
+ compose.setContent { Hosted { UpdateNeededCard(state, VersionMismatch.UpdateApp("99.0.0"), {}) } }
+ compose.onNodeWithText("Update Codync").assertIsNotEnabled()
+ compose.onNodeWithText("still in Google Play review", substring = true).assertIsDisplayed()
+ play(99_000_000)
+ compose.onNodeWithText("Update Codync").assertIsEnabled()
+ compose.onNodeWithText("still in Google Play review", substring = true).assertDoesNotExist()
+ }
+}
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/BotEditorTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/BotEditorTest.kt
index 4a38369a..2c7809b7 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/BotEditorTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/BotEditorTest.kt
@@ -34,6 +34,8 @@ class BotEditorTest {
render(scout, close = { closed = true })
compose.onNodeWithText("Settings").assertIsDisplayed()
compose.onNodeWithContentDescription("Save").assertIsEnabled()
+ // The Avatar row unfolds the picker.
+ compose.onNodeWithContentDescription("Edit Bot avatar").performClick()
compose.onNodeWithContentDescription("blob shape").assertIsSelected()
compose.onNodeWithContentDescription("cloud shape").performClick().assertIsSelected()
compose.onNodeWithContentDescription("blob shape").assertIsNotSelected()
@@ -42,14 +44,19 @@ class BotEditorTest {
snapshot("bot-editor-settings-preview.png")
name.performTextReplacement("")
compose.onNodeWithContentDescription("Save").assertIsNotEnabled()
- compose.onNodeWithContentDescription("Agent: Claude").performScrollTo().performClick()
+ // The agent row ("Claude · Default") unfolds into the model list; the agent's name opens the agents.
+ compose.onNodeWithText("Claude · Default").performScrollTo().performClick()
+ compose.onNodeWithText("Claude").performScrollTo().performClick()
+ // The agent list scrolls on its own; bring the picker's last line, under it, into the form's view.
+ compose.onNodeWithText("Changing the model starts a new agent session. Chat history is kept.").performScrollTo()
compose.onNodeWithText("Codex (not installed)").assertIsDisplayed()
compose.onNodeWithText("Custom command").performClick()
compose.onNode(hasSetTextAction() and hasText("ACP command", substring = true)).performScrollTo().performTextInput("my-agent --acp")
compose.onNodeWithText("my-agent --acp").assertIsDisplayed()
- compose.onNodeWithContentDescription("Agent: Custom command").performClick()
+ compose.onNodeWithText("Custom command").performScrollTo().performClick()
+ compose.onNodeWithText("Changing the model starts a new agent session. Chat history is kept.").performScrollTo()
compose.onNodeWithText("Codex (not installed)").performClick()
- compose.onNodeWithText("Install Codex on your computer.").assertIsDisplayed()
+ compose.onNodeWithText("Install Codex on your computer.").performScrollTo().assertIsDisplayed()
compose.onNode(hasSetTextAction() and hasText("ACP command", substring = true)).assertDoesNotExist()
compose.onNodeWithContentDescription("Close").performClick()
assertTrue(closed)
@@ -108,17 +115,19 @@ class BotEditorTest {
compose.onNodeWithText("You'll get an approval card and a notification whenever the agent asks.").assertIsDisplayed()
toggle("Notifications").performScrollTo().assertIsOn().performClick().assertIsOff()
toggle("Use the computer").performScrollTo().assertIsOff()
- toggle("GitHub").performScrollTo().assertIsOn().performClick().assertIsOff()
+ // Connectors start off until picked, as on the iPhone.
+ toggle("GitHub").performScrollTo().assertIsOff().performClick().assertIsOn()
toggle("Review changes").performScrollTo().assertIsOff().performClick().assertIsOn()
compose.onNodeWithContentDescription("Workspace").performScrollTo().performClick()
compose.onNodeWithText("Choose project folder…").performClick()
- compose.onNodeWithText("Folders").assertIsDisplayed()
+ compose.onNodeWithText("Choose workspace").assertIsDisplayed()
}
@Test fun offlineSettingsDisableSavingButKeepTheModelEditable() {
render(scout.copy(model = "old-model"), fixture().copy(actualConnection = LinkState.Connecting))
compose.onNodeWithContentDescription("Save").assertIsNotEnabled()
compose.onNodeWithText("Reconnect to this computer to save settings.").performScrollTo().assertIsDisplayed()
+ compose.onNodeWithText("Claude · old-model").performScrollTo().performClick()
compose.onNodeWithText("Connect to this computer to load its models. You can still enter a model ID.").performScrollTo().assertIsDisplayed()
compose.onNode(hasSetTextAction() and hasText("old-model")).performTextReplacement("my-model")
compose.onNode(hasSetTextAction() and hasText("my-model")).assertIsDisplayed()
@@ -148,7 +157,7 @@ class BotEditorTest {
add(buildJsonObject { put("id", "codex"); put("name", "Codex"); put("available", false); put("installHint", "Install Codex on your computer.") })
})
put("screen", buildJsonObject { put("enabled", true) })
- })
+ }, screen = ScreenState(enabled = true, computerUse = true))
private fun snapshot(name: String) {
if (InstrumentationRegistry.getArguments().getString("layoutSnapshots") != "true") return
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/ChatLayoutTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/ChatLayoutTest.kt
index bb8f7e47..e47198a8 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/ChatLayoutTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/ChatLayoutTest.kt
@@ -3,7 +3,6 @@ package com.codync.android
import android.graphics.Bitmap
import android.os.Build
import androidx.activity.compose.setContent
-import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.asAndroidBitmap
import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.createAndroidComposeRule
@@ -19,70 +18,59 @@ import java.io.File
class ChatLayoutTest {
@get:Rule val compose = createAndroidComposeRule<MainActivity>()
- @Test fun oneWayBotMessagesShowAttributionWithoutAStatusLine() {
+ private fun exchange(id: String, seq: Long, chat: String, source: String, target: String, text: String, reply: String? = null,
+ status: String = "completed", detail: String? = null) =
+ Entry(id, seq, chat, rev = seq, kind = "notice", createdAt = System.currentTimeMillis() - 60_000 + seq, data = buildJsonObject {
+ put("text", text); put("status", status)
+ put("botMessage", buildJsonObject {
+ put("sourceBotId", source); put("targetBotId", target); put("text", text)
+ reply?.let { put("reply", it) }; detail?.let { put("detail", it) }
+ })
+ })
+
+ @Test fun aBotToBotMessageIsOneLineThatOpensTheirConversation() {
assumeTrue(Build.PRODUCT.startsWith("sdk"))
val store = previewStore()
- val bot = Bot("handoff-preview", "Dex")
- val body = "Urgent. Investigate the connection error."
- val heading = "Message from Miles: $body"
- val detail = "Recipient stopped. Partial work may have happened."
- val entry = Entry("bot-message", 1, bot.id, rev = 1, kind = "notice", data = buildJsonObject {
- put("text", "$heading\n$detail"); put("heading", heading); put("delegationId", "request"); put("style", "error")
- })
- val state = AppState(previewComputer, loading = false, selectedBot = bot.id, bots = listOf(bot),
+ val dex = Bot("exchange-preview", "Dex"); val miles = Bot("miles-preview", "Miles")
+ val request = "Investigate the connection error."
+ val answer = "The caller cancelled while audio was connecting."
+ val state = AppState(previewComputer, loading = false, selectedBot = dex.id, bots = listOf(dex, miles),
connection = LinkState.Ready(HostRoute.Direct), actualConnection = LinkState.Ready(HostRoute.Direct),
- historyComplete = setOf(bot.id), entries = listOf(entry))
+ historyComplete = setOf(dex.id), entries = listOf(exchange("bot-message", 1, dex.id, miles.id, dex.id, request, answer)))
compose.runOnUiThread { compose.activity.setContent { Hosted { ChatScreen(state, store, {}) } } }
- val label = compose.onNodeWithText("Message from Miles").assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- val message = compose.onNodeWithText(body).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- assertTrue(label.bottom <= message.top)
- compose.onNodeWithText(detail).assertDoesNotExist()
- compose.onNodeWithText(heading).assertDoesNotExist()
+ // The chat keeps one line (iOS `BotMessageRow`), not the messages themselves.
+ compose.onNodeWithContentDescription("Message from Miles").assertIsDisplayed()
+ compose.onNodeWithText(request).assertDoesNotExist()
if (InstrumentationRegistry.getArguments().getString("layoutSnapshots") == "true") {
val bitmap = compose.onRoot().captureToImage().asAndroidBitmap()
File(compose.activity.cacheDir, "bot-message-preview.png").outputStream().use { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
}
+ compose.onNodeWithContentDescription("Message from Miles").performClick()
+ // The conversation, oldest first: Miles's request, then Dex's reply.
+ compose.waitUntil(5_000) { compose.onAllNodesWithText(answer).fetchSemanticsNodes().isNotEmpty() }
+ compose.waitForIdle() // the sheet has finished sliding up
+ compose.onNodeWithContentDescription("Dex and Miles").assertIsDisplayed()
+ val asked = compose.onNodeWithText(request).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
+ val replied = compose.onNodeWithText(answer).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
+ assertTrue(asked.bottom <= replied.top)
}
- @Test fun botRepliesAppearBelowTheRequestInSeparateBubbles() {
+ @Test fun consecutiveExchangesWithOneBotAreOneLineThatSaysWhenOneFailed() {
assumeTrue(Build.PRODUCT.startsWith("sdk"))
val store = previewStore()
- val bot = Bot("reply-preview", "Dex")
- val body = "Investigate the connection error."
- val heading = "Request from Miles: $body"
- val answer = "The caller cancelled while audio was connecting."
- val entry = Entry("bot-reply", 1, bot.id, rev = 1, kind = "notice", data = buildJsonObject {
- put("text", "$heading\nReply from Dex:\n$answer"); put("heading", heading)
- put("delegationId", "request"); put("status", "completed")
- })
- val state = AppState(previewComputer, loading = false, selectedBot = bot.id, bots = listOf(bot),
+ val dex = Bot("exchange-run-preview", "Dex"); val miles = Bot("miles-run-preview", "Miles")
+ val state = AppState(previewComputer, loading = false, selectedBot = dex.id, bots = listOf(dex, miles),
connection = LinkState.Ready(HostRoute.Direct), actualConnection = LinkState.Ready(HostRoute.Direct),
- historyComplete = setOf(bot.id), entries = listOf(entry))
+ historyComplete = setOf(dex.id), entries = listOf(
+ exchange("asked", 1, dex.id, dex.id, miles.id, "Review the fix.", "Looks good."),
+ exchange("failed", 2, dex.id, dex.id, miles.id, "Ship it.", status = "failed", detail = "Recipient stopped.")))
compose.runOnUiThread { compose.activity.setContent { Hosted { ChatScreen(state, store, {}) } } }
- val request = compose.onNodeWithText(body).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- val attribution = compose.onNodeWithText("Reply from Dex").assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- val reply = compose.onNodeWithText(answer).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- assertTrue(request.bottom <= attribution.top)
- assertTrue(attribution.bottom <= reply.top)
- val fullReply = Entry("full-reply", 2, bot.id, rev = 2, kind = "agent", data = buildJsonObject {
- put("text", answer); put("final", true)
- })
- compose.runOnUiThread { compose.activity.setContent {
- Hosted { ChatScreen(state.copy(entries = listOf(entry, fullReply)), store, {}) }
- } }
- compose.onAllNodesWithText("Reply from Dex").assertCountEquals(1)
- compose.onAllNodesWithText(answer).assertCountEquals(1)
- compose.onNode(hasText(answer) and hasClickAction()).performTouchInput { longClick(Offset(4f, 4f)) }
- compose.onNodeWithText("Reply").assertIsDisplayed()
- compose.onNodeWithText("Show what it did").assertIsDisplayed()
- InstrumentationRegistry.getInstrumentation().sendKeyDownUpSync(android.view.KeyEvent.KEYCODE_BACK)
- if (InstrumentationRegistry.getArguments().getString("layoutSnapshots") == "true") {
- val bitmap = compose.onRoot().captureToImage().asAndroidBitmap()
- File(compose.activity.cacheDir, "bot-reply-preview.png").outputStream().use { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
- }
+ compose.onNodeWithContentDescription("2 messages with Miles, failed").assertIsDisplayed()
+ compose.onNodeWithText("Review the fix.").assertDoesNotExist()
+ compose.onNodeWithText("Recipient stopped.").assertDoesNotExist()
}
- @Test fun aShortConversationStaysNearItsComposerAndRetainsContextActions() {
+ @Test fun aShortConversationStartsAtTheTopAndRetainsContextActions() {
assumeTrue(Build.PRODUCT.startsWith("sdk"))
val store = previewStore()
val bot = Bot("layout-preview", "Scout", avatarColor = "green", avatarShape = "cloud")
@@ -106,14 +94,16 @@ class ChatLayoutTest {
val root = compose.onRoot().fetchSemanticsNode().boundsInRoot
assertTrue(userBounds.left > agentBounds.left)
assertTrue(userBounds.right > agentBounds.right)
- assertTrue(userBounds.top > root.height / 2)
+ // Like the iPhone's list, a conversation shorter than the screen starts at the top.
+ assertTrue(userBounds.top < root.height / 2)
compose.onNodeWithContentDescription("Add files").assertIsDisplayed()
compose.onNodeWithContentDescription("Call").assertIsDisplayed()
if (InstrumentationRegistry.getArguments().getString("layoutSnapshots") == "true") {
val bitmap = compose.onRoot().captureToImage().asAndroidBitmap()
File(compose.activity.cacheDir, "layout-chat-preview.png").outputStream().use { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
}
- user.performTouchInput { longClick(Offset(4f, 4f)) }
+ // Held in its middle: the rounded corners are outside the bubble.
+ user.performTouchInput { longClick() }
compose.onNodeWithText("Reply").assertIsDisplayed()
compose.onNodeWithContentDescription("👍").assertIsDisplayed()
compose.onNodeWithText("Copy").assertIsDisplayed()
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/MessageActionsMenuTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/MessageActionsMenuTest.kt
index 3d90e388..578794a5 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/MessageActionsMenuTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/MessageActionsMenuTest.kt
@@ -69,7 +69,8 @@ class MessageActionsMenuTest {
})
val state = AppState(previewComputer, loading = false, selectedBot = bot.id, bots = listOf(bot), connection = LinkState.Ready(HostRoute.Direct),
historyComplete = setOf(bot.id), entries = listOf(reply, quoted))
- compose.setContent { Hosted { ChatScreen(state, store, {}) } }
+ var shown by mutableStateOf(state)
+ compose.setContent { Hosted { ChatScreen(shown, store, {}) } }
// The sent reply shows what it quotes.
compose.onNodeWithText("“$text”").assertIsDisplayed()
compose.onNode(hasText(text) and hasClickAction()).performTouchInput { longClick() }
@@ -80,7 +81,7 @@ class MessageActionsMenuTest {
compose.onAllNodesWithText("“$text”").assertCountEquals(1)
compose.onNodeWithContentDescription("Cancel reply").assertDoesNotExist()
// An older host can't quote: no Reply.
- compose.setContent { Hosted { ChatScreen(state.copy(hello = buildJsonObject { put("version", "2.20.0") }), store, {}) } }
+ compose.runOnUiThread { shown = state.copy(hello = buildJsonObject { put("version", "2.20.0") }) }
compose.onNode(hasText(text) and hasClickAction()).performTouchInput { longClick() }
compose.onNodeWithText("Copy").assertIsDisplayed()
compose.onNodeWithText("Reply").assertDoesNotExist()
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/OnboardingTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/OnboardingTest.kt
index 33501c1c..d3653f7b 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/OnboardingTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/OnboardingTest.kt
@@ -12,15 +12,22 @@ class OnboardingTest {
@get:Rule val compose = createComposeRule()
@Test fun welcomeLeadsToInstallAndBackReturnsToWelcome() {
+ // The welcome crew never stops moving: step the clock by hand so the test can settle.
+ compose.mainClock.autoAdvance = false
compose.setContent { Hosted { CodyncApp(AccountContext(loading = false), emptyMap(), viewModel()) } }
+ step()
compose.onNodeWithText("Your coding agents", substring = true).assertIsDisplayed()
compose.onNodeWithText("Get started").performClick()
+ step()
compose.onNodeWithText("Install Codync", substring = true).assertIsDisplayed()
compose.onNodeWithContentDescription("Step 1 of 2").assertIsDisplayed()
compose.onNodeWithContentDescription("Back").performClick()
+ step()
compose.onNodeWithText("Get started").assertIsDisplayed()
}
+ private fun step() = compose.mainClock.advanceTimeBy(1_000)
+
@Test fun installStepsFollowTheComputerAndScanKeepsTheChoice() {
var skipped = false
compose.setContent { Hosted { PairingView(AccountContext(loading = false), viewModel(), onSkip = { skipped = true }) } }
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/WidgetStoreTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/WidgetStoreTest.kt
index 0f5c89e2..7dadf161 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/WidgetStoreTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/WidgetStoreTest.kt
@@ -30,7 +30,8 @@ class WidgetStoreTest {
assertNull(PushPreferences.activeUser(context))
val originalFile = AtomicFile(File(context.noBackupFilesDir, "widget-owner.json"))
val original = if (originalFile.baseFile.exists()) originalFile.readFully() else null
- val computer = LocalStore(context).computers().single()
+ // The emulator's app may have more than one computer paired; the test needs one of them.
+ val computer = LocalStore(context).computers().first()
val first = LocalStore(context, "widget-test-a-" + UUID.randomUUID())
val second = LocalStore(context, "widget-test-b-" + UUID.randomUUID())
try {
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
index c985dc08..cf260b32 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
@@ -24,6 +24,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.unit.dp
import com.codync.android.core.AgentModels
import com.codync.android.core.Bot
@@ -71,7 +73,8 @@ private enum class PickerStage { Closed, Agents, Models, Settings }
val levels = modelOptions.mapNotNull { option -> option.values.firstOrNull { it.id == (options[option.id] ?: option.default) }?.name }
val summary = (listOf(agentName, modelName) + levels + if (fastMode) listOf("Fast") else emptyList()).joinToString(" · ")
Column(Modifier.fillMaxWidth().animateContentSize(Motion.layoutSize), verticalArrangement = Arrangement.spacedBy(8.dp)) {
- Row(Modifier.fillMaxWidth().clickable { open(if (stage == PickerStage.Closed) PickerStage.Models else PickerStage.Closed) }.padding(vertical = 8.dp),
+ Row(Modifier.fillMaxWidth().clickable { open(if (stage == PickerStage.Closed) PickerStage.Models else PickerStage.Closed) }
+ .semantics { stateDescription = if (stage == PickerStage.Closed) "Collapsed" else "Expanded" }.padding(vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
Crossfade(summary, Modifier.weight(1f), animationSpec = Motion.fade(), label = "Agent summary") { text ->
Text(text, style = Type.subheadline, color = Palette.text)
@@ -88,7 +91,7 @@ private enum class PickerStage { Closed, Agents, Models, Settings }
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
if (stage == PickerStage.Models && chooseAgent != null) IconButton("Back", "chevron.left") { open(PickerStage.Agents) }
Box(Modifier.weight(1f)) { PlainTextField(query, { query = it }, prompt = if (stage == PickerStage.Agents) "Search agents" else "Search models", singleLine = true) }
- if (loading) Spinner(12.dp) else IconButton("Refresh model list", "arrow.clockwise") { retry++ }
+ if (loading) Spinner(12.dp) else IconButton(if (failure == null) "Refresh model list" else "Retry model list", "arrow.clockwise") { retry++ }
}
val choices = (if (stage == PickerStage.Agents) agents else modelChoices).filter { it.second.contains(query, ignoreCase = true) }
Column(Modifier.heightIn(max = 180.dp).verticalScroll(rememberScrollState())) {
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AppUpdates.kt b/apps/android/app/src/main/kotlin/com/codync/android/AppUpdates.kt
index fc954780..57bc0a69 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/AppUpdates.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AppUpdates.kt
@@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
import androidx.core.content.edit
import com.codync.android.core.UpdateReminder
import com.codync.android.design.*
+import com.google.android.play.core.appupdate.AppUpdateManager
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.UpdateAvailability
import com.google.android.play.core.ktx.requestAppUpdateInfo
@@ -53,8 +54,13 @@ internal object AppUpdates {
val now = System.currentTimeMillis()
if (now - askedAt < 6 * 3_600_000L) return
askedAt = now
+ ask(AppUpdateManagerFactory.create(context))
+ }
+
+ /** What [manager] (Google Play's, or a test's stand-in) has for this phone. */
+ internal suspend fun ask(manager: AppUpdateManager) {
try {
- val info = AppUpdateManagerFactory.create(context).requestAppUpdateInfo()
+ val info = manager.requestAppUpdateInfo()
mutableStore.value = if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE)
UpdateReminder.versionOf(info.availableVersionCode().toLong()) else APP_RELEASE
} catch (cancelled: CancellationException) { throw cancelled }
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt b/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt
index aa8ccfeb..b571e932 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt
@@ -19,6 +19,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.remember
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
@@ -49,6 +50,11 @@ private enum class AppTab { Bots, State, Settings }
val open = states.firstOrNull { it.selectedBot != null }
// Opening a bot (notification, widget, link) always lands on the Bots tab.
if (open != null && tab != AppTab.Bots) tab = AppTab.Bots
+ // Other links pick the tab as on the iPhone: usage on State, the computers and extensions over Bots; another account starts on Bots.
+ var handledLink by rememberSaveable { mutableIntStateOf(app.navigationRequest) }
+ if (handledLink != app.navigationRequest) { handledLink = app.navigationRequest; tab = if (app.navigationPage == LinkPage.Usage) AppTab.State else AppTab.Bots }
+ var handledAccount by rememberSaveable { mutableIntStateOf(app.generation) }
+ if (handledAccount != app.generation) { handledAccount = app.generation; tab = AppTab.Bots }
// Leaving a chat whose answer was read may invite a rating, once the roster has stayed clear (iOS `RootView`).
val context = LocalContext.current
ReviewOnReturn(open?.let { "${app.contextId}/${it.computer.id}/${it.selectedBot}" })
diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/WidgetFeed.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/WidgetFeed.kt
index 7e9afd51..972d976b 100644
--- a/apps/android/core/src/main/kotlin/com/codync/android/core/WidgetFeed.kt
+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/WidgetFeed.kt
@@ -6,7 +6,9 @@ import kotlinx.serialization.Serializable
@Serializable data class WidgetBot(val id: String, val name: String, val status: String,
val unread: Int = 0, val avatarColor: String = "blue", val avatarShape: String = "blob", val customIcon: CustomIcon? = null,
/** The computer it lives on: bot IDs are only unique per computer. */
- val computerId: String = "") {
+ val computerId: String = "",
+ /** Its last activity, for the Bots tile's tie-break. */
+ val lastAt: Long = 0) {
/** The bot across every computer, as the Team widget's picks keep it (iOS re-keys `<computerId>/<botId>`). */
val key: String get() = if (computerId.isEmpty()) id else "$computerId/$id"
}
@@ -28,8 +30,9 @@ fun usageLimits(report: UsageReport): List<ProviderLimit> {
return listOf(top.value) + all.filterIndexed { index, _ -> index != top.index }
}
-/** The Bots tile's bot: the one that needs you most, in the feed's order, if any bot is at work. */
-fun mostUrgentBot(bots: List<WidgetBot>): WidgetBot? = bots.firstOrNull { it.status == "needsInput" || it.status == "working" }
+/** The Bots tile's bot: waiting for you, then working, then the most recent (iOS `mostUrgent`); none while every bot is quiet. */
+fun mostUrgentBot(bots: List<WidgetBot>): WidgetBot? = bots.filter { it.status == "needsInput" || it.status == "working" }
+ .minWithOrNull(compareBy<WidgetBot> { widgetRank(it.status) }.thenByDescending { it.lastAt })
/**
* The Team widget's four spots: the picked bots first (a deleted pick falls back), then the feed's order (who needs you).
@@ -49,7 +52,7 @@ fun widgetBots(bots: Map<String, List<Bot>>): List<WidgetBot> = bots.flatMap { (
.filter { (_, bot) -> !bot.hidden && !bot.deleted }
.sortedWith(compareBy<Pair<String, Bot>> { (_, bot) -> widgetRank(bot.status) }
.thenByDescending { it.second.pinned }.thenByDescending { it.second.lastAt }.thenBy { it.second.name })
- .take(256).map { (computer, it) -> WidgetBot(it.id, it.name.take(256), it.status, it.unread, it.avatarColor, it.avatarShape, it.customIcon, computer) }
+ .take(256).map { (computer, it) -> WidgetBot(it.id, it.name.take(256), it.status, it.unread, it.avatarColor, it.avatarShape, it.customIcon, computer, it.lastAt) }
/**
* The feed after reading [computers] (each one's ID and bots; null when it couldn't be read, so the bots it showed stay),
diff --git a/apps/android/core/src/test/kotlin/com/codync/android/core/WidgetFeedTest.kt b/apps/android/core/src/test/kotlin/com/codync/android/core/WidgetFeedTest.kt
index 3bc776e8..bb4abc0d 100644
--- a/apps/android/core/src/test/kotlin/com/codync/android/core/WidgetFeedTest.kt
+++ b/apps/android/core/src/test/kotlin/com/codync/android/core/WidgetFeedTest.kt
@@ -55,5 +55,8 @@ class WidgetFeedTest {
assertEquals("a", mostUrgentBot(bots)?.id)
assertEquals("b", mostUrgentBot(bots.drop(1))?.id)
assertNull(mostUrgentBot(bots.drop(2)))
+ // Two bots that need you equally: the most recent, pinned or not (iOS `mostUrgent`).
+ val tie = listOf(WidgetBot("pinned", "P", "needsInput", lastAt = 1), WidgetBot("recent", "R", "needsInput", lastAt = 2))
+ assertEquals("recent", mostUrgentBot(tie)?.id)
}
}
diff --git a/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt b/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt
index 3f7c6e1d..e01d06d1 100644
--- a/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt
+++ b/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt
@@ -8,11 +8,14 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
-import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.awaitLongPressOrCancellation
import androidx.compose.foundation.gestures.drag
+import androidx.compose.foundation.gestures.waitForUpOrCancellation
+import androidx.compose.ui.input.pointer.AwaitPointerEventScope
+import androidx.compose.ui.input.pointer.PointerEventPass
+import androidx.compose.ui.input.pointer.PointerEventTimeoutCancellationException
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.input.pointer.positionChange
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -122,14 +125,14 @@ class ContextDrag(val start: () -> Unit, val move: (Float) -> Unit, val end: ()
haptics.performHapticFeedback(HapticFeedbackType.LongPress)
open = true
}
- val gestures = if (reorder == null) Modifier.combinedClickable(enabled = enabled, onClick = { tap?.invoke() },
- onLongClickLabel = "Actions", onLongClick = hold)
// One gesture for tap, hold and drag: a click detector would swallow the move after the hold.
- else Modifier.semantics {
+ // A message reads as one node with its actions, as a clickable would merge it; a row that reorders keeps its own.
+ val gestures = Modifier.semantics(mergeDescendants = reorder == null) {
if (enabled) { onClick { tap?.invoke(); true }; onLongClick("Actions") { hold(); true } }
}.pointerInput(reorder, enabled) {
if (!enabled) return@pointerInput
awaitEachGesture {
+ if (reorder == null) { tapOrHold(tap, hold); return@awaitEachGesture }
val down = awaitFirstDown()
val held = awaitLongPressOrCancellation(down.id)
if (held == null) {
@@ -157,6 +160,25 @@ class ContextDrag(val start: () -> Unit, val move: (Float) -> Unit, val end: ()
return onGloballyPositioned { anchor = it.boundsInRoot() }.then(gestures)
}
+/**
+ * A tap, or a hold anywhere on the content, its links and buttons included, as the iPhone's context menu: the press counts
+ * even when a child took it, and after a hold the rest of it is kept from the child, so a held link opens the menu, not the page.
+ */
+private suspend fun AwaitPointerEventScope.tapOrHold(tap: (() -> Unit)?, hold: () -> Unit) {
+ awaitFirstDown(requireUnconsumed = false)
+ try {
+ val up = withTimeout(viewConfiguration.longPressTimeoutMillis) { waitForUpOrCancellation() }
+ // null: a child (a link, a button) took the tap, or the press became a scroll.
+ if (up != null) { up.consume(); tap?.invoke() }
+ } catch (_: PointerEventTimeoutCancellationException) {
+ hold()
+ do {
+ val event = awaitPointerEvent(PointerEventPass.Initial)
+ event.changes.forEach { it.consume() }
+ } while (event.changes.any { it.pressed })
+ }
+}
+
/** The menu panel and its placement around `anchor`. `cover`: grow over the anchor (pull-down menus). */
@Composable private fun MenuOverlay(open: Boolean, close: () -> Unit, anchor: Rect, items: () -> List<MenuItem>, cover: Boolean,
reactions: ReactionPick? = null) {
diff --git a/docs/plans/android-app.md b/docs/plans/android-app.md
index 5557288d..63a96778 100644
--- a/docs/plans/android-app.md
+++ b/docs/plans/android-app.md
@@ -38,37 +38,39 @@ emulator against a real host; device acceptance is listed separately.
- [x] Every screen above walked through on an API 36 emulator against a disposable host, in light and dark mode, side by side with the iOS simulator.
- [x] Live update and its status bar chip on an API 36.1 emulator.
- [x] `AppStore.kt` split by responsibility (clean-code size rule), undecodable events stop after one rewind and show *Update this app*, timeouts surface as errors.
-- [ ] Instrumentation suite run on an emulator: only single classes so far (`PlatformSpeechTest`, `AlertNotificationTest`, probes), through `am instrument` because Gradle's connected run uninstalls the paired app.
+- [x] Instrumentation suite run on an emulator (2026-11-01: 134 tests, all passing): through `am instrument`, because Gradle's connected run uninstalls the paired app, on an AVD with `hw.keyboard=yes` (`TerminalSurfaceTest` needs a hardware keyboard) and no System UI dialog in front; the `Live*` probes skip without their host.
## Not done yet
-Where the Android app still falls short, as of 2026-10-31. Everything else in the table above
+Where the Android app still falls short, as of 2026-11-01. Everything else in the table above
was walked through on an emulator against a real host (several computers: two disposable hosts
-on one emulator, 2026-10-31).
+on one emulator, 2026-10-31). Push delivery was walked on 2026-11-01: a debug build with Firebase
+(`-PcodyncGoogleServicesFile=<google-services.json>`) on the Google APIs emulator, killed, got a bot's
+*Task complete* alert through the dev relay and FCM (pushes wait while any phone, an iOS simulator
+included, is connected to that computer).
### Not verified (needs an account, a key, a device or the real Mac)
| What | Code | What it needs |
| --- | --- | --- |
| Revoke this phone's access (also on Remove of a computer approved through the account); removing older copies of the computer from the account | `core/.../CloudClient.kt` (`revokeAccess`, `removeComputer`), `AccountStoreAccount.kt`, `ComputersView.kt` | A signed-in account on the emulator or a phone; only request tests cover it |
-| Push delivery (alerts, background Live update refresh) | `PushService.kt`, `AppStoreNotifications.kt` | A device with Google Play services running the official build (Firebase and the relay's FCM secret are set up since 2026-10-24). The notification look is covered by `AlertNotificationTest` |
+| Push on a phone running the Play build, and the background Live update refresh | `PushService.kt`, `AppStoreNotifications.kt` | A phone with the official build; alert delivery through FCM is verified on the emulator |
| OpenAI Realtime, Gemini Live and Speech mode with a real key | `WebRtcPeer.kt`, `core/.../OpenAIRealtimeEngine.kt`, `GeminiLiveEngine.kt`, `CloudSpeechEngine.kt` | A provider key on the paired computer; the fallback to on-device voice is verified |
| Remote screen: Chinese IME composition, a hardware keyboard, the TURN relay path and its credential renewal | `ScreenKeys.kt`, `ScreenSession.kt`, `ScreenView.kt` | A computer it's safe to type into, and a signed-in host for the relay; viewing, trackpad and pinch zoom are verified |
| On-device voice with a live microphone | `PlatformSpeech.kt`, `LocalVoiceAudio.kt` | A phone; on the emulator the recognizer was fed the speech fixture |
| Camera QR pairing (focus and 1080p frames), launcher widget refresh, foldables, TalkBack end to end | `QrViewfinder.kt`, `CodyncWidgets.kt` | Physical devices; portrait lock with the rotating screen viewer, 130% text and TalkBack's Move up/down were checked on the emulator |
-| Google Play's update info and review prompt | `AppUpdates.kt`, `ReviewPrompt.kt` | An install from Google Play (a debug build gets neither); the policy has unit tests |
+| Google Play's review prompt, and update info from Play itself | `AppUpdates.kt`, `ReviewPrompt.kt` | An install from Google Play (a debug build gets neither); the review policy has unit tests, and `AppUpdatesTest` drives the update reminder and *Update Codync* through Play's `FakeAppUpdateManager` |
### Different from the iPhone on purpose or by platform
- **Notification subtitle**: "Task complete" / "Response needed" / "Task failed" is the
notification's sub text, which Android's conversation layout doesn't draw (`PushService.kt`).
-- **Bots tile** refreshes when Quick Settings opens, not live; between two bots that need you
- equally it picks the pinned one, the iPhone the most recent (`core/.../WidgetFeed.kt` `mostUrgentBot`).
+- **Bots tile** refreshes when Quick Settings opens, not live (it picks its bot as the iPhone's control does:
+ waiting for you, then working, then the most recent, `core/.../WidgetFeed.kt` `mostUrgentBot`).
- **Shared files**: leaving the chat during a download skips the share sheet when it finishes
(the card shows *Downloaded*); shared copies are deleted after a day (`AppStoreFiles.kt`,
`AttachmentFiles.kt`).
- **Pull to refresh** on the roster and in Computer management uses the chat's indicator; iOS uses the system one.
-- **`computers` / `plugins` links** open over the current tab; iOS switches to Bots first.
- **Shortcuts actions** (Open Live Mode, Send Text to Bot) are Apple App Intents; Android's counterparts are
**Talk to Codync** in the app icon's shortcuts (the lead, by Settings → Shortcuts → Lead to call) and text shared
from another app, which opens the picked bot's chat with the text in its box ([iOS Shortcuts](../features/ios-shortcuts.md), `LiveShortcut.kt`, `ShareToBot.kt`).