Exemplo n.º 1
0
        protected override void fillDefaultData()
        {
            base.fillDefaultData();

            //Usuario anonimo
            UserGem anon = new UserGem(ANONYMOUS_USER);

            cleanToAnonymousData(anon);
            currentData.users.Add(anon);
        }
Exemplo n.º 2
0
        protected override void afterFirstRead()
        {
            base.afterFirstRead();

            //TODO esto se va porque es un parche para SHOPIKA
            if (!string.IsNullOrEmpty(currentData.lastTimeLocalGemsGranted))
            {
                localGemsLastDate = DateTime.ParseExact(currentData.lastTimeLocalGemsGranted, "dd-MM-yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            }

            if (!string.IsNullOrEmpty(currentData.lastUsedId))
            {
                UserGem prevUser = currentData.getUserById(currentData.lastUsedId);

                if (prevUser != null && !string.IsNullOrEmpty(prevUser.accesToken) && !string.IsNullOrEmpty(prevUser._id) && !string.IsNullOrEmpty(prevUser.shareCode))
                {
                    OnUserLoggedIn(prevUser._id, prevUser.accesToken, prevUser.shareCode);
                }
            }
        }
Exemplo n.º 3
0
        public void diffUser(UserGem remoteUser, bool ignoreVersion = false)
        {
            if (currentUserId != remoteUser._id)
            {
                Debug.Log("Se recibieron datos de otro usuario: " + currentUserId + "," + remoteUser._id);
                return;
            }

            bool modified = currentUser.compareAndUpdate(remoteUser, ignoreVersion);

            saveLocalData(false);

            if (_mustShowDebugInfo)
            {
                Debug.Log("Sincronizadas: " + currentUser.gems + " para: " + currentUser._id);
            }

            if (modified)
            {
                afterGemsModified();
            }
        }
Exemplo n.º 4
0
 private void cleanToAnonymousData(UserGem user)
 {
     user.clear();
     user._id = ANONYMOUS_USER;
 }