Skip to content

Commit cc44bc5

Browse files
committed
[feat] #62 intent action application detail
1 parent fe26293 commit cc44bc5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package com.record.upload
22

33
import android.Manifest
4+
import android.content.Context
5+
import android.content.Intent
6+
import android.net.Uri
47
import android.os.Build
8+
import android.provider.Settings
59
import android.util.Log
610
import androidx.activity.compose.rememberLauncherForActivityResult
711
import androidx.activity.result.contract.ActivityResultContracts
@@ -28,6 +32,7 @@ import androidx.compose.runtime.rememberCoroutineScope
2832
import androidx.compose.runtime.setValue
2933
import androidx.compose.ui.Alignment
3034
import androidx.compose.ui.Modifier
35+
import androidx.compose.ui.platform.LocalContext
3136
import androidx.compose.ui.res.painterResource
3237
import androidx.compose.ui.text.style.TextAlign
3338
import androidx.compose.ui.tooling.preview.Preview
@@ -84,6 +89,7 @@ fun VideoPickerScreen(
8489
showShouldShowRationaleDialog: () -> Unit = {},
8590
hideShouldShowRationaleDialog: () -> Unit = {},
8691
) {
92+
val context = LocalContext.current
8793
val cameraPermissionState = rememberPermissionState(Manifest.permission.READ_MEDIA_VIDEO)
8894

8995
val requestPermissionLauncher = rememberLauncherForActivityResult(
@@ -134,7 +140,6 @@ fun VideoPickerScreen(
134140
return@customClickable
135141
}
136142
if (cameraPermissionState.status.shouldShowRationale) {
137-
Log.d("shouldShowRationale", "${cameraPermissionState.status.shouldShowRationale}")
138143
showShouldShowRationaleDialog()
139144
return@customClickable
140145
}
@@ -230,7 +235,9 @@ fun VideoPickerScreen(
230235
negativeButtonLabel = "닫기",
231236
positiveButtonLabel = "지금 설정",
232237
onDismissRequest = hideShouldShowRationaleDialog,
233-
onPositiveButtonClick = {},
238+
onPositiveButtonClick = {
239+
openAppSettings(context)
240+
},
234241
)
235242
}
236243
}
@@ -244,3 +251,10 @@ fun VideoPickerScreenPreview() {
244251
VideoPickerScreen(navigateSelectedVideo = { /*TODO*/ })
245252
}
246253
}
254+
255+
fun openAppSettings(context: Context) {
256+
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
257+
data = Uri.fromParts("package", context.packageName, null)
258+
}
259+
context.startActivity(intent)
260+
}

0 commit comments

Comments
 (0)