Skip to content

Commit

Permalink
Merge pull request #147 from Semper-Viventem/fix-db-backup
Browse files Browse the repository at this point in the history
Fix db backup oom issue
  • Loading branch information
Semper-Viventem authored Aug 2, 2024
2 parents f301193 + 4551028 commit 42993e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
minSdk = 29
targetSdk = 34

versionCode = 1708536356
versionName = "0.26.0-beta"
versionCode = 1708536357
versionName = "0.26.1-beta"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ abstract class AppDatabase : RoomDatabase() {
throw IllegalStateException("The database file doesn't exist")
}
context.contentResolver.openOutputStream(toUri)?.use { outputStream ->
outputStream.write(dbFile.readBytes())
}
dbFile.inputStream().use { inputStream ->
inputStream.copyTo(outputStream)
}
} ?: throw RuntimeException("Cannot create a backup file stream")
}
}

Expand Down

0 comments on commit 42993e2

Please sign in to comment.