refactor: Retrieve auto backup directory from Uri argument

This commit is contained in:
Ahmad Ansori Palembani 2024-09-20 07:12:49 +07:00
parent c6c6ed0553
commit e248de76d7
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -37,7 +37,6 @@ class BackupCreator(
val parser = ProtoBuf
private val db: DatabaseHelper = Injekt.get()
private val backupPreferences: BackupPreferences = Injekt.get()
private val storageManager: StorageManager by injectLazy()
@Suppress("RedundantSuspendModifier")
private suspend fun getDatabaseManga(includeReadManga: Boolean) = db.inTransactionReturn {
@ -60,7 +59,7 @@ class BackupCreator(
try {
file = if (isAutoBackup) {
// Get dir of file and create
val dir = storageManager.getAutomaticBackupsDirectory()
val dir = UniFile.fromUri(context, uri)
// Delete older backups
val numberOfBackups = backupPreferences.numberOfBackups().get()