mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(MeshService): remove discardNodeDB and simplify logic
This commit is contained in:
parent
1252b67fce
commit
a98d3899e6
3 changed files with 3 additions and 17 deletions
|
|
@ -70,14 +70,10 @@ class NodeDB @Inject constructor(
|
|||
nodeInfoDao.upsert(node)
|
||||
}
|
||||
|
||||
suspend fun clearNodeDB() = withContext(Dispatchers.IO) {
|
||||
nodeInfoDao.clearNodeInfo()
|
||||
nodeInfoDao.clearMyNodeInfo()
|
||||
}
|
||||
|
||||
suspend fun installNodeDB(mi: MyNodeInfo, nodes: List<NodeInfo>) = withContext(Dispatchers.IO) {
|
||||
clearNodeDB()
|
||||
nodeInfoDao.clearMyNodeInfo()
|
||||
nodeInfoDao.setMyNodeInfo(mi) // set MyNodeInfo first
|
||||
nodeInfoDao.clearNodeInfo()
|
||||
nodeInfoDao.putAll(nodes)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue