marinofaggiana 3 years ago
parent
commit
0eaa4eab18

+ 27 - 0
iOSClient/Utility/NCUtility.swift

@@ -707,6 +707,33 @@ class NCUtility: NSObject {
             return String(format: "%02d:%02d", minutes, seconds)
         }
     }
+    
+    func colorNavigationController(_ navigationController: UINavigationController?, backgroundColor: UIColor, titleColor: UIColor, tintColor: UIColor?) {
+        
+        if #available(iOS 13.0, *) {
+            
+            let appearance = UINavigationBarAppearance()
+            appearance.backgroundColor = backgroundColor
+            appearance.titleTextAttributes = [.foregroundColor: titleColor]
+            appearance.largeTitleTextAttributes = [.foregroundColor: titleColor]
+
+            if let tintColor = tintColor {
+                navigationController?.navigationBar.tintColor = tintColor
+            }
+            navigationController?.navigationBar.standardAppearance = appearance
+            navigationController?.navigationBar.compactAppearance = appearance
+            navigationController?.navigationBar.scrollEdgeAppearance = appearance
+            
+        } else {
+            
+            navigationController?.navigationBar.isTranslucent = true
+            navigationController?.navigationBar.shadowImage = UIImage()
+            navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
+            navigationController?.navigationBar.backgroundColor = .clear
+            navigationController?.navigationBar.barTintColor = backgroundColor
+            navigationController?.navigationBar.tintColor = titleColor
+        }
+    }
 }
 
 // MARK: -

+ 4 - 0
iOSClient/Viewer/NCViewerMedia/NCViewerMediaZoom.swift

@@ -118,6 +118,8 @@ class NCViewerMediaZoom: UIViewController {
         if viewerMedia?.currentMode == .full {
             
             viewerMedia?.navigationController?.setNavigationBarHidden(true, animated: false)
+            NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil)
+            
             viewerMedia?.view.backgroundColor = .black
             viewerMedia?.textColor = .white
             viewerMedia?.progressView.isHidden = true
@@ -128,11 +130,13 @@ class NCViewerMediaZoom: UIViewController {
             
             if (!metadata.livePhoto && metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue) {
                 
+                NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: .black, titleColor: .white, tintColor: nil)
                 viewerMedia?.view.backgroundColor = .black
                 viewerMedia?.textColor = .white
                 
             } else {
                 
+                NCUtility.shared.colorNavigationController(viewerMedia?.navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil)
                 viewerMedia?.view.backgroundColor = NCBrandColor.shared.systemBackground
                 viewerMedia?.textColor = NCBrandColor.shared.label
             }