예제 #1
0
        public void SaveLoggedUserGoogleId(string googleId)
        {
            if (_preferences.ContainsKey(GoogleIdKey))
            {
                _preferences.Remove(GoogleIdKey);
            }

            _preferences.Set(GoogleIdKey, googleId);
        }
예제 #2
0
 public static async Task <string> GetStringDecrypted(this IPreferences self, string key, string defaultValue, string password)
 {
     if (await self.ContainsKey(key))
     {
         return((await self.Get <string>(key, null)).Decrypt(password));
     }
     return(defaultValue);
 }
        public virtual bool Remove(string key)
        {
            var exists = _preferences.ContainsKey(key);

            _preferences.Remove(key);

            return(exists);
        }
예제 #4
0
        public void Track()
        {
            if (versionTrail != null)
            {
                return;
            }

            IsFirstLaunchEver = !preferences.ContainsKey(versionsKey, sharedName) || !preferences.ContainsKey(buildsKey, sharedName);
            if (IsFirstLaunchEver)
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, new List <string>() },
                    { buildsKey, new List <string>() }
                };
            }
            else
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, ReadHistory(versionsKey).ToList() },
                    { buildsKey, ReadHistory(buildsKey).ToList() }
                };
            }

            IsFirstLaunchForCurrentVersion = !versionTrail[versionsKey].Contains(CurrentVersion);
            if (IsFirstLaunchForCurrentVersion)
            {
                versionTrail[versionsKey].Add(CurrentVersion);
            }

            IsFirstLaunchForCurrentBuild = !versionTrail[buildsKey].Contains(CurrentBuild);
            if (IsFirstLaunchForCurrentBuild)
            {
                versionTrail[buildsKey].Add(CurrentBuild);
            }

            if (IsFirstLaunchForCurrentVersion || IsFirstLaunchForCurrentBuild)
            {
                WriteHistory(versionsKey, versionTrail[versionsKey]);
                WriteHistory(buildsKey, versionTrail[buildsKey]);
            }
        }
예제 #5
0
        internal void InitVersionTracking()
        {
            IsFirstLaunchEver = !preferences.ContainsKey(versionsKey, sharedName) || !preferences.ContainsKey(buildsKey, sharedName);
            if (IsFirstLaunchEver)
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, new List <string>() },
                    { buildsKey, new List <string>() }
                };
            }
            else
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, ReadHistory(versionsKey).ToList() },
                    { buildsKey, ReadHistory(buildsKey).ToList() }
                };
            }

            IsFirstLaunchForCurrentVersion = !versionTrail[versionsKey].Contains(CurrentVersion) || CurrentVersion != LastInstalledVersion;
            if (IsFirstLaunchForCurrentVersion)
            {
                // Avoid duplicates and move current version to end of list if already present
                versionTrail[versionsKey].RemoveAll(v => v == CurrentVersion);
                versionTrail[versionsKey].Add(CurrentVersion);
            }

            IsFirstLaunchForCurrentBuild = !versionTrail[buildsKey].Contains(CurrentBuild) || CurrentBuild != LastInstalledBuild;
            if (IsFirstLaunchForCurrentBuild)
            {
                // Avoid duplicates and move current build to end of list if already present
                versionTrail[buildsKey].RemoveAll(b => b == CurrentBuild);
                versionTrail[buildsKey].Add(CurrentBuild);
            }

            if (IsFirstLaunchForCurrentVersion || IsFirstLaunchForCurrentBuild)
            {
                WriteHistory(versionsKey, versionTrail[versionsKey]);
                WriteHistory(buildsKey, versionTrail[buildsKey]);
            }
        }
        public WebAssemblyVersionTracking(IPreferences preferences, IAppInfo appInfo)
        {
            _preferences = preferences;
            _appInfo     = appInfo;

            IsFirstLaunchEver = !_preferences.ContainsKey(versionsKey, sharedName) || !_preferences.ContainsKey(buildsKey, sharedName);
            if (IsFirstLaunchEver)
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, new List <string>() },
                    { buildsKey, new List <string>() }
                };
            }
            else
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, ReadHistory(versionsKey).ToList() },
                    { buildsKey, ReadHistory(buildsKey).ToList() }
                };
            }

            IsFirstLaunchForCurrentVersion = !versionTrail[versionsKey].Contains(CurrentVersion);
            if (IsFirstLaunchForCurrentVersion)
            {
                versionTrail[versionsKey].Add(CurrentVersion);
            }

            IsFirstLaunchForCurrentBuild = !versionTrail[buildsKey].Contains(CurrentBuild);
            if (IsFirstLaunchForCurrentBuild)
            {
                versionTrail[buildsKey].Add(CurrentBuild);
            }

            if (IsFirstLaunchForCurrentVersion || IsFirstLaunchForCurrentBuild)
            {
                WriteHistory(versionsKey, versionTrail[versionsKey]);
                WriteHistory(buildsKey, versionTrail[buildsKey]);
            }
        }
예제 #7
0
 public bool ContainsKey(string key, string sharedName) =>
 _preferences.ContainsKey(key, sharedName);