@@ -146,21 +146,22 @@ class AuthBackend: AuthBackendProtocol {
146146 private static func phoneCredentialInUse( response: AuthRPCResponse ) -> Error ? {
147147 #if !os(iOS)
148148 return nil
149+ #else
150+ if let phoneAuthResponse = response as? VerifyPhoneNumberResponse ,
151+ let phoneNumber = phoneAuthResponse. phoneNumber,
152+ phoneNumber. count > 0 ,
153+ let temporaryProof = phoneAuthResponse. temporaryProof,
154+ temporaryProof. count > 0 {
155+ let credential = PhoneAuthCredential ( withTemporaryProof: temporaryProof,
156+ phoneNumber: phoneNumber,
157+ providerID: PhoneAuthProvider . id)
158+ return AuthErrorUtils . credentialAlreadyInUseError ( message: nil ,
159+ credential: credential,
160+ email: nil )
161+ } else {
162+ return nil
163+ }
149164 #endif // !os(iOS)
150- if let phoneAuthResponse = response as? VerifyPhoneNumberResponse ,
151- let phoneNumber = phoneAuthResponse. phoneNumber,
152- phoneNumber. count > 0 ,
153- let temporaryProof = phoneAuthResponse. temporaryProof,
154- temporaryProof. count > 0 {
155- let credential = PhoneAuthCredential ( withTemporaryProof: temporaryProof,
156- phoneNumber: phoneNumber,
157- providerID: PhoneAuthProvider . id)
158- return AuthErrorUtils . credentialAlreadyInUseError ( message: nil ,
159- credential: credential,
160- email: nil )
161- } else {
162- return nil
163- }
164165 }
165166
166167 /// Calls the RPC using HTTP request.
0 commit comments