From 53a31ec60ed2af6c93c83b013631b77697ec2718 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 20 Nov 2023 11:51:40 +0000 Subject: [PATCH] core: add remote host ID to entities --- .../chat/simplex/common/views/call/CallView.android.kt | 2 ++ .../kotlin/chat/simplex/common/model/ChatModel.kt | 8 +++++--- .../simplex/common/views/call/IncomingCallAlertView.kt | 1 + .../kotlin/chat/simplex/common/views/call/WebRTC.kt | 4 ++-- .../kotlin/chat/simplex/common/views/chat/ChatInfoView.kt | 1 + .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 2 ++ .../simplex/common/views/chat/group/GroupChatInfoView.kt | 1 + .../simplex/common/views/chatlist/ChatListNavLinkView.kt | 2 ++ 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt index c173463d5e..51c3623250 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt @@ -579,6 +579,7 @@ fun PreviewActiveCallOverlayVideo() { SimpleXTheme { ActiveCallOverlayLayout( call = Call( + remoteHostId = null, contact = Contact.sampleData, callState = CallState.Negotiated, localMedia = CallMediaType.Video, @@ -604,6 +605,7 @@ fun PreviewActiveCallOverlayAudio() { SimpleXTheme { ActiveCallOverlayLayout( call = Call( + remoteHostId = null, contact = Contact.sampleData, callState = CallState.Negotiated, localMedia = CallMediaType.Audio, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index ab8b6af3fd..179a4e846a 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -616,7 +616,7 @@ enum class ChatType(val type: String) { @Serializable data class User( - val remoteHostId: Long? = null, + val remoteHostId: Long?, override val userId: Long, val userContactId: Long, val localDisplayName: String, @@ -639,6 +639,7 @@ data class User( companion object { val sampleData = User( + remoteHostId = null, userId = 1, userContactId = 1, localDisplayName = "alice", @@ -715,8 +716,8 @@ interface SomeChat { } @Serializable @Stable -data class Chat ( - val remoteHostId: Long? = null, +data class Chat( + val remoteHostId: Long?, val chatInfo: ChatInfo, val chatItems: List, val chatStats: ChatStats = ChatStats() @@ -749,6 +750,7 @@ data class Chat ( companion object { val sampleData = Chat( + remoteHostId = null, chatInfo = ChatInfo.Direct.sampleData, chatItems = arrayListOf(ChatItem.getSampleData()) ) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/IncomingCallAlertView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/IncomingCallAlertView.kt index 447236286f..47dd0a27d1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/IncomingCallAlertView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/IncomingCallAlertView.kt @@ -106,6 +106,7 @@ fun PreviewIncomingCallAlertLayout() { SimpleXTheme { IncomingCallAlertLayout( invitation = RcvCallInvitation( + remoteHostId = null, user = User.sampleData, contact = Contact.sampleData, callType = CallType(media = CallMediaType.Audio, capabilities = CallCapabilities(encryption = false)), diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/WebRTC.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/WebRTC.kt index 64904ba7a2..6a357d26ff 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/WebRTC.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/call/WebRTC.kt @@ -11,7 +11,7 @@ import java.util.* import kotlin.collections.ArrayList data class Call( - val remoteHostId: Long? = null, + val remoteHostId: Long?, val contact: Contact, val callState: CallState, val localMedia: CallMediaType, @@ -97,7 +97,7 @@ sealed class WCallResponse { @Serializable data class WebRTCExtraInfo(val rtcIceCandidates: String) @Serializable data class CallType(val media: CallMediaType, val capabilities: CallCapabilities) @Serializable data class RcvCallInvitation( - val remoteHostId: Long? = null, + val remoteHostId: Long?, val user: User, val contact: Contact, val callType: CallType, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt index 5816c89524..694ec2ba18 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt @@ -718,6 +718,7 @@ fun PreviewChatInfoLayout() { SimpleXTheme { ChatInfoLayout( chat = Chat( + remoteHostId = null, chatInfo = ChatInfo.Direct.sampleData, chatItems = arrayListOf() ), diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 862212217f..5975f674e3 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -1418,6 +1418,7 @@ fun PreviewChatLayout() { val searchValue = remember { mutableStateOf("") } ChatLayout( chat = Chat( + remoteHostId = null, chatInfo = ChatInfo.Direct.sampleData, chatItems = chatItems, chatStats = Chat.ChatStats() @@ -1490,6 +1491,7 @@ fun PreviewGroupChatLayout() { val searchValue = remember { mutableStateOf("") } ChatLayout( chat = Chat( + remoteHostId = null, chatInfo = ChatInfo.Group.sampleData, chatItems = chatItems, chatStats = Chat.ChatStats() diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt index 49d76d8ecd..d3b1841fe0 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt @@ -524,6 +524,7 @@ fun PreviewGroupChatInfoLayout() { SimpleXTheme { GroupChatInfoLayout( chat = Chat( + remoteHostId = null, chatInfo = ChatInfo.Direct.sampleData, chatItems = arrayListOf() ), diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt index 7e81faf3d5..e121f9ee78 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt @@ -772,6 +772,7 @@ fun PreviewChatListNavLinkDirect() { chatLinkPreview = { ChatPreviewView( chat = Chat( + remoteHostId = null, chatInfo = ChatInfo.Direct.sampleData, chatItems = listOf( ChatItem.getSampleData( @@ -815,6 +816,7 @@ fun PreviewChatListNavLinkGroup() { chatLinkPreview = { ChatPreviewView( Chat( + remoteHostId = null, chatInfo = ChatInfo.Group.sampleData, chatItems = listOf( ChatItem.getSampleData(