-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
@@ -252,11 +252,13 @@ extension HubWebViewController: WKScriptMessageHandler, WKNavigationDelegate { | |||
} | |||
|
|||
case .triggerSignInWithApple: | |||
guard case .triggerSignInWithApple(let signInWithAppleMessage) = hubMessage.payload else { return } |
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.
If no intent was initially passed, wouldn't payload be nil
and thus nothing will happen when the corresponding button is pressed?
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.
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))
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.
self.hubViewController?.hide() | ||
Rownd.requestSignIn(with: .googleId, signInOptions: RowndSignInOptions(intent: signInWithGoogleMessage?.intent)) |
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.
@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.
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 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.
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 moved hubViewController.hide()
before the requestSignIn(with: .googleId)
which seems to work for me. The hub closes right before the Google sign in dialog.
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.
Sounds good!
No description provided.