Explorar o código

Refactoring, using helper class instead of UserDefaults directly

Jonas Björkert %!s(int64=2) %!d(string=hai) anos
pai
achega
f3f7780aed
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      LoopFollow/helpers/AppVersionManager.swift

+ 4 - 4
LoopFollow/helpers/AppVersionManager.swift

@@ -48,10 +48,10 @@ class AppVersionManager {
                         .map { $0.blacklistedVersions.map { $0.version }.contains(currentVersion) } ?? false
                     
                     // Update cache with new data
-                    UserDefaults.standard.set(fetchedVersion, forKey: "latestVersion")
-                    UserDefaults.standard.set(Date(), forKey: "latestVersionChecked")
-                    UserDefaults.standard.set(isBlacklisted, forKey: "isCurrentVersionBlacklisted")
-                    UserDefaults.standard.set(currentVersion, forKey: "cachedForVersion")
+                    UserDefaultsRepository.latestVersion.value = fetchedVersion
+                    UserDefaultsRepository.latestVersionChecked.value = Date()
+                    UserDefaultsRepository.currentVersionBlackListed.value = isBlacklisted
+                    UserDefaultsRepository.cachedForVersion.value = currentVersion
                     
                     // Call completion with new data
                     completion(fetchedVersion, isNewer, isBlacklisted)