mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Update gif provider attribution
This commit is contained in:
@@ -348,8 +348,26 @@ class WebSearchControllerNode: ASDisplayNode {
|
||||
self.segmentedControlNode.updateTheme(SegmentedControlTheme(theme: self.theme))
|
||||
self.toolbarBackgroundNode.backgroundColor = self.theme.rootController.navigationBar.backgroundColor
|
||||
self.toolbarSeparatorNode.backgroundColor = self.theme.rootController.navigationBar.separatorColor
|
||||
|
||||
self.attributionNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Giphy"), color: self.theme.list.itemSecondaryTextColor)
|
||||
}
|
||||
|
||||
let gifProviderImage: UIImage?
|
||||
if let gifProvider = self.webSearchInterfaceState.gifProvider {
|
||||
switch gifProvider {
|
||||
case "tenor":
|
||||
gifProviderImage = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Tenor"), color: self.theme.list.itemSecondaryTextColor)
|
||||
case "giphy":
|
||||
gifProviderImage = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Giphy"), color: self.theme.list.itemSecondaryTextColor)
|
||||
default:
|
||||
gifProviderImage = nil
|
||||
}
|
||||
} else {
|
||||
gifProviderImage = nil
|
||||
}
|
||||
let previousGifProviderImage = self.attributionNode.image
|
||||
self.attributionNode.image = gifProviderImage
|
||||
|
||||
if previousGifProviderImage == nil, let validLayout = self.containerLayout {
|
||||
self.containerLayoutUpdated(validLayout.0, navigationBarHeight: validLayout.1, transition: .immediate)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +404,7 @@ class WebSearchControllerNode: ASDisplayNode {
|
||||
transition.updateFrame(node: self.toolbarSeparatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: toolbarY), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
||||
|
||||
if let image = self.attributionNode.image {
|
||||
transition.updateFrame(node: self.attributionNode, frame: CGRect(origin: CGPoint(x: floor((layout.size.width - image.size.width) / 2.0), y: toolbarY + floor((toolbarHeight - image.size.height) / 2.0)), size: image.size))
|
||||
self.attributionNode.frame = CGRect(origin: CGPoint(x: floor((layout.size.width - image.size.width) / 2.0), y: toolbarY + floor((toolbarHeight - image.size.height) / 2.0)), size: image.size)
|
||||
transition.updateAlpha(node: self.attributionNode, alpha: self.webSearchInterfaceState.state?.scope == .gifs ? 1.0 : 0.0)
|
||||
}
|
||||
|
||||
@@ -456,6 +474,7 @@ class WebSearchControllerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
func updateInterfaceState(_ interfaceState: WebSearchInterfaceState, animated: Bool) {
|
||||
let previousGifProvider = self.webSearchInterfaceState.gifProvider
|
||||
self.webSearchInterfaceState = interfaceState
|
||||
self.webSearchInterfaceStatePromise.set(self.webSearchInterfaceState)
|
||||
|
||||
@@ -463,6 +482,10 @@ class WebSearchControllerNode: ASDisplayNode {
|
||||
self.segmentedControlNode.selectedIndex = Int(state.scope.rawValue)
|
||||
}
|
||||
|
||||
if previousGifProvider != interfaceState.gifProvider {
|
||||
self.applyPresentationData(themeUpdated: false)
|
||||
}
|
||||
|
||||
if let validLayout = self.containerLayout {
|
||||
self.containerLayoutUpdated(validLayout.0, navigationBarHeight: validLayout.1, transition: animated ? .animated(duration: 0.4, curve: .spring) : .immediate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user