Exemple #1
0
        public void OnLoginClicked()
        {
            try
            {
                if (verifyCode.text.Trim() != "")
                {
                    credential =
                        EmailAuthProvider.credentialWithVerifyCode(email.text.Trim(), password.text.Trim(), verifyCode.text.Trim());
                }
                else
                {
                    credential =
                        EmailAuthProvider.credentialWithPassword(email.text, password.text);
                }

                if (credential.getProvider() == AGConnectAuthCredential.Email_Provider)
                {
                    AGConnectAuth.getInstance().signIn(credential)
                    .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
                    {
                        UnityMainThread.instance.AddJob(() =>
                        {
                            PanelController.popupinstance.ShowInfo("Login in successfully");
                            PanelController.userInfo.ParentPanel = this;
                            PanelController.getInstance().OpenPanel(PanelController.userInfo);
                        });
                    })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                          ) =>
                    {
                        UnityMainThread.instance.AddJob(() =>
                        {
                            Error error   = new Error();
                            error.message = e.toString();
                            PanelController.popupinstance.ShowError(error);
                        });
                    }));
                }
            }
            catch (System.Exception e)
            {
                Error error = new Error();
                error.message = e.Message;
                PanelController.popupinstance.ShowError(error);
            }
        }