Add unknown to ReaderChange enum (#66)#66
Open
marcos930807 wants to merge 1 commit intosquare:mainfrom
Open
Conversation
* update enums.dart * update models.g.dart
Author
|
@cesar-sosa-hol let me known if anythings else is needed here!. Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for an unmapped ReaderChange event value (unknown) in the Tap to Pay flow of the Square Mobile Payments Flutter SDK.
Problem
When the app transitions between background and foreground, the Tap to Pay reader reconnects and emits a ReaderChange event.
Currently, this event is value of unknown, which is not included in the ReaderChange enum. This causes a deserialization failure and we miss the event. Error:
Invalid argument(s): unknown is not one of the supported values: batteryDidBeginCharging, batteryDidEndCharging, batteryLevelDidChange, cardInserted, cardRemoved, firmwareUpdateDidFail, firmwareUpdatePercentDidChange, changedState, added, removed, batteryThreshold, batteryCharging, firmwareProgress
Solution
This PR adds the missing unknown value to the ReaderChange enum, allowing the SDK to safely deserialize all incoming events.
Benefits
Ensures the event stream remains stable during app lifecycle transitions (background ↔ foreground)
Preserves access to the reader reference included in the event
Allows consumers to fetch the latest reader state if needed, even when the event type is not explicitly mapped
It will be ideal that Native IOS SDK send the correct eventName but with this mapping at least we known that something "unknown" change on the Reader and we can fetch his current status.