mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 04:05:20 +00:00
fix(nostr): mark NostrInboxService @MainActor and use NostrEvent type; resolve Swift 6 actor isolation errors
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
@MainActor
|
||||||
final class NostrInboxService {
|
final class NostrInboxService {
|
||||||
private var processedIDs: Set<String> = []
|
private var processedIDs: Set<String> = []
|
||||||
private var order: [String] = []
|
private var order: [String] = []
|
||||||
@@ -47,7 +48,7 @@ final class NostrInboxService {
|
|||||||
limit: Int,
|
limit: Int,
|
||||||
relayCount: Int,
|
relayCount: Int,
|
||||||
subID: String? = nil,
|
subID: String? = nil,
|
||||||
handler: @escaping (NostrProtocol.Event) -> Void
|
handler: @escaping (NostrEvent) -> Void
|
||||||
) -> String {
|
) -> String {
|
||||||
let id = subID ?? "geo-\(geohash)"
|
let id = subID ?? "geo-\(geohash)"
|
||||||
let filter = NostrFilter.geohashEphemeral(
|
let filter = NostrFilter.geohashEphemeral(
|
||||||
@@ -71,7 +72,7 @@ final class NostrInboxService {
|
|||||||
pubkeyHex: String,
|
pubkeyHex: String,
|
||||||
lookbackSeconds: TimeInterval,
|
lookbackSeconds: TimeInterval,
|
||||||
subID: String? = nil,
|
subID: String? = nil,
|
||||||
handler: @escaping (NostrProtocol.Event) -> Void
|
handler: @escaping (NostrEvent) -> Void
|
||||||
) -> String {
|
) -> String {
|
||||||
let id = subID ?? "dm-\(pubkeyHex.prefix(8))"
|
let id = subID ?? "dm-\(pubkeyHex.prefix(8))"
|
||||||
let filter = NostrFilter.giftWrapsFor(pubkey: pubkeyHex, since: Date().addingTimeInterval(-lookbackSeconds))
|
let filter = NostrFilter.giftWrapsFor(pubkey: pubkeyHex, since: Date().addingTimeInterval(-lookbackSeconds))
|
||||||
@@ -87,4 +88,3 @@ final class NostrInboxService {
|
|||||||
NostrRelayManager.shared.unsubscribe(id: id)
|
NostrRelayManager.shared.unsubscribe(id: id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user