fix(macos): allow identity refresh off main actor
parent
2ca7c2629c
commit
44ffe41775
|
|
@ -277,14 +277,14 @@ final class GatewayDiscoveryModel {
|
||||||
resolver.start()
|
resolver.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func prettifyInstanceName(_ decodedName: String) -> String {
|
private nonisolated static func prettifyInstanceName(_ decodedName: String) -> String {
|
||||||
let normalized = decodedName.split(whereSeparator: \.isWhitespace).joined(separator: " ")
|
let normalized = decodedName.split(whereSeparator: \.isWhitespace).joined(separator: " ")
|
||||||
let stripped = normalized.replacingOccurrences(of: " (Clawdis)", with: "")
|
let stripped = normalized.replacingOccurrences(of: " (Clawdis)", with: "")
|
||||||
.replacingOccurrences(of: #"\s+\(\d+\)$"#, with: "", options: .regularExpression)
|
.replacingOccurrences(of: #"\s+\(\d+\)$"#, with: "", options: .regularExpression)
|
||||||
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
|
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func prettifyServiceName(_ decodedName: String) -> String {
|
private nonisolated static func prettifyServiceName(_ decodedName: String) -> String {
|
||||||
let normalized = Self.prettifyInstanceName(decodedName)
|
let normalized = Self.prettifyInstanceName(decodedName)
|
||||||
var cleaned = normalized.replacingOccurrences(of: #"\s*-?bridge$"#, with: "", options: .regularExpression)
|
var cleaned = normalized.replacingOccurrences(of: #"\s*-?bridge$"#, with: "", options: .regularExpression)
|
||||||
cleaned = cleaned
|
cleaned = cleaned
|
||||||
|
|
@ -350,7 +350,7 @@ final class GatewayDiscoveryModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func mergeLocalIdentity(
|
private nonisolated static func mergeLocalIdentity(
|
||||||
fast: LocalIdentity,
|
fast: LocalIdentity,
|
||||||
slow: LocalIdentity) -> LocalIdentity
|
slow: LocalIdentity) -> LocalIdentity
|
||||||
{
|
{
|
||||||
|
|
@ -359,7 +359,7 @@ final class GatewayDiscoveryModel {
|
||||||
displayTokens: fast.displayTokens.union(slow.displayTokens))
|
displayTokens: fast.displayTokens.union(slow.displayTokens))
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func buildLocalIdentityFast() -> LocalIdentity {
|
private nonisolated static func buildLocalIdentityFast() -> LocalIdentity {
|
||||||
var hostTokens: Set<String> = []
|
var hostTokens: Set<String> = []
|
||||||
var displayTokens: Set<String> = []
|
var displayTokens: Set<String> = []
|
||||||
|
|
||||||
|
|
@ -375,7 +375,7 @@ final class GatewayDiscoveryModel {
|
||||||
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func buildLocalIdentitySlow() -> LocalIdentity {
|
private nonisolated static func buildLocalIdentitySlow() -> LocalIdentity {
|
||||||
var hostTokens: Set<String> = []
|
var hostTokens: Set<String> = []
|
||||||
var displayTokens: Set<String> = []
|
var displayTokens: Set<String> = []
|
||||||
|
|
||||||
|
|
@ -392,7 +392,7 @@ final class GatewayDiscoveryModel {
|
||||||
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func normalizeHostToken(_ raw: String?) -> String? {
|
private nonisolated static func normalizeHostToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
if trimmed.isEmpty { return nil }
|
if trimmed.isEmpty { return nil }
|
||||||
|
|
@ -408,7 +408,7 @@ final class GatewayDiscoveryModel {
|
||||||
return token.isEmpty ? nil : token
|
return token.isEmpty ? nil : token
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func normalizeDisplayToken(_ raw: String?) -> String? {
|
private nonisolated static func normalizeDisplayToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let prettified = Self.prettifyInstanceName(raw)
|
let prettified = Self.prettifyInstanceName(raw)
|
||||||
let trimmed = prettified.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = prettified.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
|
@ -416,7 +416,7 @@ final class GatewayDiscoveryModel {
|
||||||
return trimmed.lowercased()
|
return trimmed.lowercased()
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated private static func normalizeServiceToken(_ raw: String?) -> String? {
|
private nonisolated static func normalizeServiceToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
if trimmed.isEmpty { return nil }
|
if trimmed.isEmpty { return nil }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue