No longer need write permission as we copy magnet now
This commit is contained in:
1 parent
b867bbc7a6
commit
413bb2cd82
1 file changed
+4
-17
@@ -1,6 +1,5 @@
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.Manifest
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -131,10 +130,7 @@ import com.hippo.ehviewer.ui.tools.rememberInVM
|
||||
import com.hippo.ehviewer.util.FavouriteStatusRouter
|
||||
import com.hippo.ehviewer.util.addTextToClipboard
|
||||
import com.hippo.ehviewer.util.bgWork
|
||||
import com.hippo.ehviewer.util.displayString
|
||||
import com.hippo.ehviewer.util.flattenForEach
|
||||
import com.hippo.ehviewer.util.isAtLeastQ
|
||||
import com.hippo.ehviewer.util.requestPermission
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
@@ -150,6 +146,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
import moe.tarsin.coroutines.runSuspendCatching
|
||||
import moe.tarsin.coroutines.runSwallowingWithUI
|
||||
|
||||
context(CoroutineScope, DestinationsNavigator, DialogState, MainActivity, SnackbarHostState, SharedTransitionScope, TransitionsVisibilityScope)
|
||||
@Composable
|
||||
@@ -581,19 +578,9 @@ fun BelowHeader(galleryDetail: GalleryDetail) {
|
||||
text = torrentText,
|
||||
onClick = {
|
||||
launchIO {
|
||||
if (galleryDetail.torrentCount > 0) {
|
||||
val granted = isAtLeastQ || requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
if (granted) {
|
||||
runSuspendCatching {
|
||||
showTorrentDialog()
|
||||
}.onFailure {
|
||||
showSnackbar(it.displayString())
|
||||
}
|
||||
} else {
|
||||
showSnackbar(permissionDenied)
|
||||
}
|
||||
} else {
|
||||
showSnackbar(noTorrents)
|
||||
when {
|
||||
galleryDetail.torrentCount <= 0 -> showSnackbar(noTorrents)
|
||||
else -> runSwallowingWithUI { showTorrentDialog() }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user