Răsfoiți Sursa

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 ani în urmă
părinte
comite
5281e917ac
3 a modificat fișierele cu 30 adăugiri și 14 ștergeri
  1. 4 0
      Share/NCShareExtension.swift
  2. 7 0
      iOSClient/AppDelegate.swift
  3. 19 14
      iOSClient/Brand/NCBrand.swift

+ 4 - 0
Share/NCShareExtension.swift

@@ -126,6 +126,10 @@ class NCShareExtension: UIViewController {
             NCCommunicationCommon.shared.writeLog("Start session with level \(levelLog) " + versionNextcloudiOS)
         }
 
+        // Colors
+        NCBrandColor.shared.createImagesThemingColor()
+        NCBrandColor.shared.createUserColors()
+
         hud.indicatorView = JGProgressHUDRingIndicatorView()
         if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView {
             indicatorView.ringWidth = 1.5

+ 7 - 0
iOSClient/AppDelegate.swift

@@ -120,14 +120,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
             settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account))
 
+            NCBrandColor.shared.settingThemingColor(account: activeAccount.account)
+
         } else {
 
             CCUtility.deleteAllChainStore()
             if let bundleID = Bundle.main.bundleIdentifier {
                 UserDefaults.standard.removePersistentDomain(forName: bundleID)
             }
+
+            NCBrandColor.shared.createImagesThemingColor()
         }
 
+        // Create user color
+        NCBrandColor.shared.createUserColors()
+
         // initialize
         NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize, userInfo:["atStart":1])

+ 19 - 14
iOSClient/Brand/NCBrand.swift

@@ -106,17 +106,6 @@ import UIKit
 class NCBrandColor: NSObject {
     @objc static let shared: NCBrandColor = {
         let instance = NCBrandColor()
-        #if !EXTENSION
-        if let tableAccount = NCManageDatabase.shared.getActiveAccount() {
-            instance.settingThemingColor(account: tableAccount.account)
-        } else {
-            instance.createImagesThemingColor()
-        }
-        instance.createUserColors()
-        #else
-        instance.createImagesThemingColor()
-        instance.createUserColors()
-        #endif
         return instance
     }()
 
@@ -359,11 +348,27 @@ class NCBrandColor: NSObject {
         brandText = customerText
     }
 
-    private func createUserColors() {
+    /*
+    func createColors() {
+        #if !EXTENSION
+        if let tableAccount = NCManageDatabase.shared.getActiveAccount() {
+            settingThemingColor(account: tableAccount.account)
+        } else {
+            createImagesThemingColor()
+        }
+        createUserColors()
+        #else
+        createImagesThemingColor()
+        createUserColors()
+        #endif
+    }
+    */
+    
+    func createUserColors() {
         userColors = generateColors()
     }
 
-    public func createImagesThemingColor() {
+    func createImagesThemingColor() {
 
         let gray: UIColor = UIColor(red: 162.0/255.0, green: 162.0/255.0, blue: 162.0/255.0, alpha: 0.5)
 
@@ -407,7 +412,7 @@ class NCBrandColor: NSObject {
     }
 
     #if !EXTENSION
-    public func settingThemingColor(account: String) {
+    func settingThemingColor(account: String) {
 
         let darker: CGFloat = 30    // %
         let lighter: CGFloat = 30   // %