This commit is contained in:
Justin Mazzocchi 2021-01-15 18:22:03 -08:00
parent b2ff1d0a0b
commit 406ac2a270
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C
2 changed files with 9 additions and 6 deletions

View File

@ -116,7 +116,10 @@ final class EmojiPickerViewController: UIViewController {
searchBar.searchBarStyle = .minimal
searchBar.placeholder = NSLocalizedString("emoji.search", comment: "")
searchBar.searchTextField.addAction(
UIAction { [weak self] _ in self?.viewModel.query = self?.searchBar.text ?? "" },
UIAction { [weak self] _ in
self?.viewModel.query = self?.searchBar.text ?? ""
self?.collectionView.setContentOffset(.zero, animated: false)
},
for: .editingChanged)
view.addSubview(skinToneButton)

View File

@ -34,10 +34,14 @@ final public class EmojiPickerViewModel: ObservableObject {
.assign(to: &$systemEmoji)
emojiPickerService.emojiUses(limit: Self.frequentlyUsedLimit)
.receive(on: DispatchQueue.main)
.assignErrorsToAlertItem(to: \.alertItem, on: self)
.print()
.assign(to: &$emojiUses)
$locale.removeDuplicates().flatMap(emojiPickerService.systemEmojiAnnotationsAndTagsPublisher(locale:))
.replaceError(with: [:])
.assign(to: &$systemEmojiAnnotationsAndTags)
$customEmoji.dropFirst().combineLatest(
$systemEmoji.dropFirst(),
$query,
@ -71,10 +75,6 @@ final public class EmojiPickerViewModel: ObservableObject {
return emojis.filter { !$0.value.isEmpty }
}
.assign(to: &$emoji)
$locale.removeDuplicates().flatMap(emojiPickerService.systemEmojiAnnotationsAndTagsPublisher(locale:))
.replaceError(with: [:])
.assign(to: &$systemEmojiAnnotationsAndTags)
}
}