|
|
|
|
@ -27,6 +27,7 @@ import androidx.compose.material.icons.filled.Settings
|
|
|
|
|
import androidx.compose.material.icons.filled.MoreVert |
|
|
|
|
import androidx.compose.material3.* |
|
|
|
|
import androidx.compose.runtime.* |
|
|
|
|
import androidx.compose.runtime.saveable.rememberSaveable |
|
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
|
import androidx.compose.ui.geometry.Offset |
|
|
|
|
import androidx.compose.ui.graphics.drawscope.Stroke |
|
|
|
|
@ -51,6 +52,7 @@ import com.utun.chat.data.Message
|
|
|
|
|
import com.utun.chat.data.RadioAudioEngine |
|
|
|
|
import com.utun.chat.data.RadioOverlayService |
|
|
|
|
import com.utun.chat.ui.components.ConversationMessages |
|
|
|
|
import com.utun.chat.ui.components.CreatePollDialog |
|
|
|
|
import com.utun.chat.ui.components.ConversationComposer |
|
|
|
|
import com.utun.chat.ui.components.PortableRadioIcon |
|
|
|
|
import com.utun.chat.ui.components.GroupAvatar |
|
|
|
|
@ -92,6 +94,13 @@ fun ChatScreen(
|
|
|
|
|
|
|
|
|
|
/* звук сообщений канала */ |
|
|
|
|
val soundOn by viewModel.soundOn.collectAsState() |
|
|
|
|
val reactionCatalog by viewModel.reactionCatalog.collectAsState() |
|
|
|
|
val interactionFailed by viewModel.interactionFailed.collectAsState() |
|
|
|
|
var createPoll by rememberSaveable { mutableStateOf(false) } |
|
|
|
|
if (createPoll) CreatePollDialog({ createPoll = false }, viewModel::createPoll) |
|
|
|
|
if (interactionFailed) AlertDialog(onDismissRequest = viewModel::dismissInteractionError, |
|
|
|
|
text = { Text(stringResource(R.string.poll_interaction_failed)) }, |
|
|
|
|
confirmButton = { TextButton(onClick = viewModel::dismissInteractionError) { Text(stringResource(R.string.close)) } }) |
|
|
|
|
|
|
|
|
|
/* save dialog for downloaded files */ |
|
|
|
|
var pendingSaveFilePath by remember { mutableStateOf<String?>(null) } |
|
|
|
|
@ -143,6 +152,7 @@ fun ChatScreen(
|
|
|
|
|
Box { |
|
|
|
|
IconButton(onClick = { menu = true }) { Icon(Icons.Filled.MoreVert, stringResource(R.string.options)) } |
|
|
|
|
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) { |
|
|
|
|
DropdownMenuItem(text = { Text(stringResource(R.string.poll_create)) }, onClick = { menu = false; createPoll = true }) |
|
|
|
|
DropdownMenuItem(text = { Text(stringResource(R.string.invite)) }, |
|
|
|
|
leadingIcon = { Icon(Icons.Filled.Link, null) }, onClick = { menu = false; onInvite() }) |
|
|
|
|
DropdownMenuItem(text = { Text(stringResource(R.string.sound)) }, |
|
|
|
|
@ -185,7 +195,8 @@ fun ChatScreen(
|
|
|
|
|
onSeekVoice = { path, position, duration -> viewModel.seekVoice(path, position, duration) }, |
|
|
|
|
onDownloadFile = { viewModel.downloadAttachment(it) }, |
|
|
|
|
onOpenFile = { if (it.filePath.isNotEmpty()) { pendingSaveFilePath = it.filePath; saveFileLauncher.launch(it.text) } }, |
|
|
|
|
onOpenImage = onViewPhoto, onPlayVideo = onPlayVideo, onInviteLink = viewModel::openInviteLink |
|
|
|
|
onOpenImage = onViewPhoto, onPlayVideo = onPlayVideo, onInviteLink = viewModel::openInviteLink, |
|
|
|
|
reactionCatalog = reactionCatalog, onVote = viewModel::vote, onReact = viewModel::react, authorName = viewModel::radioName |
|
|
|
|
) |
|
|
|
|
if (radioActive && !overlayShown) { |
|
|
|
|
RadioPttButton( |
|
|
|
|
|