@@ -138,21 +138,22 @@ class AuthBackend: AuthBackendProtocol {
138138 private static func phoneCredentialInUse( response: AuthRPCResponse ) -> Error ? {
139139 #if !os(iOS)
140140 return nil
141+ #else
142+ if let phoneAuthResponse = response as? VerifyPhoneNumberResponse ,
143+ let phoneNumber = phoneAuthResponse. phoneNumber,
144+ phoneNumber. count > 0 ,
145+ let temporaryProof = phoneAuthResponse. temporaryProof,
146+ temporaryProof. count > 0 {
147+ let credential = PhoneAuthCredential ( withTemporaryProof: temporaryProof,
148+ phoneNumber: phoneNumber,
149+ providerID: PhoneAuthProvider . id)
150+ return AuthErrorUtils . credentialAlreadyInUseError ( message: nil ,
151+ credential: credential,
152+ email: nil )
153+ } else {
154+ return nil
155+ }
141156 #endif // !os(iOS)
142- if let phoneAuthResponse = response as? VerifyPhoneNumberResponse ,
143- let phoneNumber = phoneAuthResponse. phoneNumber,
144- phoneNumber. count > 0 ,
145- let temporaryProof = phoneAuthResponse. temporaryProof,
146- temporaryProof. count > 0 {
147- let credential = PhoneAuthCredential ( withTemporaryProof: temporaryProof,
148- phoneNumber: phoneNumber,
149- providerID: PhoneAuthProvider . id)
150- return AuthErrorUtils . credentialAlreadyInUseError ( message: nil ,
151- credential: credential,
152- email: nil )
153- } else {
154- return nil
155- }
156157 }
157158
158159 /// Calls the RPC using HTTP request.
0 commit comments