Pārlūkot izejas kodu

fix

Signed-off-by: Marino Faggiana <8616947+marinofaggiana@users.noreply.github.com>
Marino Faggiana 1 gadu atpakaļ
vecāks
revīzija
9c281f791a
2 mainītis faili ar 11 papildinājumiem un 4 dzēšanām
  1. 3 4
      iOSClient/AppDelegate.swift
  2. 8 0
      iOSClient/NCImageCache.swift

+ 3 - 4
iOSClient/AppDelegate.swift

@@ -133,8 +133,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             NCManageDatabase.shared.setCapabilities(account: account)
             NCManageDatabase.shared.setCapabilities(account: account)
 
 
             NCBrandColor.shared.settingThemingColor(account: activeAccount.account)
             NCBrandColor.shared.settingThemingColor(account: activeAccount.account)
-            NCImageCache.shared.createImagesCache()
-            NCImageCache.shared.createMediaCache(account: activeAccount.account)
 
 
         } else {
         } else {
 
 
@@ -142,8 +140,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             if let bundleID = Bundle.main.bundleIdentifier {
             if let bundleID = Bundle.main.bundleIdentifier {
                 UserDefaults.standard.removePersistentDomain(forName: bundleID)
                 UserDefaults.standard.removePersistentDomain(forName: bundleID)
             }
             }
-
-            NCImageCache.shared.createImagesCache()
         }
         }
 
 
         NCBrandColor.shared.createUserColors()
         NCBrandColor.shared.createUserColors()
@@ -197,6 +193,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
 
         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Application did become active")
         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Application did become active")
 
 
+        NCImageCache.shared.createMediaCache(account: account)
+        NCImageCache.shared.createImagesCache()
+
         NCSettingsBundleHelper.setVersionAndBuildNumber()
         NCSettingsBundleHelper.setVersionAndBuildNumber()
         NCSettingsBundleHelper.checkAndExecuteSettings(delay: 0.5)
         NCSettingsBundleHelper.checkAndExecuteSettings(delay: 0.5)
 
 

+ 8 - 0
iOSClient/NCImageCache.swift

@@ -34,6 +34,8 @@ import NextcloudKit
     // MARK: -
     // MARK: -
 
 
     private let limit: Int = 1000
     private let limit: Int = 1000
+    private var account: String = ""
+    private var brandElementColor: UIColor?
 
 
     enum ImageType {
     enum ImageType {
         case placeholder
         case placeholder
@@ -52,6 +54,9 @@ import NextcloudKit
 
 
     func createMediaCache(account: String) {
     func createMediaCache(account: String) {
 
 
+        guard account != self.account, !account.isEmpty else { return }
+        self.account = account
+
         ocIdEtag.removeAll()
         ocIdEtag.removeAll()
         metadatas.removeAll()
         metadatas.removeAll()
         getMediaMetadatas(account: account)
         getMediaMetadatas(account: account)
@@ -197,6 +202,9 @@ import NextcloudKit
     func createImagesCache() {
     func createImagesCache() {
 
 
         let brandElement = NCBrandColor.shared.brandElement
         let brandElement = NCBrandColor.shared.brandElement
+        guard brandElement != self.brandElementColor else { return }
+        self.brandElementColor = brandElement
+
         let yellowFavorite = NCBrandColor.shared.yellowFavorite
         let yellowFavorite = NCBrandColor.shared.yellowFavorite
         let utility = NCUtility()
         let utility = NCUtility()