diff --git a/Mail/Views/New Message/AutocompletionCell.swift b/Mail/Views/New Message/AutocompletionCell.swift index 4d971d135..0d526d826 100644 --- a/Mail/Views/New Message/AutocompletionCell.swift +++ b/Mail/Views/New Message/AutocompletionCell.swift @@ -56,7 +56,7 @@ struct AutocompletionCell: View { init( addRecipient: @escaping @MainActor (any ContactAutocompletable) -> Void, autocompletion: any ContactAutocompletable, - hightlight: String?, + highlight: String?, alreadyAppend: Bool, unknownRecipient: Bool, title: String, @@ -64,6 +64,7 @@ struct AutocompletionCell: View { ) { self.addRecipient = addRecipient self.autocompletion = autocompletion + self.highlight = highlight self.alreadyAppend = alreadyAppend self.unknownRecipient = unknownRecipient self.title = title @@ -86,15 +87,15 @@ struct AutocompletionCell: View { } init( - addRecipient: @escaping @MainActor (AddressBook) -> Void, - autocompletion: AddressBook, + addRecipient: @escaping @MainActor (GroupContact) -> Void, + autocompletion: GroupContact, highlight: String?, alreadyAppend: Bool, unknownRecipient: Bool, title: String, subtitle: String ) { - self.addRecipient = { addRecipient($0 as! AddressBook) } + self.addRecipient = { addRecipient($0 as! GroupContact) } self.autocompletion = autocompletion self.alreadyAppend = alreadyAppend self.unknownRecipient = unknownRecipient @@ -103,16 +104,17 @@ struct AutocompletionCell: View { } init( - addRecipient: @escaping @MainActor (GroupContact) -> Void, - autocompletion: GroupContact, + addRecipient: @escaping @MainActor (AddressBook) -> Void, + autocompletion: AddressBook, highlight: String?, alreadyAppend: Bool, unknownRecipient: Bool, title: String, subtitle: String ) { - self.addRecipient = { addRecipient($0 as! GroupContact) } + self.addRecipient = { addRecipient($0 as! AddressBook) } self.autocompletion = autocompletion + self.highlight = highlight self.alreadyAppend = alreadyAppend self.unknownRecipient = unknownRecipient self.title = title @@ -151,7 +153,7 @@ struct AutocompletionCell: View { AutocompletionCell( addRecipient: { _ in /* Preview */ }, autocompletion: PreviewHelper.sampleMergedContact, - hightlight: "", + highlight: "", alreadyAppend: false, unknownRecipient: false, title: "", diff --git a/Mail/Views/New Message/AutocompletionView.swift b/Mail/Views/New Message/AutocompletionView.swift index 675e76d6a..161671946 100644 --- a/Mail/Views/New Message/AutocompletionView.swift +++ b/Mail/Views/New Message/AutocompletionView.swift @@ -38,8 +38,6 @@ extension Recipient: @retroactive ContactAutocompletable { } struct AutocompletionView: View { - private static let maxAutocompleteCount = 10 - @EnvironmentObject private var mailboxManager: MailboxManager @State private var shouldAddUserProposal = false @@ -70,7 +68,7 @@ struct AutocompletionView: View { AutocompletionCell( addRecipient: addRecipient, autocompletion: groupContact, - hightlight: textDebounce.text, + highlight: textDebounce.text, alreadyAppend: addedRecipients.contains { $0.id == contact.contactId }, unknownRecipient: isUserProposal, title: groupContact.name, @@ -80,7 +78,7 @@ struct AutocompletionView: View { AutocompletionCell( addRecipient: addRecipient, autocompletion: addressBookContact, - hightlight: textDebounce.text, + highlight: textDebounce.text, alreadyAppend: addedRecipients.contains { $0.id == contact.contactId }, unknownRecipient: isUserProposal, title: addressBookContact.name, diff --git a/Mail/Views/New Message/ComposeMessageHeaderView.swift b/Mail/Views/New Message/ComposeMessageHeaderView.swift index 4624eefb9..05ffd0293 100644 --- a/Mail/Views/New Message/ComposeMessageHeaderView.swift +++ b/Mail/Views/New Message/ComposeMessageHeaderView.swift @@ -58,7 +58,6 @@ struct ComposeMessageHeaderView: View { focusedField: _focusedField, type: .to, areCCAndBCCEmpty: draft.cc.isEmpty && draft.bcc.isEmpty, - totalRecipients: totalRecipients, isRecipientLimitExceeded: isRecipientLimitExceeded ) .accessibilityLabel(MailResourcesStrings.Localizable.toTitle) @@ -70,7 +69,6 @@ struct ComposeMessageHeaderView: View { autocompletionType: $autocompletionType, focusedField: _focusedField, type: .cc, - totalRecipients: totalRecipients, isRecipientLimitExceeded: isRecipientLimitExceeded ) .accessibilityLabel(MailResourcesStrings.Localizable.ccTitle) @@ -81,7 +79,6 @@ struct ComposeMessageHeaderView: View { autocompletionType: $autocompletionType, focusedField: _focusedField, type: .bcc, - totalRecipients: totalRecipients, isRecipientLimitExceeded: isRecipientLimitExceeded ) .accessibilityLabel(MailResourcesStrings.Localizable.bccTitle) diff --git a/Mail/Views/New Message/Header Cells/ComposeMessageCellRecipients.swift b/Mail/Views/New Message/Header Cells/ComposeMessageCellRecipients.swift index d318892bf..d132c097f 100644 --- a/Mail/Views/New Message/Header Cells/ComposeMessageCellRecipients.swift +++ b/Mail/Views/New Message/Header Cells/ComposeMessageCellRecipients.swift @@ -65,7 +65,6 @@ struct ComposeMessageCellRecipients: View { let type: ComposeViewFieldType var areCCAndBCCEmpty = false - let totalRecipients: Int let isRecipientLimitExceeded: Bool /// It should be displayed only for the field to if cc and bcc are empty and when autocompletion is not displayed @@ -208,7 +207,6 @@ struct ComposeMessageCellRecipients: View { showRecipientsFields: .constant(false), autocompletionType: .constant(nil), type: .bcc, - totalRecipients: 0, isRecipientLimitExceeded: false ) .environmentObject(PreviewHelper.sampleMailboxManager)