mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 10:45:20 +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)
|
var tracker = EOSETracker(pendingRelays: Set(urls), callback: onEOSE, timer: nil)
|
||||||
// Fallback timeout to avoid hanging if a relay never sends EOSE
|
// Fallback timeout to avoid hanging if a relay never sends EOSE
|
||||||
tracker.timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false) { [weak self] _ in
|
tracker.timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false) { [weak self] _ in
|
||||||
guard let self = self else { return }
|
Task { @MainActor in
|
||||||
if let t = self.eoseTrackers[id] {
|
guard let self = self else { return }
|
||||||
t.timer?.invalidate()
|
if let t = self.eoseTrackers[id] {
|
||||||
self.eoseTrackers.removeValue(forKey: id)
|
t.timer?.invalidate()
|
||||||
onEOSE()
|
self.eoseTrackers.removeValue(forKey: id)
|
||||||
|
onEOSE()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eoseTrackers[id] = tracker
|
eoseTrackers[id] = tracker
|
||||||
|
|||||||
@@ -1183,7 +1183,7 @@ struct ContentView: View {
|
|||||||
notesGeohash = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash
|
notesGeohash = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash
|
||||||
showLocationNotes = true
|
showLocationNotes = true
|
||||||
}) {
|
}) {
|
||||||
HStack(spacing: 4) {
|
HStack(alignment: .center, spacing: 4) {
|
||||||
Image(systemName: "long.text.page.and.pencil")
|
Image(systemName: "long.text.page.and.pencil")
|
||||||
.font(.system(size: 12))
|
.font(.system(size: 12))
|
||||||
.foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82))
|
.foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82))
|
||||||
@@ -1191,8 +1191,11 @@ struct ContentView: View {
|
|||||||
Text("\(c)")
|
Text("\(c)")
|
||||||
.font(.system(size: 11, design: .monospaced))
|
.font(.system(size: 11, design: .monospaced))
|
||||||
.foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82))
|
.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)
|
.buttonStyle(.plain)
|
||||||
.accessibilityLabel("Location notes for this place")
|
.accessibilityLabel("Location notes for this place")
|
||||||
|
|||||||
Reference in New Issue
Block a user