diff --git a/CHANGELOG.md b/CHANGELOG.md index c9c64989f..253c8b740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Improve "All media empty" and "Block contact" wordings (#2580) +- Unify buttons and icons (#2584) - Fix: Allow to share contacts that do not have a chat (#2583) diff --git a/deltachat-ios/Controller/AccountSwitchViewController.swift b/deltachat-ios/Controller/AccountSwitchViewController.swift index 84f9e5117..704a59d6e 100644 --- a/deltachat-ios/Controller/AccountSwitchViewController.swift +++ b/deltachat-ios/Controller/AccountSwitchViewController.swift @@ -19,6 +19,7 @@ class AccountSwitchViewController: UITableViewController { private lazy var addAccountCell: ActionCell = { let cell = ActionCell() cell.actionTitle = String.localized("add_account") + cell.imageView?.image = UIImage(systemName: "plus") return cell }() diff --git a/deltachat-ios/Controller/AddGroupMembersViewController.swift b/deltachat-ios/Controller/AddGroupMembersViewController.swift index 7149727a8..f89f6bb20 100644 --- a/deltachat-ios/Controller/AddGroupMembersViewController.swift +++ b/deltachat-ios/Controller/AddGroupMembersViewController.swift @@ -24,6 +24,7 @@ class AddGroupMembersViewController: GroupMembersViewController { private lazy var newContactCell: ActionCell = { let cell = ActionCell() cell.actionColor = UIColor.systemBlue + cell.imageView?.image = UIImage(systemName: "highlighter") cell.actionTitle = String.localized("menu_new_classic_contact") return cell }() diff --git a/deltachat-ios/Controller/ContactDetailViewController.swift b/deltachat-ios/Controller/ContactDetailViewController.swift index 7e6ef8e7c..e1bea93fb 100644 --- a/deltachat-ios/Controller/ContactDetailViewController.swift +++ b/deltachat-ios/Controller/ContactDetailViewController.swift @@ -24,7 +24,7 @@ class ContactDetailViewController: UITableViewController { private lazy var startChatCell: ActionCell = { let cell = ActionCell() - cell.actionColor = UIColor.systemBlue + cell.imageView?.image = UIImage(systemName: "paperplane") cell.actionTitle = String.localized("send_message") return cell }() @@ -49,19 +49,15 @@ class ContactDetailViewController: UITableViewController { } let isOnHomescreen = chatIdsOnHomescreen.contains(viewModel.chatId) - if isOnHomescreen { - cell.actionTitle = String.localized("remove_from_widget") - } else { - cell.actionTitle = String.localized("add_to_widget") - } - cell.actionColor = UIColor.systemBlue + cell.imageView?.image = UIImage(systemName: isOnHomescreen ? "minus.square" : "plus.square") + cell.actionTitle = String.localized(isOnHomescreen ? "remove_from_widget" : "add_to_widget") return cell }() private lazy var shareContactCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: "square.and.arrow.up") cell.actionTitle = String.localized("menu_share") - cell.actionColor = UIColor.systemBlue return cell }() @@ -75,27 +71,30 @@ class ContactDetailViewController: UITableViewController { private lazy var showEncrInfoCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: "info.circle") cell.actionTitle = String.localized("encryption_info_title_desktop") - cell.actionColor = UIColor.systemBlue return cell }() private lazy var blockContactCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: "nosign") cell.actionTitle = viewModel.contact.isBlocked ? String.localized("menu_unblock_contact") : String.localized("menu_block_contact") - cell.actionColor = viewModel.contact.isBlocked ? UIColor.systemBlue : UIColor.systemRed + cell.actionColor = UIColor.systemRed return cell }() private lazy var archiveChatCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: viewModel.chatIsArchived ? "tray.and.arrow.up" : "tray.and.arrow.down") cell.actionTitle = viewModel.chatIsArchived ? String.localized("menu_unarchive_chat") : String.localized("menu_archive_chat") - cell.actionColor = UIColor.systemBlue return cell }() private lazy var clearChatCell: ActionCell = { let cell = ActionCell() + let image = if #available(iOS 16.0, *) { "eraser" } else { "rectangle.portrait" } + cell.imageView?.image = UIImage(systemName: image) cell.actionTitle = String.localized("clear_chat") cell.actionColor = UIColor.systemRed return cell @@ -103,6 +102,7 @@ class ContactDetailViewController: UITableViewController { private lazy var deleteChatCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: "trash") cell.actionTitle = String.localized("menu_delete_chat") cell.actionColor = UIColor.systemRed return cell @@ -367,7 +367,7 @@ class ContactDetailViewController: UITableViewController { @objc private func shareContact() { guard let vcardData = viewModel.context.makeVCard(contactIds: [viewModel.contactId]) else { return } - RelayHelper.shared.setForwardVCard(dialogTitle: String.localized("forward_to"), vcardData: vcardData) + RelayHelper.shared.setForwardVCard(vcardData: vcardData) navigationController?.popToRootViewController(animated: true) } @@ -436,6 +436,7 @@ class ContactDetailViewController: UITableViewController { if archived { self.navigationController?.popToRootViewController(animated: false) } else { + archiveChatCell.imageView?.image = UIImage(systemName: "tray.and.arrow.down") archiveChatCell.actionTitle = String.localized("menu_archive_chat") } } @@ -459,16 +460,12 @@ class ContactDetailViewController: UITableViewController { guard #available(iOS 17, *) else { return } let onHomescreen = viewModel.toggleChatInHomescreenWidget() - if onHomescreen { - homescreenWidgetCell.actionTitle = String.localized("remove_from_widget") - } else { - homescreenWidgetCell.actionTitle = String.localized("add_to_widget") - } + homescreenWidgetCell.imageView?.image = UIImage(systemName: onHomescreen ? "minus.square" : "plus.square") + homescreenWidgetCell.actionTitle = String.localized(onHomescreen ? "remove_from_widget" : "add_to_widget") } private func updateBlockContactCell() { blockContactCell.actionTitle = viewModel.contact.isBlocked ? String.localized("menu_unblock_contact") : String.localized("menu_block_contact") - blockContactCell.actionColor = viewModel.contact.isBlocked ? UIColor.systemBlue : UIColor.systemRed } diff --git a/deltachat-ios/Controller/EphemeralMessagesViewController.swift b/deltachat-ios/Controller/EphemeralMessagesViewController.swift index 3197f61bd..37ea888fb 100644 --- a/deltachat-ios/Controller/EphemeralMessagesViewController.swift +++ b/deltachat-ios/Controller/EphemeralMessagesViewController.swift @@ -103,7 +103,10 @@ class EphemeralMessagesViewController: UITableViewController { } override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return String.localized("ephemeral_messages_hint") + if !dcContext.getChat(chatId: chatId).isSelfTalk { // the hint refers to "all member of the chat", this is weird for "Saved Messages" + return String.localized("ephemeral_messages_hint") + } + return nil } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/deltachat-ios/Controller/GroupChatDetailViewController.swift b/deltachat-ios/Controller/GroupChatDetailViewController.swift index ae36aa17e..95cc018cc 100644 --- a/deltachat-ios/Controller/GroupChatDetailViewController.swift +++ b/deltachat-ios/Controller/GroupChatDetailViewController.swift @@ -87,13 +87,15 @@ class GroupChatDetailViewController: UIViewController { private lazy var archiveChatCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: chat.isArchived ? "tray.and.arrow.up" : "tray.and.arrow.down") cell.actionTitle = chat.isArchived ? String.localized("menu_unarchive_chat") : String.localized("menu_archive_chat") - cell.actionColor = UIColor.systemBlue return cell }() private lazy var cloneChatCell: ActionCell = { let cell = ActionCell() + let image = if #available(iOS 15.0, *) { "rectangle.portrait.on.rectangle.portrait" } else { "square.on.square" } + cell.imageView?.image = UIImage(systemName: image) cell.actionTitle = String.localized("clone_chat") cell.actionColor = UIColor.systemBlue return cell @@ -101,6 +103,8 @@ class GroupChatDetailViewController: UIViewController { private lazy var leaveGroupCell: ActionCell = { let cell = ActionCell() + let image = if #available(iOS 15.0, *) { "rectangle.portrait.and.arrow.right" } else { "arrow.right.square" } + cell.imageView?.image = UIImage(systemName: image) cell.actionTitle = String.localized("menu_leave_group") cell.actionColor = UIColor.systemRed return cell @@ -115,6 +119,8 @@ class GroupChatDetailViewController: UIViewController { private lazy var clearChatCell: ActionCell = { let cell = ActionCell() + let image = if #available(iOS 16.0, *) { "eraser" } else { "rectangle.portrait" } + cell.imageView?.image = UIImage(systemName: image) cell.actionTitle = String.localized("clear_chat") cell.actionColor = UIColor.systemRed return cell @@ -122,6 +128,7 @@ class GroupChatDetailViewController: UIViewController { private lazy var deleteChatCell: ActionCell = { let cell = ActionCell() + cell.imageView?.image = UIImage(systemName: "trash") cell.actionTitle = String.localized("menu_delete_chat") cell.actionColor = UIColor.systemRed return cell @@ -163,12 +170,8 @@ class GroupChatDetailViewController: UIViewController { } let isOnHomescreen = chatIdsOnHomescreen.contains(chatId) - if isOnHomescreen { - cell.actionTitle = String.localized("remove_from_widget") - } else { - cell.actionTitle = String.localized("add_to_widget") - } - cell.actionColor = UIColor.systemBlue + cell.imageView?.image = UIImage(systemName: isOnHomescreen ? "minus.square" : "plus.square") + cell.actionTitle = String.localized(isOnHomescreen ? "remove_from_widget" : "add_to_widget") return cell }() @@ -369,11 +372,8 @@ class GroupChatDetailViewController: UIViewController { onHomescreen = true } - if onHomescreen { - homescreenWidgetCell.actionTitle = String.localized("remove_from_widget") - } else { - homescreenWidgetCell.actionTitle = String.localized("add_to_widget") - } + homescreenWidgetCell.imageView?.image = UIImage(systemName: onHomescreen ? "minus.square" : "plus.square") + homescreenWidgetCell.actionTitle = String.localized(onHomescreen ? "remove_from_widget" : "add_to_widget") } @objc func editButtonPressed() { @@ -402,6 +402,7 @@ class GroupChatDetailViewController: UIViewController { } dcContext.archiveChat(chatId: chat.id, archive: !archivedBefore) if archivedBefore { + archiveChatCell.imageView?.image = UIImage(systemName: "tray.and.arrow.down") archiveChatCell.actionTitle = String.localized("menu_archive_chat") } else { self.navigationController?.popToRootViewController(animated: false) @@ -549,9 +550,11 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou } if row == membersRowAddMembers { actionCell.actionTitle = String.localized(chat.isBroadcast ? "add_recipients" : "group_add_members") + actionCell.imageView?.image = UIImage(systemName: "plus") actionCell.actionColor = UIColor.systemBlue } else if row == membersRowQrInvite { actionCell.actionTitle = String.localized("qrshow_join_group_title") + actionCell.imageView?.image = UIImage(systemName: "qrcode") actionCell.actionColor = UIColor.systemBlue } return actionCell diff --git a/deltachat-ios/Controller/NewChatViewController.swift b/deltachat-ios/Controller/NewChatViewController.swift index a9789dbd7..1bb29e402 100644 --- a/deltachat-ios/Controller/NewChatViewController.swift +++ b/deltachat-ios/Controller/NewChatViewController.swift @@ -150,12 +150,16 @@ class NewChatViewController: UITableViewController { switch newOptions[row] { case .scanQRCode: + actionCell.imageView?.image = UIImage(systemName: "qrcode") actionCell.actionTitle = String.localized("menu_new_contact") case .newGroup: + actionCell.imageView?.image = UIImage(systemName: "plus") actionCell.actionTitle = String.localized("menu_new_group") case .newBroadcastList: + actionCell.imageView?.image = UIImage(systemName: "plus") actionCell.actionTitle = String.localized("new_broadcast_list") case .newContact: + actionCell.imageView?.image = UIImage(systemName: "highlighter") actionCell.actionTitle = String.localized("menu_new_classic_contact") } @@ -163,6 +167,7 @@ class NewChatViewController: UITableViewController { } else if section == sectionInviteFriends { guard let actionCell = tableView.dequeueReusableCell(withIdentifier: ActionCell.reuseIdentifier, for: indexPath) as? ActionCell else { fatalError("No Action Cell") } + actionCell.imageView?.image = UIImage(systemName: "heart") actionCell.actionTitle = String.localized("invite_friends") return actionCell @@ -175,6 +180,13 @@ class NewChatViewController: UITableViewController { } } + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + if section == sectionContacts { + return String.localized("chat_with") + } + return nil + } + override func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) { let row = indexPath.row let section = indexPath.section diff --git a/deltachat-ios/Controller/NewGroupController.swift b/deltachat-ios/Controller/NewGroupController.swift index 5d213f0be..a50c8a6cd 100644 --- a/deltachat-ios/Controller/NewGroupController.swift +++ b/deltachat-ios/Controller/NewGroupController.swift @@ -161,6 +161,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate { case .invite: guard let actionCell = tableView.dequeueReusableCell(withIdentifier: ActionCell.reuseIdentifier, for: indexPath) as? ActionCell else { fatalError("No ActionCell") } if inviteRows[row] == .addMembers { + actionCell.imageView?.image = UIImage(systemName: "plus") actionCell.actionTitle = String.localized(createBroadcast ? "add_recipients" : "group_add_members") actionCell.actionColor = UIColor.systemBlue actionCell.isUserInteractionEnabled = true diff --git a/deltachat-ios/Controller/QrPageController.swift b/deltachat-ios/Controller/QrPageController.swift index 445434307..1a617020d 100644 --- a/deltachat-ios/Controller/QrPageController.swift +++ b/deltachat-ios/Controller/QrPageController.swift @@ -116,7 +116,7 @@ class QrPageController: UIPageViewController { self?.pasteFromClipboard() }) if dcContext.isChatmail == false { - actions.append(UIAction(title: String.localized("menu_new_classic_contact"), image: UIImage(systemName: "pencil")) { [weak self] _ in + actions.append(UIAction(title: String.localized("menu_new_classic_contact"), image: UIImage(systemName: "highlighter")) { [weak self] _ in guard let self else { return } self.navigationController?.pushViewController(NewContactController(dcContext: self.dcContext), animated: true) }) diff --git a/deltachat-ios/Controller/Settings/NotificationsViewController.swift b/deltachat-ios/Controller/Settings/NotificationsViewController.swift index a8e964cdb..bdfbae02c 100644 --- a/deltachat-ios/Controller/Settings/NotificationsViewController.swift +++ b/deltachat-ios/Controller/Settings/NotificationsViewController.swift @@ -50,11 +50,10 @@ internal final class NotificationsViewController: UITableViewController { }) }() - private lazy var systemSettingsCell: UITableViewCell = { - let cell = UITableViewCell(style: .value1, reuseIdentifier: nil) + private lazy var systemSettingsCell: ActionCell = { + let cell = ActionCell() cell.tag = CellTags.systemSettings.rawValue cell.textLabel?.text = String.localized("system_settings") - cell.accessoryType = .disclosureIndicator return cell }() diff --git a/deltachat-ios/Controller/Settings/Proxy/ProxySettingsViewController.swift b/deltachat-ios/Controller/Settings/Proxy/ProxySettingsViewController.swift index 33d14ba07..5b97510ad 100644 --- a/deltachat-ios/Controller/Settings/Proxy/ProxySettingsViewController.swift +++ b/deltachat-ios/Controller/Settings/Proxy/ProxySettingsViewController.swift @@ -40,6 +40,7 @@ class ProxySettingsViewController: UITableViewController { addProxyCell = ActionCell() addProxyCell.actionTitle = String.localized("proxy_add") + addProxyCell.imageView?.image = UIImage(systemName: "plus") toggleProxyCell = SwitchCell(textLabel: String.localized("proxy_use_proxy"), on: dcContext.isProxyEnabled) super.init(style: .insetGrouped) diff --git a/deltachat-ios/Helper/RelayHelper.swift b/deltachat-ios/Helper/RelayHelper.swift index b45e4f2c3..63f6101c6 100644 --- a/deltachat-ios/Helper/RelayHelper.swift +++ b/deltachat-ios/Helper/RelayHelper.swift @@ -31,8 +31,9 @@ class RelayHelper { // forwarding messages - func setForwardVCard(dialogTitle: String, vcardData: Data) { - self.dialogTitle = dialogTitle + func setForwardVCard(vcardData: Data) { + finishRelaying() + self.dialogTitle = String.localized("chat_share_with_title") self.forwardVCardData = vcardData } diff --git a/deltachat-ios/View/ActionCell.swift b/deltachat-ios/View/ActionCell.swift index d73d94fb1..bb7941c3b 100644 --- a/deltachat-ios/View/ActionCell.swift +++ b/deltachat-ios/View/ActionCell.swift @@ -8,45 +8,25 @@ class ActionCell: UITableViewCell { var actionTitle: String? { didSet { - actionLabel.text = actionTitle + textLabel?.text = actionTitle } } var actionColor: UIColor? { didSet { - actionLabel.textColor = actionColor ?? UIColor.systemBlue + textLabel?.textColor = actionColor ?? UIColor.systemBlue + if let imageView { + imageView.tintColor = actionColor ?? UIColor.systemBlue + } } } - private lazy var actionLabel: UILabel = { - let label = UILabel() - label.text = actionTitle - label.textColor = UIColor.systemBlue - label.font = .preferredFont(forTextStyle: .body) - label.adjustsFontForContentSizeCategory = true - label.textAlignment = .center - label.numberOfLines = 0 - return label - }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - setupSubviews() + textLabel?.textColor = UIColor.systemBlue } required init?(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } - - private func setupSubviews() { - contentView.addSubview(actionLabel) - actionLabel.translatesAutoresizingMaskIntoConstraints = false - contentView.addConstraints([ - actionLabel.constraintAlignLeadingTo(contentView, paddingLeading: 12), - actionLabel.constraintAlignTrailingTo(contentView, paddingTrailing: 12), - actionLabel.constraintAlignTopTo(contentView, paddingTop: 12), - actionLabel.constraintAlignBottomTo(contentView, paddingBottom: 12) - - ]) - } } diff --git a/deltachat-ios/ViewModel/ContactDetailViewModel.swift b/deltachat-ios/ViewModel/ContactDetailViewModel.swift index a2cdf88a4..70c752afe 100644 --- a/deltachat-ios/ViewModel/ContactDetailViewModel.swift +++ b/deltachat-ios/ViewModel/ContactDetailViewModel.swift @@ -93,10 +93,10 @@ class ContactDetailViewModel { if chatExists { if !isDeviceTalk { chatOptions.append(.ephemeralMessages) - chatOptions.append(.startChat) } - if isSavedMessages == false && isDeviceTalk == false { + if !isSavedMessages && !isDeviceTalk { + chatOptions.append(.startChat) chatOptions.append(.shareContact) }