Browse Source

remove redundant default parameter values in pinChat and updateChatList

cyberta 3 years ago
parent
commit
1dd86b35d1

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

@@ -445,14 +445,14 @@ class ChatListController: UITableViewController {
         let archiveActionTitle: String = String.localized(archived ? "unarchive" : "archive")
 
         let archiveAction = UITableViewRowAction(style: .destructive, title: archiveActionTitle) { [weak self] _, _ in
-            self?.viewModel?.archiveChatToggle(chatId: chatId, notifyListener: true)
+            self?.viewModel?.archiveChatToggle(chatId: chatId)
             self?.setEditing(false, animated: true)
         }
         archiveAction.backgroundColor = UIColor.lightGray
 
         let pinned = chat.visibility==DC_CHAT_VISIBILITY_PINNED
         let pinAction = UITableViewRowAction(style: .destructive, title: String.localized(pinned ? "unpin" : "pin")) { [weak self] _, _ in
-            self?.viewModel?.pinChatToggle(chatId: chat.id, notifyListerner: true)
+            self?.viewModel?.pinChatToggle(chatId: chat.id)
             self?.setEditing(false, animated: true)
         }
         pinAction.backgroundColor = UIColor.systemGreen

+ 4 - 4
deltachat-ios/ViewModel/ChatListViewModel.swift

@@ -228,20 +228,20 @@ class ChatListViewModel: NSObject {
         INInteraction.delete(with: ["\(dcContext.id).\(chatId)"])
     }
 
-    func archiveChatToggle(chatId: Int, notifyListener: Bool = false) {
+    func archiveChatToggle(chatId: Int) {
         let chat = dcContext.getChat(chatId: chatId)
         let isArchivedBefore = chat.isArchived
         dcContext.archiveChat(chatId: chatId, archive: !isArchivedBefore)
         if !isArchivedBefore {
             NotificationManager.removeNotificationsForChat(dcContext: dcContext, chatId: chatId)
         }
-        updateChatList(notifyListener: notifyListener)
+        updateChatList(notifyListener: true)
     }
 
-    func pinChatToggle(chatId: Int, notifyListerner: Bool = false) {
+    func pinChatToggle(chatId: Int) {
         let chat: DcChat = dcContext.getChat(chatId: chatId)
         let pinned = chat.visibility == DC_CHAT_VISIBILITY_PINNED
-        pinChat(chatId: chatId, pinned: pinned, notifyListener: notifyListerner)
+        pinChat(chatId: chatId, pinned: pinned, notifyListener: true)
     }
 
     func pinChat(chatId: Int, pinned: Bool, notifyListener: Bool = false) {