fix(presence): stabilize instance identity
This commit is contained in:
22
apps/macos/Sources/Clawdis/InstanceIdentity.swift
Normal file
22
apps/macos/Sources/Clawdis/InstanceIdentity.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Foundation
|
||||
|
||||
enum InstanceIdentity {
|
||||
static let instanceId: String = {
|
||||
if let name = Host.current().localizedName?.trimmingCharacters(in: .whitespacesAndNewlines),
|
||||
!name.isEmpty
|
||||
{
|
||||
return name
|
||||
}
|
||||
return UUID().uuidString
|
||||
}()
|
||||
|
||||
static let displayName: String = {
|
||||
if let name = Host.current().localizedName?.trimmingCharacters(in: .whitespacesAndNewlines),
|
||||
!name.isEmpty
|
||||
{
|
||||
return name
|
||||
}
|
||||
return "clawdis-mac"
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user