public Task UnenrollAsync(IMultiFactorInfo multiFactorInfo) { var tcs = new TaskCompletionSource <bool>(); _multiFactor.Unenroll(multiFactorInfo.ToNative(), (error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(true); } }); return(tcs.Task); }
public Task UnenrollAsync(string factorUid) { var tcs = new TaskCompletionSource <bool>(); _multiFactor.Unenroll(factorUid, (error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(true); } }); return(tcs.Task); }
public Task <IMultiFactorSession> GetSessionAsync() { var tcs = new TaskCompletionSource <IMultiFactorSession>(); _multiFactor.GetSession((session, error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(new MultiFactorSessionWrapper(session !)); } }); return(tcs.Task); }
public Task EnrollAsync(IMultiFactorAssertion multiFactorAssertion, string?displayName) { var tcs = new TaskCompletionSource <bool>(); _multiFactor.Enroll(multiFactorAssertion.ToNative(), displayName, (error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(true); } }); return(tcs.Task); }
public Task <IAuthResult> ResolveSignInAsync(IMultiFactorAssertion multiFactorAssertion) { var tcs = new TaskCompletionSource <IAuthResult>(); _multiFactorResolver.ResolveSignIn(multiFactorAssertion.ToNative(), (authResult, error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(new AuthResultWrapper(authResult)); } }); return(tcs.Task); }
public async Task <PhoneNumberVerificationResult> VerifyPhoneNumberAsync(IAuth auth, string phoneNumber, TimeSpan timeSpan) { try { var wrapper = (AuthWrapper)auth; var firebaseAuth = (Auth)wrapper; firebaseAuth.Settings.AppVerificationDisabledForTesting = false; var verificationId = await PhoneAuthProvider.From(firebaseAuth) .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); } }
public async Task UpdateProfileAsync(UserProfileChangeRequest request) { try { var userProfileChangeRequest = _user.ProfileChangeRequest(); if (request.IsDisplayNameChanged) { userProfileChangeRequest.DisplayName = request.DisplayName; } if (request.IsPhotoUrlChanged) { userProfileChangeRequest.PhotoUrl = request.PhotoUrl != null ? new NSUrl(request.PhotoUrl.ToString()) : null; } await userProfileChangeRequest.CommitChangesAsync().ConfigureAwait(false); } catch (NSErrorException e) { throw ExceptionMapper.Map(e); } }
public Task <IAuthResult> LinkWithProviderAsync(IFederatedAuthProvider federatedAuthProvider) { var tcs = new TaskCompletionSource <IAuthResult>(); federatedAuthProvider.ToNative().Completion(FirebaseAuth.LinkWithProviderAuthUIDelegate, (credential, error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { _user.Link(credential !, (result, error) => { if (error != null) { tcs.SetException(ExceptionMapper.Map(error)); } else { tcs.SetResult(new AuthResultWrapper(result !)); }
public async Task UpdateProfileAsync(UserProfileChangeRequest request) { try { var builder = new Firebase.Auth.UserProfileChangeRequest.Builder(); if (request.IsDisplayNameChanged) { builder.SetDisplayName(request.DisplayName); } if (request.IsPhotoUrlChanged) { var uri = request.PhotoUrl != null?Android.Net.Uri.Parse(request.PhotoUrl.ToString()) : null; builder.SetPhotoUri(uri); } await _user.UpdateProfileAsync(builder.Build()).ConfigureAwait(false); } catch (FirebaseException e) { throw ExceptionMapper.Map(e); } }
public override void OnVerificationFailed(FirebaseException exception) { _tcs.SetException(ExceptionMapper.Map(exception)); }