refactor(backup): Remove unnecessary function

This commit is contained in:
Ahmad Ansori Palembani 2024-11-04 13:22:02 +07:00
parent 30726d030c
commit ca7496bda1
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -35,14 +35,6 @@ class BackupCreator(
val parser = ProtoBuf val parser = ProtoBuf
private val backupPreferences: BackupPreferences = Injekt.get() private val backupPreferences: BackupPreferences = Injekt.get()
private suspend fun getDatabaseManga(includeReadManga: Boolean) =
getManga.awaitFavorites() +
if (includeReadManga) {
getManga.awaitReadNotFavorites()
} else {
emptyList()
}
/** /**
* Create backup Json file from database * Create backup Json file from database
* *
@ -74,7 +66,8 @@ class BackupCreator(
throw IllegalStateException("Invalid backup destination") throw IllegalStateException("Invalid backup destination")
} }
val backupManga = mangaBackupCreator(getDatabaseManga(options.readManga), options) val readNotFavorites = if (options.readManga) getManga.awaitReadNotFavorites() else emptyList()
val backupManga = mangaBackupCreator(getManga.awaitFavorites() + readNotFavorites, options)
val backup = Backup( val backup = Backup(
backupManga = backupManga, backupManga = backupManga,
backupCategories = categoriesBackupCreator(options), backupCategories = categoriesBackupCreator(options),