refactor: implement repository pattern for NodeDB (#835)

- enforce Unidirectional Data Flow removing nodeDB updates via `MainActivity`/`UIState`
- merge `MyNodeInfoDao` into `NodeInfoDao`
- move node list re-indexing to database
This commit is contained in:
Andre K 2024-02-06 20:03:15 -03:00 committed by GitHub
parent 3f0dfb7690
commit c8f93db00d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 170 additions and 147 deletions

View file

@ -340,8 +340,6 @@ class MainActivity : AppCompatActivity(), Logging {
else {
// If our app is too old/new, we probably don't understand the new DeviceConfig messages, so we don't read them until here
model.updateNodesFromDevice()
// we have a connection to our device now, do the channel change
perhapsChangeChannel()
}
@ -453,11 +451,6 @@ class MainActivity : AppCompatActivity(), Logging {
val connectionState =
MeshService.ConnectionState.valueOf(service.connectionState())
// if we are not connected, onMeshConnectionChange won't fetch nodes from the service
// in that case, we do it here - because the service certainly has a better idea of node db that we have
if (connectionState != MeshService.ConnectionState.CONNECTED)
model.updateNodesFromDevice()
// We won't receive a notify for the initial state of connection, so we force an update here
onMeshConnectionChanged(connectionState)
} catch (ex: RemoteException) {