diff --git a/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift b/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift index cb49eced17..1d47227094 100644 --- a/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift +++ b/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift @@ -665,17 +665,21 @@ struct ComposeView: View { if let oldMsgContent = ei.content.msgContent { do { let mc = updateMsgContent(oldMsgContent) - let chatItem = try await apiUpdateChatItem( - type: chat.chatInfo.chatType, - id: chat.chatInfo.apiId, - itemId: ei.id, - msg: mc, - live: live - ) - await MainActor.run { - _ = self.chatModel.upsertChatItem(self.chat.chatInfo, chatItem) + if mc != oldMsgContent || (ei.meta.itemLive ?? false) { + let chatItem = try await apiUpdateChatItem( + type: chat.chatInfo.chatType, + id: chat.chatInfo.apiId, + itemId: ei.id, + msg: mc, + live: live + ) + await MainActor.run { + _ = self.chatModel.upsertChatItem(self.chat.chatInfo, chatItem) + } + return chatItem + } else { + return nil } - return chatItem } catch { logger.error("ChatView.sendMessage error: \(error.localizedDescription)") AlertManager.shared.showAlertMsg(title: "Error updating message", message: "Error: \(responseError(error))") diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index 664c8277ba..378a032afe 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -2724,7 +2724,7 @@ public enum CIFileStatus: Decodable, Equatable { } } -public enum MsgContent { +public enum MsgContent: Equatable { case text(String) case link(text: String, preview: LinkPreview) case image(text: String, image: String) @@ -2785,6 +2785,19 @@ public enum MsgContent { case image case duration } + + public static func == (lhs: MsgContent, rhs: MsgContent) -> Bool { + switch (lhs, rhs) { + case let (.text(lt), .text(rt)): return lt == rt + case let (.link(lt, lp), .link(rt, rp)): return lt == rt && lp == rp + case let (.image(lt, li), .image(rt, ri)): return lt == rt && li == ri + case let (.video(lt, li, ld), .video(rt, ri, rd)): return lt == rt && li == ri && ld == rd + case let (.voice(lt, ld), .voice(rt, rd)): return lt == rt && ld == rd + case let (.file(lf), .file(rf)): return lf == rf + case let (.unknown(lType, lt), .unknown(rType, rt)): return lType == rType && lt == rt + default: return false + } + } } extension MsgContent: Decodable { diff --git a/cabal.project b/cabal.project index 9ad4819741..eb9efbb483 100644 --- a/cabal.project +++ b/cabal.project @@ -7,7 +7,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: 58cb2855d23ac970a619a61d088ed2a08dfb3d81 + tag: de95119ca600965ed29a7c0cf18867ccc576ec2c source-repository-package type: git diff --git a/package.yaml b/package.yaml index d3b6c93a79..329b91a470 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: simplex-chat -version: 5.2.0.1 +version: 5.2.0.2 #synopsis: #description: homepage: https://github.com/simplex-chat/simplex-chat#readme diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index 30382689b8..ecbc3095ed 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."58cb2855d23ac970a619a61d088ed2a08dfb3d81" = "053id418z9l0qciignvrl88kip6gmnfa36r7sl0avarqpach0fn1"; + "https://github.com/simplex-chat/simplexmq.git"."de95119ca600965ed29a7c0cf18867ccc576ec2c" = "122wma1yb6p1x56x2cajxk02bw35cl4395y5lxk7x6kh2nd3x166"; "https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38"; "https://github.com/kazu-yamamoto/http2.git"."b5a1b7200cf5bc7044af34ba325284271f6dff25" = "0dqb50j57an64nf4qcf5vcz4xkd1vzvghvf8bk529c1k30r9nfzb"; "https://github.com/simplex-chat/direct-sqlcipher.git"."34309410eb2069b029b8fc1872deb1e0db123294" = "0kwkmhyfsn2lixdlgl15smgr1h5gjk7fky6abzh8rng2h5ymnffd"; diff --git a/simplex-chat.cabal b/simplex-chat.cabal index 8d4bd437de..bd5c6822d2 100644 --- a/simplex-chat.cabal +++ b/simplex-chat.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: simplex-chat -version: 5.2.0.1 +version: 5.2.0.2 category: Web, System, Services, Cryptography homepage: https://github.com/simplex-chat/simplex-chat#readme author: simplex.chat diff --git a/stack.yaml b/stack.yaml index 21030e109e..17997dfd76 100644 --- a/stack.yaml +++ b/stack.yaml @@ -49,7 +49,7 @@ extra-deps: # - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561 # - ../simplexmq - github: simplex-chat/simplexmq - commit: 58cb2855d23ac970a619a61d088ed2a08dfb3d81 + commit: de95119ca600965ed29a7c0cf18867ccc576ec2c - github: kazu-yamamoto/http2 commit: b5a1b7200cf5bc7044af34ba325284271f6dff25 # - ../direct-sqlcipher diff --git a/tests/ChatClient.hs b/tests/ChatClient.hs index b0c3a3b499..85ef243191 100644 --- a/tests/ChatClient.hs +++ b/tests/ChatClient.hs @@ -302,7 +302,7 @@ serverCfg = ServerConfig { transports = [(serverPort, transport @TLS)], tbqSize = 1, - serverTbqSize = 1, + -- serverTbqSize = 1, msgQueueQuota = 16, queueIdBytes = 12, msgIdBytes = 6, @@ -321,7 +321,8 @@ serverCfg = serverStatsLogFile = "tests/smp-server-stats.daily.log", serverStatsBackupFile = Nothing, smpServerVRange = supportedSMPServerVRange, - transportConfig = defaultTransportServerConfig + transportConfig = defaultTransportServerConfig, + controlPort = Nothing } withSmpServer :: IO () -> IO ()