我正在构建用于身份验证的预构建Firebase UI。它很好用,我正在寻找对用户进行身份验证的解决方案,我想将其传递到特定的viewcontroller,而不是弹出authUI.authViewController()并返回列表。我尝试使用委托-它起作用了,但是它先弹出了auth viewcontroller,然后转到设置。有点尴尬,但想知道是否有可能去viewcontroller而不是弹出vc。
extension ListViewController : FUIAuthDelegate {
func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) {
print("authDataResult : \(authDataResult?.description)")
print("error : \(error?.localizedDescription)")
if let error = error {
//assertionFailure("Error signing in: \(error.localizedDescription)")
return
}
if let nextViewController =
ListSettingController.storyboardInstance() { navigationController?.pushViewController(nextViewController, animated: true)
}
}
}
if Auth.auth().currentUser != nil {
if let nextViewController =
ListSettingController.storyboardInstance() { navigationController?.pushViewController(nextViewController, animated: true)
}
} else {
let providers: [FUIAuthProvider] = [
FUIGoogleAuth(),
FUIEmailAuth(),
FUIFacebookAuth()
]
authUI.providers = providers
authUI.tosurl = URL(string: "hi")
authUI.privacyPolicyURL = URL(string: "pwned")
let authViewController = authUI.authViewController()
self.present(authViewController, animated: true, completion: nil)
}