mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Merge pull request #4602
* refactor(test): Introduce MeshTestApplication for robust testing
This commit is contained in:
parent
f75622002f
commit
ac5a1714e0
4 changed files with 77 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ import androidx.room.RoomDatabase
|
|||
import co.touchlab.kermit.Logger
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
|
@ -209,6 +210,14 @@ class DatabaseManager @Inject constructor(private val app: Application, private
|
|||
}
|
||||
prefs.edit().putBoolean(DatabaseConstants.LEGACY_DB_CLEANED_KEY, true).apply()
|
||||
}
|
||||
|
||||
/** Closes all open databases and cancels background work. */
|
||||
fun close() {
|
||||
managerScope.cancel()
|
||||
dbCache.values.forEach { it.close() }
|
||||
dbCache.clear()
|
||||
_currentDb.value = null
|
||||
}
|
||||
}
|
||||
|
||||
object DatabaseConstants {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue