Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Charanke.ViewModels.LoginPageViewModel"/> class.
        /// </summary>
        public LoginPageViewModel(IFirebaseAuthenticator firebaseAuthenticator)
        {
            FirebaseAuthenticator = firebaseAuthenticator;

            _AuthModel = new FirebaseAuthenticationModel(FirebaseAuthenticator);

            Email = ReactiveProperty.FromObject(
                _AuthModel,
                x => x.Email);

            Password = ReactiveProperty.FromObject(
                _AuthModel,
                x => x.Password);

            AuthMessage = _AuthModel.ObserveProperty(m => m.AuthMessage)
                          .ToReadOnlyReactiveProperty();

            SendSignInByEmailAndPassword = Email.ObserveHasErrors.CombineLatest(
                Password.ObserveHasErrors, (x, y) => !x && !y)
                                           .ToReactiveCommand();

            SendSignUpByEmailAndPassword = Email.ObserveHasErrors.CombineLatest(
                Password.ObserveHasErrors, (x, y) => !x && !y)
                                           .ToReactiveCommand();

            SendSignInByEmailAndPassword.Subscribe(
                async() => await this.SignInByEmailAndPasswordAction());

            SendSignUpByEmailAndPassword.Subscribe(
                async() => await this.SignUpByEmailAndPasswordAction());
        }
 internal static FirebaseStorageOptions GetStorageAuthOptions(this FirebaseAuthProvider authProvider, FirebaseAuthenticationModel authSettings)
 {
     return(new FirebaseStorageOptions {
         AuthTokenAsyncFactory = async() => await authSettings.GetAuthenticationTokenAsync(authProvider)
     });
 }