-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FX-722] Add support for derivedCardInfo.usState
to ElementState
for ForagePANEditText
#133
Merged
devinmorgan
merged 4 commits into
main
from
devin/fx-772-android-expose-the-state-of-the-ebt-card-in-pan-element
Dec 5, 2023
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
27 changes: 23 additions & 4 deletions
27
...ge-android/src/main/java/com/joinforage/forage/android/core/element/state/ElementState.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
package com.joinforage.forage.android.core.element.state | ||
|
||
import com.joinforage.forage.android.core.element.ElementValidationError | ||
import com.joinforage.forage.android.model.USState | ||
|
||
data class ElementState( | ||
data class ElementState<InputDetails>( | ||
val isFocused: Boolean, | ||
val isBlurred: Boolean, | ||
val isEmpty: Boolean, | ||
val isValid: Boolean, | ||
val isComplete: Boolean, | ||
val validationError: ElementValidationError? | ||
val validationError: ElementValidationError?, | ||
val details: InputDetails, | ||
) | ||
internal val INITIAL_ELEMENT_STATE = ElementState( | ||
|
||
internal typealias PinDetails = Nothing? | ||
internal val INITIAL_PIN_ELEMENT_STATE = ElementState<PinDetails>( | ||
isFocused = false, | ||
isBlurred = true, | ||
isEmpty = true, | ||
isValid = true, | ||
isComplete = false, | ||
validationError = null | ||
validationError = null, | ||
details = null, | ||
) | ||
|
||
data class DerivedCardInfo(val usState: USState? = null) | ||
data class PanDetails( | ||
val derivedCardInfo: DerivedCardInfo? | ||
) | ||
internal val INITIAL_PAN_ELEMENT_STATE = ElementState<PanDetails>( | ||
isFocused = false, | ||
isBlurred = true, | ||
isEmpty = true, | ||
isValid = true, | ||
isComplete = false, | ||
validationError = null, | ||
details = PanDetails(null), | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@devinmorgan Will this be a breaking change for the client? My guess is no, but just want to confirm.
i.e. will the client have to update their code to conform to the new interfaces?
Also, should we explicitly declare
public
classes aspublic
or is it fine to omit? Not sure what the kotlin linting rules prefer.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.
I fear for the flakiness of the QA tests so I am taking a screenshot to capture that the CI tests passed for this PR at one point (see below).
It depends. As you can see the CI tests against this PR is that I did not change the Sample App in this PR. The significance of them passing is that this PR is reverse compatible (for the with the Sample App at least). The reason this change is reverse compatible with the Sample App is because the Sample App never explicitly refers to any of the types that this PR changes (e.g.
ElementState
,AbstractElement
, etc). If the Sample App had referenced these types then this would have been a breaking change.This same point applies to GoPuff. If they currently reference the types that this PR does change instead of letting the compiler infer the types, then this PR would be a breaking change. However, even if GoPuff does reference the types changed, it would only require minor updates in their code (just updating the types)
Screenshot of CI tests passing