public void Update()
        {
            if (Time.unscaledTime - _lastTimeCheckedInternetConnection > INTERNET_CONNECTION_CHECK_INTERVAL_SECONDS)
            {
                DropboxSyncUtils.IsOnlineAsync((isOnline) => {
                    if (isOnline)
                    {
                        if (!_wasConnectedWhenCheckedLastTime && _lastTimeCheckedInternetConnection > -1)
                        {
                            OnInternetConnectionRecovered();

                            foreach (var a in _onInternetRecoverOnceCallbacks)
                            {
                                a();
                            }
                            _onInternetRecoverOnceCallbacks.Clear();
                        }

                        _wasConnectedWhenCheckedLastTime = true;
                    }
                    else
                    {
                        if (_wasConnectedWhenCheckedLastTime && _lastTimeCheckedInternetConnection > -1)
                        {
                            OnLostInternetConnection();
                        }

                        _wasConnectedWhenCheckedLastTime = false;
                    }
                });
                _lastTimeCheckedInternetConnection = Time.unscaledTime;
            }
        }
Esempio n. 2
0
 public static void ValidateAccessToken(string accessToken)
 {
     if (DropboxSyncUtils.IsBadAccessToken(accessToken))
     {
         throw new Exception("Bad Dropbox access token. Please specify a valid access token.");
     }
 }