~cytrogen/vbhelper

542072c2387c770e4893a48f8ff7530f3b7ec266 — Nacho 1 year, 3 months ago 42dd87f
Forgot to close DB before importing process
This will clear the database lock file before closing the application, ensuring that during the second startup the application does not see anything weird with the data. Not closing the database before import can lead to weird behavior.
M app/src/main/java/com/github/nacabaro/vbhelper/screens/settingsScreen/NewSettingsScreenControllerImpl.kt => app/src/main/java/com/github/nacabaro/vbhelper/screens/settingsScreen/NewSettingsScreenControllerImpl.kt +4 -0
@@ 91,6 91,8 @@ class NewSettingsScreenControllerImpl(
    private fun importDatabase(roomDbName: String, sourceUri: Uri) {
        context.lifecycleScope.launch(Dispatchers.IO) {
            try {
                var application = context.applicationContext as VBHelper

                if (!getFileNameFromUri(sourceUri)!!.endsWith(".vbhelper")) {
                    context.runOnUiThread {
                        Toast.makeText(context, "Invalid file format", Toast.LENGTH_SHORT).show()


@@ 98,6 100,8 @@ class NewSettingsScreenControllerImpl(
                    return@launch
                }

                application.container.db.close()

                val dbPath = context.getDatabasePath(roomDbName)
                val shmFile = File(dbPath.parent, "$roomDbName-shm")
                val walFile = File(dbPath.parent, "$roomDbName-wal")