mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(settings): Add firmware capability checks for settings (#4403)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
fac72af9f4
commit
37b2efa176
5 changed files with 76 additions and 60 deletions
|
|
@ -56,6 +56,14 @@ data class Capabilities(val firmwareVersion: String?, internal val forceEnableAl
|
|||
val supportsQrCodeSharing: Boolean
|
||||
get() = isSupported("2.6.8")
|
||||
|
||||
/** Support for Status Message module. Supported since firmware v2.7.17. */
|
||||
val supportsStatusMessage: Boolean
|
||||
get() = isSupported("2.7.17")
|
||||
|
||||
/** Support for location sharing on secondary channels. Supported since firmware v2.6.10. */
|
||||
val supportsSecondaryChannelLocation: Boolean
|
||||
get() = isSupported("2.6.10")
|
||||
|
||||
/** Support for ESP32 Unified OTA. Supported since firmware v2.7.18. */
|
||||
val supportsEsp32Ota: Boolean
|
||||
get() = isSupported("2.7.18")
|
||||
|
|
|
|||
|
|
@ -65,6 +65,18 @@ class CapabilitiesTest {
|
|||
assertTrue(caps("2.6.8").supportsQrCodeSharing)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `supportsSecondaryChannelLocation requires v2 6 10`() {
|
||||
assertFalse(caps("2.6.9").supportsSecondaryChannelLocation)
|
||||
assertTrue(caps("2.6.10").supportsSecondaryChannelLocation)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `supportsStatusMessage requires v2 7 17`() {
|
||||
assertFalse(caps("2.7.16").supportsStatusMessage)
|
||||
assertTrue(caps("2.7.17").supportsStatusMessage)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `null firmware returns all false`() {
|
||||
val c = caps(null)
|
||||
|
|
@ -74,6 +86,8 @@ class CapabilitiesTest {
|
|||
assertFalse(c.canToggleTelemetryEnabled)
|
||||
assertFalse(c.canToggleUnmessageable)
|
||||
assertFalse(c.supportsQrCodeSharing)
|
||||
assertFalse(c.supportsSecondaryChannelLocation)
|
||||
assertFalse(c.supportsStatusMessage)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -85,6 +99,8 @@ class CapabilitiesTest {
|
|||
assertFalse(c.canToggleTelemetryEnabled)
|
||||
assertFalse(c.canToggleUnmessageable)
|
||||
assertFalse(c.supportsQrCodeSharing)
|
||||
assertFalse(c.supportsSecondaryChannelLocation)
|
||||
assertFalse(c.supportsStatusMessage)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -96,6 +112,8 @@ class CapabilitiesTest {
|
|||
assertTrue(c.canToggleTelemetryEnabled)
|
||||
assertTrue(c.canToggleUnmessageable)
|
||||
assertTrue(c.supportsQrCodeSharing)
|
||||
assertTrue(c.supportsSecondaryChannelLocation)
|
||||
assertTrue(c.supportsStatusMessage)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -107,5 +125,7 @@ class CapabilitiesTest {
|
|||
assertTrue(c.canToggleTelemetryEnabled)
|
||||
assertTrue(c.canToggleUnmessageable)
|
||||
assertTrue(c.supportsQrCodeSharing)
|
||||
assertTrue(c.supportsSecondaryChannelLocation)
|
||||
assertTrue(c.supportsStatusMessage)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue