Last active
April 8, 2020 04:47
-
-
Save wata/9836d0615bbf2264af10eff3b1a325b2 to your computer and use it in GitHub Desktop.
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
@IBAction func didTapEmailButton(_ sender: Any) { | |
let authUI = FUIAuth.defaultAuthUI()! | |
authUI.delegate = self | |
let settings = ActionCodeSettings() | |
settings.url = Constants.URLs.login | |
settings.handleCodeInApp = true | |
settings.setIOSBundleID(Constants.AppInfo.bundleIdentifier) | |
authUI.providers = [ | |
FUIEmailAuth( | |
authAuthUI: authUI, | |
signInMethod: EmailLinkAuthSignInMethod, | |
forceSameDevice: true, | |
allowNewEmailAccounts: true, | |
actionCodeSetting: settings | |
) | |
] | |
let provider = authUI.providers.first as! FUIEmailAuth | |
provider.signIn(withPresenting: self, email: nil) | |
} | |
/// For more information, see [FirebaseUI for iOS — Auth](https://github.com/firebase/FirebaseUI-iOS/blob/master/Auth/README.md) | |
static func handle(universalLink link: URL) -> Bool { | |
guard | |
let emailLinkString = link.queries["link"] as? String, | |
let emailLink = URL(string: emailLinkString) | |
else { return false } | |
return FUIAuth.defaultAuthUI()?.handleOpen(emailLink, sourceApplication: nil) ?? false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment