Skip to content

remove state and use reader status#72

Merged
cesar-sosa-hol merged 1 commit intomainfrom
remove-state-and-use-status
Feb 10, 2026
Merged

remove state and use reader status#72
cesar-sosa-hol merged 1 commit intomainfrom
remove-state-and-use-status

Conversation

@cesar-sosa-hol
Copy link
Collaborator

No description provided.

Comment on lines +169 to +219
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"
}
}
}

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?

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for cases of enum

@cesar-sosa-hol cesar-sosa-hol merged commit 6a031c0 into main Feb 10, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants