-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add missing Reader callbacks #706
Conversation
@@ -19,5 +19,8 @@ enum class ReactNativeConstants(val listenerName: String) { | |||
CHANGE_OFFLINE_STATUS("didChangeOfflineStatus"), | |||
FORWARD_PAYMENT_INTENT("didForwardPaymentIntent"), | |||
REPORT_FORWARDING_ERROR("didReportForwardingError"), | |||
DISCONNECT("didDisconnect") | |||
DISCONNECT("didDisconnect"), | |||
BATTERY_LEVEL_UPDATE("didBatteryLevelUpdate"), |
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.
didUpdateBatteryLevel
?
ios/Mappers.swift
Outdated
switch readerEvent { | ||
case ReaderEvent.cardInserted: return "cardInserted" | ||
case ReaderEvent.cardRemoved: return "cardRemoved" | ||
default: return "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.
recommend using @unknown default
so the compiler tells us when new entries are added
and should be able to remove the prefix
switch readerEvent { | |
case ReaderEvent.cardInserted: return "cardInserted" | |
case ReaderEvent.cardRemoved: return "cardRemoved" | |
default: return "unknown" | |
} | |
switch readerEvent { | |
case .cardInserted: return "cardInserted" | |
case .cardRemoved: return "cardRemoved" | |
@unknown default: return "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.
and should the values be the values from the enum?
export enum ReaderEvent {
CARD_INSERTED = 'CARD_INSERTED',
CARD_REMOVED = 'CARD_REMOVED',
}
? (not sure what's expected on the RN layer there - or does something else map them to that?)
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.
Android changes lgtm
ios/StripeTerminalReactNative.swift
Outdated
@@ -21,6 +21,9 @@ enum ReactNativeConstants: String, CaseIterable { | |||
case FORWARD_PAYMENT_INTENT = "didForwardPaymentIntent" | |||
case REPORT_FORWARDING_ERROR = "didReportForwardingError" | |||
case DISCONNECT = "didDisconnect" | |||
case UPDATE_BATTERY_LEVEL = "didReportBatteryLevel" |
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.
didUpdateBatteryLevel
Summary
Add missing callbacks on ReaderListener and BluetoothReaderDelegate
Motivation
Ensure all the callbacks on native SDKs are supported:
Testing
Documentation
Select one: