marinofaggiana 4 年之前
父節點
當前提交
24fc250900
共有 2 個文件被更改,包括 24 次插入0 次删除
  1. 13 0
      iOSClient/Main/NCMainNavigationController.swift
  2. 11 0
      iOSClient/Main/NCMainTabBar.swift

+ 13 - 0
iOSClient/Main/NCMainNavigationController.swift

@@ -25,11 +25,24 @@ import Foundation
 
 class NCMainNavigationController: UINavigationController {
     
+    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+
     required init?(coder: NSCoder) {
         super.init(coder: coder)
         
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         
+        if #available(iOS 13.0, *) {
+            if traitCollection.userInterfaceStyle == .dark {
+                appDelegate.darkMode = true
+            } else {
+                appDelegate.darkMode = false
+            }
+        } else {
+            appDelegate.darkMode = false
+        }
+        
+        NCBrandColor.shared.setDarkMode(appDelegate.darkMode)
         changeTheming()
     }
 

+ 11 - 0
iOSClient/Main/NCMainTabBar.swift

@@ -42,6 +42,17 @@ class NCMainTabBar: UITabBar {
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUpdateBadgeNumber), object: nil)
 
+        if #available(iOS 13.0, *) {
+            if traitCollection.userInterfaceStyle == .dark {
+                appDelegate.darkMode = true
+            } else {
+                appDelegate.darkMode = false
+            }
+        } else {
+            appDelegate.darkMode = false
+        }
+        
+        NCBrandColor.shared.setDarkMode(appDelegate.darkMode)
         changeTheming()
     }