From 2bc875dee5b2d33a4ab5651733e50cbc6c7655ee Mon Sep 17 00:00:00 2001 From: islam <2553451+qalandarov@users.noreply.github.com> Date: Tue, 16 Sep 2025 23:08:34 +0100 Subject: [PATCH] `updateChannelActivityTimeThenSend` function --- bitchat/ViewModels/ChatViewModel.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bitchat/ViewModels/ChatViewModel.swift b/bitchat/ViewModels/ChatViewModel.swift index 2975765b..0aff1630 100644 --- a/bitchat/ViewModels/ChatViewModel.swift +++ b/bitchat/ViewModels/ChatViewModel.swift @@ -1464,22 +1464,21 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { // Force immediate UI update for user's own messages objectWillChange.send() - // Update channel activity time on send + updateChannelActivityTimeThenSend(content: content, trimmed: trimmed, mentions: mentions) + } + + private func updateChannelActivityTimeThenSend(content: String, trimmed: String, mentions: [String]) { switch activeChannel { case .mesh: lastPublicActivityAt["mesh"] = Date() + // Send via mesh with mentions + meshService.sendMessage(content, mentions: mentions) case .location(let ch): lastPublicActivityAt["geo:\(ch.geohash)"] = Date() - } - - if case .location(let ch) = activeChannel { // Send to geohash channel via Nostr ephemeral Task { @MainActor in sendGeohash(ch: ch, content: trimmed) } - } else { - // Send via mesh with mentions - meshService.sendMessage(content, mentions: mentions) } }