diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index c0ff697a1d..c599b720ae 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -1717,6 +1717,7 @@ public enum ChatErrorType: Decodable { case fallbackToSMPProhibited(fileId: Int64) case inlineFileProhibited(fileId: Int64) case invalidQuote + case invalidForward case invalidChatItemUpdate case invalidChatItemDelete case hasCurrentCall diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index ed62b5c9ac..7d8ae53ce0 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -2546,6 +2546,7 @@ public struct CIMeta: Decodable { public var itemStatus: CIStatus public var createdAt: Date public var updatedAt: Date + public var itemForwarded: CIForwardedFrom? public var itemDeleted: CIDeleted? public var itemEdited: Bool public var itemTimed: CITimed? @@ -2713,6 +2714,17 @@ public enum CIDeleted: Decodable { } } +public enum MsgDirection: Decodable { + case rcv + case snd +} + +public enum CIForwardedFrom: Decodable { + case unknown + case contact(chatName: String, msgDir: MsgDirection, contactId: Int64?, chatItemId: Int64?) + case group(chatName: String, msgDir: MsgDirection, groupId: Int64?, chatItemId: Int64?) +} + public enum CIDeleteMode: String, Decodable { case cidmBroadcast = "broadcast" case cidmInternal = "internal" @@ -3751,6 +3763,7 @@ public enum ChatItemTTL: Hashable, Identifiable, Comparable { public struct ChatItemInfo: Decodable { public var itemVersions: [ChatItemVersion] public var memberDeliveryStatuses: [MemberDeliveryStatus]? + public var forwardedFromChatItem: AChatItem? } public struct ChatItemVersion: Decodable { 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 0e15079ac5..9636199a14 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 @@ -1884,6 +1884,7 @@ data class ChatItem ( status: CIStatus = CIStatus.SndNew(), quotedItem: CIQuote? = null, file: CIFile? = null, + itemForwarded: CIForwardedFrom? = null, itemDeleted: CIDeleted? = null, itemEdited: Boolean = false, itemTimed: CITimed? = null, @@ -2258,6 +2259,19 @@ sealed class CIDeleted { @Serializable @SerialName("moderated") class Moderated(val deletedTs: Instant?, val byGroupMember: GroupMember): CIDeleted() } +@Serializable +enum class MsgDirection { + @SerialName("rcv") Rcv, + @SerialName("snd") Snd; +} + +@Serializable +sealed class CIForwardedFrom { + @Serializable @SerialName("unknown") object Unknown: CIForwardedFrom() + @Serializable @SerialName("contact") class Contact(val chatName: String, val msgDir: MsgDirection, val contactId: Long? = null, val chatItemId: Long? = null): CIForwardedFrom() + @Serializable @SerialName("group") class Group(val chatName: String, val msgDir: MsgDirection, val groupId: Long? = null, val chatItemId: Long? = null): CIForwardedFrom() +} + @Serializable enum class CIDeleteMode(val deleteMode: String) { @SerialName("internal") cidmInternal("internal"), @@ -3252,7 +3266,8 @@ sealed class ChatItemTTL: Comparable { @Serializable class ChatItemInfo( val itemVersions: List, - val memberDeliveryStatuses: List? + val memberDeliveryStatuses: List?, + val forwardedFromChatItem: AChatItem? ) @Serializable diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index 484990bfc0..b70c970623 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -4772,6 +4772,7 @@ sealed class ChatErrorType { is FallbackToSMPProhibited -> "fallbackToSMPProhibited" is InlineFileProhibited -> "inlineFileProhibited" is InvalidQuote -> "invalidQuote" + is InvalidForward -> "invalidForward" is InvalidChatItemUpdate -> "invalidChatItemUpdate" is InvalidChatItemDelete -> "invalidChatItemDelete" is HasCurrentCall -> "hasCurrentCall" @@ -4850,6 +4851,7 @@ sealed class ChatErrorType { @Serializable @SerialName("fallbackToSMPProhibited") class FallbackToSMPProhibited(val fileId: Long): ChatErrorType() @Serializable @SerialName("inlineFileProhibited") class InlineFileProhibited(val fileId: Long): ChatErrorType() @Serializable @SerialName("invalidQuote") object InvalidQuote: ChatErrorType() + @Serializable @SerialName("invalidForward") object InvalidForward: ChatErrorType() @Serializable @SerialName("invalidChatItemUpdate") object InvalidChatItemUpdate: ChatErrorType() @Serializable @SerialName("invalidChatItemDelete") object InvalidChatItemDelete: ChatErrorType() @Serializable @SerialName("hasCurrentCall") object HasCurrentCall: ChatErrorType()