Skip to content
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

Merged
merged 13 commits into from
May 29, 2024
Merged

Conversation

EricLin-BBpos
Copy link
Collaborator

@EricLin-BBpos EricLin-BBpos commented May 23, 2024

Summary

Add missing callbacks on ReaderListener and BluetoothReaderDelegate

Motivation

Ensure all the callbacks on native SDKs are supported:

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

@@ -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"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

didUpdateBatteryLevel ?

Comment on lines 838 to 842
switch readerEvent {
case ReaderEvent.cardInserted: return "cardInserted"
case ReaderEvent.cardRemoved: return "cardRemoved"
default: return "unknown"
}
Copy link
Collaborator

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

Suggested change
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"
}

Copy link
Collaborator

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?)

Copy link

@ugochukwu-stripe ugochukwu-stripe left a comment

Choose a reason for hiding this comment

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

Android changes lgtm

@@ -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"
Copy link
Collaborator

Choose a reason for hiding this comment

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

didUpdateBatteryLevel

nazli-stripe
nazli-stripe previously approved these changes May 28, 2024
@nazli-stripe nazli-stripe merged commit 4084634 into main May 29, 2024
2 checks passed
@nazli-stripe nazli-stripe deleted the bbpos/add-missing-reader-callbacks branch September 6, 2024 20:52
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