This commit is contained in:
Christoph Hagen 2023-08-09 16:27:15 +02:00
parent 32b4c8c81a
commit f451715a11

View File

@ -1,5 +1,6 @@
import Foundation
import SwiftUI
import SFSafeSymbols
enum ConnectionError {
case serverNotReached
@ -97,7 +98,8 @@ enum ClientState {
self = .openSesame
case .messageDeviceInvalid:
self = .messageRejected(.invalidDeviceId)
case .noBodyData, .invalidMessageData, .textReceived, .unexpectedSocketEvent:
case .noBodyData, .invalidMessageSize, .textReceived, .unexpectedSocketEvent, .invalidUrlParameter, .invalidResponseAuthentication:
print("Unexpected internal error: \(keyResult)")
self = .internalError(keyResult.description)
case .deviceNotConnected:
self = .deviceNotAvailable(.deviceDisconnected)
@ -242,7 +244,7 @@ extension ClientState {
}
case .openSesame:
return 17
case .internalError(_):
case .internalError:
return 18
}
}
@ -294,3 +296,26 @@ extension ClientState {
}
}
}
extension ClientState {
@available(iOS 16, *)
var symbol: SFSymbol {
switch self {
case .deviceNotAvailable:
return .wifiExclamationmark
case .internalError:
return .applewatchSlash
case .noKeyAvailable:
return .lockTrianglebadgeExclamationmark
case .openSesame:
return .lockOpen
case .messageRejected:
return .nosign
case .responseRejected:
return .exclamationmarkTriangle
case .requestingStatus, .ready, .waitingForResponse:
return .wifiExclamationmark
}
}
}