1
1
package com.record.upload
2
2
3
3
import android.Manifest
4
+ import android.content.Context
5
+ import android.content.Intent
6
+ import android.net.Uri
4
7
import android.os.Build
8
+ import android.provider.Settings
5
9
import android.util.Log
6
10
import androidx.activity.compose.rememberLauncherForActivityResult
7
11
import androidx.activity.result.contract.ActivityResultContracts
@@ -28,6 +32,7 @@ import androidx.compose.runtime.rememberCoroutineScope
28
32
import androidx.compose.runtime.setValue
29
33
import androidx.compose.ui.Alignment
30
34
import androidx.compose.ui.Modifier
35
+ import androidx.compose.ui.platform.LocalContext
31
36
import androidx.compose.ui.res.painterResource
32
37
import androidx.compose.ui.text.style.TextAlign
33
38
import androidx.compose.ui.tooling.preview.Preview
@@ -84,6 +89,7 @@ fun VideoPickerScreen(
84
89
showShouldShowRationaleDialog : () -> Unit = {},
85
90
hideShouldShowRationaleDialog : () -> Unit = {},
86
91
) {
92
+ val context = LocalContext .current
87
93
val cameraPermissionState = rememberPermissionState(Manifest .permission.READ_MEDIA_VIDEO )
88
94
89
95
val requestPermissionLauncher = rememberLauncherForActivityResult(
@@ -134,7 +140,6 @@ fun VideoPickerScreen(
134
140
return @customClickable
135
141
}
136
142
if (cameraPermissionState.status.shouldShowRationale) {
137
- Log .d(" shouldShowRationale" , " ${cameraPermissionState.status.shouldShowRationale} " )
138
143
showShouldShowRationaleDialog()
139
144
return @customClickable
140
145
}
@@ -230,7 +235,9 @@ fun VideoPickerScreen(
230
235
negativeButtonLabel = " 닫기" ,
231
236
positiveButtonLabel = " 지금 설정" ,
232
237
onDismissRequest = hideShouldShowRationaleDialog,
233
- onPositiveButtonClick = {},
238
+ onPositiveButtonClick = {
239
+ openAppSettings(context)
240
+ },
234
241
)
235
242
}
236
243
}
@@ -244,3 +251,10 @@ fun VideoPickerScreenPreview() {
244
251
VideoPickerScreen (navigateSelectedVideo = { /* TODO*/ })
245
252
}
246
253
}
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