From 5bf28e5ba45414f91d4cffcc1a500fe2f0c8e33a Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 13 Sep 2025 11:53:19 +0200 Subject: [PATCH] Fix Swift 6 isolation: hop to @MainActor inside Timer callback for EOSE tracker mutations --- bitchat/Nostr/NostrRelayManager.swift | 12 +++++++----- bitchat/Views/ContentView.swift | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bitchat/Nostr/NostrRelayManager.swift b/bitchat/Nostr/NostrRelayManager.swift index 2b8ec1f0..8830d684 100644 --- a/bitchat/Nostr/NostrRelayManager.swift +++ b/bitchat/Nostr/NostrRelayManager.swift @@ -264,11 +264,13 @@ final class NostrRelayManager: ObservableObject { var tracker = EOSETracker(pendingRelays: Set(urls), callback: onEOSE, timer: nil) // Fallback timeout to avoid hanging if a relay never sends EOSE tracker.timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false) { [weak self] _ in - guard let self = self else { return } - if let t = self.eoseTrackers[id] { - t.timer?.invalidate() - self.eoseTrackers.removeValue(forKey: id) - onEOSE() + Task { @MainActor in + guard let self = self else { return } + if let t = self.eoseTrackers[id] { + t.timer?.invalidate() + self.eoseTrackers.removeValue(forKey: id) + onEOSE() + } } } eoseTrackers[id] = tracker diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index bca748ad..0539a670 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1183,7 +1183,7 @@ struct ContentView: View { notesGeohash = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash showLocationNotes = true }) { - HStack(spacing: 4) { + HStack(alignment: .center, spacing: 4) { Image(systemName: "long.text.page.and.pencil") .font(.system(size: 12)) .foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82)) @@ -1191,8 +1191,11 @@ struct ContentView: View { Text("\(c)") .font(.system(size: 11, design: .monospaced)) .foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82)) + .lineLimit(1) + .fixedSize(horizontal: true, vertical: false) } } + .fixedSize(horizontal: true, vertical: false) } .buttonStyle(.plain) .accessibilityLabel("Location notes for this place")