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

fix: pass down intent from hub to apple/google sign-in #42

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

mfmurray
Copy link
Contributor

No description provided.

@@ -252,11 +252,13 @@ extension HubWebViewController: WKScriptMessageHandler, WKNavigationDelegate {
}

case .triggerSignInWithApple:
guard case .triggerSignInWithApple(let signInWithAppleMessage) = hubMessage.payload else { return }
Copy link
Contributor

Choose a reason for hiding this comment

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

If no intent was initially passed, wouldn't payload be nil and thus nothing will happen when the corresponding button is pressed?

Copy link
Contributor

@mhamann mhamann Jan 31, 2023

Choose a reason for hiding this comment

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

Perhaps this could be simplified, but maybe something along these lines? Backward and forward compat, I think...

var signInWithAppleMessage: MessagePayload.TriggerSignInWithAppleMessage? = nil
if case .triggerSignInWithApple(let message) = hubMessage.payload {
    signInWithAppleMessage = message
}

self.hubViewController?.hide()
Rownd.requestSignIn(with: .appleId, signInOptions: RowndSignInOptions(intent: signInWithAppleMessage?.intent))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the intent is passed from the hub as undefined, the guard check still seems to be working.

Screen Shot 2023-01-31 at 8 22 30 AM

Comment on lines +267 to +268
self.hubViewController?.hide()
Rownd.requestSignIn(with: .googleId, signInOptions: RowndSignInOptions(intent: signInWithGoogleMessage?.intent))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BobbyRadford Is it alright if I remove the hubViewController.hide() callback? I was seeing some error at times when the Hub would still be open and another hub webview would try to load.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the idea behind this was to close the webview when the Sign in with Google dialog is shown so that once a user completes sign-in, the Rownd webview will be gone. Otherwise, a user will complete Google Sign-in, and Rownd will still be displayed. At the time, calling hide() was the only way I could figure out how to do this. If you can think of another way, or if things have changed since then and this is no longer a problem, feel free to remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved hubViewController.hide() before the requestSignIn(with: .googleId) which seems to work for me. The hub closes right before the Google sign in dialog.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

@mhamann mhamann merged commit 54c0def into main Feb 1, 2023
@mhamann mhamann deleted the sign-in-up-flow-2 branch February 1, 2023 02:21
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.

3 participants