Use .toUri()
extension function
(cherry picked from commit 0dda64b9d80a47a96fb52d13b5e0ece6d5fca2b1) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt
This commit is contained in:
parent
5f2e979bb5
commit
fb1a3da0ea
@ -43,6 +43,7 @@ import tachiyomi.presentation.core.i18n.stringResource
|
|||||||
import tachiyomi.presentation.core.util.collectAsState
|
import tachiyomi.presentation.core.util.collectAsState
|
||||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import androidx.core.net.toUri
|
||||||
|
|
||||||
internal class PermissionStep : OnboardingStep {
|
internal class PermissionStep : OnboardingStep {
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ internal class PermissionStep : OnboardingStep {
|
|||||||
onButtonClick = {
|
onButtonClick = {
|
||||||
@SuppressLint("BatteryLife")
|
@SuppressLint("BatteryLife")
|
||||||
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply {
|
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply {
|
||||||
data = Uri.parse("package:${context.packageName}")
|
data = "package:${context.packageName}".toUri()
|
||||||
}
|
}
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
},
|
},
|
||||||
|
@ -54,6 +54,7 @@ import uy.kohesive.injekt.api.get
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.time.Duration.Companion.hours
|
import kotlin.time.Duration.Companion.hours
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
import androidx.core.net.toUri
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache where we dump the downloads directory from the filesystem. This class is needed because
|
* Cache where we dump the downloads directory from the filesystem. This class is needed because
|
||||||
@ -483,7 +484,7 @@ private object UniFileAsStringSerializer : KSerializer<UniFile?> {
|
|||||||
|
|
||||||
override fun deserialize(decoder: Decoder): UniFile? {
|
override fun deserialize(decoder: Decoder): UniFile? {
|
||||||
return if (decoder.decodeNotNullMark()) {
|
return if (decoder.decodeNotNullMark()) {
|
||||||
UniFile.fromUri(Injekt.get<Application>(), Uri.parse(decoder.decodeString()))
|
UniFile.fromUri(Injekt.get<Application>(), decoder.decodeString().toUri())
|
||||||
} else {
|
} else {
|
||||||
decoder.decodeNull()
|
decoder.decodeNull()
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import kotlinx.coroutines.SupervisorJob
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import tachiyomi.core.common.util.system.logcat
|
import tachiyomi.core.common.util.system.logcat
|
||||||
|
import androidx.core.net.toUri
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast receiver that listens for the system's packages installed, updated or removed, and only
|
* Broadcast receiver that listens for the system's packages installed, updated or removed, and only
|
||||||
@ -138,7 +139,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : Broadc
|
|||||||
|
|
||||||
private fun notify(context: Context, pkgName: String, action: String) {
|
private fun notify(context: Context, pkgName: String, action: String) {
|
||||||
Intent(action).apply {
|
Intent(action).apply {
|
||||||
data = Uri.parse("package:$pkgName")
|
data = "package:$pkgName".toUri()
|
||||||
`package` = context.packageName
|
`package` = context.packageName
|
||||||
context.sendBroadcast(this)
|
context.sendBroadcast(this)
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ val Context.isShizukuInstalled get() = isPackageInstalled("moe.shizuku.privilege
|
|||||||
fun Context.launchRequestPackageInstallsPermission() {
|
fun Context.launchRequestPackageInstallsPermission() {
|
||||||
val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {
|
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {
|
||||||
data = Uri.parse("package:$packageName")
|
data = "package:$packageName".toUri()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Intent(Settings.ACTION_SECURITY_SETTINGS)
|
Intent(Settings.ACTION_SECURITY_SETTINGS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user