From 6a48fed17060dabf38ab1a5f0d5cce2c5c979097 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 3 Dec 2023 14:25:09 -0500 Subject: [PATCH] Remove storage permission check when manually creating backups Co-authored-by: jmir1 --- .../eu/kanade/tachiyomi/data/backup/BackupCreator.kt | 6 ------ .../kanade/tachiyomi/util/system/ContextExtensions.kt | 11 ----------- 2 files changed, 17 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt index de907c91ea..b578742a9a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.backup -import android.Manifest import android.content.Context import android.net.Uri import com.hippo.unifile.UniFile @@ -31,7 +30,6 @@ import eu.kanade.tachiyomi.data.backup.models.backupTrackMapper import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.preferenceKey import eu.kanade.tachiyomi.source.sourcePreferences -import eu.kanade.tachiyomi.util.system.hasPermission import kotlinx.serialization.protobuf.ProtoBuf import logcat.LogPriority import okio.buffer @@ -73,10 +71,6 @@ class BackupCreator( * @param isAutoBackup backup called from scheduled backup job */ suspend fun createBackup(uri: Uri, flags: Int, isAutoBackup: Boolean): String { - if (!context.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - throw IllegalStateException(context.stringResource(MR.strings.missing_storage_permission)) - } - val databaseManga = getFavorites.await() val backup = Backup( backupMangas(databaseManga, flags), diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index 44635e98dc..05c0971fd8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -10,7 +10,6 @@ import android.net.Uri import android.os.Build import android.os.PowerManager import androidx.appcompat.view.ContextThemeWrapper -import androidx.core.content.PermissionChecker import androidx.core.content.getSystemService import androidx.core.net.toUri import com.hippo.unifile.UniFile @@ -53,16 +52,6 @@ fun Context.copyToClipboard(label: String, content: String) { } } -/** - * Checks if the give permission is granted. - * - * @param permission the permission to check. - * @return true if it has permissions. - */ -fun Context.hasPermission( - permission: String, -) = PermissionChecker.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED - val Context.powerManager: PowerManager get() = getSystemService()!!