|
@@ -6,6 +6,7 @@ import android.net.Uri
|
|
|
import android.os.Bundle
|
|
|
import android.os.Parcelable
|
|
|
import android.provider.OpenableColumns
|
|
|
+import android.util.Log
|
|
|
import android.widget.Toast
|
|
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
|
|
import androidx.activity.result.contract.ActivityResultContracts
|
|
@@ -37,6 +38,7 @@ import androidx.compose.runtime.getValue
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
import androidx.compose.runtime.remember
|
|
|
import androidx.compose.runtime.rememberCoroutineScope
|
|
|
+import androidx.compose.runtime.saveable.rememberSaveable
|
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
@@ -79,7 +81,9 @@ fun Attachments(modifier: Modifier, onAttachment: (List<Uri>) -> Unit) {
|
|
|
mutableStateOf(false)
|
|
|
}
|
|
|
val context = LocalContext.current
|
|
|
- var tempUri = Uri.EMPTY
|
|
|
+ var tempUri by rememberSaveable {
|
|
|
+ mutableStateOf(Uri.EMPTY)
|
|
|
+ }
|
|
|
val coroutine = rememberCoroutineScope()
|
|
|
IconButton(onClick = {
|
|
|
if (isDismiss) {
|
|
@@ -127,6 +131,7 @@ fun Attachments(modifier: Modifier, onAttachment: (List<Uri>) -> Unit) {
|
|
|
}
|
|
|
val launcherCamera =
|
|
|
rememberLauncherForActivityResult(ActivityResultContracts.TakePicture()) {
|
|
|
+ Log.d("SAPI", "TakePicture:$it")
|
|
|
if (it) {
|
|
|
onAttachment(listOf(tempUri))
|
|
|
}
|