Add unlock complication, improve info display
This commit is contained in:
@ -111,7 +111,57 @@ enum ClientState {
|
||||
}
|
||||
|
||||
var actionText: String {
|
||||
"Unlock"
|
||||
switch self {
|
||||
case .noKeyAvailable:
|
||||
return "No key"
|
||||
case .requestingStatus:
|
||||
return "Checking..."
|
||||
case .deviceNotAvailable(let connectionError):
|
||||
switch connectionError {
|
||||
case .serverNotReached:
|
||||
return "Server not found"
|
||||
case .deviceDisconnected:
|
||||
return "Device disconnected"
|
||||
}
|
||||
case .ready:
|
||||
return "Unlock"
|
||||
case .waitingForResponse:
|
||||
return "Unlocking..."
|
||||
case .messageRejected(let rejectionCause):
|
||||
switch rejectionCause {
|
||||
case .invalidDeviceId:
|
||||
return "Invalid device ID"
|
||||
case .invalidCounter:
|
||||
return "Invalid counter"
|
||||
case .invalidTime:
|
||||
return "Invalid timestamp"
|
||||
case .invalidAuthentication:
|
||||
return "Invalid signature"
|
||||
case .timeout:
|
||||
return "Device not responding"
|
||||
case .missingKey:
|
||||
return "Device key missing"
|
||||
}
|
||||
case .responseRejected(let rejectionCause):
|
||||
switch rejectionCause {
|
||||
case .invalidDeviceId:
|
||||
return "Invalid device id (response)"
|
||||
case .invalidCounter:
|
||||
return "Invalid counter (response)"
|
||||
case .invalidTime:
|
||||
return "Invalid time (response)"
|
||||
case .invalidAuthentication:
|
||||
return "Invalid signature (response)"
|
||||
case .timeout:
|
||||
return "Timed out (response)"
|
||||
case .missingKey:
|
||||
return "Missing key (response)"
|
||||
}
|
||||
case .openSesame:
|
||||
return "Unlocked"
|
||||
case .internalError(let string):
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
var requiresDescription: Bool {
|
||||
@ -144,7 +194,7 @@ enum ClientState {
|
||||
|
||||
var allowsAction: Bool {
|
||||
switch self {
|
||||
case .noKeyAvailable:
|
||||
case .noKeyAvailable, .waitingForResponse:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
|
Reference in New Issue
Block a user