Эх сурвалжийг харах

set correct titles for mailinglists

B. Petersen 4 жил өмнө
parent
commit
9398b1f648

+ 4 - 0
DcCore/DcCore/DC/Wrapper.swift

@@ -687,6 +687,10 @@ public class DcChat {
         return type == DC_CHAT_TYPE_GROUP || type == DC_CHAT_TYPE_MAILINGLIST
     }
 
+    public var isMailinglist: Bool {
+        return Int(dc_chat_get_type(chatPointer)) == DC_CHAT_TYPE_MAILINGLIST
+    }
+
     public var isSelfTalk: Bool {
         return Int(dc_chat_is_self_talk(chatPointer)) != 0
     }

+ 8 - 8
deltachat-ios/Chat/ChatViewController.swift

@@ -621,16 +621,16 @@ class ChatViewController: UITableViewController {
 
         var subtitle = "ErrSubtitle"
         let chatContactIds = chat.contactIds
-        if chat.isGroup {
+        if chat.isMailinglist {
+            subtitle = String.localized("mailing_list")
+        } else if chat.isGroup {
             subtitle = String.localized(stringID: "n_members", count: chatContactIds.count)
+        } else if chat.isDeviceTalk {
+            subtitle = String.localized("device_talk_subtitle")
+        } else if chat.isSelfTalk {
+            subtitle = String.localized("chat_self_talk_subtitle")
         } else if chatContactIds.count >= 1 {
-            if chat.isDeviceTalk {
-                subtitle = String.localized("device_talk_subtitle")
-            } else if chat.isSelfTalk {
-                subtitle = String.localized("chat_self_talk_subtitle")
-            } else {
-                subtitle = DcContact(id: chatContactIds[0]).email
-            }
+            subtitle = DcContact(id: chatContactIds[0]).email
         }
 
         titleView.updateTitleView(title: chat.name, subtitle: subtitle)

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

@@ -189,7 +189,11 @@ class GroupChatDetailViewController: UIViewController {
     // MARK: - lifecycle
     override func viewDidLoad() {
         super.viewDidLoad()
-        title = String.localized("tab_group")
+        if chat.isMailinglist {
+            title = String.localized("mailing_list")
+        } else {
+            title = String.localized("tab_group")
+        }
         navigationItem.rightBarButtonItem = editBarButtonItem
         groupHeader.frame = CGRect(0, 0, tableView.frame.width, ContactCell.cellHeight)
     }
@@ -220,7 +224,8 @@ class GroupChatDetailViewController: UIViewController {
     private func updateHeader() {
         groupHeader.updateDetails(
             title: chat.name,
-            subtitle: String.localizedStringWithFormat(String.localized("n_members"), chat.contactIds.count)
+            subtitle: chat.isMailinglist ?
+                nil : String.localizedStringWithFormat(String.localized("n_members"), chat.contactIds.count)
         )
         if let img = chat.profileImage {
             groupHeader.setImage(img)