diff --git a/submodules/ComponentFlow/Source/Base/Transition.swift b/submodules/ComponentFlow/Source/Base/Transition.swift index a6679fc7ba..5bf0b3954f 100644 --- a/submodules/ComponentFlow/Source/Base/Transition.swift +++ b/submodules/ComponentFlow/Source/Base/Transition.swift @@ -724,4 +724,60 @@ public struct Transition { ) } } + + public func setTintColor(view: UIView, color: UIColor, completion: ((Bool) -> Void)? = nil) { + if let current = view.tintColor, current == color { + completion?(true) + return + } + + switch self.animation { + case .none: + view.tintColor = color + completion?(true) + case let .curve(duration, curve): + let previousColor: UIColor = view.tintColor ?? UIColor.clear + view.tintColor = color + + view.layer.animate( + from: previousColor, + to: color.cgColor, + keyPath: "contentsMultiplyColor", + duration: duration, + delay: 0.0, + curve: curve, + removeOnCompletion: true, + additive: false, + completion: completion + ) + } + } + + public func setTintColor(layer: CALayer, color: UIColor, completion: ((Bool) -> Void)? = nil) { + if let current = layer.layerTintColor, current == color.cgColor { + completion?(true) + return + } + + switch self.animation { + case .none: + layer.layerTintColor = color.cgColor + completion?(true) + case let .curve(duration, curve): + let previousColor: CGColor = layer.layerTintColor ?? UIColor.clear.cgColor + layer.layerTintColor = color.cgColor + + layer.animate( + from: previousColor, + to: color.cgColor, + keyPath: "contentsMultiplyColor", + duration: duration, + delay: 0.0, + curve: curve, + removeOnCompletion: true, + additive: false, + completion: completion + ) + } + } } diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index df1fdbfde1..bc24c91fa9 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -652,6 +652,12 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati panelContentControlVibrantSelectionColor: UIColor(white: 1.0, alpha: 0.1), panelContentControlOpaqueOverlayColor: UIColor(white: 1.0, alpha: 0.1), panelContentControlOpaqueSelectionColor: UIColor(white: 1.0, alpha: 0.1), + panelContentVibrantSearchOverlayColor: UIColor(rgb: 0x808080), + panelContentVibrantSearchOverlaySelectedColor: UIColor(rgb: 0x808080), + panelContentVibrantSearchOverlayHighlightColor: UIColor(rgb: 0x808080).withMultipliedAlpha(0.25), + panelContentOpaqueSearchOverlayColor: UIColor(rgb: 0x808080), + panelContentOpaqueSearchOverlaySelectedColor: UIColor(rgb: 0x808080), + panelContentOpaqueSearchOverlayHighlightColor: UIColor(rgb: 0x808080).withMultipliedAlpha(0.25), stickersBackgroundColor: UIColor(rgb: 0x000000), stickersSectionTextColor: UIColor(rgb: 0x7b7b7b), stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d), diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift index f0d6ab8816..76c1c159e5 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift @@ -449,6 +449,12 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme panelContentControlVibrantOverlayColor: mainSecondaryTextColor?.withAlphaComponent(0.3), panelContentControlOpaqueOverlayColor: mainSecondaryTextColor?.withAlphaComponent(0.3), panelContentControlOpaqueSelectionColor: mainSecondaryTextColor?.withAlphaComponent(0.3), + panelContentVibrantSearchOverlayColor: mainSecondaryTextColor?.withAlphaComponent(0.3), + panelContentVibrantSearchOverlaySelectedColor: mainSecondaryTextColor?.withAlphaComponent(0.3), + panelContentVibrantSearchOverlayHighlightColor: mainSecondaryTextColor?.withAlphaComponent(0.3 * 0.5), + panelContentOpaqueSearchOverlayColor: mainSecondaryTextColor?.withAlphaComponent(0.3), + panelContentOpaqueSearchOverlaySelectedColor: mainSecondaryTextColor?.withAlphaComponent(0.3), + panelContentOpaqueSearchOverlayHighlightColor: mainSecondaryTextColor?.withAlphaComponent(0.3 * 0.5), stickersBackgroundColor: additionalBackgroundColor, stickersSectionTextColor: mainSecondaryTextColor?.withAlphaComponent(0.5), stickersSearchBackgroundColor: accentColor?.withMultiplied(hue: 1.009, saturation: 0.621, brightness: 0.15), @@ -866,6 +872,12 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres panelContentControlVibrantSelectionColor: mainSecondaryTextColor.withAlphaComponent(0.1), panelContentControlOpaqueOverlayColor: mainSecondaryTextColor.withAlphaComponent(0.1), panelContentControlOpaqueSelectionColor: mainSecondaryTextColor.withAlphaComponent(0.1), + panelContentVibrantSearchOverlayColor: mainSecondaryTextColor.withAlphaComponent(0.5), + panelContentVibrantSearchOverlaySelectedColor: mainSecondaryTextColor.withAlphaComponent(0.5), + panelContentVibrantSearchOverlayHighlightColor: mainSecondaryTextColor.withAlphaComponent(0.1), + panelContentOpaqueSearchOverlayColor: mainSecondaryTextColor.withAlphaComponent(0.5), + panelContentOpaqueSearchOverlaySelectedColor: mainSecondaryTextColor.withAlphaComponent(0.5), + panelContentOpaqueSearchOverlayHighlightColor: mainSecondaryTextColor.withAlphaComponent(0.1), stickersBackgroundColor: additionalBackgroundColor, stickersSectionTextColor: mainSecondaryTextColor.withAlphaComponent(0.5), stickersSearchBackgroundColor: accentColor.withMultiplied(hue: 1.009, saturation: 0.621, brightness: 0.15), diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index 4940685ff5..f9d53abc71 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -901,6 +901,12 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio panelContentControlVibrantSelectionColor: UIColor(white: 0.85, alpha: 0.1), panelContentControlOpaqueOverlayColor: UIColor(white: 0.0, alpha: 0.2), panelContentControlOpaqueSelectionColor: UIColor(white: 0.0, alpha: 0.1), + panelContentVibrantSearchOverlayColor: UIColor(white: 0.6, alpha: 0.55), + panelContentVibrantSearchOverlaySelectedColor: UIColor(white: 0.4, alpha: 0.6), + panelContentVibrantSearchOverlayHighlightColor: UIColor(white: 0.2, alpha: 0.02), + panelContentOpaqueSearchOverlayColor: UIColor(white: 0.0, alpha: 0.3), + panelContentOpaqueSearchOverlaySelectedColor: UIColor(white: 0.0, alpha: 0.4), + panelContentOpaqueSearchOverlayHighlightColor: UIColor(white: 0.0, alpha: 0.1), stickersBackgroundColor: UIColor(rgb: 0xe8ebf0), stickersSectionTextColor: UIColor(rgb: 0x9099a2), stickersSearchBackgroundColor: UIColor(rgb: 0xd9dbe1), diff --git a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift index ca0f78f2e2..a50dcdb2a8 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift @@ -1163,6 +1163,12 @@ public final class PresentationThemeInputMediaPanel { public let panelContentControlVibrantSelectionColor: UIColor public let panelContentControlOpaqueOverlayColor: UIColor public let panelContentControlOpaqueSelectionColor: UIColor + public let panelContentVibrantSearchOverlayColor: UIColor + public let panelContentVibrantSearchOverlaySelectedColor: UIColor + public let panelContentVibrantSearchOverlayHighlightColor: UIColor + public let panelContentOpaqueSearchOverlayColor: UIColor + public let panelContentOpaqueSearchOverlaySelectedColor: UIColor + public let panelContentOpaqueSearchOverlayHighlightColor: UIColor public let stickersBackgroundColor: UIColor public let stickersSectionTextColor: UIColor public let stickersSearchBackgroundColor: UIColor @@ -1182,6 +1188,12 @@ public final class PresentationThemeInputMediaPanel { panelContentControlVibrantSelectionColor: UIColor, panelContentControlOpaqueOverlayColor: UIColor, panelContentControlOpaqueSelectionColor: UIColor, + panelContentVibrantSearchOverlayColor: UIColor, + panelContentVibrantSearchOverlaySelectedColor: UIColor, + panelContentVibrantSearchOverlayHighlightColor: UIColor, + panelContentOpaqueSearchOverlayColor: UIColor, + panelContentOpaqueSearchOverlaySelectedColor: UIColor, + panelContentOpaqueSearchOverlayHighlightColor: UIColor, stickersBackgroundColor: UIColor, stickersSectionTextColor: UIColor, stickersSearchBackgroundColor: UIColor, @@ -1200,6 +1212,12 @@ public final class PresentationThemeInputMediaPanel { self.panelContentControlVibrantSelectionColor = panelContentControlVibrantSelectionColor self.panelContentControlOpaqueOverlayColor = panelContentControlOpaqueOverlayColor self.panelContentControlOpaqueSelectionColor = panelContentControlOpaqueSelectionColor + self.panelContentVibrantSearchOverlayColor = panelContentVibrantSearchOverlayColor + self.panelContentVibrantSearchOverlaySelectedColor = panelContentVibrantSearchOverlaySelectedColor + self.panelContentVibrantSearchOverlayHighlightColor = panelContentVibrantSearchOverlayHighlightColor + self.panelContentOpaqueSearchOverlayColor = panelContentOpaqueSearchOverlayColor + self.panelContentOpaqueSearchOverlaySelectedColor = panelContentOpaqueSearchOverlaySelectedColor + self.panelContentOpaqueSearchOverlayHighlightColor = panelContentOpaqueSearchOverlayHighlightColor self.stickersBackgroundColor = stickersBackgroundColor self.stickersSectionTextColor = stickersSectionTextColor self.stickersSearchBackgroundColor = stickersSearchBackgroundColor @@ -1220,6 +1238,12 @@ public final class PresentationThemeInputMediaPanel { panelContentControlVibrantSelectionColor: UIColor? = nil, panelContentControlOpaqueOverlayColor: UIColor? = nil, panelContentControlOpaqueSelectionColor: UIColor? = nil, + panelContentVibrantSearchOverlayColor: UIColor? = nil, + panelContentVibrantSearchOverlaySelectedColor: UIColor? = nil, + panelContentVibrantSearchOverlayHighlightColor: UIColor? = nil, + panelContentOpaqueSearchOverlayColor: UIColor? = nil, + panelContentOpaqueSearchOverlaySelectedColor: UIColor? = nil, + panelContentOpaqueSearchOverlayHighlightColor: UIColor? = nil, stickersBackgroundColor: UIColor? = nil, stickersSectionTextColor: UIColor? = nil, stickersSearchBackgroundColor: UIColor? = nil, @@ -1239,6 +1263,12 @@ public final class PresentationThemeInputMediaPanel { panelContentControlVibrantSelectionColor: panelContentControlVibrantSelectionColor ?? self.panelContentControlVibrantSelectionColor, panelContentControlOpaqueOverlayColor: panelContentControlOpaqueOverlayColor ?? self.panelContentControlOpaqueOverlayColor, panelContentControlOpaqueSelectionColor: panelContentControlOpaqueSelectionColor ?? self.panelContentControlOpaqueSelectionColor, + panelContentVibrantSearchOverlayColor: panelContentVibrantSearchOverlayColor ?? self.panelContentVibrantSearchOverlayColor, + panelContentVibrantSearchOverlaySelectedColor: panelContentVibrantSearchOverlaySelectedColor ?? self.panelContentVibrantSearchOverlaySelectedColor, + panelContentVibrantSearchOverlayHighlightColor: panelContentVibrantSearchOverlayHighlightColor ?? self.panelContentVibrantSearchOverlayHighlightColor, + panelContentOpaqueSearchOverlayColor: panelContentOpaqueSearchOverlayColor ?? self.panelContentOpaqueSearchOverlayColor, + panelContentOpaqueSearchOverlaySelectedColor: panelContentOpaqueSearchOverlaySelectedColor ?? self.panelContentOpaqueSearchOverlaySelectedColor, + panelContentOpaqueSearchOverlayHighlightColor: panelContentOpaqueSearchOverlayHighlightColor ?? self.panelContentOpaqueSearchOverlayHighlightColor, stickersBackgroundColor: stickersBackgroundColor ?? self.stickersBackgroundColor, stickersSectionTextColor: stickersSectionTextColor ?? self.stickersSectionTextColor, stickersSearchBackgroundColor: stickersSearchBackgroundColor ?? self.stickersSearchBackgroundColor, diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index fac8cfa68e..10ed993ba4 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -1642,6 +1642,12 @@ extension PresentationThemeInputMediaPanel: Codable { case stickersSearchControl case gifsBg case bg + case panelContentVibrantSearchOverlay + case panelContentVibrantSearchOverlaySelected + case panelContentVibrantSearchOverlayHighlight + case panelContentOpaqueSearchOverlay + case panelContentOpaqueSearchOverlaySelected + case panelContentOpaqueSearchOverlayHighlight } public convenience init(from decoder: Decoder) throws { @@ -1675,6 +1681,12 @@ extension PresentationThemeInputMediaPanel: Codable { panelContentControlVibrantSelectionColor: try decodeColor(values, .panelContentControlVibrantSelection, fallbackKey: "\(codingPath).stickersSectionText"), panelContentControlOpaqueOverlayColor: try decodeColor(values, .panelContentControlOpaqueOverlay, fallbackKey: "\(codingPath).stickersSectionText"), panelContentControlOpaqueSelectionColor: try decodeColor(values, .panelContentControlOpaqueSelection, fallbackKey: "\(codingPath).stickersSectionText"), + panelContentVibrantSearchOverlayColor: try decodeColor(values, .panelContentVibrantSearchOverlay, fallbackKey: "\(codingPath).stickersSectionText"), + panelContentVibrantSearchOverlaySelectedColor: try decodeColor(values, .panelContentVibrantSearchOverlaySelected, fallbackKey: "\(codingPath).stickersSectionText"), + panelContentVibrantSearchOverlayHighlightColor: try decodeColor(values, .panelContentVibrantSearchOverlayHighlight, fallbackKey: "\(codingPath).panelHighlightedIconBg"), + panelContentOpaqueSearchOverlayColor: try decodeColor(values, .panelContentOpaqueSearchOverlay, fallbackKey: "\(codingPath).stickersSectionText"), + panelContentOpaqueSearchOverlaySelectedColor: try decodeColor(values, .panelContentOpaqueSearchOverlaySelected, fallbackKey: "\(codingPath).stickersSectionText"), + panelContentOpaqueSearchOverlayHighlightColor: try decodeColor(values, .panelContentOpaqueSearchOverlayHighlight, fallbackKey: "\(codingPath).panelHighlightedIconBg"), stickersBackgroundColor: try decodeColor(values, .stickersBg), stickersSectionTextColor: try decodeColor(values, .stickersSectionText), stickersSearchBackgroundColor: try decodeColor(values, .stickersSearchBg), @@ -1695,6 +1707,14 @@ extension PresentationThemeInputMediaPanel: Codable { try encodeColor(&values, self.panelContentControlVibrantSelectionColor, .panelContentControlVibrantSelection) try encodeColor(&values, self.panelContentControlOpaqueOverlayColor, .panelContentControlOpaqueOverlay) try encodeColor(&values, self.panelContentControlOpaqueSelectionColor, .panelContentControlOpaqueSelection) + + try encodeColor(&values, self.panelContentVibrantSearchOverlayColor, .panelContentVibrantSearchOverlay) + try encodeColor(&values, self.panelContentVibrantSearchOverlaySelectedColor, .panelContentVibrantSearchOverlaySelected) + try encodeColor(&values, self.panelContentVibrantSearchOverlayHighlightColor, .panelContentVibrantSearchOverlayHighlight) + try encodeColor(&values, self.panelContentOpaqueSearchOverlayColor, .panelContentOpaqueSearchOverlay) + try encodeColor(&values, self.panelContentOpaqueSearchOverlaySelectedColor, .panelContentOpaqueSearchOverlaySelected) + try encodeColor(&values, self.panelContentOpaqueSearchOverlayHighlightColor, .panelContentOpaqueSearchOverlayHighlight) + try encodeColor(&values, self.stickersBackgroundColor, .stickersBg) try encodeColor(&values, self.stickersSectionTextColor, .stickersSectionText) try encodeColor(&values, self.stickersSearchBackgroundColor, .stickersSearchBg) diff --git a/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift b/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift index d75eaf03ee..5582ff0d60 100644 --- a/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift +++ b/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift @@ -1762,7 +1762,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode { return emoji.withUpdatedItemGroups(panelItemGroups: self.processStableItemGroupList(category: .emoji, itemGroups: emoji.panelItemGroups), contentItemGroups: self.processStableItemGroupList(category: .emoji, itemGroups: emoji.contentItemGroups), itemContentUniqueId: emoji.itemContentUniqueId, emptySearchResults: emoji.emptySearchResults) }, stickers: inputData.stickers.flatMap { stickers in - return stickers.withUpdatedItemGroups(panelItemGroups: self.processStableItemGroupList(category: .stickers, itemGroups: stickers.panelItemGroups), contentItemGroups: self.processStableItemGroupList(category: .stickers, itemGroups: stickers.contentItemGroups), itemContentUniqueId: nil, emptySearchResults: nil) + return stickers.withUpdatedItemGroups(panelItemGroups: self.processStableItemGroupList(category: .stickers, itemGroups: stickers.panelItemGroups), contentItemGroups: self.processStableItemGroupList(category: .stickers, itemGroups: stickers.contentItemGroups), itemContentUniqueId: stickers.itemContentUniqueId, emptySearchResults: nil) }, gifs: inputData.gifs, availableGifSearchEmojies: inputData.availableGifSearchEmojies diff --git a/submodules/TelegramUI/Components/EmojiStatusSelectionComponent/Sources/EmojiStatusSelectionComponent.swift b/submodules/TelegramUI/Components/EmojiStatusSelectionComponent/Sources/EmojiStatusSelectionComponent.swift index 6fbceaec17..fd1d470605 100644 --- a/submodules/TelegramUI/Components/EmojiStatusSelectionComponent/Sources/EmojiStatusSelectionComponent.swift +++ b/submodules/TelegramUI/Components/EmojiStatusSelectionComponent/Sources/EmojiStatusSelectionComponent.swift @@ -559,110 +559,53 @@ public final class EmojiStatusSelectionController: ViewController { strongSelf.emojiSearchResult.set(.single((result, AnyHashable(query)))) })) } - case let .category(query): - if query.isEmpty { - strongSelf.emojiSearchDisposable.set(nil) - strongSelf.emojiSearchResult.set(.single(nil)) - } else { - let context = strongSelf.context + case let .category(value): + let resultSignal = strongSelf.context.engine.stickers.searchEmoji(emojiString: value) + |> mapToSignal { files -> Signal<[EmojiPagerContentComponent.ItemGroup], NoError> in + var items: [EmojiPagerContentComponent.Item] = [] - let signal = context.engine.stickers.searchEmojiKeywords(inputLanguageCode: "en", query: query, completeMatch: false) - - let hasPremium = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId)) - |> map { peer -> Bool in - guard case let .user(user) = peer else { - return false + var existingIds = Set() + for itemFile in files { + if existingIds.contains(itemFile.fileId) { + continue } - return user.isPremium - } - |> distinctUntilChanged - - let resultSignal = signal - |> mapToSignal { keywords -> Signal<[EmojiPagerContentComponent.ItemGroup], NoError> in - return combineLatest( - context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000), - context.engine.stickers.availableReactions(), - hasPremium + existingIds.insert(itemFile.fileId) + let animationData = EntityKeyboardAnimationData(file: itemFile) + let item = EmojiPagerContentComponent.Item( + animationData: animationData, + content: .animation(animationData), + itemFile: itemFile, subgroupId: nil, + icon: .none, + tintMode: animationData.isTemplate ? .primary : .none ) - |> take(1) - |> map { view, availableReactions, hasPremium -> [EmojiPagerContentComponent.ItemGroup] in - var result: [(String, TelegramMediaFile?, String)] = [] - - var allEmoticons: [String: String] = [:] - for keyword in keywords { - for emoticon in keyword.emoticons { - allEmoticons[emoticon] = keyword.keyword - } - } - - for entry in view.entries { - guard let item = entry.item as? StickerPackItem else { - continue - } - for attribute in item.file.attributes { - switch attribute { - case let .CustomEmoji(_, _, alt, _): - if !item.file.isPremiumEmoji || hasPremium { - if !alt.isEmpty, let keyword = allEmoticons[alt] { - result.append((alt, item.file, keyword)) - } else if alt == query { - result.append((alt, item.file, alt)) - } - } - default: - break - } - } - } - - var items: [EmojiPagerContentComponent.Item] = [] - - var existingIds = Set() - for item in result { - if let itemFile = item.1 { - if existingIds.contains(itemFile.fileId) { - continue - } - existingIds.insert(itemFile.fileId) - let animationData = EntityKeyboardAnimationData(file: itemFile) - let item = EmojiPagerContentComponent.Item( - animationData: animationData, - content: .animation(animationData), - itemFile: itemFile, subgroupId: nil, - icon: .none, - tintMode: animationData.isTemplate ? .primary : .none - ) - items.append(item) - } - } - - return [EmojiPagerContentComponent.ItemGroup( - supergroupId: "search", - groupId: "search", - title: nil, - subtitle: nil, - actionButtonTitle: nil, - isFeatured: false, - isPremiumLocked: false, - isEmbedded: false, - hasClear: false, - collapsedLineCount: nil, - displayPremiumBadges: false, - headerItem: nil, - items: items - )] - } + items.append(item) } - strongSelf.emojiSearchDisposable.set((resultSignal - |> delay(0.15, queue: .mainQueue()) - |> deliverOnMainQueue).start(next: { result in - guard let strongSelf = self else { - return - } - strongSelf.emojiSearchResult.set(.single((result, AnyHashable(query)))) - })) + return .single([EmojiPagerContentComponent.ItemGroup( + supergroupId: "search", + groupId: "search", + title: nil, + subtitle: nil, + actionButtonTitle: nil, + isFeatured: false, + isPremiumLocked: false, + isEmbedded: false, + hasClear: false, + collapsedLineCount: nil, + displayPremiumBadges: false, + headerItem: nil, + items: items + )]) } + + strongSelf.emojiSearchDisposable.set((resultSignal + |> delay(0.15, queue: .mainQueue()) + |> deliverOnMainQueue).start(next: { result in + guard let strongSelf = self else { + return + } + strongSelf.emojiSearchResult.set(.single((result, AnyHashable(value)))) + })) } }, updateScrollingToItemGroup: { diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index 2af5fddfa7..bc5d3ef902 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -1852,13 +1852,19 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate { let isActiveWithText = isActive && self.currentPresetSearchTerm == nil if self.params?.theme !== theme { - self.searchIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: theme.chat.inputMediaPanel.panelContentVibrantOverlayColor) + self.searchIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: .white)?.withRenderingMode(.alwaysTemplate) + self.searchIconView.tintColor = useOpaqueTheme ? theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayColor : theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayColor + self.searchIconTintView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: .white) - self.backIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.chat.inputMediaPanel.panelContentVibrantOverlayColor) + self.backIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: .white)?.withRenderingMode(.alwaysTemplate) + self.backIconView.tintColor = useOpaqueTheme ? theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayColor : theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayColor + self.backIconTintView.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: .white) - self.clearIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: theme.chat.inputMediaPanel.panelContentVibrantOverlayColor) + self.clearIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: .white)?.withRenderingMode(.alwaysTemplate) + self.clearIconView.tintColor = useOpaqueTheme ? theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayColor : theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayColor + self.clearIconTintView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: .white) } @@ -1948,6 +1954,7 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate { context: context, theme: theme, strings: strings, + useOpaqueTheme: useOpaqueTheme, textInputState: textInputState, categories: searchCategories, searchTermUpdated: { [weak self] term in @@ -6470,22 +6477,22 @@ public final class EmojiPagerContentComponent: Component { } if animateContentCrossfade { - for (_, itemLayer) in self.visibleItemLayers { + /*for (_, itemLayer) in self.visibleItemLayers { if let snapshotLayer = itemLayer.snapshotContentTree() { itemLayer.superlayer?.insertSublayer(snapshotLayer, above: itemLayer) snapshotLayer.animateAlpha(from: CGFloat(snapshotLayer.opacity), to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snapshotLayer] _ in snapshotLayer?.removeFromSuperlayer() }) } - } + }*/ } self.updateVisibleItems(transition: itemTransition, attemptSynchronousLoads: attemptSynchronousLoads, previousItemPositions: previousItemPositions, previousAbsoluteItemPositions: previousAbsoluteItemPositions, updatedItemPositions: updatedItemPositions, hintDisappearingGroupFrame: hintDisappearingGroupFrame) if animateContentCrossfade { - for (_, itemLayer) in self.visibleItemLayers { + /*for (_, itemLayer) in self.visibleItemLayers { itemLayer.animateAlpha(from: 0.0, to: CGFloat(itemLayer.opacity), duration: 0.2) - } + }*/ } return availableSize diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiSearchSearchBarComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiSearchSearchBarComponent.swift index 712c50e439..a950fef04d 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiSearchSearchBarComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiSearchSearchBarComponent.swift @@ -61,6 +61,7 @@ final class EmojiSearchSearchBarComponent: Component { let context: AccountContext let theme: PresentationTheme let strings: PresentationStrings + let useOpaqueTheme: Bool let textInputState: TextInputState let categories: EmojiSearchCategories? let searchTermUpdated: (String?) -> Void @@ -70,6 +71,7 @@ final class EmojiSearchSearchBarComponent: Component { context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, + useOpaqueTheme: Bool, textInputState: TextInputState, categories: EmojiSearchCategories?, searchTermUpdated: @escaping (String?) -> Void, @@ -78,6 +80,7 @@ final class EmojiSearchSearchBarComponent: Component { self.context = context self.theme = theme self.strings = strings + self.useOpaqueTheme = useOpaqueTheme self.textInputState = textInputState self.categories = categories self.searchTermUpdated = searchTermUpdated @@ -91,6 +94,9 @@ final class EmojiSearchSearchBarComponent: Component { if lhs.strings !== rhs.strings { return false } + if lhs.useOpaqueTheme != rhs.useOpaqueTheme { + return false + } if lhs.textInputState != rhs.textInputState { return false } @@ -116,15 +122,15 @@ final class EmojiSearchSearchBarComponent: Component { init(containerSize: CGSize, textSize: CGSize, itemCount: Int) { self.containerSize = containerSize self.itemCount = itemCount - self.itemSpacing = 8.0 + self.itemSpacing = 11.0 self.leftInset = 6.0 self.rightInset = 8.0 self.itemSize = CGSize(width: 24.0, height: 24.0) - self.textSpacing = 8.0 + self.textSpacing = 11.0 self.textFrame = CGRect(origin: CGPoint(x: self.leftInset, y: floor((containerSize.height - textSize.height) * 0.5)), size: textSize) - self.itemStartX = max(self.textFrame.maxX + self.textSpacing, self.leftInset + floor(((containerSize.width - self.leftInset - self.rightInset) / 2.0) - self.itemSize.width)) + self.itemStartX = self.textFrame.maxX + self.textSpacing self.contentSize = CGSize(width: self.itemStartX + self.itemSize.width * CGFloat(self.itemCount) + self.itemSpacing * CGFloat(max(0, self.itemCount - 1)) + self.rightInset, height: containerSize.height) } @@ -348,7 +354,12 @@ final class EmojiSearchSearchBarComponent: Component { self.visibleItemViews[AnyHashable(item.id)] = itemView } - let color = component.theme.chat.inputMediaPanel.panelContentVibrantOverlayColor + let color: UIColor + if component.useOpaqueTheme { + color = self.selectedItem == AnyHashable(item.id) ? component.theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlaySelectedColor : component.theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayColor + } else { + color = self.selectedItem == AnyHashable(item.id) ? component.theme.chat.inputMediaPanel.panelContentVibrantSearchOverlaySelectedColor : component.theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayColor + } let _ = itemView.view.update( transition: .immediate, @@ -421,8 +432,8 @@ final class EmojiSearchSearchBarComponent: Component { let selectedItemCenter = itemLayout.frame(at: index).center let selectionSize = CGSize(width: 28.0, height: 28.0) - self.selectedItemBackground.backgroundColor = component.theme.chat.inputMediaPanel.panelContentControlVibrantSelectionColor.cgColor - self.selectedItemTintBackground.backgroundColor = UIColor(white: 1.0, alpha: 0.2).cgColor + self.selectedItemBackground.backgroundColor = component.useOpaqueTheme ? component.theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayHighlightColor.cgColor : component.theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayHighlightColor.cgColor + self.selectedItemTintBackground.backgroundColor = UIColor(white: 1.0, alpha: 0.15).cgColor self.selectedItemBackground.cornerRadius = selectionSize.height * 0.5 self.selectedItemTintBackground.cornerRadius = selectionSize.height * 0.5 @@ -453,7 +464,7 @@ final class EmojiSearchSearchBarComponent: Component { component: AnyComponent(Text( text: component.strings.Common_Search, font: Font.regular(17.0), - color: component.theme.chat.inputMediaPanel.panelContentVibrantOverlayColor + color: component.useOpaqueTheme ? component.theme.chat.inputMediaPanel.panelContentOpaqueSearchOverlayColor : component.theme.chat.inputMediaPanel.panelContentVibrantSearchOverlayColor )), environment: {}, containerSize: CGSize(width: availableSize.width - 32.0, height: 100.0) diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift index 950904ba03..9465e1d7c5 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift @@ -80,7 +80,7 @@ private final class BottomPanelIconComponent: Component { self.component = component - let textInset: CGFloat = 18.0 + let textInset: CGFloat = 12.0 let textSize = self.contentView.image?.size ?? CGSize() let size = CGSize(width: textSize.width + textInset * 2.0, height: 28.0) diff --git a/submodules/TelegramUI/Components/LottieComponent/Sources/LottieComponent.swift b/submodules/TelegramUI/Components/LottieComponent/Sources/LottieComponent.swift index f773b61d1f..584f59703c 100644 --- a/submodules/TelegramUI/Components/LottieComponent/Sources/LottieComponent.swift +++ b/submodules/TelegramUI/Components/LottieComponent/Sources/LottieComponent.swift @@ -229,7 +229,7 @@ public final class LottieComponent: Component { } if self.tintColor != component.color { - self.tintColor = component.color + transition.setTintColor(view: self, color: component.color) } return availableSize