Hi everyone I'm working with Firebase authentication with which I allow the user to log in with his email and a verification link that is sent to his email ...
Everything works but with iOS 13 I have to use SceneDelegate
instead of AppDelegate
and in the func scene method (_ scene: UIScene, continue userActivity: NSUserActivity
) I get an alert that warns me that I am not calling the result of the flatMap call.
Can anyone help me resolve this alert?
Result of call to 'flatMap' is unused
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
userActivity.webpageURL.flatMap(handlePasswordlessSignIn)
}
func handlePasswordlessSignIn(withURL: URL) -> Bool {
let link = withURL.absoluteString
if Auth.auth().isSignIn(withEmailLink: link) {
guard let email = UserDefaults.standard.value(forKey: FirebaseUserAuthWithLink.email) as? String else {
print("L'email utilizzata per accedere non esiste")
return true
}
Auth.auth().signIn(withEmail: email, link: link) { (user, error) in
if let error = error {
print(error.localizedDescription)
return
}
guard let user = user else {
print(" Authentication con Link Fallita")
return
}
let uid = user.user.uid
print("Autenticazione Riuscita")
let data = [
"email" : email
] as [String : Any]
Firestore.firestore().collection("Users").document(uid).setData(data) { (error) in
if let error = error {
print(error.localizedDescription)
return
}
}
}
return true
}
return false
}
Following the tutorial for the implementation, all the examples of queues refer to AppDelegate instead I tried to update the code working on SceneDelegate