mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-29 03:03:05 -04: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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user