private void InitJosApps(AuthAccount result)
        {
            HMSAccountManager.Instance.HuaweiId = result;
            Debug.Log("HMS GAMES: Setted app");
            IJosAppsClient josAppsClient = JosApps.GetJosAppsClient();

            Debug.Log("HMS GAMES: jossClient");
            josAppsClient.Init();
            Debug.Log("HMS GAMES: jossClient init");
            InitGameManagers();
        }
Beispiel #2
0
 private void Init()
 {
     Debug.Log("HMS GAMES init");
     if (accountManager.HuaweiId != null)
     {
         Debug.Log("HMS GAMES: Setted app");
         IJosAppsClient josAppsClient = JosApps.GetJosAppsClient(accountManager.HuaweiId);
         Debug.Log("HMS GAMES: jossClient");
         josAppsClient.Init();
         Debug.Log("HMS GAMES: jossClient init");
     }
 }
Beispiel #3
0
        public void AuthenticateUser(Action <bool> callback = null)
        {
            if (!IsAuthenticated())
            {
                _authService.StartSignIn(authId =>
                {
                    Debug.Log(TAG + ": Signed In Succesfully!");

                    commonAuthUser = new CommonAuthUser
                    {
                        email    = authId.Email,
                        name     = authId.DisplayName,
                        id       = authId.OpenId,
                        photoUrl = authId.AvatarUriString
                    };

                    PlayerPrefs.SetInt("autoLogin", 1);

                    HuaweiId = authId;
                    Debug.Log(TAG + ": HuaweiIdToken is " + HuaweiId.IdToken);

                    //Load IJosAppClient for HMS
                    HuaweiMobileServicesUtil.SetApplication();
                    IJosAppsClient josAppsClient = JosApps.GetJosAppsClient(HuaweiId);
                    josAppsClient.Init();


                    _rankingClient     = Games.GetRankingsClient(HuaweiId);
                    _achievementClient = Games.GetAchievementsClient(HuaweiId);

                    callback?.Invoke(true);
                }, (error) =>
                {
                    commonAuthUser = null;
                    callback?.Invoke(false);
                });
            }
        }
Beispiel #4
0
        private void Init()
        {
            Debug.Log("HMS GAMES init");
            authService = accountManager.GetGameAuthService();

            ITask <AuthHuaweiId> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                accountManager.HuaweiId = result;
                Debug.Log("HMS GAMES: Setted app");
                IJosAppsClient josAppsClient = JosApps.GetJosAppsClient(accountManager.HuaweiId);
                Debug.Log("HMS GAMES: jossClient");
                josAppsClient.Init();
                Debug.Log("HMS GAMES: jossClient init");
                InitGameMAnagers();
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMS GAMES: The app has not been authorized");
                authService.StartSignIn(SignInSuccess, SignInFailure);
                InitGameMAnagers();
            });
        }