diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-17 13:29:25 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-17 13:29:25 +0200 |
| commit | 165847da1ca3c3be627b5968bc77e9a11b3385cb (patch) | |
| tree | 603329a801d1304fdba833c1a8f4cd8c4ce4e7c6 /packages/meshbay-android/app/src/test/kotlin/org/meshbay/client | |
| parent | a1d18a2957d167444c6fc6c2e4ec8628509a7009 (diff) | |
| download | meshbay-165847da1ca3c3be627b5968bc77e9a11b3385cb.tar.gz | |
feat(android): ask for the local network when a group opens
Android 17 makes it a permission for an application targeting SDK 37.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-android/app/src/test/kotlin/org/meshbay/client')
| -rw-r--r-- | packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/LocalNetworkTest.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/LocalNetworkTest.kt b/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/LocalNetworkTest.kt new file mode 100644 index 00000000..cc5d3bac --- /dev/null +++ b/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/LocalNetworkTest.kt @@ -0,0 +1,28 @@ +package org.meshbay.client + +import org.junit.Assert.assertEquals +import org.junit.Test +import org.meshbay.client.shell.LocalNetwork + +class LocalNetworkTest { + private fun state(sdk: Int = 37, granted: Boolean = false, asked: Boolean = false, rationale: Boolean = false) = + LocalNetwork.stateOf(sdk, granted, asked, rationale) + + @Test fun `before Android 17 the local network comes with the internet`() { + assertEquals("granted", state(sdk = 36)) + assertEquals("granted", state(sdk = 26, asked = true)) + } + + @Test fun `a permission given is granted`() { + assertEquals("granted", state(granted = true)) + } + + @Test fun `never asked, or refused once, Android still asks`() { + assertEquals("prompt", state()) + assertEquals("prompt", state(asked = true, rationale = true)) + } + + @Test fun `refused for good, only the settings can change it`() { + assertEquals("denied", state(asked = true, rationale = false)) + } +} |