feat(#3508): Optionally preserve Favorites on nodeDb reset (#3633)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2025-11-11 02:38:45 +00:00 committed by GitHub
parent 81dc625c70
commit e701ad6aee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 68 additions and 14 deletions

View file

@ -26,7 +26,7 @@ interface NodeInfoWriteDataSource {
suspend fun installConfig(mi: MyNodeEntity, nodes: List<NodeEntity>)
suspend fun clearNodeDB()
suspend fun clearNodeDB(preserveFavorites: Boolean)
suspend fun deleteNode(num: Int)

View file

@ -40,8 +40,8 @@ constructor(
override suspend fun installConfig(mi: MyNodeEntity, nodes: List<NodeEntity>) =
withContext(dispatchers.io) { dbManager.withDb { it.nodeInfoDao().installConfig(mi, nodes) } }
override suspend fun clearNodeDB() =
withContext(dispatchers.io) { dbManager.withDb { it.nodeInfoDao().clearNodeInfo() } }
override suspend fun clearNodeDB(preserveFavorites: Boolean) =
withContext(dispatchers.io) { dbManager.withDb { it.nodeInfoDao().clearNodeInfo(preserveFavorites) } }
override suspend fun deleteNode(num: Int) =
withContext(dispatchers.io) { dbManager.withDb { it.nodeInfoDao().deleteNode(num) } }

View file

@ -136,7 +136,8 @@ constructor(
suspend fun installConfig(mi: MyNodeEntity, nodes: List<NodeEntity>) =
withContext(dispatchers.io) { nodeInfoWriteDataSource.installConfig(mi, nodes) }
suspend fun clearNodeDB() = withContext(dispatchers.io) { nodeInfoWriteDataSource.clearNodeDB() }
suspend fun clearNodeDB(preserveFavorites: Boolean = false) =
withContext(dispatchers.io) { nodeInfoWriteDataSource.clearNodeDB(preserveFavorites) }
suspend fun deleteNode(num: Int) = withContext(dispatchers.io) {
nodeInfoWriteDataSource.deleteNode(num)