コード例 #1
0
 public void Initialized(THSdkAuthResponseAllInOne response, string appId)
 {
     ServerTimeDiff = response.SdkAuthResponse.ServerTime - DateTime.Now.ToUnixTimestamp();
     IsInitialized  = true;
     AppId          = appId;
     SaveSession(response.SdkAuthResponse.SessionId, response.SdkAuthResponse.User);
     InviteChannels = response.InviteProviders.Providers;
     OnInit.SafeCall();
     OnInit = null;
 }
コード例 #2
0
        private void Init(THSdkAuthRequest request)
        {
            LogRequest("authenticateSdk", request);
            WithHadesClient(client =>
            {
                THSdkAuthResponseAllInOne response = null;
                while (response == null)
                {
                    try
                    {
                        try {
                            response = client.authenticateSdkAllInOne(new THSdkAuthRequestAllInOne
                            {
                                SdkAuthRequest        = request,
                                ProcessAppOpenRequest = new THProcessAppOpenRequest
                                {
                                }
                            });
                        }
                        catch (THErrors errors)
                        {
                            GetSocialLogs.W(errors.Errors.First().ErrorMsg);
                            throw errors; // if GetSocial exception - rethrow
                        }
                    }
                    catch (Exception exception)
                    {
                        // if system exception - try again
                        Ui(() => GetSocialLogs.W("Failed to init GetSocial, retry in 1 second, exception: " + exception));

                        // wait for 1 sec
                        Thread.Sleep(1000);

                        // unity doesn't stop background threads, so we have to check a state of app
                        if (!EngineUtils.IsApplicationRunning())
                        {
                            return;
                        }
                    }
                }
                Ui(() =>
                {
                    LogResponse("authenticateSdk", response);
                    _stateController.Initialized(response, request.AppId);
#if !UNITY_EDITOR
                    TrackAnalyticsEvent(new AnalyticsEvent
                    {
                        Name      = AnalyticsEventDetails.AppSessionStart,
                        CreatedAt = ApplicationStateListener.Instance.AppStartTime
                    });
#endif
                });
            }, requireInitialization: false);
        }
コード例 #3
0
 public void Initialized(THSdkAuthResponseAllInOne response, string appId)
 {
     Info           = response.SdkAuthResponse.ApplicationInfo;
     ServerTimeDiff = response.SdkAuthResponse.ServerTime - DateTime.Now.ToUnixTimestamp();
     IsInitialized  = true;
     AppId          = appId;
     SaveSession(response.SdkAuthResponse.SessionId, response.SdkAuthResponse.User, response.SdkAuthResponse.UploadEndpoint);
     InviteChannels = response.InviteProviders.Providers;
     while (OnInitializeListeners.Any())
     {
         OnInitializeListeners.Pop().SafeCall();
     }
 }