diff --git a/View Controllers/EmojiPickerViewController.swift b/View Controllers/EmojiPickerViewController.swift index c4bc381..21a4a49 100644 --- a/View Controllers/EmojiPickerViewController.swift +++ b/View Controllers/EmojiPickerViewController.swift @@ -155,7 +155,7 @@ final class EmojiPickerViewController: UICollectionViewController { guard let item = dataSource.itemIdentifier(for: indexPath) else { return } - select(item.applyingDefaultSkinTone(identityContext: viewModel.identityContext)) + select(emoji: item.applyingDefaultSkinTone(identityContext: viewModel.identityContext)) viewModel.updateUse(emoji: item) } diff --git a/Views/UIKit/Collection View Cells/AutocompleteItemCollectionViewCell.swift b/Views/UIKit/Collection View Cells/AutocompleteItemCollectionViewCell.swift index 0224219..c25593b 100644 --- a/Views/UIKit/Collection View Cells/AutocompleteItemCollectionViewCell.swift +++ b/Views/UIKit/Collection View Cells/AutocompleteItemCollectionViewCell.swift @@ -12,9 +12,11 @@ final class AutocompleteItemCollectionViewCell: SeparatorConfiguredCollectionVie contentConfiguration = AutocompleteItemContentConfiguration(item: item, identityContext: identityContext) - var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell() + var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell().updated(for: state) - backgroundConfiguration.backgroundColor = state.isHighlighted || state.isSelected ? nil : .clear + if !state.isHighlighted && !state.isSelected { + backgroundConfiguration.backgroundColor = .clear + } self.backgroundConfiguration = backgroundConfiguration diff --git a/Views/UIKit/Collection View Cells/EmojiCollectionViewCell.swift b/Views/UIKit/Collection View Cells/EmojiCollectionViewCell.swift index 0407dab..2fe4b71 100644 --- a/Views/UIKit/Collection View Cells/EmojiCollectionViewCell.swift +++ b/Views/UIKit/Collection View Cells/EmojiCollectionViewCell.swift @@ -11,9 +11,12 @@ final class EmojiCollectionViewCell: UICollectionViewCell { contentConfiguration = EmojiContentConfiguration(emoji: emoji) - var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell() + var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell().updated(for: state) + + if !state.isHighlighted && !state.isSelected { + backgroundConfiguration.backgroundColor = .clear + } - backgroundConfiguration.backgroundColor = state.isHighlighted || state.isSelected ? nil : .clear backgroundConfiguration.cornerRadius = .defaultCornerRadius self.backgroundConfiguration = backgroundConfiguration diff --git a/Views/UIKit/CompositionInputAccessoryView.swift b/Views/UIKit/CompositionInputAccessoryView.swift index 0348720..04d8a9f 100644 --- a/Views/UIKit/CompositionInputAccessoryView.swift +++ b/Views/UIKit/CompositionInputAccessoryView.swift @@ -62,6 +62,8 @@ private extension CompositionInputAccessoryView { autocompleteCollectionView.backgroundColor = .clear autocompleteCollectionView.layer.cornerRadius = .defaultCornerRadius autocompleteCollectionView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner] + autocompleteCollectionView.dataSource = autocompleteDataSource + autocompleteCollectionView.delegate = self let autocompleteBackgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .systemChromeMaterial)) @@ -236,6 +238,12 @@ private extension CompositionInputAccessoryView { } } +extension CompositionInputAccessoryView: UICollectionViewDelegate { + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + collectionView.deselectItem(at: indexPath, animated: true) + } +} + private extension CompositionInputAccessoryView { static func autocompleteLayout() -> UICollectionViewLayout { var listConfig = UICollectionLayoutListConfiguration(appearance: .plain)