diff --git a/TODO.md b/TODO.md index e143a294..379e6bb8 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,7 @@ # High priority MVP features required for first public alpha +* don't show test texts when not under emulator * make a boot screen explaining this is an early alpha, tell user to go to settings if they have a radio, otherwise go to website * show offline nodes as greyed out * make node list view not look like ass diff --git a/app/src/main/java/com/geeksville/mesh/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt index 7d13ab0f..e2c98fb2 100644 --- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt +++ b/app/src/main/java/com/geeksville/mesh/MainActivity.kt @@ -288,6 +288,20 @@ class MainActivity : AppCompatActivity(), Logging, // everytime the radio reconnects, we slam in our current owner data, the radio is smart enough to only broadcast if needed UIState.setOwner(this) + + val m = UIState.meshService!! + + // Pull down our real node ID + NodeDB.myId.value = m.myId + + // Update our nodeinfos based on data from the device + NodeDB.nodes.clear() + NodeDB.nodes.putAll( + m.nodes.map + { + it.user?.id!! to it + } + ) } } @@ -347,15 +361,6 @@ class MainActivity : AppCompatActivity(), Logging, onMeshConnectionChanged(m.isConnected) debug("connected to mesh service, isConnected=${UIState.isConnected.value}") - - // Update our nodeinfos based on data from the device - NodeDB.nodes.clear() - NodeDB.nodes.putAll( - m.nodes.map - { - it.user?.id!! to it - } - ) } override fun onDisconnected() { diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index 8a86a5f1..6eaa9859 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -495,8 +495,9 @@ class MeshService : Service(), Logging { /// Update our DB of users based on someone sending out a User subpacket private fun handleReceivedUser(fromNum: Int, p: MeshProtos.User) { updateNodeInfo(fromNum) { + val oldId = it.user?.id.orEmpty() it.user = MeshUser( - p.id, + if (p.id.isNotEmpty()) p.id else oldId, // If the new update doesn't contain an ID keep our old value p.longName, p.shortName ) diff --git a/app/src/main/java/com/geeksville/mesh/ui/Channel.kt b/app/src/main/java/com/geeksville/mesh/ui/Channel.kt index b94ffada..9b95f762 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/Channel.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/Channel.kt @@ -1,6 +1,8 @@ package com.geeksville.mesh.ui import androidx.compose.Composable +import androidx.compose.ambient +import androidx.ui.core.ContextAmbient import androidx.ui.core.Text import androidx.ui.foundation.Clickable import androidx.ui.foundation.DrawImage @@ -10,7 +12,9 @@ import androidx.ui.material.ripple.Ripple import androidx.ui.res.imageResource import androidx.ui.tooling.preview.Preview import androidx.ui.unit.dp +import com.geeksville.android.GeeksvilleApplication import com.geeksville.android.Logging +import com.geeksville.android.toast import com.geeksville.mesh.R /// The Compose IDE preview doesn't like the protobufs @@ -21,6 +25,7 @@ object ChannelLog : Logging @Composable fun ChannelContent(channel: Channel = Channel("Default", 7)) { val typography = MaterialTheme.typography() + val context = ambient(ContextAmbient) Column(modifier = LayoutSize.Fill + LayoutPadding(16.dp)) { Text( @@ -37,7 +42,8 @@ fun ChannelContent(channel: Channel = Channel("Default", 7)) { Ripple(bounded = false) { Clickable(onClick = { - TODO() + GeeksvilleApplication.analytics.track("channel_share") // track how many times users share channels + context.toast("Channel sharing is not yet implemented") }) { VectorImage( id = R.drawable.ic_twotone_share_24, diff --git a/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt b/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt index dd94507b..0a1516d8 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt @@ -48,17 +48,19 @@ fun HomeContent() { Column { Text("Connected") - /// Create a software update button - val context = ambient(ContextAmbient) - RadioInterfaceService.getBondedDeviceAddress(context)?.let { macAddress -> - Button(text = "Update firmware", - onClick = { - SoftwareUpdateService.enqueueWork( - context, - SoftwareUpdateService.startUpdateIntent(macAddress) - ) - } - ) + if (false) { // hide the firmware update button for now, it is kinda ugly and users don't need it yet + /// Create a software update button + val context = ambient(ContextAmbient) + RadioInterfaceService.getBondedDeviceAddress(context)?.let { macAddress -> + Button(text = "Update firmware", + onClick = { + SoftwareUpdateService.enqueueWork( + context, + SoftwareUpdateService.startUpdateIntent(macAddress) + ) + } + ) + } } } } else {