Beispiel #1
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            LoginButton.SetTitleColor(
                UIColor.White.ColorWithAlpha((nfloat)0.5),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ =>
            {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.Login();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            setupKeyboardDismissingGestureRecognizers();

            prepareForgotPasswordButton();
            ShowPasswordButton.SetupShowPasswordButton();
        }
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            LoginButton.SetTitleColor(
                Foundation.MvvmCross.Helper.Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ =>
            {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.Login();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            prepareForgotPasswordButton();
            ShowPasswordButton.SetupShowPasswordButton();
        }
Beispiel #3
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartSpinning();

            SignupButton.SetTitleColor(
                Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.Signup.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            ShowPasswordButton.SetupShowPasswordButton();
        }
        private void prepareViews()
        {
            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartAnimation();

            LoginButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            PasswordTextField.ResignFirstResponder();

            ShowPasswordButton.SetupShowPasswordButton();
            prepareForgotPasswordButton();
        }
        private void prepareViews()
        {
            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartAnimation();

            SignupButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            PasswordTextField.ResignFirstResponder();

            ShowPasswordButton.SetupShowPasswordButton();

            SelectCountryButton.SemanticContentAttribute = UISemanticContentAttribute.ForceRightToLeft;
            var spacing = 4;

            SelectCountryButton.ImageEdgeInsets = new UIEdgeInsets(0, spacing, 0, 0);
            SelectCountryButton.TitleEdgeInsets = new UIEdgeInsets(0, 0, 0, spacing);
        }
Beispiel #6
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartSpinning();

            SignupButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.SignupCommand.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            SignupShakeTriggerButton.TouchUpInside += (sender, e) =>
            {
                if (!ViewModel.Email.IsValid)
                {
                    EmailTextField.Shake();
                }
                if (!ViewModel.Password.IsValid)
                {
                    PasswordTextField.Shake();
                }
                if (!ViewModel.IsCountryValid)
                {
                    SelectCountryButton.Shake();
                    CountryNotSelectedImageView.Shake();
                    CountryDropDownCaretImageView.Shake();
                }
            };

            ShowPasswordButton.SetupShowPasswordButton();

            EmailTextField.ResignFirstResponder();
            PasswordTextField.ResignFirstResponder();
        }
Beispiel #7
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            LoginButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.LoginCommand.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            LoginShakeTriggerButton.TouchUpInside += (sender, e) =>
            {
                if (!ViewModel.Email.IsValid)
                {
                    EmailTextField.Shake();
                }
                if (!ViewModel.Password.IsValid)
                {
                    PasswordTextField.Shake();
                }
            };

            PasswordTextField.ResignFirstResponder();

            ShowPasswordButton.SetupShowPasswordButton();
            prepareForgotPasswordButton();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = Resources.LoginTitle;
            ResetSuccessLabel.Text        = Resources.APITokenResetSuccess;
            InstructionLabel.Text         = Resources.TokenResetInstruction;
            PasswordTextField.Placeholder = Resources.Password;
            SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal);

            EmailLabel.Text = ViewModel.Email.ToString();

            ViewModel.Error
            .Subscribe(ErrorLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.Password
            .Subscribe(PasswordTextField.Rx().TextObserver())
            .DisposedBy(DisposeBag);

            PasswordTextField.Rx().Text()
            .Subscribe(ViewModel.Password)
            .DisposedBy(DisposeBag);

            SignOutButton.Rx()
            .BindAction(ViewModel.SignOut)
            .DisposedBy(DisposeBag);

            ViewModel.SignOut.Elements
            .Subscribe(IosDependencyContainer.Instance.IntentDonationService.ClearAll)
            .DisposedBy(DisposeBag);

            ShowPasswordButton.Rx().Tap()
            .Subscribe(_ =>
            {
                PasswordTextField.ResignFirstResponder();
                PasswordTextField.SecureTextEntry = !PasswordTextField.SecureTextEntry;
                PasswordTextField.BecomeFirstResponder();
            })
            .DisposedBy(DisposeBag);

            LoginButton.Rx().Tap()
            .Subscribe(ViewModel.Done.Inputs)
            .DisposedBy(DisposeBag);

            PasswordTextField.Rx().ShouldReturn()
            .Subscribe(ViewModel.Done.Inputs)
            .DisposedBy(DisposeBag);

            //Enabled
            ViewModel.NextIsEnabled
            .Subscribe(LoginButton.Rx().Enabled())
            .DisposedBy(DisposeBag);

            //Visibility
            ErrorLabel.Hidden = true;
            ViewModel.HasError
            .Subscribe(ErrorLabel.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.Done.Executing
            .Invert()
            .Subscribe(ShowPasswordButton.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.Done.Executing
            .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.Done.Executing.Select(loginButtonTitle)
            .Subscribe(LoginButton.Rx().AnimatedTitle())
            .DisposedBy(DisposeBag);

            PasswordTextField.BecomeFirstResponder();
            ShowPasswordButton.SetupShowPasswordButton();

            //Color
            ViewModel.HasError
            .Select(loginButtonTintColor)
            .Subscribe(LoginButton.Rx().TintColor())
            .DisposedBy(DisposeBag);

            ViewModel.NextIsEnabled
            .Select(loginButtonTitleColor)
            .Subscribe(LoginButton.Rx().TitleColor())
            .DisposedBy(DisposeBag);

            UIColor loginButtonTintColor(bool hasError)
            => hasError ? UIColor.White : UIColor.Black;

            UIColor loginButtonTitleColor(bool enabled) => enabled
                ? Core.UI.Helper.Colors.Login.EnabledButtonColor.ToNativeColor()
                : Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor();
        }