예제 #1
0
        private void LoginUser(string phoneNumber)
        {
            FirebaseDatabase database = FirebaseDatabase.Instance;
            FirebaseCallback p        = new FirebaseCallback();

            p.LoginUserAsync(database, phoneNumber);
            p._Auth += (sender, obj) =>
            {
                Progress.Hide();
                if (!string.IsNullOrEmpty(obj.UserID))
                {
                    SaveUserData(obj);
                    ActivityOptionsCompat option = ActivityOptionsCompat.MakeSceneTransitionAnimation(Activity);
                    Intent intent = new Intent(Activity, typeof(MainActivity));
                    StartActivity(intent);
                }
                else
                {
                    LoginFailAlertDialog();
                }
            };
        }
예제 #2
0
        private void CreateAccount(User S)
        {
            var progress = new ProgressDialog(Activity);

            progress.SetMessage(Resources.GetString(Resource.String.tilte_connecting));
            progress.SetCanceledOnTouchOutside(false);
            progress.Show();

            FirebaseDatabase database = FirebaseDatabase.Instance;
            FirebaseCallback p        = new FirebaseCallback();
            FirebaseCallback u        = new FirebaseCallback();

            u.LoginUserAsync(database, S.PhoneNumber);
            u._Auth += (o, data) =>
            {
                if (!string.IsNullOrEmpty(data.PhoneNumber))
                {
                    progress.Hide();
                    RegFailAlertDialog();
                }
                else
                {
                    p.CreateUserAsync(database, S);
                    p._Auth += (sender, obj) =>
                    {
                        progress.Hide();
                        if (!string.IsNullOrEmpty(obj.UserID))
                        {
                            SaveUserData(obj);
                            Intent I = new Intent(Context, typeof(MainActivity));
                            StartActivity(I);
                        }
                    };
                }
            };
        }