浏览代码

Merge pull request #1258 from Infomaniak/new-design-bugfix

New design bugfix
Marino Faggiana 4 年之前
父节点
当前提交
5c306b7645
共有 3 个文件被更改,包括 26 次插入10 次删除
  1. 10 4
      iOSClient/Main/AppDelegate+Swift.swift
  2. 10 2
      iOSClient/Main/CCMain+Swift.swift
  3. 6 4
      iOSClient/Main/CCMain.m

+ 10 - 4
iOSClient/Main/AppDelegate+Swift.swift

@@ -14,24 +14,30 @@ extension AppDelegate {
         if #available(iOS 13.0, *) {
             var navBarAppearance = UINavigationBarAppearance()
             navBarAppearance.configureWithOpaqueBackground()
+            
+            navBarAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+            navBarAppearance.backgroundColor = NCBrandColor.sharedInstance.backgroundView
+            
             navBarAppearance.shadowColor = .clear
             navBarAppearance.shadowImage = UIImage()
+            
             viewController.navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
 
             navBarAppearance = UINavigationBarAppearance()
             navBarAppearance.configureWithOpaqueBackground()
-            navBarAppearance.backgroundColor = .systemBackground
+            
+            navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+            navBarAppearance.backgroundColor = NCBrandColor.sharedInstance.backgroundView
 
             viewController.navigationController?.navigationBar.standardAppearance = navBarAppearance
         } else {
             viewController.navigationController?.navigationBar.barStyle = .default
             viewController.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.backgroundView
             viewController.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.sharedInstance.textView]
-            if #available(iOS 11.0, *) {
-                viewController.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.sharedInstance.textView]
-            }
+            viewController.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.sharedInstance.textView]
         }
         viewController.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brand
+        viewController.navigationController?.navigationBar.setNeedsLayout()
     }
     
 }

+ 10 - 2
iOSClient/Main/CCMain+Swift.swift

@@ -15,11 +15,15 @@ extension CCMain {
             if #available(iOS 13.0, *) {
                 let navBarAppearance = UINavigationBarAppearance()
                 navBarAppearance.configureWithOpaqueBackground()
-                navBarAppearance.backgroundColor = .systemBackground
+                navBarAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                navBarAppearance.backgroundColor = NCBrandColor.sharedInstance.backgroundView
                 self.navigationController?.navigationBar.standardAppearance = navBarAppearance
                 self.navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
             } else {
                 self.navigationController?.navigationBar.barStyle = .default
+                self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                self.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
                 self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.backgroundView
                 self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brand
                 self.navigationController?.navigationBar.shadowImage = nil
@@ -31,13 +35,17 @@ extension CCMain {
             if #available(iOS 13.0, *) {
                 let navBarAppearance = UINavigationBarAppearance()
                 navBarAppearance.configureWithOpaqueBackground()
-                navBarAppearance.backgroundColor = .systemBackground
+                navBarAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                navBarAppearance.backgroundColor = NCBrandColor.sharedInstance.backgroundView
                 navBarAppearance.shadowColor = .clear
                 navBarAppearance.shadowImage = UIImage()
                 self.navigationController?.navigationBar.standardAppearance = navBarAppearance
                 self.navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
             } else {
                 self.navigationController?.navigationBar.barStyle = .default
+                self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
+                self.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
                 self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.backgroundView
                 self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brand
                 self.navigationController?.navigationBar.shadowImage = UIImage()

+ 6 - 4
iOSClient/Main/CCMain.m

@@ -167,7 +167,7 @@
     self.navigationItem.searchController = self.searchController;
     self.searchController.hidesNavigationBarDuringPresentation = true;
     self.navigationController.navigationBar.prefersLargeTitles = true;
-    self.navigationItem.hidesSearchBarWhenScrolling = false;
+    self.navigationItem.hidesSearchBarWhenScrolling = true;
     [self.navigationController.navigationBar sizeToFit];
 
     // Table Header View
@@ -216,8 +216,8 @@
 {
     [super viewWillAppear:animated];
     [self updateNavBarShadow:self.tableView force:false];
-    if (@available(iOS 13.0, *)) {
-        self.navigationItem.hidesSearchBarWhenScrolling = true;
+    if(_isViewDidLoad) {
+        self.navigationItem.hidesSearchBarWhenScrolling = false;
     }
     // test
     if (appDelegate.activeAccount.length == 0)
@@ -246,6 +246,9 @@
 - (void)viewDidAppear:(BOOL)animated
 {
     [super viewDidAppear:animated];
+    if(_isViewDidLoad) {
+        self.navigationItem.hidesSearchBarWhenScrolling = true;
+    }
     // Active Main
     appDelegate.activeMain = self;
     
@@ -308,7 +311,6 @@
 // detect scroll for remove keyboard in search mode
 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
 {
-    self.navigationItem.hidesSearchBarWhenScrolling = true;
     if (self.searchController.isActive && scrollView == self.tableView) {
         
         [self.searchController.searchBar endEditing:YES];