mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-05 05:22:38 +08:00
[fix] hide privacy controls on locked desktops across clients
This commit is contained in:
@@ -12,6 +12,7 @@ struct RemotePrivacyStatus: Decodable {
|
||||
}
|
||||
|
||||
struct RemotePrivacyScreen {
|
||||
private(set) var desktopAvailable = true
|
||||
private(set) var snapshot: RemotePrivacyStatus?
|
||||
private(set) var pending = false
|
||||
private(set) var requestID: UInt32 = 0
|
||||
@@ -20,6 +21,10 @@ struct RemotePrivacyScreen {
|
||||
private var requestedAt: TimeInterval = 0
|
||||
private var failure = ""
|
||||
|
||||
mutating func setInteractiveStage(_ stage: String) {
|
||||
desktopAvailable = !["lock-screen", "credential-ui", "secure-desktop"].contains(stage)
|
||||
}
|
||||
|
||||
var active: Bool {
|
||||
guard let s = snapshot else { return false }
|
||||
return s.overlayActive || s.remotePaused || [2, 3, 4].contains(s.state)
|
||||
@@ -37,6 +42,7 @@ struct RemotePrivacyScreen {
|
||||
return "隐私屏"
|
||||
}
|
||||
func feedback(at now: TimeInterval) -> String {
|
||||
if !desktopAvailable { return "" }
|
||||
if failure.isEmpty && (pending || fresh(at: now) && [2, 4].contains(snapshot?.state ?? -1)) {
|
||||
return ""
|
||||
}
|
||||
@@ -47,7 +53,7 @@ struct RemotePrivacyScreen {
|
||||
}
|
||||
func canToggle(at now: TimeInterval) -> Bool {
|
||||
guard let s = snapshot else { return false }
|
||||
return !pending && fresh(at: now) && s.state != 4 && (active || s.supported && s.state == 1)
|
||||
return desktopAvailable && !pending && fresh(at: now) && s.state != 4 && (active || s.supported && s.state == 1)
|
||||
}
|
||||
mutating func receive(_ data: Data, at now: TimeInterval) {
|
||||
struct Envelope: Decodable { let type: Int; let privacyStatus: RemotePrivacyStatus }
|
||||
|
||||
Reference in New Issue
Block a user