Ejemplo n.º 1
0
        private void GoToHome()
        {
            Intent intent = new Intent(activity.ApplicationContext, typeof(HomeActivity));

            activity.StartActivity(intent);
            activity.Finish();
        }
Ejemplo n.º 2
0
        public async void OnResume()
        {
            AndroidLoginManager loginManager = AndroidLoginManager.Instance(activity.ApplicationContext);

            if (!await loginManager.IsLoggedIn())
            {
                //Display the login screen
                activity.StartActivity(typeof(LoginActivity));
            }
        }
Ejemplo n.º 3
0
        public async void OnAttemptLogin(string email, string password)
        {
            try{
                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
                {
                    view.OnLoginError("You must enter a username and password");
                }
                else
                {
                    AndroidLoginManager loginManager = AndroidLoginManager.Instance(activity.ApplicationContext);
                    LoginResult         loginResult  = await loginManager.Login(email, password);

                    view.ShowBusy(false);

                    activity.sendGaEvent("ui_action", "user login", "login result", Convert.ToInt16(loginResult.Success));
                    if (loginResult.Success)
                    {
                        AccountManager acm      = new AccountManager();
                        TravelerModel  traveler = await acm.GetTravelerByEmail(email);

                        if (traveler.InformedConsent)
                        {
                            Intent intent = new Intent(activity.ApplicationContext, typeof(HomeActivity));
                            activity.StartActivity(intent);
                            activity.Finish();
                        }
                        else
                        {
                            view.showTerms();
                        }
                    }
                    else
                    {
                        view.OnLoginError(loginResult.ErrorString);
                    }
                }
            }catch (Exception e) {
                Console.WriteLine(e);
                view.OnLoginError("Login failed");
            }
        }