Marino Faggiana 7 жил өмнө
parent
commit
014053a9c4

+ 35 - 15
iOSClient/AppDelegate.m

@@ -1028,44 +1028,64 @@
 
 - (void)settingThemingColorBrand
 {
-    UIColor *newColor, *newColorText;
+    UIColor *newColor, *newColorElement, *newColorText;
     
     if (self.activeAccount.length > 0) {
     
         tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilites];
     
-        if ([NCBrandOptions sharedInstance].use_themingColor && capabilities.themingColor.length == 7) {
+        if ([NCBrandOptions sharedInstance].use_themingColor) {
         
-            newColor = [CCGraphics colorFromHexString:capabilities.themingColor];
-            newColorText = [CCGraphics colorFromHexString:capabilities.themingColorText];
+            // COLOR
+            if (capabilities.themingColor.length == 7) {
+                newColor = [CCGraphics colorFromHexString:capabilities.themingColor];
+            } else {
+                newColor = [NCBrandColor sharedInstance].customer;
+            }
+            
+            // COLOR TEXT
+            if (capabilities.themingColorText.length == 7) {
+                newColorText = [CCGraphics colorFromHexString:capabilities.themingColorText];
+            } else {
+                newColorText = [NCBrandColor sharedInstance].customerText;
+            }
+            
+            // COLOR ELEMENT
+            if (capabilities.themingColorElement.length == 7) {
+                newColorElement = [CCGraphics colorFromHexString:capabilities.themingColorElement];
+            } else {
+                if ([capabilities.themingColorText isEqualToString:@"#000000"])
+                    newColorElement = [UIColor blackColor];
+                else
+                    newColorElement = newColor;
+            }
             
         } else {
             
             newColor = [NCBrandColor sharedInstance].customer;
+            newColorElement = [NCBrandColor sharedInstance].customer;
             newColorText = [NCBrandColor sharedInstance].customerText;
         }
         
     } else {
         
         newColor = [NCBrandColor sharedInstance].customer;
+        newColorElement = [NCBrandColor sharedInstance].customer;
         newColorText = [NCBrandColor sharedInstance].customerText;
     }
     
-    if (self.activeAccount.length > 0 && ![newColor isEqual:[NCBrandColor sharedInstance].brand] && newColor) {
-        
-        [NCBrandColor sharedInstance].brand = newColor;
-        [NCBrandColor sharedInstance].brandText = newColorText;
-        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
-    }
+    [NCBrandColor sharedInstance].brand = newColor;
+    [NCBrandColor sharedInstance].brandElement = newColorElement;
+    [NCBrandColor sharedInstance].brandText = newColorText;
+
+    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
 }
 
 - (void)changeTheming:(UIViewController *)vc
 {
-    UIColor *color = [NCBrandColor sharedInstance].brand;
-    
     // Change Navigation & TabBar color
-    vc.navigationController.navigationBar.barTintColor = color;
-    vc.tabBarController.tabBar.tintColor = color;
+    vc.navigationController.navigationBar.barTintColor = [NCBrandColor sharedInstance].brand;
+    vc.tabBarController.tabBar.tintColor = [NCBrandColor sharedInstance].brandElement;
     // Change bar bottom line shadow
     vc.navigationController.navigationBar.shadowImage = [CCGraphics generateSinglePixelImageWithColor:[NCBrandColor sharedInstance].brand];
     
@@ -1074,7 +1094,7 @@
     UITabBarController *tabBarController = [splitViewController.viewControllers firstObject];
     
     UIButton *button = [tabBarController.view viewWithTag:99];
-    UIImage *buttonImage = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"tabBarPlus"] color:color];
+    UIImage *buttonImage = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"tabBarPlus"] color:[NCBrandColor sharedInstance].brandElement];
     
     [button setBackgroundImage:buttonImage forState:UIControlStateNormal];
     [button setBackgroundImage:buttonImage forState:UIControlStateHighlighted];

+ 1 - 2
iOSClient/Brand/NCBrand.swift

@@ -32,7 +32,6 @@ class NCBrandColor: NSObject {
 
     // Color
     @objc public let customer:              UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)    // BLU NC : #0082c9
-    @objc public var customerElement:       UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)    // BLU NC : #0082c9
     @objc public var customerText:          UIColor = .white
     
     @objc public var brand:                 UIColor                                                                                 // don't touch me
@@ -50,7 +49,7 @@ class NCBrandColor: NSObject {
 
     override init() {
         self.brand = self.customer
-        self.brandElement = self.customerElement
+        self.brandElement = self.customer
         self.brandText = self.customerText
     }
     

+ 11 - 3
iOSClient/Main/CCMain.m

@@ -324,6 +324,9 @@
     self.searchController.searchBar.barTintColor = [NCBrandColor sharedInstance].brand;
     self.searchController.searchBar.backgroundColor = [NCBrandColor sharedInstance].brand;
     
+    // Title
+    [self setTitle];
+    
     // Reload Table View
     [self tableViewReloadData];
 }
@@ -555,10 +558,15 @@
             
             self.navigationItem.title = nil;
             
-            if ([appDelegate.reachability isReachable] == NO)
+            if ([appDelegate.reachability isReachable] == NO) {
                 _ImageTitleHomeCryptoCloud = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navigationLogoOffline"]];
-            else
-                _ImageTitleHomeCryptoCloud = [[UIImageView alloc] initWithImage:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"navigationLogo"] color:[NCBrandColor sharedInstance].brandText]];
+            } else {
+                tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilites];
+                if ([capabilities.themingColor isEqualToString:@"#FFFFFF"])
+                    _ImageTitleHomeCryptoCloud = [[UIImageView alloc] initWithImage:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"navigationLogo"] color:[UIColor blackColor]]];
+                else
+                    _ImageTitleHomeCryptoCloud = [[UIImageView alloc] initWithImage:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"navigationLogo"] color:[UIColor whiteColor]]];
+            }
             
             [_ImageTitleHomeCryptoCloud setUserInteractionEnabled:YES];
             UITapGestureRecognizer *singleTap =  [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(menuLogo:)];