marinofaggiana před 3 roky
rodič
revize
820f8e9ee6

+ 2 - 2
iOSClient/Account Request/NCAccountRequest.swift

@@ -77,7 +77,7 @@ class NCAccountRequest: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(startTimer), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidEnterBackground), object: nil)
         
-        setColors()
+        setColors(userInterfaceStyle: nil)
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -110,7 +110,7 @@ class NCAccountRequest: UIViewController {
     
     // MARK: - Colors
     
-    func setColors(userInterfaceStyle: UIUserInterfaceStyle? = nil) {
+    func setColors(userInterfaceStyle: UIUserInterfaceStyle?) {
         
         if userInterfaceStyle == .dark {
             // personalized

+ 42 - 17
iOSClient/Main/AudioRecorder/NCAudioRecorderViewController.swift

@@ -49,34 +49,41 @@ class NCAudioRecorderViewController: UIViewController , NCAudioRecorderDelegate
 
     override func viewDidLoad() {
         super.viewDidLoad()
+        
+        voiceRecordHUD.update(0.0)
+        durationLabel.text = ""
+        startStopLabel.text = NSLocalizedString("_voice_memo_start_", comment: "")
+        
+        setColors(userInterfaceStyle: nil)
     }
     
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
+    }
+    
+    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
+        super.traitCollectionDidChange(previousTraitCollection)
         
-        contentContainerView.backgroundColor = UIColor.lightGray
-        voiceRecordHUD.update(0.0)
-        voiceRecordHUD.fillColor = UIColor.green
-        durationLabel.text = ""
-        startStopLabel.text = NSLocalizedString("_voice_memo_start_", comment: "")
+        setColors(userInterfaceStyle: traitCollection.userInterfaceStyle)
     }
     
-    func createRecorder(fileName: String) {
+    // MARK: - Colors
+    
+    func setColors(userInterfaceStyle: UIUserInterfaceStyle?) {
         
-        self.fileName = fileName
-        recording = NCAudioRecorder(to: fileName)
-        recording.delegate = self
-
-        DispatchQueue.global().async {
-            // Background thread
-            do {
-                try self.recording.prepare()
-            } catch {
-                print(error)
-            }
+        if userInterfaceStyle == .dark {
+            // personalized
+        } else {
+            // personalized
         }
+        
+        view.backgroundColor = .clear
+        contentContainerView.backgroundColor = UIColor.lightGray
+        voiceRecordHUD.fillColor = UIColor.green
     }
     
+    // MARK: - Action
+    
     @IBAction func touchViewController() {
         
         if recording.state == .record {
@@ -111,6 +118,24 @@ class NCAudioRecorderViewController: UIViewController , NCAudioRecorderDelegate
         }
     }
     
+    // MARK: - Code
+    
+    func createRecorder(fileName: String) {
+        
+        self.fileName = fileName
+        recording = NCAudioRecorder(to: fileName)
+        recording.delegate = self
+
+        DispatchQueue.global().async {
+            // Background thread
+            do {
+                try self.recording.prepare()
+            } catch {
+                print(error)
+            }
+        }
+    }
+    
     func audioMeterDidUpdate(_ db: Float) {
         
         //print("db level: %f", db)