Browse Source

fix colors for messages with text and media or files

cyberta 5 years ago
parent
commit
0b7c8e1b8a
1 changed files with 12 additions and 7 deletions
  1. 12 7
      deltachat-ios/DC/Wrapper.swift

+ 12 - 7
deltachat-ios/DC/Wrapper.swift

@@ -523,9 +523,9 @@ class DcMsg: MessageType {
         if isInfo {
             let text = NSAttributedString(string: self.text ?? "", attributes: [
                 NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 12),
-                NSAttributedString.Key.foregroundColor: UIColor.darkGray,
+                NSAttributedString.Key.foregroundColor: DcColors.grayTextColor,
                 ])
-            return MessageKind.attributedText(text)
+            print("show info: ", text)
         } else if isSetupMessage {
             return MessageKind.text(String.localized("autocrypt_asm_click_body"))
         }
@@ -559,7 +559,8 @@ class DcMsg: MessageType {
         if text.isEmpty {
                        return MessageKind.video(Media(url: fileURL))
                    }
-                   let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)])
+        let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0),
+                                                                             NSAttributedString.Key.foregroundColor: DcColors.defaultTextColor])
                    return MessageKind.videoText(Media(url: fileURL, text: attributedString))
     }
 
@@ -567,7 +568,8 @@ class DcMsg: MessageType {
         if text.isEmpty {
             return MessageKind.photo(Media(image: image))
         }
-        let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)])
+        let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0),
+                                                                             NSAttributedString.Key.foregroundColor: DcColors.defaultTextColor])
         return MessageKind.photoText(Media(image: image, text: attributedString))
     }
 
@@ -575,7 +577,8 @@ class DcMsg: MessageType {
         let audioAsset = AVURLAsset(url: fileURL!)
         let seconds = Float(CMTimeGetSeconds(audioAsset.duration))
         if !text.isEmpty {
-            let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)])
+            let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0),
+                                                                                 NSAttributedString.Key.foregroundColor: DcColors.defaultTextColor])
             return MessageKind.audio(Audio(url: audioAsset.url, duration: seconds, text: attributedString))
         }
         return MessageKind.audio(Audio(url: fileURL!, duration: seconds))
@@ -584,12 +587,14 @@ class DcMsg: MessageType {
     internal func createFileMessage(text: String) -> MessageKind {
         let fileString = "\(self.filename ?? "???") (\(self.filesize / 1024) kB)"
         let attributedFileString = NSMutableAttributedString(string: fileString,
-                                                             attributes: [NSAttributedString.Key.font: UIFont.italicSystemFont(ofSize: 13.0)])
+                                                             attributes: [NSAttributedString.Key.font: UIFont.italicSystemFont(ofSize: 13.0),
+                                                                          NSAttributedString.Key.foregroundColor: DcColors.defaultTextColor])
         if !text.isEmpty {
             attributedFileString.append(NSAttributedString(string: "\n\n",
                                                            attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 7.0)]))
             attributedFileString.append(NSAttributedString(string: text,
-                                                           attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)]))
+                                                           attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0),
+                                                                        NSAttributedString.Key.foregroundColor: DcColors.defaultTextColor]))
         }
         return MessageKind.fileText(Media(text: attributedFileString))
     }