Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Settings: show "Away from home Wi-Fi" only when the pairing carries a relay

Rhytam Biswasca8a9c09fc6b
diff --git a/android/app/src/main/kotlin/com/coucou/android/core/RelayStatus.kt b/android/app/src/main/kotlin/com/coucou/android/core/RelayStatus.kt
index 3243a1b2..65ccaf91 100644
--- a/android/app/src/main/kotlin/com/coucou/android/core/RelayStatus.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/core/RelayStatus.kt
@@ -7,6 +7,9 @@ import com.coucou.android.link.Route
enum class RelayLineKind { NO_RELAY_IN_PAIRING, SWITCHED_OFF, DIRECT, VIA_RELAY, WAITING, ACCESS_REFUSED, ROOM_TAKEN, RATE_LIMITED, UNREACHABLE, COMPUTER_AWAY }
object RelayStatus {
+ /** The card is shown only when this pairing carries a relay: no computer build offers the setting yet, so a hint to turn it on would point at nothing (issue #629). */
+ fun sectionVisible(paired: Boolean, hasRelay: Boolean): Boolean = paired && hasRelay
+
fun kind(hasRelay: Boolean, useRelay: Boolean, connected: Boolean, route: Route?, issue: RelayIssue): RelayLineKind = when {
!hasRelay -> RelayLineKind.NO_RELAY_IN_PAIRING
!useRelay -> RelayLineKind.SWITCHED_OFF
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/SettingsScreens.kt b/android/app/src/main/kotlin/com/coucou/android/ui/SettingsScreens.kt
index 3843438d..e105142e 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/SettingsScreens.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/SettingsScreens.kt
@@ -187,7 +187,7 @@ fun SettingsScreen(model: AppModel, onHistory: () -> Unit, onGallery: () -> Unit
}
}
- if (model.mode == Mode.PAIRED) {
+ if (RelayStatus.sectionVisible(model.mode == Mode.PAIRED, model.hasRelay)) {
item { SectionHeading(stringResource(R.string.settings_section_away)) }
item { RelayCard(model) }
}
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 86298495..a4c6e346 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -189,7 +189,7 @@
<string name="settings_section_away">Away from home Wi-Fi</string>
<string name="relay_use">Use the relay when I\'m away</string>
<string name="relay_use_hint">Reaches your computer from mobile data or another network, through the relay you set up. Everything stays end-to-end encrypted. The direct link is always tried first.</string>
- <string name="relay_line_none">This pairing has no relay. On your computer, turn on Away from home Wi-Fi in Settings, then scan the new code.</string>
+ <string name="relay_line_none">This pairing has no relay.</string>
<string name="relay_line_off">The relay is off. Coucou only connects when your computer is on this network.</string>
<string name="relay_line_direct">Connected directly on this network.</string>
<string name="relay_line_via">Connected through your relay (%1$s).</string>
diff --git a/android/app/src/test/kotlin/com/coucou/android/RelayStatusTest.kt b/android/app/src/test/kotlin/com/coucou/android/RelayStatusTest.kt
index f91c414b..8ebf3531 100644
--- a/android/app/src/test/kotlin/com/coucou/android/RelayStatusTest.kt
+++ b/android/app/src/test/kotlin/com/coucou/android/RelayStatusTest.kt
@@ -5,6 +5,7 @@ import com.coucou.android.core.RelayStatus
import com.coucou.android.link.RelayIssue
import com.coucou.android.link.Route
import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -12,6 +13,12 @@ class RelayStatusTest {
private fun kind(hasRelay: Boolean = true, use: Boolean = true, connected: Boolean = false, route: Route? = null, issue: RelayIssue = RelayIssue.NONE) =
RelayStatus.kind(hasRelay, use, connected, route, issue)
+ @Test fun theAwayCardIsHiddenUnlessThePairingCarriesARelay() {
+ assertFalse(RelayStatus.sectionVisible(paired = true, hasRelay = false))
+ assertFalse(RelayStatus.sectionVisible(paired = false, hasRelay = true))
+ assertTrue(RelayStatus.sectionVisible(paired = true, hasRelay = true))
+ }
+
@Test fun aPairingWithoutARelayExplainsHowToGetOne() = assertEquals(RelayLineKind.NO_RELAY_IN_PAIRING, kind(hasRelay = false, connected = true))
@Test fun switchedOffSaysSo() = assertEquals(RelayLineKind.SWITCHED_OFF, kind(use = false, connected = true, route = Route.LAN))
diff --git a/android/i18n/app-strings.json b/android/i18n/app-strings.json
index a62364e3..8b8960fb 100644
--- a/android/i18n/app-strings.json
+++ b/android/i18n/app-strings.json
@@ -189,7 +189,7 @@
"settings_section_away": "Away from home Wi-Fi",
"relay_use": "Use the relay when I'm away",
"relay_use_hint": "Reaches your computer from mobile data or another network, through the relay you set up. Everything stays end-to-end encrypted. The direct link is always tried first.",
- "relay_line_none": "This pairing has no relay. On your computer, turn on Away from home Wi-Fi in Settings, then scan the new code.",
+ "relay_line_none": "This pairing has no relay.",
"relay_line_off": "The relay is off. Coucou only connects when your computer is on this network.",
"relay_line_direct": "Connected directly on this network.",
"relay_line_via": "Connected through your relay (%1$s).",