kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
text message gui for sneding kinda works
rodzic
165df2c4de
commit
b3026ba6be
1
TODO.md
1
TODO.md
|
@ -8,6 +8,7 @@ MVP features required for first public alpha
|
|||
* let user set name and shortname
|
||||
* take video
|
||||
|
||||
* when we connect to radio, distances to nodes in the chat log should automatically redraw
|
||||
* show pointer arrow on the outside of the user icons, always pointing towoards them
|
||||
* stop scan when we start the service
|
||||
* set the radio by using the service
|
||||
|
|
|
@ -320,14 +320,9 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
MeshProtos.Data.Type.CLEAR_TEXT_VALUE -> {
|
||||
// FIXME - use the real time from the packet
|
||||
// FIXME - don't just slam in a new list each time, it probably causes extra drawing. Figure out how to be Compose smarter...
|
||||
val modded = MessagesState.messages.value.toMutableList()
|
||||
modded.add(
|
||||
TextMessage(
|
||||
sender,
|
||||
payload.toString(utf8)
|
||||
)
|
||||
)
|
||||
MessagesState.messages.value = modded
|
||||
val msg = TextMessage(sender, payload.toString(utf8))
|
||||
|
||||
MessagesState.addMessage(msg)
|
||||
}
|
||||
else -> TODO()
|
||||
}
|
||||
|
|
|
@ -46,5 +46,6 @@ object NodeDB {
|
|||
/// A map from nodeid to to nodeinfo
|
||||
val nodes = mutableStateOf(testNodes.map { it.user!!.id to it }.toMap())
|
||||
|
||||
val ourNodeInfo get() = nodes.value[myId.value!!] ?: error("our node not found")
|
||||
/// Could be null if we haven't received our node DB yet
|
||||
val ourNodeInfo get() = nodes.value[myId.value!!]
|
||||
}
|
|
@ -26,7 +26,7 @@ import com.google.protobuf.ByteString
|
|||
import java.nio.charset.Charset
|
||||
|
||||
|
||||
class RadioNotConnectedException() : Exception("Can't find radio")
|
||||
class RadioNotConnectedException() : Exception("Not connected to radio")
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.os.RemoteException
|
||||
import androidx.compose.Composable
|
||||
import androidx.compose.state
|
||||
import androidx.ui.core.Modifier
|
||||
|
@ -118,11 +119,15 @@ fun MessagesContent() {
|
|||
var error: String? = null
|
||||
val service = UIState.meshService
|
||||
if (service != null)
|
||||
service.sendData(
|
||||
null,
|
||||
str.toByteArray(utf8),
|
||||
MeshProtos.Data.Type.CLEAR_TEXT_VALUE
|
||||
)
|
||||
try {
|
||||
service.sendData(
|
||||
null,
|
||||
str.toByteArray(utf8),
|
||||
MeshProtos.Data.Type.CLEAR_TEXT_VALUE
|
||||
)
|
||||
} catch (ex: RemoteException) {
|
||||
error = "Error: ${ex.message}"
|
||||
}
|
||||
else
|
||||
error = "Error: No Mesh service"
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ fun UserIcon(user: NodeInfo? = null, modifier: Modifier = Modifier.None) {
|
|||
modifier = LayoutGravity.Center
|
||||
)
|
||||
val ourNodeInfo = NodeDB.ourNodeInfo
|
||||
val distance = ourNodeInfo.distanceStr(user)
|
||||
val distance = ourNodeInfo?.distanceStr(user)
|
||||
if (distance != null)
|
||||
Text(distance, modifier = LayoutGravity.Center)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue