Просмотр исходного кода

Merge pull request #529 from deltachat/fix-start-chat

tweak 'send message'
bjoern 5 лет назад
Родитель
Сommit
e6d2f3e41c

+ 1 - 1
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -20,7 +20,7 @@ class ContactDetailViewController: UITableViewController {
     private lazy var startChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionColor = SystemColor.blue.uiColor
-        cell.actionTitle = String.localized("menu_new_chat")
+        cell.actionTitle = String.localized("send_message")
         cell.selectionStyle = .none
         return cell
     }()

+ 1 - 8
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -452,7 +452,7 @@ class ChatViewCoordinator: NSObject, Coordinator {
                 contactDetailController.coordinator = coordinator
                 navigationController.pushViewController(contactDetailController, animated: true)
             }
-        case .GROUP, .VERYFIEDGROUP:
+        case .GROUP, .VERIFIEDGROUP:
             let groupChatDetailViewController = GroupChatDetailViewController(chatId: chatId, context: dcContext) // inherits from ChatDetailViewController
             let coordinator = GroupChatDetailCoordinator(dcContext: dcContext, chatId: chatId, navigationController: navigationController)
             childCoordinators.append(coordinator)
@@ -462,13 +462,6 @@ class ChatViewCoordinator: NSObject, Coordinator {
     }
 
     func showContactDetail(of contactId: Int, in chatOfType: ChatType, chatId: Int?) {
-        let startChatOption: Bool
-        switch chatOfType {
-        case .GROUP, .VERYFIEDGROUP:
-            startChatOption = true
-        case .SINGLE:
-            startChatOption = false
-        }
         let viewModel = ContactDetailViewModel(contactId: contactId, chatId: chatId, context: dcContext )
         let contactDetailController = ContactDetailViewController(viewModel: viewModel)
         let coordinator = ContactDetailCoordinator(dcContext: dcContext, chatId: chatId, navigationController: navigationController)

+ 1 - 1
deltachat-ios/DC/Wrapper.swift

@@ -978,7 +978,7 @@ class DcLot {
 enum ChatType: Int {
     case SINGLE = 100
     case GROUP = 120
-    case VERYFIEDGROUP = 130
+    case VERIFIEDGROUP = 130
 }
 
 enum MessageViewType: CustomStringConvertible {

+ 1 - 6
deltachat-ios/ViewModel/ContactDetailViewModel.swift

@@ -34,7 +34,6 @@ class ContactDetailViewModel: ContactDetailViewModelProtocol {
     var contact: DcContact
     private let chatId: Int?
     private let sharedChats: DcChatlist
-    private let startChatOption: Bool
     private var sections: [ProfileSections] = []
     private var actions: [ChatAction] = [] // chatDetail: archive, block, delete - else: block
 
@@ -44,12 +43,9 @@ class ContactDetailViewModel: ContactDetailViewModelProtocol {
         self.contactId = contactId
         self.chatId = chatId
         self.contact = DcContact(id: contactId)
-        self.startChatOption = chatId == nil
         self.sharedChats = context.getChatlist(flags: 0, queryString: nil, queryId: contactId)
 
-        if startChatOption {
-            sections.append(.startChat)
-        }
+        sections.append(.startChat)
         if sharedChats.length > 0 {
             sections.append(.sharedChats)
         }
@@ -60,7 +56,6 @@ class ContactDetailViewModel: ContactDetailViewModelProtocol {
         } else {
             actions = [.blockChat]
         }
-
     }
 
     func typeFor(section: Int) -> ContactDetailViewModel.ProfileSections {