Example #1
0
 public void OnConnectionSuspended(int resultCode)
 {
     resolving = false;
     SignedOut = false;
     signingIn = false;
     client.Disconnect();
     OnSignInFailed?.Invoke(this, EventArgs.Empty);
 }
        public void CancelAuthorization()
        {
            ITask <HuaweiMobileServices.Utils.Void> taskAuthHuaweiId = authService.CancelAuthorization();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                Debug.Log("[HMS]: CancelAuthorization onSuccess ");
            }).AddOnFailureListener((exception) =>
            {
                OnSignInFailed?.Invoke(exception);
            });
        }
 public void SignInDrive()
 {
     Debug.Log("[HMS]: Sign in Drive " + authServiceDrive);
     authServiceDrive.StartSignIn((authId) =>
     {
         HuaweiId = authId;
         OnSignInSuccess?.Invoke(authId);
     }, (error) =>
     {
         HuaweiId = null;
         OnSignInFailed?.Invoke(error);
     });
 }
        public void CancelAuthorization()
        {
            ITask <HuaweiMobileServices.Utils.Void> taskAuthHuaweiId = authService.CancelAuthorization();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                Debug.Log("[HMSAccountManager]: CancelAuthorization onSuccess ");
            }).AddOnFailureListener((exception) =>
            {
                Debug.LogError("[HMSAccountManager]: Cancel Authorization failed. CauseMessage: " + exception.WrappedCauseMessage + ", ExceptionMessage: " + exception.WrappedExceptionMessage);
                OnSignInFailed?.Invoke(exception);
            });
        }
        public void SilentSignIn()
        {
            ITask <AuthAccount> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                HuaweiId = result;
                OnSignInSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                HuaweiId = null;
                OnSignInFailed?.Invoke(exception);
            });
        }
 public void SignIn()
 {
     Debug.Log("[HMSAccountManager]: Sign in " + authService);
     authService.StartSignIn((authId) =>
     {
         HuaweiId = authId;
         OnSignInSuccess?.Invoke(authId);
     }, (error) =>
     {
         HuaweiId = null;
         Debug.LogError("[HMSAccountManager]: Sign in failed. CauseMessage: " + error.WrappedCauseMessage + ", ExceptionMessage: " + error.WrappedExceptionMessage);
         OnSignInFailed?.Invoke(error);
     });
 }
Example #7
0
 public void ResetPassword(string countryCode, string phoneNumber, string newPassword, string verifyCode)
 {
     if (_AGConnectAuth == null)
     {
         return;
     }
     _AGConnectAuth.ResetPassword(countryCode, phoneNumber, newPassword, verifyCode)
     .AddOnSuccessListener(Void => {
         OnResetPasswordSuccess?.Invoke(true);
     })
     .AddOnFailureListener(error => {
         OnSignInFailed?.Invoke(error);
     });
 }
Example #8
0
 /// <summary>
 /// Processes the Activity Results from the Signin process. MUST be called from your activity OnActivityResult override.
 /// </summary>
 /// <param name="requestCode">Request code.</param>
 /// <param name="resultCode">Result code.</param>
 /// <param name="data">Data.</param>
 public void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     if (requestCode == RC_RESOLVE)
     {
         if (resultCode == Result.Ok)
         {
             Start();
         }
         else
         {
             OnSignInFailed?.Invoke(this, EventArgs.Empty);
         }
     }
 }
        public void SilentSignIn()
        {
            ITask <AuthAccount> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                HuaweiId = result;
                OnSignInSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                HuaweiId = null;
                Debug.LogError("[HMSAccountManager]: Silent Sign in failed. CauseMessage: " + exception.WrappedCauseMessage + ", ExceptionMessage: " + exception.WrappedExceptionMessage);
                OnSignInFailed?.Invoke(exception);
            });
        }
Example #10
0
 public void SignInAnonymously()
 {
     if (_AGConnectAuth == null)
     {
         return;
     }
     _AGConnectAuth.SignInAnonymously()
     .AddOnSuccessListener((signInResult) =>
     {
         OnSignInSuccess?.Invoke(signInResult);
     })
     .AddOnFailureListener((error) =>
     {
         OnSignInFailed?.Invoke(error);
     });
 }
Example #11
0
 public void SignIn(AGConnectAuthCredential paramAGConnectAuthCredential)
 {
     if (_AGConnectAuth == null)
     {
         return;
     }
     _AGConnectAuth.SignIn(paramAGConnectAuthCredential)
     .AddOnSuccessListener((signInResult) =>
     {
         OnSignInSuccess?.Invoke(signInResult);
     })
     .AddOnFailureListener((error) =>
     {
         OnSignInFailed?.Invoke(error);
     });
 }
 public void SignInAnonymously()
 {
     if (_AGConnectAuth == null)
     {
         return;
     }
     _AGConnectAuth.SignInAnonymously()
     .AddOnSuccessListener((signInResult) =>
     {
         OnSignInSuccess?.Invoke(signInResult);
     })
     .AddOnFailureListener((error) =>
     {
         Debug.LogError("[HMSAuthServiceManager]: Sign in Anonymously failed. CauseMessage: " + error.WrappedCauseMessage + ", ExceptionMessage: " + error.WrappedExceptionMessage);
         OnSignInFailed?.Invoke(error);
     });
 }
Example #13
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (resolving)
            {
                return;
            }

            if (result.HasResolution)
            {
                resolving = true;
                result.StartResolutionForResult(activity, RC_RESOLVE);
                return;
            }

            resolving = false;
            SignedOut = false;
            signingIn = false;
            OnSignInFailed?.Invoke(this, EventArgs.Empty);
        }
    public Task SignInAnonymously()
    {
        return(auth.SignInAnonymouslyAsync().ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("SignInAnonymouslyAsync was canceled.");
                OnSignInFailed?.Invoke();
                return;
            }

            if (task.IsFaulted)
            {
                Debug.LogError("SignInAnonymouslyAsync encountered an error: " + task.Exception);
                OnSignInFailed?.Invoke();
                return;
            }

            user = task.Result;
            Debug.LogFormat("User signed in successfully: {0} ({1})", user.DisplayName, user.UserId);
        }));
    }