Remove redundant DB transaction function

This commit is contained in:
arkon 2020-04-26 16:45:23 -04:00
parent 17fc8deb19
commit 6ef59a5949
2 changed files with 2 additions and 11 deletions

View File

@ -226,7 +226,7 @@ class BackupRestoreService : Service() {
} }
private fun restoreCategories(categoriesJson: JsonElement) { private fun restoreCategories(categoriesJson: JsonElement) {
db.executeTransaction { db.inTransaction {
backupManager.restoreCategories(categoriesJson.asJsonArray) backupManager.restoreCategories(categoriesJson.asJsonArray)
restoreProgress += 1 restoreProgress += 1
@ -235,7 +235,7 @@ class BackupRestoreService : Service() {
} }
private fun restoreManga(mangaJson: JsonObject) { private fun restoreManga(mangaJson: JsonObject) {
db.executeTransaction { db.inTransaction {
val manga = backupManager.parser.fromJson<MangaImpl>(mangaJson.get(MANGA)) val manga = backupManager.parser.fromJson<MangaImpl>(mangaJson.get(MANGA))
val chapters = backupManager.parser.fromJson<List<ChapterImpl>>( val chapters = backupManager.parser.fromJson<List<ChapterImpl>>(
mangaJson.get(CHAPTERS) mangaJson.get(CHAPTERS)

View File

@ -45,13 +45,4 @@ open class DatabaseHelper(context: Context) :
.build() .build()
inline fun inTransaction(block: () -> Unit) = db.inTransaction(block) inline fun inTransaction(block: () -> Unit) = db.inTransaction(block)
fun executeTransaction(block: () -> Unit) {
db.lowLevel().beginTransaction()
block()
db.lowLevel().setTransactionSuccessful()
db.lowLevel().endTransaction()
}
} }