|
@@ -11,20 +11,12 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
|
|
import androidx.activity.result.contract.ActivityResultContracts
|
|
|
import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.clickable
|
|
|
-import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
-import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
|
-import androidx.compose.foundation.layout.PaddingValues
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
-import androidx.compose.foundation.layout.consumeWindowInsets
|
|
|
-import androidx.compose.foundation.layout.fillMaxSize
|
|
|
-import androidx.compose.foundation.layout.imeNestedScroll
|
|
|
-import androidx.compose.foundation.layout.imePadding
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
-import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.filled.Add
|
|
@@ -49,27 +41,20 @@ import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
import androidx.compose.ui.graphics.graphicsLayer
|
|
|
-import androidx.compose.ui.layout.ContentScale
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
-import androidx.compose.ui.res.painterResource
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.window.Popup
|
|
|
import androidx.core.content.FileProvider
|
|
|
import androidx.core.net.toUri
|
|
|
-import androidx.navigation.NavHostController
|
|
|
import androidx.navigation.NavType
|
|
|
-import coil.compose.AsyncImage
|
|
|
-import coil.request.ImageRequest
|
|
|
import io.nexilis.alpha.BuildConfig
|
|
|
-import io.nexilis.alpha.R
|
|
|
import io.nexilis.service.core.BlueSky
|
|
|
import io.nexilis.service.core.DarkLimeGreen
|
|
|
import io.nexilis.service.core.Orange
|
|
|
import io.nexilis.service.core.Purple
|
|
|
import io.nexilis.service.core.createFile
|
|
|
import io.nexilis.service.core.getMimeType
|
|
|
-import io.nexilis.service.data.entities.Buddy
|
|
|
import kotlinx.parcelize.Parcelize
|
|
|
import kotlinx.serialization.KSerializer
|
|
|
import kotlinx.serialization.Serializable
|
|
@@ -367,65 +352,3 @@ fun AttachmentItemList.toArrayListUri() : ArrayList<Uri> {
|
|
|
return list
|
|
|
}
|
|
|
|
|
|
-@OptIn(ExperimentalLayoutApi::class)
|
|
|
-@Composable
|
|
|
-fun AttachmentCaption(
|
|
|
- navController: NavHostController,
|
|
|
- contentPadding: PaddingValues,
|
|
|
- pin: String,
|
|
|
- me: Buddy,
|
|
|
- attachments: AttachmentItemList
|
|
|
-) {
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .consumeWindowInsets(contentPadding)
|
|
|
- .imePadding()
|
|
|
- .imeNestedScroll()
|
|
|
- ) {
|
|
|
- LazyColumn(
|
|
|
- modifier = Modifier.weight(1.0f),
|
|
|
- reverseLayout = true,
|
|
|
- verticalArrangement = Arrangement.Top
|
|
|
- ) {
|
|
|
- attachments.list[0]?.let {
|
|
|
- item {
|
|
|
- if (it.mimeType.startsWith("image")) {
|
|
|
- AsyncImage(
|
|
|
- model = ImageRequest.Builder(LocalContext.current)
|
|
|
- .data(it.uri)
|
|
|
- .addHeader("Cookie", "PHPSESSID=123;MOBILE=123")
|
|
|
- .crossfade(true)
|
|
|
- .build(),
|
|
|
- placeholder = painterResource(R.drawable.ic_placeholder),
|
|
|
- contentDescription = "",
|
|
|
- contentScale = ContentScale.Fit,
|
|
|
- modifier = Modifier.fillMaxSize()
|
|
|
- )
|
|
|
- } else if (it.mimeType.startsWith("video")) {
|
|
|
-
|
|
|
- } else if (it.mimeType.startsWith("audio")) {
|
|
|
- Icon(
|
|
|
- imageVector = Icons.Default.Headset,
|
|
|
- contentDescription = null,
|
|
|
- modifier = Modifier.fillMaxSize(),
|
|
|
- tint = Color.Orange
|
|
|
- )
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- InputChat(
|
|
|
- navController = navController,
|
|
|
- pin = pin,
|
|
|
- me = me,
|
|
|
- placeHolderText = "Add a caption...",
|
|
|
- enableAttachment = false,
|
|
|
- enableEmpty = true,
|
|
|
- popAfterSent = true,
|
|
|
- attachments = attachments.toArrayListUri()
|
|
|
- )
|
|
|
- }
|
|
|
-}
|