mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
a better fix for the problem of sending messages while device is asleep
Better just to Observe myId and wait for it to be !null
This commit is contained in:
parent
1558675cc7
commit
5abb56ec3f
1 changed files with 7 additions and 0 deletions
|
|
@ -169,11 +169,18 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
|
|||
messagesAdapter.onMessagesChanged(it)
|
||||
})
|
||||
|
||||
// If connection state _OR_ myID changes we have to fix our ability to edit outgoing messages
|
||||
model.isConnected.observe(viewLifecycleOwner, Observer { connected ->
|
||||
// If we don't know our node ID and we are offline don't let user try to send
|
||||
textInputLayout.isEnabled =
|
||||
connected != MeshService.ConnectionState.DISCONNECTED && model.nodeDB.myId.value != null
|
||||
})
|
||||
|
||||
model.nodeDB.myId.observe(viewLifecycleOwner, Observer { myId ->
|
||||
// If we don't know our node ID and we are offline don't let user try to send
|
||||
textInputLayout.isEnabled =
|
||||
model.isConnected.value != MeshService.ConnectionState.DISCONNECTED && myId != null
|
||||
})
|
||||
}
|
||||
|
||||
private val dateFormat = SimpleDateFormat("h:mm a")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue