mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 05:05:19 +00:00
Fix Swift 6 isolation: hop to @MainActor inside Timer callback for EOSE tracker mutations
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user