chore: update dependencies (#964)

---------

Co-authored-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
Caner Karaca
2024-05-08 15:13:44 +03:00
committed by GitHub
parent 80e1895355
commit 4e460ed2be
12 changed files with 38 additions and 41 deletions

View File

@@ -2,6 +2,7 @@ package me.rhunk.snapenhance.ui.setup.screens.impl
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
@@ -9,7 +10,6 @@ import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.provider.Settings
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
@@ -81,7 +81,7 @@ class PermissionsScreen : SetupScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
activityLauncherHelper.requestPermission(Manifest.permission.POST_NOTIFICATIONS) { resultCode, _ ->
coroutineScope.launch {
grantedPermissions[perm.translationKey] = resultCode == ComponentActivity.RESULT_OK
grantedPermissions[perm.translationKey] = resultCode == Activity.RESULT_OK
}
}
}

View File

@@ -1,5 +1,6 @@
package me.rhunk.snapenhance.ui.util
import android.app.Activity
import android.content.Intent
import androidx.activity.ComponentActivity
import androidx.activity.result.ActivityResultLauncher
@@ -15,7 +16,7 @@ class ActivityLauncherHelper(
private var permissionResultLauncher: ActivityResultLauncher<String> =
activity.registerForActivityResult(ActivityResultContracts.RequestPermission()) { result ->
runCatching {
callback?.let { it(if (result) ComponentActivity.RESULT_OK else ComponentActivity.RESULT_CANCELED, null) }
callback?.let { it(if (result) Activity.RESULT_OK else Activity.RESULT_CANCELED, null) }
}.onFailure {
AbstractLogger.directError("Failed to process activity result", it)
}
@@ -55,7 +56,7 @@ fun ActivityLauncherHelper.chooseFolder(callback: (uri: String) -> Unit) {
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
) { resultCode, intent ->
if (resultCode != ComponentActivity.RESULT_OK) {
if (resultCode != Activity.RESULT_OK) {
return@launch
}
val uri = intent?.data ?: return@launch
@@ -77,7 +78,7 @@ fun ActivityLauncherHelper.saveFile(name: String, type: String = "*/*", callback
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
) { resultCode, intent ->
if (resultCode != ComponentActivity.RESULT_OK) {
if (resultCode != Activity.RESULT_OK) {
return@launch
}
val uri = intent?.data ?: return@launch
@@ -97,7 +98,7 @@ fun ActivityLauncherHelper.openFile(type: String = "*/*", callback: (uri: String
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
) { resultCode, intent ->
if (resultCode != ComponentActivity.RESULT_OK) {
if (resultCode != Activity.RESULT_OK) {
return@launch
}
val uri = intent?.data ?: return@launch