multiplatform: ChatView enhancements (#2945)

* multiplatform: ChatView enhancements

* removed unused code

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Stanislav Dmitrenko 2023-08-17 17:26:11 +03:00 committed by GitHub
parent 63ca7a34ff
commit ea397049f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -14,7 +14,7 @@ interface RecorderInterface {
fun stop(): Int
}
expect class RecorderNative: RecorderInterface
expect class RecorderNative(): RecorderInterface
interface AudioPlayerInterface {
fun play(

View File

@ -105,7 +105,7 @@ fun ChatView(chatId: String, chatModel: ChatModel, onComposed: () -> Unit) {
// Having activeChat reloaded on every change in it is inefficient (UI lags)
val unreadCount = remember {
derivedStateOf {
chatModel.chats.firstOrNull { chat -> chat.chatInfo.id == chatId }?.chatStats?.unreadCount ?: 0
chatModel.chats.firstOrNull { chat -> chat.chatInfo.id == chatModel.chatId.value }?.chatStats?.unreadCount ?: 0
}
}
val clipboard = LocalClipboardManager.current
@ -974,7 +974,8 @@ fun BoxWithConstraintsScope.FloatingButtons(
onLongClick = { showDropDown.value = true }
)
DefaultDropdownMenu(showDropDown, offset = DpOffset(maxWidth - DEFAULT_PADDING, 24.dp + fabSize)) {
Box {
DefaultDropdownMenu(showDropDown, offset = DpOffset(this@FloatingButtons.maxWidth - DEFAULT_PADDING, 24.dp + fabSize)) {
ItemAction(
generalGetString(MR.strings.mark_read),
painterResource(MR.images.ic_check),
@ -987,6 +988,7 @@ fun BoxWithConstraintsScope.FloatingButtons(
})
}
}
}
@Composable
fun PreloadItems(

View File

@ -104,7 +104,7 @@ fun ChatListNavLinkView(chat: Chat, chatModel: ChatModel) {
fun directChatAction(chatInfo: ChatInfo, chatModel: ChatModel) {
if (chatInfo.ready) {
withApi { openChat(chatInfo, chatModel) }
withBGApi { openChat(chatInfo, chatModel) }
} else {
pendingContactAlertDialog(chatInfo, chatModel)
}
@ -114,7 +114,7 @@ fun groupChatAction(groupInfo: GroupInfo, chatModel: ChatModel) {
when (groupInfo.membership.memberStatus) {
GroupMemberStatus.MemInvited -> acceptGroupInvitationAlertDialog(groupInfo, chatModel)
GroupMemberStatus.MemAccepted -> groupInvitationAcceptedAlert()
else -> withApi { openChat(ChatInfo.Group(groupInfo), chatModel) }
else -> withBGApi { openChat(ChatInfo.Group(groupInfo), chatModel) }
}
}