Fix problem of old messages not being remembered

1.2-legacy
geeksville 2020-07-01 17:47:53 -07:00
rodzic 800060a991
commit c0e58391a3
4 zmienionych plików z 13 dodań i 9 usunięć

Wyświetl plik

@ -1,10 +1,8 @@
# Remaining tasks before declaring 1.0
- feh123 problem sony
- fix release build inclusion of firmware - per https://developer.android.com/studio/build/build-variants
- Android frontend should refetch the android messages from backend service on Resume
- disable software update button after update finishes
- first message sent is still doubled for some people
- fix release build inclusion of firmware - per https://developer.android.com/studio/build/build-variants
- disable software update button after update finishes
- let users set arbitrary params in android
- add a low level settings screen (let user change any of the RadioConfig parameters)

Wyświetl plik

@ -423,7 +423,7 @@ class MainActivity : AppCompatActivity(), Logging,
private fun updateConnectionStatusImage(connected: MeshService.ConnectionState) {
if (actionBarMenu==null)
if (actionBarMenu == null)
return
val (image, tooltip) = when (connected) {
@ -736,7 +736,9 @@ class MainActivity : AppCompatActivity(), Logging,
registerMeshReceiver()
// Init our messages table with the service's record of past text messages
model.messagesState.messages.value = service.oldMessages
val msgs = service.oldMessages
debug("Service provided ${msgs.size} messages")
model.messagesState.messages.value = msgs
val connectionState =
MeshService.ConnectionState.valueOf(service.connectionState())

Wyświetl plik

@ -605,13 +605,13 @@ class MeshService : Service(), Logging {
}
/**
* discard entire node db & message state - used when changing radio channels
* discard entire node db & message state - used when downloading a new db from the device
*/
private fun discardNodeDB() {
myNodeInfo = null
nodeDBbyNodeNum.clear()
nodeDBbyID.clear()
recentDataPackets.clear()
// recentDataPackets.clear() We do NOT want to clear this, because it is the record of old messages the GUI still might want to show
haveNodeDB = false
}
@ -1024,6 +1024,9 @@ class MeshService : Service(), Logging {
/// Perform all the steps needed once we start waiting for device sleep to complete
fun startDeviceSleep() {
// Just in case the user uncleanly reboots the phone, save now (we normally save in onDestroy)
saveSettings()
// lost radio connection, therefore no need to keep listening to GPS
stopLocationRequests()

Wyświetl plik

@ -187,7 +187,8 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
layoutManager.stackFromEnd = true // We want the last rows to always be shown
messageListView.layoutManager = layoutManager
model.messagesState.messages.observe(viewLifecycleOwner, Observer { it ->
model.messagesState.messages.observe(viewLifecycleOwner, Observer {
debug("New messages received: ${it.size}")
messagesAdapter.onMessagesChanged(it)
})