Просмотр исходного кода

Reset notification status when a new version is detected

Jonas Björkert 2 лет назад
Родитель
Сommit
646ed636cb

+ 6 - 0
LoopFollow/helpers/AppVersionManager.swift

@@ -24,6 +24,12 @@ class AppVersionManager {
         let currentVersionBlackListed = UserDefaultsRepository.currentVersionBlackListed.value
         let cachedForVersion = UserDefaultsRepository.cachedForVersion.value
         
+        // Reset notifications if version has changed
+        if let cachedVersion = cachedForVersion, cachedVersion != currentVersion {
+            UserDefaultsRepository.lastBlacklistNotificationShown.value = Date.distantPast
+            UserDefaultsRepository.lastVersionUpdateNotificationShown.value = Date.distantPast
+        }
+        
         // Check if the cache is still valid
         if let cachedVersion = cachedForVersion, cachedVersion == currentVersion,
            now.timeIntervalSince(latestVersionChecked) < 24 * 3600, let latestVersion = latestVersion {

+ 1 - 0
LoopFollow/helpers/GitHubService.swift

@@ -18,6 +18,7 @@ class GitHubService {
             case .versionConfig:
                 return "https://raw.githubusercontent.com/loopandlearn/LoopFollow/main/Config.xcconfig"
             case .blacklistedVersions:
+                return "https://raw.githubusercontent.com/bjorkert/LoopFollow/Main/blacklisted-versions.json"
                 return "https://raw.githubusercontent.com/loopandlearn/LoopFollow/main/blacklisted-versions.json"
             }
         }