示例#1
0
        public IPhoneAuthCredential GetCredential(IAuth auth, string verificationId, string verificationCode)
        {
            var wrapper    = (AuthWrapper)auth;
            var credential = PhoneAuthProvider.Create((Auth)wrapper).GetCredential(verificationId, verificationCode);

            return(new PhoneAuthCredentialWrapper(credential));
        }
        private async Task <PhoneNumberVerificationResult> VerifyPhoneNumberAsync(Auth auth, IPhoneMultiFactorInfo phoneMultiFactorInfo, IMultiFactorSession multiFactorSession)
        {
            try
            {
                auth.Settings.AppVerificationDisabledForTesting = false;

                var verificationId = await PhoneAuthProvider.Create(auth)
                                     .VerifyPhoneNumberAsync(phoneMultiFactorInfo.ToNative(), FirebaseAuth.VerifyingPhoneNumberAuthUIDelegate, multiFactorSession.ToNative())
                                     .ConfigureAwait(false);

                return(new PhoneNumberVerificationResult(null, verificationId));
            }
            catch (NSErrorException e)
            {
                throw ExceptionMapper.Map(e);
            }
        }
        private async Task <PhoneNumberVerificationResult> VerifyPhoneNumberAsync(Auth auth, string phoneNumber)
        {
            try
            {
                auth.Settings.AppVerificationDisabledForTesting = false;

                var verificationId = await PhoneAuthProvider.Create(auth)
                                     .VerifyPhoneNumberAsync(phoneNumber, FirebaseAuth.VerifyingPhoneNumberAuthUIDelegate)
                                     .ConfigureAwait(false);

                return(new PhoneNumberVerificationResult(null, verificationId));
            }
            catch (NSErrorException e)
            {
                throw ExceptionMapper.Map(e);
            }
        }
        private async Task <PhoneNumberVerificationResult> VerifyPhoneNumberForTestingAsync(Auth auth, string phoneNumber, string verificationCode, TimeSpan timeout)
        {
            try
            {
                auth.Settings.AppVerificationDisabledForTesting = true;

                var verificationId = await PhoneAuthProvider.Create(auth)
                                     .VerifyPhoneNumberAsync(phoneNumber, FirebaseAuth.VerifyingPhoneNumberAuthUIDelegate)
                                     .ConfigureAwait(false);

                var credential = GetCredential(auth, verificationId, verificationCode);

                return(new PhoneNumberVerificationResult(credential, verificationId));
            }
            catch (NSErrorException e)
            {
                throw ExceptionMapper.Map(e);
            }
        }
        private IPhoneAuthCredential GetCredential(Auth auth, string verificationId, string verificationCode)
        {
            var credential = PhoneAuthProvider.Create(auth).GetCredential(verificationId, verificationCode);

            return(new PhoneAuthCredentialWrapper(credential));
        }