Esempio n. 1
0
        private void prepareForgotPasswordButton()
        {
            var normalFont = UIFont.SystemFontOfSize(12, UIFontWeight.Regular);
            var boldFont   = UIFont.SystemFontOfSize(12, UIFontWeight.Medium);
            var color      = Color.Login.ForgotPassword.ToNativeColor();
            var text       = new NSMutableAttributedString(
                Resources.LoginForgotPassword, foregroundColor: color);
            var boldText = new NSAttributedString(
                Resources.LoginGetHelpLoggingIn,
                foregroundColor: color,
                font: boldFont);

            text.Append(boldText);
            ForgotPasswordButton.SetAttributedTitle(text, UIControlState.Normal);
        }
Esempio n. 2
0
        private void prepareTextFields()
        {
            var stringAttributes = new CTStringAttributes(
                new UIStringAttributes {
                ForegroundColor = UIColor.White.ColorWithAlpha(0.5f)
            }.Dictionary
                );

            EmailTextField.TintColor             = UIColor.White;
            EmailTextField.AttributedPlaceholder =
                new NSAttributedString(Resources.LoginSignUpEmailPlaceholder, stringAttributes);

            PasswordTextField.TintColor             = UIColor.White;
            PasswordTextField.AttributedPlaceholder =
                new NSAttributedString(Resources.LoginSignUpPasswordPlaceholder, stringAttributes);

            ForgotPasswordButton.SetTitle(Resources.LoginForgotPassword, UIControlState.Normal);
        }
Esempio n. 3
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityIndicator != null)
            {
                ActivityIndicator.Dispose();
                ActivityIndicator = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (ForgotPasswordButton != null)
            {
                ForgotPasswordButton.Dispose();
                ForgotPasswordButton = null;
            }

            if (GoogleLoginButton != null)
            {
                GoogleLoginButton.Dispose();
                GoogleLoginButton = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (LogoImageView != null)
            {
                LogoImageView.Dispose();
                LogoImageView = null;
            }

            if (PasswordManagerButton != null)
            {
                PasswordManagerButton.Dispose();
                PasswordManagerButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (ShowPasswordButton != null)
            {
                ShowPasswordButton.Dispose();
                ShowPasswordButton = null;
            }

            if (SignupCard != null)
            {
                SignupCard.Dispose();
                SignupCard = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (LoginShakeTriggerButton != null)
            {
                LoginShakeTriggerButton.Dispose();
                LoginShakeTriggerButton = null;
            }
        }
Esempio n. 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            EmailTextField.Placeholder    = Resources.EmailAddress;
            PasswordTextField.Placeholder = Resources.Password;
            OrLabel.Text = Resources.Or.ToUpper();
            LoginButton.SetTitle(Resources.LoginTitle, UIControlState.Normal);
            GoogleLoginButton.SetTitle(Resources.GoogleLogin, UIControlState.Normal);
            DontHaveAnAccountLabel.Text = Resources.DoNotHaveAnAccountWithQuestionMark;
            SignUpForFreeLabel.Text     = Resources.SignUpTitle;

            NavigationController.NavigationBarHidden = true;

            UIKeyboard.Notifications.ObserveWillShow(KeyboardWillShow);
            UIKeyboard.Notifications.ObserveWillHide(KeyboardWillHide);

            //Text
            ViewModel.Email
            .Subscribe(EmailTextField.Rx().TextObserver())
            .DisposedBy(DisposeBag);

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

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

            EmailTextField.Rx().Text()
            .Select(Email.From)
            .Subscribe(ViewModel.SetEmail)
            .DisposedBy(DisposeBag);

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

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

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

            ViewModel.IsLoading
            .Subscribe(ActivityIndicator.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.IsPasswordMasked
            .Skip(1)
            .Subscribe(PasswordTextField.Rx().SecureTextEntry())
            .DisposedBy(DisposeBag);

            ViewModel.IsShowPasswordButtonVisible
            .Subscribe(ShowPasswordButton.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            PasswordTextField.FirstResponder
            .Subscribe(ViewModel.SetIsShowPasswordButtonVisible)
            .DisposedBy(DisposeBag);

            //Commands
            SignupCard.Rx()
            .BindAction(ViewModel.Signup)
            .DisposedBy(DisposeBag);

            LoginButton.Rx().Tap()
            .Subscribe(ViewModel.Login)
            .DisposedBy(DisposeBag);

            GoogleLoginButton.Rx().Tap()
            .Subscribe(ViewModel.GoogleLogin)
            .DisposedBy(DisposeBag);

            ForgotPasswordButton.Rx()
            .BindAction(ViewModel.ForgotPassword)
            .DisposedBy(DisposeBag);

            ShowPasswordButton.Rx().Tap()
            .Subscribe(ViewModel.TogglePasswordVisibility)
            .DisposedBy(DisposeBag);

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

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

            //Animation
            ViewModel.Shake
            .Subscribe(shakeTargets =>
            {
                if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Email))
                {
                    EmailTextField.Shake();
                }

                if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Password))
                {
                    PasswordTextField.Shake();
                }
            })
            .DisposedBy(DisposeBag);

            prepareViews();

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

            UIColor loginButtonTitleColor(bool enabled) => enabled
                ? UIColor.White
                : UIColor.White.ColorWithAlpha((nfloat)0.5);
        }
        void ReleaseDesignerOutlets()
        {
            if (ActivityIndicator != null)
            {
                ActivityIndicator.Dispose();
                ActivityIndicator = null;
            }

            if (BottomConstraint != null)
            {
                BottomConstraint.Dispose();
                BottomConstraint = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (InfoLabel != null)
            {
                InfoLabel.Dispose();
                InfoLabel = null;
            }

            if (ForgotPasswordButton != null)
            {
                ForgotPasswordButton.Dispose();
                ForgotPasswordButton = null;
            }

            if (PasswordManagerButton != null)
            {
                PasswordManagerButton.Dispose();
                PasswordManagerButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (PrivacyPolicyButton != null)
            {
                PrivacyPolicyButton.Dispose();
                PrivacyPolicyButton = null;
            }

            if (ShowPasswordButton != null)
            {
                ShowPasswordButton.Dispose();
                ShowPasswordButton = null;
            }

            if (SignUpLabels != null)
            {
                SignUpLabels.Dispose();
                SignUpLabels = null;
            }

            if (TermsOfServiceButton != null)
            {
                TermsOfServiceButton.Dispose();
                TermsOfServiceButton = null;
            }
        }
    public void                    DisplayPanel(bool blnClearFields = false)
    {
                        #if USES_STATUSMANAGER
        Status.UpdateStatus();
                        #endif

        if (blnClearFields)
        {
            if (UsernameInput.GetComponent <InputField>().interactable)
            {
                UsernameInput.GetComponent <InputField>().text = "";
            }
            PasswordInput.GetComponent <InputField>().text     = "";
            EmailAddressInput.GetComponent <InputField>().text = "";
        }

        if (Net == null || !Net.IsConnected || App.IsLoggedIn)
        {
            // TURN EVERYTHING OFF
            this.GetComponent <Image>().enabled = false;
            for (int i = 0; i < this.transform.childCount; i++)
            {
                this.transform.GetChild(0).GetChild(i).gameObject.SetActive(false);
            }
        }
        else
        {
            // TURN EVERYTHING ON
            this.GetComponent <Image>().enabled = true;
            for (int i = 0; i < this.transform.childCount - 1; i++)
            {
                this.transform.GetChild(0).GetChild(i).gameObject.SetActive(true);
            }

            // MODIFY WHICH BUTTONS/INPUTFIELDS ARE ACTIVE BASED ON THE STATE
            if (App.UserLoginType == 2)                                 // WINDOWS USERNAME LOGIN TYPE
            {
                UsernameInput.GetComponent <InputField>().interactable = false;
                PasswordContainer.SetActive(false);
                EmailAddressContainer.SetActive(false);
                ResetPasswordLabel.SetActive(false);
                ForgotPasswordContainer.SetActive(false);
                SignUpButton.SetActive(false);
                LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline);
                UsernameInput.GetComponent <InputField>().text = App.GetWindowsUsername();
                UsernameInput.GetComponent <InputField>().MoveTextEnd(false);
                UsernameInput.GetComponent <InputField>().DeactivateInputField();
                EventSystem.current.SetSelectedGameObject(UsernameInput.GetComponent <InputField>().gameObject, null);
                UsernameInput.GetComponent <InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
            }
            else
            {
                UsernameInput.GetComponent <InputField>().interactable = true;
                UsernameContainer.SetActive(!_blnIsForgetting);
                PasswordContainer.SetActive(!_blnIsForgetting);
                EmailAddressContainer.SetActive(_blnIsSigningUp || _blnIsForgetting);
                ForgotPasswordContainer.SetActive(!_blnIsForgetting && !_blnIsSigningUp);
                ResetPasswordLabel.SetActive(_blnIsForgetting);
                LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline);
                SignUpButton.SetActive(App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp);
            }

            bool blnCanOffline = (App != null && App.CanWorkOffline && App.IsWorkingOffline && !_blnIsForgetting && !_blnIsSigningUp);
                                #if USES_DATABASEMANAGER
            blnCanOffline = blnCanOffline && Database != null && Database.ClientsCanUse;
                                #else
            blnCanOffline = false;
                                #endif
            OfflineButton.SetActive(blnCanOffline);

            // ACTIVATE/DEACTIVATE BUTTONS BASED ON ACTIVE LOGIN  (IE, GAME VERSION IS UP TO DATE)
            LoginButton.GetComponent <Button>().interactable          = LoginIsActive && !Net.IsWorkingOffline;
            ForgotPasswordButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline;
            SignUpButton.GetComponent <Button>().interactable         = LoginIsActive && !Net.IsWorkingOffline && (App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp);
            OfflineButton.GetComponent <Button>().interactable        = LoginIsActive;
        }
    }
Esempio n. 7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            BlockerView = new UIBlockerView(View, View.Frame.ToRectF( ));

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor);

            ScrollView                   = new UIScrollViewWrapper();
            ScrollView.Parent            = this;
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Bounds            = View.Bounds;
            //ScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( 0x0000FFFF );
            View.AddSubview(ScrollView);

            UserNameField = new StyledTextField();
            ScrollView.AddSubview(UserNameField.Background);

            UserNameField.Field.AutocapitalizationType = UITextAutocapitalizationType.None;
            UserNameField.Field.AutocorrectionType     = UITextAutocorrectionType.No;
            ControlStyling.StyleTextField(UserNameField.Field, LoginStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ControlStyling.StyleBGLayer(UserNameField.Background);
            UserNameField.Field.ShouldReturn += (textField) =>
            {
                textField.ResignFirstResponder();

                TryRockBind();
                return(true);
            };

            PasswordField = new StyledTextField();
            ScrollView.AddSubview(PasswordField.Background);
            PasswordField.Field.AutocorrectionType = UITextAutocorrectionType.No;
            PasswordField.Field.SecureTextEntry    = true;

            ControlStyling.StyleTextField(PasswordField.Field, LoginStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ControlStyling.StyleBGLayer(PasswordField.Background);
            PasswordField.Field.ShouldReturn += (textField) =>
            {
                textField.ResignFirstResponder();

                TryRockBind();
                return(true);
            };

            // obviously attempt a login if login is pressed
            LoginButton = UIButton.FromType(UIButtonType.System);
            ScrollView.AddSubview(LoginButton);
            ControlStyling.StyleButton(LoginButton, LoginStrings.LoginButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            LoginButton.SizeToFit( );
            LoginButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                if (RockMobileUser.Instance.LoggedIn == true)
                {
                    RockMobileUser.Instance.LogoutAndUnbind( );

                    SetUIState(LoginState.Out);
                }
                else
                {
                    TryRockBind();
                }
            };

            // if they forgot their password, kick them out to the forgot password page
            ForgotPasswordButton = UIButton.FromType(UIButtonType.System);
            ScrollView.AddSubview(ForgotPasswordButton);
            ControlStyling.StyleButton(ForgotPasswordButton, LoginStrings.ForgotPasswordButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ForgotPasswordButton.SizeToFit( );
            ForgotPasswordButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                TaskWebViewController.HandleUrl(true, true, LoginConfig.ForgotPassword_Url, null, null, false, false, false);
            };

            AdditionalOptions = new UILabel( );
            ScrollView.AddSubview(AdditionalOptions);
            ControlStyling.StyleUILabel(AdditionalOptions, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            AdditionalOptions.Text      = LoginStrings.AdditionalOptions;
            AdditionalOptions.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor);
            AdditionalOptions.SizeToFit( );

            OrSpacerLabel = new UILabel( );
            ScrollView.AddSubview(OrSpacerLabel);
            ControlStyling.StyleUILabel(OrSpacerLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            OrSpacerLabel.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor);
            OrSpacerLabel.Text      = LoginStrings.OrString;
            OrSpacerLabel.SizeToFit( );

            RegisterButton = UIButton.FromType(UIButtonType.System);
            ScrollView.AddSubview(RegisterButton);
            ControlStyling.StyleButton(RegisterButton, LoginStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            //RegisterButton.BackgroundColor = UIColor.Clear;
            RegisterButton.SizeToFit( );
            RegisterButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                Springboard.RegisterNewUser( );
            };

            // setup the result
            LoginResult = new StyledTextField( );
            ScrollView.AddSubview(LoginResult.Background);

            ControlStyling.StyleTextField(LoginResult.Field, "", ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            ControlStyling.StyleBGLayer(LoginResult.Background);
            LoginResult.Field.UserInteractionEnabled = false;
            LoginResult.Field.TextAlignment          = UITextAlignment.Center;

            // setup the facebook button
            FacebookLogin = new UIButton( );
            ScrollView.AddSubview(FacebookLogin);
            string imagePath = NSBundle.MainBundle.BundlePath + "/" + "facebook_login.png";

            FBImageView = new UIImageView(new UIImage(imagePath));

            FacebookLogin.SetTitle("", UIControlState.Normal);
            FacebookLogin.AddSubview(FBImageView);
            FacebookLogin.Layer.CornerRadius = 4;
            FBImageView.Layer.CornerRadius   = 4;

            FacebookLogin.TouchUpInside += (object sender, EventArgs e) =>
            {
                TryFacebookBind();
            };

            // If cancel is pressed, notify the springboard we're done.
            CancelButton = UIButton.FromType(UIButtonType.System);
            ScrollView.AddSubview(CancelButton);
            CancelButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor), UIControlState.Normal);
            CancelButton.SetTitle(GeneralStrings.Cancel, UIControlState.Normal);
            CancelButton.SizeToFit( );
            CancelButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                // don't allow canceling while we wait for a web request.
                if (LoginState.Trying != State)
                {
                    Springboard.ResignModelViewController(this, null);
                }
            };


            // set the title image for the bar if there's no safe area defined. (A safe area is like, say, the notch for iPhone X)
            nfloat safeAreaTopInset = 0;

            // Make sure they're on iOS 11 before checking for insets. This is only needed for iPhone X anyways, which shipped with iOS 11.
            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                safeAreaTopInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top;
            }

            // setup the fake header if they're not on a device with save zones (iphone x)
            if (safeAreaTopInset == 0)
            {
                HeaderView = new UIView( );
                View.AddSubview(HeaderView);
                HeaderView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor);

                imagePath = NSBundle.MainBundle.BundlePath + "/" + PrivatePrimaryNavBarConfig.LogoFile_iOS;
                LogoView  = new UIImageView(new UIImage(imagePath));
                LogoView.SizeToFit( );
                LogoView.Layer.AnchorPoint = CGPoint.Empty;

                HeaderView.AddSubview(LogoView);
                HeaderView.SizeToFit( );
            }
        }
Esempio n. 8
0
        void ReleaseDesignerOutlets()
        {
            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (BackgroundVisualEffectView != null)
            {
                BackgroundVisualEffectView.Dispose();
                BackgroundVisualEffectView = null;
            }

            if (AppIconImageView != null)
            {
                AppIconImageView.Dispose();
                AppIconImageView = null;
            }

            if (AppleIDTextField != null)
            {
                AppleIDTextField.Dispose();
                AppleIDTextField = null;
            }

            if (ForgotPasswordButton != null)
            {
                ForgotPasswordButton.Dispose();
                ForgotPasswordButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (SigninButton != null)
            {
                SigninButton.Dispose();
                SigninButton = null;
            }

            if (SigninHeaderTextField != null)
            {
                SigninHeaderTextField.Dispose();
                SigninHeaderTextField = null;
            }

            if (VersionTextField != null)
            {
                VersionTextField.Dispose();
                VersionTextField = null;
            }

            if (WelcomeTextField != null)
            {
                WelcomeTextField.Dispose();
                WelcomeTextField = null;
            }
        }