Browse Source

adapt message top label theming according to DC Android

cyberta 3 years ago
parent
commit
7665f551d7

+ 2 - 2
DcCore/DcCore/Helper/DcColors.swift

@@ -21,10 +21,10 @@ public struct DcColors {
     public static let checkmarkGreen = UIColor.themeColor(light: UIColor.rgb(red: 112, green: 177, blue: 92))
     public static let unreadBadge = UIColor(hexString: "3792fc")
     public static let defaultTextColor = UIColor.themeColor(light: .darkText, dark: .white)
-    public static let grayTextColor = UIColor.themeColor(light: .darkGray, dark: .lightGray)
-    public static let grayDateColor = UIColor.themeColor(lightHex: "999999", darkHex: "bbbbbb") // slight variations of lightGray (#aaaaaa)
+    public static let grayTextColor = UIColor.themeColor(light: .darkGray, dark: coreDark05)
     public static let coreDark05 = UIColor.init(hexString: "EFEFEF") // naming according to DC Android
     public static let grey50 = UIColor.init(hexString: "808080") // naming according to DC Android
+    public static let unknownSender = UIColor.init(hexString: "999999") // naming according to DC Android
     public static let incomingMessageSecondaryTextColor = UIColor.themeColor(light: grey50, dark: coreDark05)
     public static let middleGray = UIColor(hexString: "848ba7")
     public static let secondaryTextColor = UIColor.themeColor(lightHex: "848ba7", darkHex: "a5abc0")

+ 25 - 4
deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

@@ -36,7 +36,7 @@ public class BaseMessageCell: UITableViewCell {
             mainContentBelowTopLabelConstraint?.isActive = !newValue
             mainContentUnderTopLabelConstraint?.isActive = newValue
             topLabel.backgroundColor = newValue ?
-                UIColor(alpha: 200, red: 20, green: 20, blue: 20) :
+                DcColors.systemMessageBackgroundColor :
                 UIColor(alpha: 0, red: 0, green: 0, blue: 0)
         }
     }
@@ -297,7 +297,17 @@ public class BaseMessageCell: UITableViewCell {
         let fromContact = dcContext.getContact(id: msg.fromContactId)
         if msg.isFromCurrentSender {
             topLabel.text = msg.isForwarded ? String.localized("forwarded_message") : nil
-            topLabel.textColor = msg.isForwarded ? DcColors.grayDateColor : DcColors.defaultTextColor
+            let topLabelTextColor: UIColor
+            if msg.isForwarded {
+                if topCompactView {
+                    topLabelTextColor = DcColors.coreDark05
+                } else {
+                    topLabelTextColor = DcColors.unknownSender
+                }
+            } else {
+                topLabelTextColor = DcColors.defaultTextColor
+            }
+            topLabel.textColor = topLabelTextColor
             leadingConstraint?.isActive = false
             leadingConstraintGroup?.isActive = false
             trailingConstraint?.isActive = false
@@ -306,8 +316,19 @@ public class BaseMessageCell: UITableViewCell {
         } else {
             topLabel.text = msg.isForwarded ? String.localized("forwarded_message") :
                 showName ? msg.getSenderName(fromContact, markOverride: true) : nil
-            topLabel.textColor = msg.isForwarded ? DcColors.grayDateColor :
-                showName ? fromContact.color : DcColors.defaultTextColor
+            let topLabelTextColor: UIColor
+            if msg.isForwarded {
+                if topCompactView {
+                    topLabelTextColor = DcColors.coreDark05
+                } else {
+                    topLabelTextColor = DcColors.unknownSender
+                }
+            } else if showName {
+                topLabelTextColor = fromContact.color
+            } else {
+                topLabelTextColor = DcColors.defaultTextColor
+            }
+            topLabel.textColor = topLabelTextColor
             leadingConstraintCurrentSender?.isActive = false
             trailingConstraintCurrentSender?.isActive = false
             if showName {