mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
start cleaning up models
This commit is contained in:
parent
52deba7d4b
commit
f18ac28dc0
9 changed files with 307 additions and 268 deletions
32
app/src/main/java/com/geeksville/mesh/model/UIState.kt
Normal file
32
app/src/main/java/com/geeksville/mesh/model/UIState.kt
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package com.geeksville.mesh.model
|
||||
|
||||
import android.util.Base64
|
||||
import androidx.compose.mutableStateOf
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
|
||||
/// FIXME - figure out how to merge this staate with the AppStatus Model
|
||||
object UIState {
|
||||
|
||||
/// Kinda ugly - created in the activity but used from Compose - figure out if there is a cleaner way GIXME
|
||||
// lateinit var googleSignInClient: GoogleSignInClient
|
||||
|
||||
|
||||
/// Are we connected to our radio device
|
||||
val isConnected = mutableStateOf(false)
|
||||
|
||||
/// various radio settings (including the channel)
|
||||
val radioConfig = mutableStateOf(MeshProtos.RadioConfig.getDefaultInstance())
|
||||
|
||||
/// our name in hte radio
|
||||
/// Note, we generate owner initials automatically for now
|
||||
val ownerName = mutableStateOf("fixme readfromprefs")
|
||||
|
||||
/// Return an URL that represents the current channel values
|
||||
val channelUrl
|
||||
get(): String {
|
||||
val channelBytes = radioConfig.value.channelSettings.toByteArray()
|
||||
val enc = Base64.encodeToString(channelBytes, Base64.URL_SAFE + Base64.NO_WRAP)
|
||||
|
||||
return "https://www.meshtastic.org/c/$enc"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue