Browse Source

set chat title bold in chat list if there are unread messages

cyberta 5 years ago
parent
commit
f2d8400573
1 changed files with 7 additions and 2 deletions
  1. 7 2
      deltachat-ios/Controller/ChatListController.swift

+ 7 - 2
deltachat-ios/Controller/ChatListController.swift

@@ -142,8 +142,13 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
 
         let chat = DcChat(id: chatId)
         let summary = chatList.getSummary(index: row)
+        let unreadMessages = dcContext.getUnreadMessages(chatId: chatId)
+
+        cell.nameLabel.attributedText = (unreadMessages > 0) ?
+            NSAttributedString(string: chat.name, attributes: [ .font: UIFont.systemFont(ofSize: 16, weight: .bold) ]) :
+            NSAttributedString(string: chat.name, attributes: [ .font: UIFont.systemFont(ofSize: 16, weight: .medium) ])
+
 
-        cell.nameLabel.text = chat.name
         if let img = chat.profileImage {
             cell.resetBackupImage()
             cell.setImage(img)
@@ -163,7 +168,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
 
         cell.emailLabel.text = result
         cell.setTimeLabel(summary.timestamp)
-        cell.setUnreadMessageCounter(dcContext.getUnreadMessages(chatId: chatId))
+        cell.setUnreadMessageCounter(unreadMessages)
         cell.setDeliveryStatusIndicator(summary.state)
 
         return cell