marinofaggiana 3 years ago
parent
commit
e3f13f7f1d

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -72,7 +72,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         self.navigationItem.rightBarButtonItem = saveButton
         
-        NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil)
+        NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false)
         
         tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
 

+ 17 - 4
iOSClient/Utility/NCUtility.swift

@@ -708,25 +708,38 @@ class NCUtility: NSObject {
         }
     }
     
-    func colorNavigationController(_ navigationController: UINavigationController?, backgroundColor: UIColor, titleColor: UIColor, tintColor: UIColor?) {
+    func colorNavigationController(_ navigationController: UINavigationController?, backgroundColor: UIColor, titleColor: UIColor, tintColor: UIColor?, withoutShadow: Bool) {
         
         if #available(iOS 13.0, *) {
             
             let appearance = UINavigationBarAppearance()
-            appearance.backgroundColor = backgroundColor
+//            appearance.configureWithTransparentBackground()
             appearance.titleTextAttributes = [.foregroundColor: titleColor]
             appearance.largeTitleTextAttributes = [.foregroundColor: titleColor]
-
+            
+            if withoutShadow {
+                appearance.shadowColor = .clear
+                appearance.shadowImage = UIImage()
+            }
+            
             if let tintColor = tintColor {
                 navigationController?.navigationBar.tintColor = tintColor
             }
+            navigationController?.view.backgroundColor = backgroundColor
             navigationController?.navigationBar.standardAppearance = appearance
             navigationController?.navigationBar.compactAppearance = appearance
             navigationController?.navigationBar.scrollEdgeAppearance = appearance
             
         } else {
-                        
+            
+            navigationController?.navigationBar.isTranslucent = true
             navigationController?.navigationBar.barTintColor = backgroundColor
+            
+            if withoutShadow {
+                navigationController?.navigationBar.shadowImage = UIImage()
+                navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
+            }
+            
             let titleDict: NSDictionary = [NSAttributedString.Key.foregroundColor: titleColor]
             navigationController?.navigationBar.titleTextAttributes = titleDict as? [NSAttributedString.Key : Any]
             if let tintColor = tintColor {

+ 2 - 2
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -157,7 +157,7 @@ class NCViewerMedia: UIViewController {
 
             currentViewController.playerToolBar.showToolBar(metadata: currentViewController.metadata, detailView: currentViewController.detailView)
             
-            NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil)
+            NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false)
             view.backgroundColor = NCBrandColor.shared.systemBackground
             textColor = NCBrandColor.shared.label
             
@@ -168,7 +168,7 @@ class NCViewerMedia: UIViewController {
             
             currentViewController.playerToolBar.hideToolBar()
 
-            NCUtility.shared.colorNavigationController(navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil)
+            NCUtility.shared.colorNavigationController(navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil, withoutShadow: false)
             view.backgroundColor = .black
             textColor = .white
         }

+ 2 - 2
iOSClient/Viewer/NCViewerMedia/NCViewerMediaZoom.swift

@@ -120,7 +120,7 @@ class NCViewerMediaZoom: UIViewController {
             
             viewerMedia?.navigationController?.setNavigationBarHidden(true, animated: true)
             
-            NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil)
+            NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil, withoutShadow: false)
             
             viewerMedia?.view.backgroundColor = .black
             viewerMedia?.textColor = .white
@@ -130,7 +130,7 @@ class NCViewerMediaZoom: UIViewController {
             
             viewerMedia?.navigationController?.setNavigationBarHidden(false, animated: true)
                 
-            NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil)
+            NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false)
             
             viewerMedia?.view.backgroundColor = NCBrandColor.shared.systemBackground
             viewerMedia?.textColor = NCBrandColor.shared.label