-
Notifications
You must be signed in to change notification settings - Fork 657
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 Completed result to LinkActivityResult #9855
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
is LinkActivityResult.Failed -> { | ||
linkEventsReporter.onPopupError(linkActivityResult.error) | ||
} | ||
LinkActivityResult.Completed -> Unit |
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.
why does completed not also get a onPopupSuccess event?
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.
do we need a test for when LinkActivityResult is the new Completed type?
@@ -12,10 +12,16 @@ import org.json.JSONObject | |||
|
|||
internal sealed class LinkActivityResult : Parcelable { | |||
/** | |||
* Indicates that the flow was completed successfully. | |||
* Indicates that the flow was completed successfully |
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.
* Indicates that the flow was completed successfully | |
* Indicates that the flow was completed successfully. |
data object Completed : LinkActivityResult() | ||
|
||
/** | ||
* Indicates that the user selected a payment method. This payment method should be used for confirmation. |
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.
* Indicates that the user selected a payment method. This payment method should be used for confirmation. | |
* Indicates that the user selected a payment method. This payment method has not yet been confirmed. |
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.
Could you look into a few things to clean up these tests:
- Are all of the mocks here necessary? Can we swap any for fakes?
- Is it possible to share more setup between tests? It looks like the set up to many of these tests is the exact same. It'd be nice to factor that out to make it easier to update these tests in the future and to make them more readable
private open class LauncherLinkAnalyticsHelper : FakeLinkAnalyticsHelper() { | ||
override fun onLinkLaunched() = Unit | ||
} | ||
|
||
private class TrackingLinkAnalyticsHelper : LauncherLinkAnalyticsHelper() { | ||
var lastResult: LinkActivityResult? = null | ||
override fun onLinkResult(linkResult: LinkActivityResult) { | ||
lastResult = linkResult | ||
} | ||
} |
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.
Wdyt of just making FakeLinkAnalyticsHelper
functional so that you don't have to create these custom overrides? By "functional" I just mean take whatever implementation you needed in these tests and add that implementation to the fake directly. It should simplify this code and also make it easier to test with that fake going forward
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.
Also to add, it would be nice if TrackingLinkAnalyticsHelper
worked similar to RecordingLinkStore.test
so that we can ensure that all the interactions with LauncherLinkAnalyticsHelper
are consumed and we have no unexpected calls.
intent = confirmationParameters.intent, | ||
deferredIntentConfirmationType = deferredIntentConfirmationType | ||
) | ||
} |
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.
Happy to see that this was easy to do with the changes we made to the ConfirmationDefinition design!
private open class LauncherLinkAnalyticsHelper : FakeLinkAnalyticsHelper() { | ||
override fun onLinkLaunched() = Unit | ||
} | ||
|
||
private class TrackingLinkAnalyticsHelper : LauncherLinkAnalyticsHelper() { | ||
var lastResult: LinkActivityResult? = null | ||
override fun onLinkResult(linkResult: LinkActivityResult) { | ||
lastResult = linkResult | ||
} | ||
} |
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.
Also to add, it would be nice if TrackingLinkAnalyticsHelper
worked similar to RecordingLinkStore.test
so that we can ensure that all the interactions with LauncherLinkAnalyticsHelper
are consumed and we have no unexpected calls.
Summary
Current result set is [
completed(paymentMethod)
,canceled
,failed
].New result set is [
completed
,paymentMethodObtained(paymentMethod)
,canceled
,failed
].This accounts for Link handling the payment confirmation. In this scenario, we don't need to send a payment method as part of the result.
Motivation
JIRA
Testing