Emoji search improvements

This commit is contained in:
Ali
2023-01-24 09:06:58 +01:00
parent 0724b9b3b2
commit d556a80d0b
3 changed files with 39 additions and 12 deletions

View File

@@ -146,8 +146,26 @@ func managedSynchronizeEmojiSearchCategories(postbox: Postbox, network: Network,
break
}
var fileIds: [Int64] = []
if let cached = _internal_cachedEmojiSearchCategories(transaction: transaction, kind: kind) {
for group in cached.groups {
fileIds.append(group.id)
}
}
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: fileIds)
|> mapToSignal { files -> Signal<Never, NoError> in
var fetchSignals: Signal<Never, NoError> = .complete()
for (_, file) in files {
let signal = fetchedMediaResource(mediaBox: postbox.mediaBox, userLocation: .other, userContentType: .other, reference: .standalone(resource: file.resource))
|> ignoreValues
|> `catch` { _ -> Signal<Never, NoError> in
return .complete()
}
fetchSignals = fetchSignals |> then(signal)
}
return fetchSignals
}
}
|> switchToLatest
}
}

View File

@@ -6485,7 +6485,9 @@ public final class EmojiPagerContentComponent: Component {
let searchHeaderFrame = CGRect(origin: CGPoint(x: itemLayout.searchInsets.left, y: itemLayout.searchInsets.top), size: CGSize(width: itemLayout.width - itemLayout.searchInsets.left - itemLayout.searchInsets.right, height: itemLayout.searchHeight))
visibleSearchHeader.update(context: component.context, theme: keyboardChildEnvironment.theme, strings: keyboardChildEnvironment.strings, text: displaySearchWithPlaceholder, useOpaqueTheme: useOpaqueTheme, isActive: self.isSearchActivated, size: searchHeaderFrame.size, canFocus: !component.searchIsPlaceholderOnly, searchCategories: component.searchCategories, transition: transition)
/*transition.attachAnimation(view: visibleSearchHeader, id: "search_transition", completion: { [weak self] completed in
if !useOpaqueTheme {
transition.setFrame(view: visibleSearchHeader, frame: searchHeaderFrame)
transition.attachAnimation(view: visibleSearchHeader, id: "search_transition", completion: { [weak self] completed in
guard let strongSelf = self, completed, let visibleSearchHeader = strongSelf.visibleSearchHeader else {
return
}
@@ -6494,8 +6496,8 @@ public final class EmojiPagerContentComponent: Component {
strongSelf.scrollView.addSubview(visibleSearchHeader)
strongSelf.mirrorContentScrollView.addSubview(visibleSearchHeader.tintContainerView)
}
})*/
if visibleSearchHeader.frame != searchHeaderFrame {
})
} else {
transition.setFrame(view: visibleSearchHeader, frame: searchHeaderFrame, completion: { [weak self] completed in
if !useOpaqueTheme {
guard let strongSelf = self, completed, let visibleSearchHeader = strongSelf.visibleSearchHeader else {

View File

@@ -15,6 +15,7 @@ import LottieAnimationComponent
import EmojiStatusComponent
import LottieComponent
import LottieComponentEmojiContent
import AudioToolbox
private final class RoundMaskView: UIImageView {
private var currentDiameter: CGFloat?
@@ -214,6 +215,10 @@ final class EmojiSearchSearchBarComponent: Component {
private var selectedItem: AnyHashable?
private lazy var hapticFeedback: HapticFeedback = {
return HapticFeedback()
}()
override init(frame: CGRect) {
self.tintContainerView = UIView()
@@ -281,6 +286,8 @@ final class EmojiSearchSearchBarComponent: Component {
self.selectedItem = nil
} else {
self.selectedItem = AnyHashable(id)
AudioServicesPlaySystemSound(0x450)
self.hapticFeedback.tap()
}
self.state?.updated(transition: .immediate)