mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(backup/creator): Use injectLazy
This commit is contained in:
parent
ec5e86942a
commit
0f96f4dbe1
1 changed files with 4 additions and 4 deletions
|
@ -29,6 +29,7 @@ import eu.kanade.tachiyomi.util.system.workManager
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import yokai.domain.backup.BackupPreferences
|
import yokai.domain.backup.BackupPreferences
|
||||||
import yokai.domain.storage.StorageManager
|
import yokai.domain.storage.StorageManager
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||||
CoroutineWorker(context, workerParams) {
|
CoroutineWorker(context, workerParams) {
|
||||||
|
|
||||||
private val notifier = BackupNotifier(context.localeContext)
|
private val notifier = BackupNotifier(context.localeContext)
|
||||||
|
private val storageManager: StorageManager by injectLazy()
|
||||||
|
|
||||||
override suspend fun doWork(): Result {
|
override suspend fun doWork(): Result {
|
||||||
val isAutoBackup = inputData.getBoolean(IS_AUTO_BACKUP_KEY, true)
|
val isAutoBackup = inputData.getBoolean(IS_AUTO_BACKUP_KEY, true)
|
||||||
|
@ -64,10 +66,8 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAutomaticBackupLocation(): Uri? {
|
private fun getAutomaticBackupLocation(): Uri? =
|
||||||
val storageManager = Injekt.get<StorageManager>()
|
storageManager.getAutomaticBackupsDirectory()?.uri
|
||||||
return storageManager.getAutomaticBackupsDirectory()?.uri
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getForegroundInfo(): ForegroundInfo {
|
override suspend fun getForegroundInfo(): ForegroundInfo {
|
||||||
return ForegroundInfo(
|
return ForegroundInfo(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue