-
Notifications
You must be signed in to change notification settings - Fork 7
remove state and use reader status #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| extension ReaderStatus { | ||
| func toName() -> String { | ||
| return switch self { | ||
| case .connectingToDevice: | ||
| "CONNECTING_TO_DEVICE" | ||
| case .connectingToSquare: | ||
| "CONNECTING_TO_SQUARE" | ||
| case .readerUnavailable : | ||
| "READER_UNAVAILABLE" | ||
| case .faulty: | ||
| "FAULTY" | ||
| case .ready: | ||
| "READY" | ||
| default : | ||
| "UNKNOWN" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension ReaderUnavailableReason { | ||
| func toName() -> String { | ||
| return switch self { | ||
| case .internalError: | ||
| "INTERNAL_ERROR" | ||
| case .bluetoothDisabled: | ||
| "BLUETOOTH_DISABLED" | ||
| case .bluetoothFailure: | ||
| "BLUETOOTH_FAILURE" | ||
| case .secureConnectionToSquareFailure: | ||
| "SECURE_CONNECTION_TO_SQUARE_FAILURE" | ||
| case .secureConnectionNetworkFailure: | ||
| "SECURE_CONNECTION_NETWORK_FAILURE" | ||
| case .blockingFirmwareUpdate: | ||
| "BLOCKING_UPDATE" | ||
| case .maxReadersConnected: | ||
| "MAX_READERS_CONNECTED" | ||
| case .notConnectedToInternet | ||
| : "NOT_CONNECTED_TO_INTERNET" | ||
| case .readerTimeout: | ||
| "READER_TIMEOUT" | ||
| case .revokedByDevice: | ||
| "REVOKED_BY_DEVICE" | ||
| case .tapToPayError: | ||
| "TAP_TO_PAY_ERROR" | ||
| case .tapToPayIsNotLinked: | ||
| "TAP_TO_PAY_IS_NOT_LINKED" | ||
| default: | ||
| "UNKNOWN" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you're writing out strings for each status and unavailable reason when both those API's have a public description property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is the way it's done for all MPSDK enums so LGTM.
No description provided.