-
Notifications
You must be signed in to change notification settings - Fork 48
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
Remove onNewIntent Override in MainActivity #311
base: main
Are you sure you want to change the base?
Conversation
@@ -48,7 +49,11 @@ fun ApproveOrderView( | |||
val context = LocalContext.current | |||
OnLifecycleOwnerResumeEffect { | |||
val intent = context.getActivityOrNull()?.intent | |||
intent?.let { viewModel.completeAuthChallenge(intent) } | |||
intent?.let { viewModel.completeAuthChallenge(it) } |
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 do we need to check onResume as well as newIntent if we are assuming singeTop launch mode?
Is there a chance that this is called the second time in onResume?
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.
This is a good callout. This is need for process kill, but I do need to make sure we're doing Activity state restoration and I'll debug with "Don't keep activities" to make sure it's being called.
@@ -235,18 +235,25 @@ class ApproveOrderViewModel @Inject constructor( | |||
OrderInfo(orderId, status, didAttemptThreeDSecureAuthentication) | |||
} | |||
approveOrderState = ActionState.Success(orderInfo) | |||
// discard authState | |||
authState = null |
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.
This is mentioned in the v2_MIGRATION_GUIDE but it was missing here.
The merchant needs to discard authState
when they are done to prevent stale auth state from being parsed again to check for auth completion when a merchant app comes back into the foreground. Notice authState
is not discarded when .NoResult
is returned by the SDK.
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.
can u explain that a bit Steven? why authState is not discarded with .NoResult?
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.
Yeah in the demo app, keeping authState
when we can't determine if the user completed the flow allows the user to retry launching the browser-switched flow.
Summary of changes
onNewIntent
in the Demo app'sMainActivity
OnNewIntentEffect
internallyChecklist
Added a changelog entryAuthors