This commit is contained in:
Justin Mazzocchi 2021-02-15 11:17:06 -08:00
parent 38ffad5f60
commit 588154b050
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
4 changed files with 18 additions and 5 deletions

View file

@ -155,7 +155,7 @@ final class EmojiPickerViewController: UICollectionViewController {
guard let item = dataSource.itemIdentifier(for: indexPath) else { return } 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) viewModel.updateUse(emoji: item)
} }

View file

@ -12,9 +12,11 @@ final class AutocompleteItemCollectionViewCell: SeparatorConfiguredCollectionVie
contentConfiguration = AutocompleteItemContentConfiguration(item: item, identityContext: identityContext) 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 self.backgroundConfiguration = backgroundConfiguration

View file

@ -11,9 +11,12 @@ final class EmojiCollectionViewCell: UICollectionViewCell {
contentConfiguration = EmojiContentConfiguration(emoji: emoji) 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 backgroundConfiguration.cornerRadius = .defaultCornerRadius
self.backgroundConfiguration = backgroundConfiguration self.backgroundConfiguration = backgroundConfiguration

View file

@ -62,6 +62,8 @@ private extension CompositionInputAccessoryView {
autocompleteCollectionView.backgroundColor = .clear autocompleteCollectionView.backgroundColor = .clear
autocompleteCollectionView.layer.cornerRadius = .defaultCornerRadius autocompleteCollectionView.layer.cornerRadius = .defaultCornerRadius
autocompleteCollectionView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner] autocompleteCollectionView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
autocompleteCollectionView.dataSource = autocompleteDataSource
autocompleteCollectionView.delegate = self
let autocompleteBackgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .systemChromeMaterial)) 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 { private extension CompositionInputAccessoryView {
static func autocompleteLayout() -> UICollectionViewLayout { static func autocompleteLayout() -> UICollectionViewLayout {
var listConfig = UICollectionLayoutListConfiguration(appearance: .plain) var listConfig = UICollectionLayoutListConfiguration(appearance: .plain)