kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
fix node id lookups
rodzic
2c8c7ac8d6
commit
b5fc637f30
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
# High priority
|
# High priority
|
||||||
MVP features required for first public alpha
|
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
|
* 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
|
* show offline nodes as greyed out
|
||||||
* make node list view not look like ass
|
* make node list view not look like ass
|
||||||
|
|
|
@ -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
|
// everytime the radio reconnects, we slam in our current owner data, the radio is smart enough to only broadcast if needed
|
||||||
UIState.setOwner(this)
|
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)
|
onMeshConnectionChanged(m.isConnected)
|
||||||
|
|
||||||
debug("connected to mesh service, isConnected=${UIState.isConnected.value}")
|
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() {
|
override fun onDisconnected() {
|
||||||
|
|
|
@ -495,8 +495,9 @@ class MeshService : Service(), Logging {
|
||||||
/// Update our DB of users based on someone sending out a User subpacket
|
/// Update our DB of users based on someone sending out a User subpacket
|
||||||
private fun handleReceivedUser(fromNum: Int, p: MeshProtos.User) {
|
private fun handleReceivedUser(fromNum: Int, p: MeshProtos.User) {
|
||||||
updateNodeInfo(fromNum) {
|
updateNodeInfo(fromNum) {
|
||||||
|
val oldId = it.user?.id.orEmpty()
|
||||||
it.user = MeshUser(
|
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.longName,
|
||||||
p.shortName
|
p.shortName
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.geeksville.mesh.ui
|
package com.geeksville.mesh.ui
|
||||||
|
|
||||||
import androidx.compose.Composable
|
import androidx.compose.Composable
|
||||||
|
import androidx.compose.ambient
|
||||||
|
import androidx.ui.core.ContextAmbient
|
||||||
import androidx.ui.core.Text
|
import androidx.ui.core.Text
|
||||||
import androidx.ui.foundation.Clickable
|
import androidx.ui.foundation.Clickable
|
||||||
import androidx.ui.foundation.DrawImage
|
import androidx.ui.foundation.DrawImage
|
||||||
|
@ -10,7 +12,9 @@ import androidx.ui.material.ripple.Ripple
|
||||||
import androidx.ui.res.imageResource
|
import androidx.ui.res.imageResource
|
||||||
import androidx.ui.tooling.preview.Preview
|
import androidx.ui.tooling.preview.Preview
|
||||||
import androidx.ui.unit.dp
|
import androidx.ui.unit.dp
|
||||||
|
import com.geeksville.android.GeeksvilleApplication
|
||||||
import com.geeksville.android.Logging
|
import com.geeksville.android.Logging
|
||||||
|
import com.geeksville.android.toast
|
||||||
import com.geeksville.mesh.R
|
import com.geeksville.mesh.R
|
||||||
|
|
||||||
/// The Compose IDE preview doesn't like the protobufs
|
/// The Compose IDE preview doesn't like the protobufs
|
||||||
|
@ -21,6 +25,7 @@ object ChannelLog : Logging
|
||||||
@Composable
|
@Composable
|
||||||
fun ChannelContent(channel: Channel = Channel("Default", 7)) {
|
fun ChannelContent(channel: Channel = Channel("Default", 7)) {
|
||||||
val typography = MaterialTheme.typography()
|
val typography = MaterialTheme.typography()
|
||||||
|
val context = ambient(ContextAmbient)
|
||||||
|
|
||||||
Column(modifier = LayoutSize.Fill + LayoutPadding(16.dp)) {
|
Column(modifier = LayoutSize.Fill + LayoutPadding(16.dp)) {
|
||||||
Text(
|
Text(
|
||||||
|
@ -37,7 +42,8 @@ fun ChannelContent(channel: Channel = Channel("Default", 7)) {
|
||||||
|
|
||||||
Ripple(bounded = false) {
|
Ripple(bounded = false) {
|
||||||
Clickable(onClick = {
|
Clickable(onClick = {
|
||||||
TODO()
|
GeeksvilleApplication.analytics.track("channel_share") // track how many times users share channels
|
||||||
|
context.toast("Channel sharing is not yet implemented")
|
||||||
}) {
|
}) {
|
||||||
VectorImage(
|
VectorImage(
|
||||||
id = R.drawable.ic_twotone_share_24,
|
id = R.drawable.ic_twotone_share_24,
|
||||||
|
|
|
@ -48,17 +48,19 @@ fun HomeContent() {
|
||||||
Column {
|
Column {
|
||||||
Text("Connected")
|
Text("Connected")
|
||||||
|
|
||||||
/// Create a software update button
|
if (false) { // hide the firmware update button for now, it is kinda ugly and users don't need it yet
|
||||||
val context = ambient(ContextAmbient)
|
/// Create a software update button
|
||||||
RadioInterfaceService.getBondedDeviceAddress(context)?.let { macAddress ->
|
val context = ambient(ContextAmbient)
|
||||||
Button(text = "Update firmware",
|
RadioInterfaceService.getBondedDeviceAddress(context)?.let { macAddress ->
|
||||||
onClick = {
|
Button(text = "Update firmware",
|
||||||
SoftwareUpdateService.enqueueWork(
|
onClick = {
|
||||||
context,
|
SoftwareUpdateService.enqueueWork(
|
||||||
SoftwareUpdateService.startUpdateIntent(macAddress)
|
context,
|
||||||
)
|
SoftwareUpdateService.startUpdateIntent(macAddress)
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Ładowanie…
Reference in New Issue