marinofaggiana há 5 anos atrás
pai
commit
0eb2f8019e
2 ficheiros alterados com 9 adições e 19 exclusões
  1. 2 0
      iOSClient/AppDelegate.m
  2. 7 19
      iOSClient/RichWorkspace/NCRichWorkspace.swift

+ 2 - 0
iOSClient/AppDelegate.m

@@ -217,6 +217,8 @@
     if (self.activeDetail.richDocument) {
         [self.activeDetail.richDocument grabFocus];
     }
+    
+    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"applicationWillEnterForeground" object:nil];
 }
 
 //

+ 7 - 19
iOSClient/RichWorkspace/NCRichWorkspace.swift

@@ -31,35 +31,23 @@ import MarkdownKit
 
     var markdownParser = MarkdownParser()
     var richWorkspaceText: String?
-    var textViewColor: UIColor?
+    //var textViewColor: UIColor?
     //let gradientLayer: CAGradientLayer = CAGradientLayer()
 
     required init?(coder: NSCoder) {
         super.init(coder: coder)
         
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "applicationWillEnterForeground"), object: nil)
         changeTheming()
     }
 
     @objc func changeTheming() {
-        var textColor = NCBrandColor.sharedInstance.textView
-        if #available(iOS 13.0, *) {
-            if CCUtility.getDarkModeDetect() {
-                if traitCollection.userInterfaceStyle == .dark {
-                    textColor = .white
-                } else {
-                    textColor = .black
-                }
-            }
-        }
-                
-        if textColor != self.textViewColor {
-            markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: NCBrandColor.sharedInstance.textView)
-            markdownParser.header.font = UIFont.systemFont(ofSize: 25)
-            if let richWorkspaceText = richWorkspaceText {
-                textView.attributedText = markdownParser.parse(richWorkspaceText)
-            }
-            self.textViewColor = NCBrandColor.sharedInstance.textView
+        
+        markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: NCBrandColor.sharedInstance.textView)
+        markdownParser.header.font = UIFont.systemFont(ofSize: 25)
+        if let richWorkspaceText = richWorkspaceText {
+            textView.attributedText = markdownParser.parse(richWorkspaceText)
         }
     }