diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index d61f1342de..564b0569a5 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -1200,7 +1200,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { let draftText = stringWithAppliedEntities(draftState.text, entities: draftState.entities, baseColor: theme.messageTextColor, linkColor: theme.messageTextColor, baseFont: textFont, linkFont: textFont, boldFont: textFont, italicFont: textFont, boldItalicFont: textFont, fixedFont: textFont, blockQuoteFont: textFont, message: nil) attributedText = foldLineBreaks(draftText) - } else if let message = messages.last { + } else if let message = messages.first { var composedString: NSMutableAttributedString if let peerText = peerText { diff --git a/submodules/Components/LottieAnimationComponent/Sources/LottieAnimationComponent.swift b/submodules/Components/LottieAnimationComponent/Sources/LottieAnimationComponent.swift index 299339653d..ea7b60c4dd 100644 --- a/submodules/Components/LottieAnimationComponent/Sources/LottieAnimationComponent.swift +++ b/submodules/Components/LottieAnimationComponent/Sources/LottieAnimationComponent.swift @@ -127,9 +127,13 @@ public final class LottieAnimationComponent: Component { updateColors = true } + var animateSize = true + var updateComponent = true + if self.component?.animation != component.animation { if let animationView = self.animationView { if case .animateTransitionFromPrevious = component.animation.mode, !animationView.isAnimationPlaying, !self.didPlayToCompletion { + updateComponent = false animationView.play { [weak self] _ in self?.currentCompletion?() } @@ -143,7 +147,6 @@ public final class LottieAnimationComponent: Component { } strongSelf.didPlayToCompletion = true let _ = strongSelf.update(component: component, availableSize: availableSize, transition: transition) - strongSelf.currentCompletion = nil } animationView.loopMode = .playOnce } else { @@ -173,10 +176,13 @@ public final class LottieAnimationComponent: Component { self.animationView = view self.addSubview(view) + animateSize = false updatePlayback = true } } - } else { + } + + if updateComponent { self.component = component } @@ -209,7 +215,7 @@ public final class LottieAnimationComponent: Component { let animationFrame = CGRect(origin: CGPoint(x: floor((size.width - animationSize.width) / 2.0), y: floor((size.height - animationSize.height) / 2.0)), size: animationSize) if animationView.frame != animationFrame { - if !transition.animation.isImmediate && !animationView.frame.isEmpty && animationView.frame.size != animationFrame.size { + if !transition.animation.isImmediate && animateSize && !animationView.frame.isEmpty && animationView.frame.size != animationFrame.size { let previouosAnimationFrame = animationView.frame if let snapshotView = animationView.snapshotView(afterScreenUpdates: false) { diff --git a/submodules/Components/PagerComponent/Sources/PagerComponent.swift b/submodules/Components/PagerComponent/Sources/PagerComponent.swift index a042fd5b3b..a020e249f8 100644 --- a/submodules/Components/PagerComponent/Sources/PagerComponent.swift +++ b/submodules/Components/PagerComponent/Sources/PagerComponent.swift @@ -65,7 +65,7 @@ public final class PagerComponentChildEnvironment: Equatable { public final class PagerComponentPanelEnvironment: Equatable { public let contentOffset: CGFloat public let contentTopPanels: [AnyComponentWithIdentity] - public let contentIcons: [AnyComponentWithIdentity] + public let contentIcons: [PagerComponentContentIcon] public let contentAccessoryLeftButtons: [AnyComponentWithIdentity] public let contentAccessoryRightButtons: [AnyComponentWithIdentity] public let activeContentId: AnyHashable? @@ -76,7 +76,7 @@ public final class PagerComponentPanelEnvironment: Equatabl init( contentOffset: CGFloat, contentTopPanels: [AnyComponentWithIdentity], - contentIcons: [AnyComponentWithIdentity], + contentIcons: [PagerComponentContentIcon], contentAccessoryLeftButtons: [AnyComponentWithIdentity], contentAccessoryRightButtons: [AnyComponentWithIdentity], activeContentId: AnyHashable?, @@ -141,13 +141,36 @@ public enum PagerComponentPanelHideBehavior { case hide } +public final class PagerComponentContentIcon: Equatable { + public let id: AnyHashable + public let imageName: String + + public init(id: AnyHashable, imageName: String) { + self.id = id + self.imageName = imageName + } + + public static func ==(lhs: PagerComponentContentIcon, rhs: PagerComponentContentIcon) -> Bool { + if lhs === rhs { + return true + } + if lhs.id != rhs.id { + return false + } + if lhs.imageName != rhs.imageName { + return false + } + return true + } +} + public final class PagerComponent: Component { public typealias EnvironmentType = ChildEnvironmentType public let contentInsets: UIEdgeInsets public let contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>] public let contentTopPanels: [AnyComponentWithIdentity] - public let contentIcons: [AnyComponentWithIdentity] + public let contentIcons: [PagerComponentContentIcon] public let contentAccessoryLeftButtons:[AnyComponentWithIdentity] public let contentAccessoryRightButtons:[AnyComponentWithIdentity] public let defaultId: AnyHashable? @@ -163,7 +186,7 @@ public final class PagerComponent], contentTopPanels: [AnyComponentWithIdentity], - contentIcons: [AnyComponentWithIdentity], + contentIcons: [PagerComponentContentIcon], contentAccessoryLeftButtons: [AnyComponentWithIdentity], contentAccessoryRightButtons: [AnyComponentWithIdentity], defaultId: AnyHashable?, @@ -565,7 +588,7 @@ public final class PagerComponent var contentBackgroundTransition = panelStateTransition diff --git a/submodules/Display/Source/UIKitUtils.swift b/submodules/Display/Source/UIKitUtils.swift index 3592dc0062..5c6021eb33 100644 --- a/submodules/Display/Source/UIKitUtils.swift +++ b/submodules/Display/Source/UIKitUtils.swift @@ -387,7 +387,7 @@ public func assertNotOnMainThread(_ file: String = #file, line: Int = #line) { } public extension UIImage { - func precomposed() -> UIImage { + func precomposed() -> UIImage { UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) self.draw(at: CGPoint()) let result = UIGraphicsGetImageFromCurrentImageContext()! diff --git a/submodules/TelegramCore/Sources/PendingMessages/PendingUpdateMessageManager.swift b/submodules/TelegramCore/Sources/PendingMessages/PendingUpdateMessageManager.swift index 44df047ecf..ab583b7a85 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/PendingUpdateMessageManager.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/PendingUpdateMessageManager.swift @@ -64,7 +64,7 @@ private final class PendingUpdateMessageManagerImpl { } } - func add(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool) { + func add(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool) { if let context = self.contexts[messageId] { self.contexts.removeValue(forKey: messageId) context.disposable.dispose() @@ -75,7 +75,7 @@ private final class PendingUpdateMessageManagerImpl { self.contexts[messageId] = context let queue = self.queue - disposable.set((requestEditMessage(postbox: self.postbox, network: self.network, stateManager: self.stateManager, transformOutgoingMessageMedia: self.transformOutgoingMessageMedia, messageMediaPreuploadManager: self.messageMediaPreuploadManager, mediaReferenceRevalidationContext: self.mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview, scheduleTime: nil) + disposable.set((requestEditMessage(postbox: self.postbox, network: self.network, stateManager: self.stateManager, transformOutgoingMessageMedia: self.transformOutgoingMessageMedia, messageMediaPreuploadManager: self.messageMediaPreuploadManager, mediaReferenceRevalidationContext: self.mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview, scheduleTime: nil) |> deliverOn(self.queue)).start(next: { [weak self, weak context] value in queue.async { guard let strongSelf = self, let initialContext = context else { @@ -163,9 +163,9 @@ public final class PendingUpdateMessageManager { }) } - public func add(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute? = nil, disableUrlPreview: Bool = false) { + public func add(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool = false) { self.impl.with { impl in - impl.add(messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview) + impl.add(messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview) } } diff --git a/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift b/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift index 155e3ef164..4c5098b296 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift @@ -27,15 +27,15 @@ public enum RequestEditMessageError { case invalidGrouping } -func _internal_requestEditMessage(account: Account, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute? = nil, disableUrlPreview: Bool = false, scheduleTime: Int32? = nil) -> Signal { - return requestEditMessage(postbox: account.postbox, network: account.network, stateManager: account.stateManager, transformOutgoingMessageMedia: account.transformOutgoingMessageMedia, messageMediaPreuploadManager: account.messageMediaPreuploadManager, mediaReferenceRevalidationContext: account.mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime) +func _internal_requestEditMessage(account: Account, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool = false, scheduleTime: Int32? = nil) -> Signal { + return requestEditMessage(postbox: account.postbox, network: account.network, stateManager: account.stateManager, transformOutgoingMessageMedia: account.transformOutgoingMessageMedia, messageMediaPreuploadManager: account.messageMediaPreuploadManager, mediaReferenceRevalidationContext: account.mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime) } -func requestEditMessage(postbox: Postbox, network: Network, stateManager: AccountStateManager, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, mediaReferenceRevalidationContext: MediaReferenceRevalidationContext, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool, scheduleTime: Int32?) -> Signal { - return requestEditMessageInternal(postbox: postbox, network: network, stateManager: stateManager, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, mediaReferenceRevalidationContext: mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime, forceReupload: false) +func requestEditMessage(postbox: Postbox, network: Network, stateManager: AccountStateManager, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, mediaReferenceRevalidationContext: MediaReferenceRevalidationContext, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool, scheduleTime: Int32?) -> Signal { + return requestEditMessageInternal(postbox: postbox, network: network, stateManager: stateManager, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, mediaReferenceRevalidationContext: mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime, forceReupload: false) |> `catch` { error -> Signal in if case .invalidReference = error { - return requestEditMessageInternal(postbox: postbox, network: network, stateManager: stateManager, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, mediaReferenceRevalidationContext: mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime, forceReupload: true) + return requestEditMessageInternal(postbox: postbox, network: network, stateManager: stateManager, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, mediaReferenceRevalidationContext: mediaReferenceRevalidationContext, messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime, forceReupload: true) } else { return .fail(error) } @@ -50,7 +50,7 @@ func requestEditMessage(postbox: Postbox, network: Network, stateManager: Accoun } } -private func requestEditMessageInternal(postbox: Postbox, network: Network, stateManager: AccountStateManager, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, mediaReferenceRevalidationContext: MediaReferenceRevalidationContext, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool, scheduleTime: Int32?, forceReupload: Bool) -> Signal { +private func requestEditMessageInternal(postbox: Postbox, network: Network, stateManager: AccountStateManager, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, mediaReferenceRevalidationContext: MediaReferenceRevalidationContext, messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool, scheduleTime: Int32?, forceReupload: Bool) -> Signal { let uploadedMedia: Signal switch media { case .keep: @@ -95,6 +95,10 @@ private func requestEditMessageInternal(postbox: Postbox, network: Network, stat guard let message = transaction.getMessage(messageId) else { return (nil, nil, SimpleDictionary()) } + + for (_, file) in inlineStickers { + transaction.storeMediaIfNotPresent(media: file) + } if text.isEmpty { for media in message.media { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift index f45b440830..830f9c0537 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift @@ -85,8 +85,8 @@ public extension TelegramEngine { return _internal_clearAuthorHistory(account: self.account, peerId: peerId, memberId: memberId) } - public func requestEditMessage(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute? = nil, disableUrlPreview: Bool = false, scheduleTime: Int32? = nil) -> Signal { - return _internal_requestEditMessage(account: self.account, messageId: messageId, text: text, media: media, entities: entities, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime) + public func requestEditMessage(messageId: MessageId, text: String, media: RequestEditMessageMedia, entities: TextEntitiesMessageAttribute?, inlineStickers: [MediaId: TelegramMediaFile], disableUrlPreview: Bool = false, scheduleTime: Int32? = nil) -> Signal { + return _internal_requestEditMessage(account: self.account, messageId: messageId, text: text, media: media, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview, scheduleTime: scheduleTime) } public func requestEditLiveLocation(messageId: MessageId, stop: Bool, coordinate: (latitude: Double, longitude: Double, accuracyRadius: Int32?)?, heading: Int32?, proximityNotificationRadius: Int32?) -> Signal { diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index 331c154d89..13ae1184ec 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -608,13 +608,16 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati panelSeparatorColor: UIColor(rgb: 0x3d3d40), panelIconColor: UIColor(rgb: 0x808080), panelHighlightedIconBackgroundColor: UIColor(rgb: 0x262628), + panelHighlightedIconColor: UIColor(rgb: 0x808080).mixedWith(UIColor(rgb: 0xffffff), alpha: 0.35), + panelContentVibrantOverlayColor: UIColor(rgb: 0x808080), stickersBackgroundColor: UIColor(rgb: 0x000000), stickersSectionTextColor: UIColor(rgb: 0x7b7b7b), stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d), stickersSearchPlaceholderColor: UIColor(rgb: 0x8d8e93), stickersSearchPrimaryColor: UIColor(rgb: 0xffffff), stickersSearchControlColor: UIColor(rgb: 0x8d8e93), - gifsBackgroundColor: UIColor(rgb: 0x000000) + gifsBackgroundColor: UIColor(rgb: 0x000000), + backgroundColor: UIColor(rgb: 0x000000, alpha: 0.75) ) let inputButtonPanel = PresentationThemeInputButtonPanel( diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift index b351d10941..bf45c93fd5 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift @@ -440,12 +440,15 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme panelSeparatorColor: mainBackgroundColor, panelIconColor: mainSecondaryTextColor?.withAlphaComponent(0.5), panelHighlightedIconBackgroundColor: inputBackgroundColor, + panelHighlightedIconColor: mainSecondaryTextColor?.withAlphaComponent(0.5).mixedWith(chat.inputPanel.primaryTextColor, alpha: 0.35), + panelContentVibrantOverlayColor: mainSecondaryTextColor?.withAlphaComponent(0.5), stickersBackgroundColor: additionalBackgroundColor, stickersSectionTextColor: mainSecondaryTextColor?.withAlphaComponent(0.5), stickersSearchBackgroundColor: accentColor?.withMultiplied(hue: 1.009, saturation: 0.621, brightness: 0.15), stickersSearchPlaceholderColor: accentColor?.withMultiplied(hue: 0.99, saturation: 0.243, brightness: 0.59), stickersSearchControlColor: accentColor?.withMultiplied(hue: 0.99, saturation: 0.243, brightness: 0.59), - gifsBackgroundColor: additionalBackgroundColor + gifsBackgroundColor: additionalBackgroundColor, + backgroundColor: additionalBackgroundColor?.withMultipliedAlpha(0.75) ), inputButtonPanel: chat.inputButtonPanel.withUpdated( panelSeparatorColor: mainBackgroundColor, @@ -837,13 +840,16 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres panelSeparatorColor: mainBackgroundColor, panelIconColor: mainSecondaryTextColor.withAlphaComponent(0.5), panelHighlightedIconBackgroundColor: inputBackgroundColor, + panelHighlightedIconColor: mainSecondaryTextColor.withAlphaComponent(0.5).mixedWith(inputPanel.primaryTextColor, alpha: 0.35), + panelContentVibrantOverlayColor: mainSecondaryTextColor.withAlphaComponent(0.5), stickersBackgroundColor: additionalBackgroundColor, stickersSectionTextColor: mainSecondaryTextColor.withAlphaComponent(0.5), stickersSearchBackgroundColor: accentColor.withMultiplied(hue: 1.009, saturation: 0.621, brightness: 0.15), stickersSearchPlaceholderColor: accentColor.withMultiplied(hue: 0.99, saturation: 0.243, brightness: 0.59), stickersSearchPrimaryColor: .white, stickersSearchControlColor: accentColor.withMultiplied(hue: 0.99, saturation: 0.243, brightness: 0.59), - gifsBackgroundColor: additionalBackgroundColor + gifsBackgroundColor: additionalBackgroundColor, + backgroundColor: additionalBackgroundColor.withMultipliedAlpha(0.75) ) let inputButtonPanel = PresentationThemeInputButtonPanel( diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index 0a9c295e36..3ad0c85faa 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -862,13 +862,16 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio panelSeparatorColor: UIColor(rgb: 0xbec2c6), panelIconColor: UIColor(rgb: 0x858e99), panelHighlightedIconBackgroundColor: UIColor(rgb: 0x858e99, alpha: 0.2), + panelHighlightedIconColor: UIColor(rgb: 0x4D5561), + panelContentVibrantOverlayColor: day ? UIColor(white: 0.0, alpha: 0.3) : UIColor(white: 0.6, alpha: 0.65), stickersBackgroundColor: UIColor(rgb: 0xe8ebf0), stickersSectionTextColor: UIColor(rgb: 0x9099a2), stickersSearchBackgroundColor: UIColor(rgb: 0xd9dbe1), stickersSearchPlaceholderColor: UIColor(rgb: 0x8e8e93), stickersSearchPrimaryColor: UIColor(rgb: 0x000000), stickersSearchControlColor: UIColor(rgb: 0x8e8e93), - gifsBackgroundColor: UIColor(rgb: 0xffffff) + gifsBackgroundColor: UIColor(rgb: 0xffffff), + backgroundColor: UIColor(rgb: 0xffffff, alpha: 0.7) ) let inputButtonPanel = PresentationThemeInputButtonPanel( diff --git a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift index cbe4d11d2c..d04a40c8e7 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift @@ -1142,6 +1142,8 @@ public final class PresentationThemeInputMediaPanel { public let panelSeparatorColor: UIColor public let panelIconColor: UIColor public let panelHighlightedIconBackgroundColor: UIColor + public let panelHighlightedIconColor: UIColor + public let panelContentVibrantOverlayColor: UIColor public let stickersBackgroundColor: UIColor public let stickersSectionTextColor: UIColor public let stickersSearchBackgroundColor: UIColor @@ -1149,11 +1151,14 @@ public final class PresentationThemeInputMediaPanel { public let stickersSearchPrimaryColor: UIColor public let stickersSearchControlColor: UIColor public let gifsBackgroundColor: UIColor + public let backgroundColor: UIColor - public init(panelSeparatorColor: UIColor, panelIconColor: UIColor, panelHighlightedIconBackgroundColor: UIColor, stickersBackgroundColor: UIColor, stickersSectionTextColor: UIColor, stickersSearchBackgroundColor: UIColor, stickersSearchPlaceholderColor: UIColor, stickersSearchPrimaryColor: UIColor, stickersSearchControlColor: UIColor, gifsBackgroundColor: UIColor) { + public init(panelSeparatorColor: UIColor, panelIconColor: UIColor, panelHighlightedIconBackgroundColor: UIColor, panelHighlightedIconColor: UIColor, panelContentVibrantOverlayColor: UIColor, stickersBackgroundColor: UIColor, stickersSectionTextColor: UIColor, stickersSearchBackgroundColor: UIColor, stickersSearchPlaceholderColor: UIColor, stickersSearchPrimaryColor: UIColor, stickersSearchControlColor: UIColor, gifsBackgroundColor: UIColor, backgroundColor: UIColor) { self.panelSeparatorColor = panelSeparatorColor self.panelIconColor = panelIconColor self.panelHighlightedIconBackgroundColor = panelHighlightedIconBackgroundColor + self.panelHighlightedIconColor = panelHighlightedIconColor + self.panelContentVibrantOverlayColor = panelContentVibrantOverlayColor self.stickersBackgroundColor = stickersBackgroundColor self.stickersSectionTextColor = stickersSectionTextColor self.stickersSearchBackgroundColor = stickersSearchBackgroundColor @@ -1161,10 +1166,11 @@ public final class PresentationThemeInputMediaPanel { self.stickersSearchPrimaryColor = stickersSearchPrimaryColor self.stickersSearchControlColor = stickersSearchControlColor self.gifsBackgroundColor = gifsBackgroundColor + self.backgroundColor = backgroundColor } - public func withUpdated(panelSeparatorColor: UIColor? = nil, panelIconColor: UIColor? = nil, panelHighlightedIconBackgroundColor: UIColor? = nil, stickersBackgroundColor: UIColor? = nil, stickersSectionTextColor: UIColor? = nil, stickersSearchBackgroundColor: UIColor? = nil, stickersSearchPlaceholderColor: UIColor? = nil, stickersSearchPrimaryColor: UIColor? = nil, stickersSearchControlColor: UIColor? = nil, gifsBackgroundColor: UIColor? = nil) -> PresentationThemeInputMediaPanel { - return PresentationThemeInputMediaPanel(panelSeparatorColor: panelSeparatorColor ?? self.panelSeparatorColor, panelIconColor: panelIconColor ?? self.panelIconColor, panelHighlightedIconBackgroundColor: panelHighlightedIconBackgroundColor ?? self.panelHighlightedIconBackgroundColor, stickersBackgroundColor: stickersBackgroundColor ?? self.stickersBackgroundColor, stickersSectionTextColor: stickersSectionTextColor ?? self.stickersSectionTextColor, stickersSearchBackgroundColor: stickersSearchBackgroundColor ?? self.stickersSearchBackgroundColor, stickersSearchPlaceholderColor: stickersSearchPlaceholderColor ?? self.stickersSearchPlaceholderColor, stickersSearchPrimaryColor: stickersSearchPrimaryColor ?? self.stickersSearchPrimaryColor, stickersSearchControlColor: stickersSearchControlColor ?? self.stickersSearchControlColor, gifsBackgroundColor: gifsBackgroundColor ?? self.gifsBackgroundColor) + public func withUpdated(panelSeparatorColor: UIColor? = nil, panelIconColor: UIColor? = nil, panelHighlightedIconBackgroundColor: UIColor? = nil, panelHighlightedIconColor: UIColor? = nil, panelContentVibrantOverlayColor: UIColor? = nil, stickersBackgroundColor: UIColor? = nil, stickersSectionTextColor: UIColor? = nil, stickersSearchBackgroundColor: UIColor? = nil, stickersSearchPlaceholderColor: UIColor? = nil, stickersSearchPrimaryColor: UIColor? = nil, stickersSearchControlColor: UIColor? = nil, gifsBackgroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -> PresentationThemeInputMediaPanel { + return PresentationThemeInputMediaPanel(panelSeparatorColor: panelSeparatorColor ?? self.panelSeparatorColor, panelIconColor: panelIconColor ?? self.panelIconColor, panelHighlightedIconBackgroundColor: panelHighlightedIconBackgroundColor ?? self.panelHighlightedIconBackgroundColor, panelHighlightedIconColor: panelHighlightedIconColor ?? self.panelHighlightedIconColor, panelContentVibrantOverlayColor: panelContentVibrantOverlayColor ?? self.panelContentVibrantOverlayColor, stickersBackgroundColor: stickersBackgroundColor ?? self.stickersBackgroundColor, stickersSectionTextColor: stickersSectionTextColor ?? self.stickersSectionTextColor, stickersSearchBackgroundColor: stickersSearchBackgroundColor ?? self.stickersSearchBackgroundColor, stickersSearchPlaceholderColor: stickersSearchPlaceholderColor ?? self.stickersSearchPlaceholderColor, stickersSearchPrimaryColor: stickersSearchPrimaryColor ?? self.stickersSearchPrimaryColor, stickersSearchControlColor: stickersSearchControlColor ?? self.stickersSearchControlColor, gifsBackgroundColor: gifsBackgroundColor ?? self.gifsBackgroundColor, backgroundColor: backgroundColor ?? self.backgroundColor) } } diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index b302e7529f..d04b76ed88 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -1605,6 +1605,8 @@ extension PresentationThemeInputMediaPanel: Codable { case panelSeparator case panelIcon case panelHighlightedIconBg + case panelHighlightedIcon + case panelContentVibrantOverlay case stickersBg case stickersSectionText case stickersSearchBg @@ -1612,20 +1614,43 @@ extension PresentationThemeInputMediaPanel: Codable { case stickersSearchPrimary case stickersSearchControl case gifsBg + case bg } public convenience init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) + + let backgroundColor: UIColor + if let value = try? decodeColor(values, .bg) { + backgroundColor = value + } else { + backgroundColor = try decodeColor(values, .gifsBg).withMultipliedAlpha(0.75) + } + + let panelHighlightedIconColor: UIColor + if let value = try? decodeColor(values, .panelHighlightedIcon) { + panelHighlightedIconColor = value + } else if let value = try? decodeColor(values, .panelHighlightedIcon, fallbackKey: "chat.inputPanel.inputText") { + let defaultColor = try decodeColor(values, .panelIcon) + panelHighlightedIconColor = defaultColor.mixedWith(value, alpha: 0.35) + } else { + panelHighlightedIconColor = try decodeColor(values, .panelIcon) + } + + let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".") + self.init(panelSeparatorColor: try decodeColor(values, .panelSeparator), panelIconColor: try decodeColor(values, .panelIcon), panelHighlightedIconBackgroundColor: try decodeColor(values, .panelHighlightedIconBg), + panelHighlightedIconColor: panelHighlightedIconColor, + panelContentVibrantOverlayColor: try decodeColor(values, .panelContentVibrantOverlay, fallbackKey: "\(codingPath).panelIcon"), stickersBackgroundColor: try decodeColor(values, .stickersBg), stickersSectionTextColor: try decodeColor(values, .stickersSectionText), stickersSearchBackgroundColor: try decodeColor(values, .stickersSearchBg), stickersSearchPlaceholderColor: try decodeColor(values, .stickersSearchPlaceholder), stickersSearchPrimaryColor: try decodeColor(values, .stickersSearchPrimary), stickersSearchControlColor: try decodeColor(values, .stickersSearchControl), - gifsBackgroundColor: try decodeColor(values, .gifsBg)) + gifsBackgroundColor: try decodeColor(values, .gifsBg), backgroundColor: backgroundColor) } public func encode(to encoder: Encoder) throws { @@ -1633,6 +1658,8 @@ extension PresentationThemeInputMediaPanel: Codable { try encodeColor(&values, self.panelSeparatorColor, .panelSeparator) try encodeColor(&values, self.panelIconColor, .panelIcon) try encodeColor(&values, self.panelHighlightedIconBackgroundColor, .panelHighlightedIconBg) + try encodeColor(&values, self.panelHighlightedIconColor, .panelHighlightedIcon) + try encodeColor(&values, self.panelContentVibrantOverlayColor, .panelContentVibrantOverlay) try encodeColor(&values, self.stickersBackgroundColor, .stickersBg) try encodeColor(&values, self.stickersSectionTextColor, .stickersSectionText) try encodeColor(&values, self.stickersSearchBackgroundColor, .stickersSearchBg) @@ -1640,6 +1667,7 @@ extension PresentationThemeInputMediaPanel: Codable { try encodeColor(&values, self.stickersSearchPrimaryColor, .stickersSearchPrimary) try encodeColor(&values, self.stickersSearchControlColor, .stickersSearchControl) try encodeColor(&values, self.gifsBackgroundColor, .gifsBg) + try encodeColor(&values, self.backgroundColor, .bg) } } diff --git a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift index 51d10d9031..b3e6d7d8da 100644 --- a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift @@ -1284,7 +1284,7 @@ public struct PresentationResourcesChat { public static func chatEntityKeyboardLock(_ theme: PresentationTheme, color: UIColor) -> UIImage? { return theme.image(PresentationResourceParameterKey.chatEntityKeyboardLock(color: color.argb), { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Stickers/SmallLock"), color: color) + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Media/PanelSectionLockIcon"), color: color) }) } } diff --git a/submodules/TelegramUI/Components/AnimationCache/Sources/AnimationCache.swift b/submodules/TelegramUI/Components/AnimationCache/Sources/AnimationCache.swift index 59a51609cc..efb5fd4379 100644 --- a/submodules/TelegramUI/Components/AnimationCache/Sources/AnimationCache.swift +++ b/submodules/TelegramUI/Components/AnimationCache/Sources/AnimationCache.swift @@ -264,7 +264,7 @@ private final class AnimationCacheItemWriterInternal { } let width = roundUp(proposedWidth, multiple: 16) - let height = roundUp(proposedWidth, multiple: 16) + let height = roundUp(proposedHeight, multiple: 16) var isFirstFrame = false @@ -466,7 +466,7 @@ private final class AnimationCacheItemWriterImpl: AnimationCacheItemWriter { } let width = roundUp(proposedWidth, multiple: 16) - let height = roundUp(proposedWidth, multiple: 16) + let height = roundUp(proposedHeight, multiple: 16) var isFirstFrame = false @@ -1336,7 +1336,7 @@ public final class AnimationCacheImpl: AnimationCache { self.queue = queue let fetchQueueCount: Int - if ProcessInfo.processInfo.activeProcessorCount > 2 { + if ProcessInfo.processInfo.processorCount > 2 { fetchQueueCount = 3 } else { fetchQueueCount = 2 diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index 97ad8548ab..eb5f007d65 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -579,7 +579,7 @@ private final class GroupHeaderLayer: UIView { cache: AnimationCache, renderer: MultiAnimationRenderer, attemptSynchronousLoad: Bool - ) -> CGSize { + ) -> (size: CGSize, centralContentWidth: CGFloat) { var themeUpdated = false if self.theme !== theme { self.theme = theme @@ -599,56 +599,15 @@ private final class GroupHeaderLayer: UIView { color = theme.chat.inputPanel.primaryTextColor needsTintText = false } else { - //color = theme.chat.inputMediaPanel.stickersSectionTextColor.withMultipliedAlpha(0.1) - color = UIColor(white: 1.0, alpha: 0.0) + color = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor needsTintText = true } - let subtitleColor = theme.chat.inputMediaPanel.stickersSectionTextColor.withMultipliedAlpha(0.1) + let subtitleColor = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor let titleHorizontalOffset: CGFloat if isPremiumLocked { - let lockIconLayer: SimpleLayer - if let current = self.lockIconLayer { - lockIconLayer = current - } else { - lockIconLayer = SimpleLayer() - self.lockIconLayer = lockIconLayer - self.layer.addSublayer(lockIconLayer) - } - if let image = PresentationResourcesChat.chatEntityKeyboardLock(theme, color: color) { - let imageSize = image.size.aspectFitted(CGSize(width: 16.0, height: 16.0)) - lockIconLayer.contents = image.cgImage - titleHorizontalOffset = imageSize.width + 2.0 - lockIconLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: imageSize) - } else { - lockIconLayer.contents = nil - titleHorizontalOffset = 0.0 - } - - let tintLockIconLayer: SimpleLayer - if let current = self.tintLockIconLayer { - tintLockIconLayer = current - } else { - tintLockIconLayer = SimpleLayer() - self.tintLockIconLayer = tintLockIconLayer - self.tintContentLayer.addSublayer(tintLockIconLayer) - } - if let image = PresentationResourcesChat.chatEntityKeyboardLock(theme, color: .white) { - let imageSize = image.size.aspectFitted(CGSize(width: 16.0, height: 16.0)) - tintLockIconLayer.contents = image.cgImage - tintLockIconLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: imageSize) - } else { - tintLockIconLayer.contents = nil - } + titleHorizontalOffset = 10.0 + 2.0 } else { - if let lockIconLayer = self.lockIconLayer { - self.lockIconLayer = nil - lockIconLayer.removeFromSuperlayer() - } - if let tintLockIconLayer = self.tintLockIconLayer { - self.tintLockIconLayer = nil - tintLockIconLayer.removeFromSuperlayer() - } titleHorizontalOffset = 0.0 } @@ -712,11 +671,54 @@ private final class GroupHeaderLayer: UIView { self.currentTextLayout = (title, color, textConstrainedWidth, textSize) } - let textFrame = CGRect(origin: CGPoint(x: titleHorizontalOffset, y: textOffsetY), size: textSize) + let textFrame: CGRect + textFrame = CGRect(origin: CGPoint(x: titleHorizontalOffset + floor((constrainedSize.width - titleHorizontalOffset - textSize.width) / 2.0), y: textOffsetY), size: textSize) self.textLayer.frame = textFrame self.tintTextLayer.frame = textFrame self.tintTextLayer.isHidden = !needsTintText + if isPremiumLocked { + let lockIconLayer: SimpleLayer + if let current = self.lockIconLayer { + lockIconLayer = current + } else { + lockIconLayer = SimpleLayer() + self.lockIconLayer = lockIconLayer + self.layer.addSublayer(lockIconLayer) + } + if let image = PresentationResourcesChat.chatEntityKeyboardLock(theme, color: color) { + let imageSize = image.size + lockIconLayer.contents = image.cgImage + lockIconLayer.frame = CGRect(origin: CGPoint(x: textFrame.minX - imageSize.width - 3.0, y: 2.0 + UIScreenPixel), size: imageSize) + } else { + lockIconLayer.contents = nil + } + + let tintLockIconLayer: SimpleLayer + if let current = self.tintLockIconLayer { + tintLockIconLayer = current + } else { + tintLockIconLayer = SimpleLayer() + self.tintLockIconLayer = tintLockIconLayer + self.tintContentLayer.addSublayer(tintLockIconLayer) + } + if let image = PresentationResourcesChat.chatEntityKeyboardLock(theme, color: .white) { + tintLockIconLayer.contents = image.cgImage + tintLockIconLayer.frame = lockIconLayer.frame + } else { + tintLockIconLayer.contents = nil + } + } else { + if let lockIconLayer = self.lockIconLayer { + self.lockIconLayer = nil + lockIconLayer.removeFromSuperlayer() + } + if let tintLockIconLayer = self.tintLockIconLayer { + self.tintLockIconLayer = nil + tintLockIconLayer.removeFromSuperlayer() + } + } + let subtitleSize: CGSize if let subtitle = subtitle { var updateSubtitleContents: UIImage? @@ -808,7 +810,7 @@ private final class GroupHeaderLayer: UIView { } var clearSize = clearIconLayer.bounds.size - if updateImage, let image = PresentationResourcesChat.chatInputMediaPanelGridDismissImage(theme, color: theme.chat.inputMediaPanel.stickersSectionTextColor.withMultipliedAlpha(0.1)) { + if updateImage, let image = PresentationResourcesChat.chatInputMediaPanelGridDismissImage(theme, color: theme.chat.inputMediaPanel.panelContentVibrantOverlayColor) { clearSize = image.size clearIconLayer.contents = image.cgImage } @@ -816,12 +818,8 @@ private final class GroupHeaderLayer: UIView { tintClearIconLayer.contents = image.cgImage } - switch layoutType { - case .compact: - clearIconLayer.frame = CGRect(origin: CGPoint(x: titleHorizontalOffset + textSize.width + 4.0, y: floorToScreenPixels((textSize.height - clearSize.height) / 2.0)), size: clearSize) - case .detailed: - clearIconLayer.frame = CGRect(origin: CGPoint(x: constrainedSize.width - clearSize.width, y: floorToScreenPixels((textSize.height - clearSize.height) / 2.0)), size: clearSize) - } + clearIconLayer.frame = CGRect(origin: CGPoint(x: constrainedSize.width - clearSize.width, y: floorToScreenPixels((textSize.height - clearSize.height) / 2.0)), size: clearSize) + tintClearIconLayer.frame = clearIconLayer.frame clearWidth = 4.0 + clearSize.width } else { @@ -836,12 +834,7 @@ private final class GroupHeaderLayer: UIView { } var size: CGSize - switch layoutType { - case .compact: - size = CGSize(width: titleHorizontalOffset + textSize.width + clearWidth, height: constrainedSize.height) - case .detailed: - size = CGSize(width: constrainedSize.width, height: constrainedSize.height) - } + size = CGSize(width: constrainedSize.width, height: constrainedSize.height) if let embeddedItems = embeddedItems { let groupEmbeddedView: GroupEmbeddedView @@ -885,7 +878,7 @@ private final class GroupHeaderLayer: UIView { self.separatorLayer = separatorLayer self.layer.addSublayer(separatorLayer) } - separatorLayer.backgroundColor = theme.chat.inputMediaPanel.stickersSectionTextColor.withAlphaComponent(0.15).cgColor + separatorLayer.backgroundColor = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.cgColor separatorLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: UIScreenPixel)) let tintSeparatorLayer: SimpleLayer @@ -909,7 +902,7 @@ private final class GroupHeaderLayer: UIView { } } - return size + return (size, titleHorizontalOffset + textSize.width + clearWidth) } override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { @@ -1190,7 +1183,7 @@ private final class GroupExpandActionButton: UIButton { let textConstrainedWidth: CGFloat = 100.0 let color = theme.list.itemCheckColors.foregroundColor - self.backgroundLayer.backgroundColor = theme.chat.inputMediaPanel.stickersSectionTextColor.withMultipliedAlpha(0.1).cgColor + self.backgroundLayer.backgroundColor = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.cgColor self.tintContainerLayer.backgroundColor = UIColor.white.cgColor let textSize: CGSize @@ -1254,6 +1247,7 @@ public final class EmojiPagerContentComponent: Component { public let performItemAction: (AnyHashable, Item, UIView, CGRect, CALayer) -> Void public let deleteBackwards: () -> Void public let openStickerSettings: () -> Void + public let openFeatured: () -> Void public let addGroupAction: (AnyHashable, Bool) -> Void public let clearGroup: (AnyHashable) -> Void public let pushController: (ViewController) -> Void @@ -1267,6 +1261,7 @@ public final class EmojiPagerContentComponent: Component { performItemAction: @escaping (AnyHashable, Item, UIView, CGRect, CALayer) -> Void, deleteBackwards: @escaping () -> Void, openStickerSettings: @escaping () -> Void, + openFeatured: @escaping () -> Void, addGroupAction: @escaping (AnyHashable, Bool) -> Void, clearGroup: @escaping (AnyHashable) -> Void, pushController: @escaping (ViewController) -> Void, @@ -1279,6 +1274,7 @@ public final class EmojiPagerContentComponent: Component { self.performItemAction = performItemAction self.deleteBackwards = deleteBackwards self.openStickerSettings = openStickerSettings + self.openFeatured = openFeatured self.addGroupAction = addGroupAction self.clearGroup = clearGroup self.pushController = pushController @@ -1544,17 +1540,25 @@ public final class EmojiPagerContentComponent: Component { switch layoutType { case .compact: minItemsPerRow = 8 - self.nativeItemSize = 36.0 + self.nativeItemSize = 40.0 self.playbackItemSize = 48.0 self.verticalSpacing = 9.0 - minSpacing = 9.0 + + if width >= 420.0 { + self.itemInsets = UIEdgeInsets(top: containerInsets.top, left: containerInsets.left + 5.0, bottom: containerInsets.bottom, right: containerInsets.right + 5.0) + minSpacing = 2.0 + } else { + self.itemInsets = UIEdgeInsets(top: containerInsets.top, left: containerInsets.left + 7.0, bottom: containerInsets.bottom, right: containerInsets.right + 7.0) + minSpacing = 9.0 + } + + self.headerInsets = UIEdgeInsets(top: containerInsets.top, left: containerInsets.left + 16.0, bottom: containerInsets.bottom, right: containerInsets.right + 16.0) + self.itemDefaultHeaderHeight = 24.0 self.itemFeaturedHeaderHeight = self.itemDefaultHeaderHeight - self.itemInsets = UIEdgeInsets(top: containerInsets.top, left: containerInsets.left + 12.0, bottom: containerInsets.bottom, right: containerInsets.right + 12.0) - self.headerInsets = UIEdgeInsets(top: containerInsets.top, left: containerInsets.left + 12.0, bottom: containerInsets.bottom, right: containerInsets.right + 12.0) case .detailed: minItemsPerRow = 5 - self.nativeItemSize = 71.0 + self.nativeItemSize = 70.0 self.playbackItemSize = 96.0 self.verticalSpacing = 2.0 minSpacing = 12.0 @@ -1571,9 +1575,13 @@ public final class EmojiPagerContentComponent: Component { self.itemsPerRow = max(minItemsPerRow, Int((itemHorizontalSpace + minSpacing) / (self.nativeItemSize + minSpacing))) - self.visibleItemSize = floor((itemHorizontalSpace - CGFloat(self.itemsPerRow - 1) * minSpacing) / CGFloat(self.itemsPerRow)) + self.visibleItemSize = self.nativeItemSize - self.horizontalSpacing = floor((itemHorizontalSpace - self.visibleItemSize * CGFloat(self.itemsPerRow)) / CGFloat(self.itemsPerRow - 1)) + self.horizontalSpacing = floorToScreenPixels((itemHorizontalSpace - self.visibleItemSize * CGFloat(self.itemsPerRow)) / CGFloat(self.itemsPerRow - 1)) + + let actualContentWidth = self.visibleItemSize * CGFloat(self.itemsPerRow) + self.horizontalSpacing * CGFloat(self.itemsPerRow - 1) + self.itemInsets.left = floorToScreenPixels((width - actualContentWidth) / 2.0) + self.itemInsets.right = self.itemInsets.left var verticalGroupOrigin: CGFloat = self.itemInsets.top self.itemGroupLayouts = [] @@ -1837,7 +1845,7 @@ public final class EmojiPagerContentComponent: Component { return } - if file.isVideoEmoji { + if file.isVideoEmoji || file.isVideoSticker { cacheVideoAnimation(path: result, width: Int(size.width), height: Int(size.height), writer: writer) } else if file.isAnimatedSticker { guard let data = try? Data(contentsOf: URL(fileURLWithPath: result)) else { @@ -2139,7 +2147,7 @@ public final class EmojiPagerContentComponent: Component { override init(frame: CGRect) { self.backgroundView = BlurredBackgroundView(color: nil) - if ProcessInfo.processInfo.activeProcessorCount > 2 { + if ProcessInfo.processInfo.processorCount > 2 { self.shimmerHostView = PortalSourceView() self.standaloneShimmerEffect = StandaloneShimmerEffect() } else { @@ -2867,7 +2875,7 @@ public final class EmojiPagerContentComponent: Component { let position = CGPoint(x: itemLayer.frame.midX, y: itemLayer.frame.midY) let distance = CGPoint(x: localPoint.x - position.x, y: localPoint.y - position.y) let distance2 = distance.x * distance.x + distance.y * distance.y - if distance2 > pow(max(itemLayer.bounds.width, itemLayer.bounds.height) / 2.0, 2.0) { + if distance2 > pow(max(itemLayer.bounds.width, itemLayer.bounds.height), 2.0) { continue } @@ -3025,7 +3033,7 @@ public final class EmojiPagerContentComponent: Component { assignTopVisibleSubgroupId = true } - var headerSize: CGSize? + var headerCentralContentWidth: CGFloat? var headerSizeUpdated = false if let title = itemGroup.title { validGroupHeaderIds.insert(itemGroup.groupId) @@ -3060,12 +3068,9 @@ public final class EmojiPagerContentComponent: Component { actionButtonTitle = itemGroup.actionButtonTitle } - var hasTopSeparator = false - if case .detailed = itemLayout.layoutType, itemGroup.isFeatured, groupItems.groupIndex != 0 { - hasTopSeparator = true - } + let hasTopSeparator = false - let groupHeaderSize = groupHeaderView.update( + let (groupHeaderSize, centralContentWidth) = groupHeaderView.update( context: component.context, theme: theme, layoutType: itemLayout.layoutType, @@ -3086,11 +3091,11 @@ public final class EmojiPagerContentComponent: Component { if groupHeaderView.bounds.size != groupHeaderSize { headerSizeUpdated = true } + headerCentralContentWidth = centralContentWidth let groupHeaderFrame = CGRect(origin: CGPoint(x: floor((itemLayout.contentSize.width - groupHeaderSize.width) / 2.0), y: itemGroupLayout.frame.minY + 1.0), size: groupHeaderSize) groupHeaderView.bounds = CGRect(origin: CGPoint(), size: groupHeaderFrame.size) groupHeaderTransition.setPosition(view: groupHeaderView, position: CGPoint(x: groupHeaderFrame.midX, y: groupHeaderFrame.midY)) - headerSize = CGSize(width: groupHeaderSize.width, height: groupHeaderSize.height) } let groupBorderRadius: CGFloat = 16.0 @@ -3108,7 +3113,7 @@ public final class EmojiPagerContentComponent: Component { self.scrollView.layer.insertSublayer(groupBorderLayer, at: 0) self.mirrorContentScrollView.layer.addSublayer(groupBorderLayer.tintContainerLayer) - groupBorderLayer.strokeColor = theme.chat.inputMediaPanel.stickersSectionTextColor.withMultipliedAlpha(0.1).cgColor + groupBorderLayer.strokeColor = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.cgColor groupBorderLayer.tintContainerLayer.strokeColor = UIColor.white.cgColor groupBorderLayer.lineWidth = 1.6 groupBorderLayer.lineCap = .round @@ -3123,8 +3128,8 @@ public final class EmojiPagerContentComponent: Component { if groupBorderLayer.bounds.size != groupBorderFrame.size || headerSizeUpdated { let headerWidth: CGFloat - if let headerSize = headerSize { - headerWidth = headerSize.width + 14.0 + if let headerCentralContentWidth = headerCentralContentWidth { + headerWidth = headerCentralContentWidth + 14.0 } else { headerWidth = 0.0 } @@ -3293,9 +3298,9 @@ public final class EmojiPagerContentComponent: Component { } else { itemDimensions = CGSize(width: 512.0, height: 512.0) } - let itemNativeFitSize = itemDimensions.fitted(CGSize(width: itemLayout.nativeItemSize, height: itemLayout.nativeItemSize)) - let itemVisibleFitSize = itemDimensions.fitted(CGSize(width: itemLayout.visibleItemSize, height: itemLayout.visibleItemSize)) - let itemPlaybackSize = itemDimensions.fitted(CGSize(width: itemLayout.playbackItemSize, height: itemLayout.playbackItemSize)) + let itemNativeFitSize = itemDimensions.aspectFitted(CGSize(width: itemLayout.nativeItemSize, height: itemLayout.nativeItemSize)) + let itemVisibleFitSize = itemDimensions.aspectFitted(CGSize(width: itemLayout.visibleItemSize, height: itemLayout.visibleItemSize)) + let itemPlaybackSize = itemDimensions.aspectFitted(CGSize(width: itemLayout.playbackItemSize, height: itemLayout.playbackItemSize)) var animateItemIn = false var updateItemLayerPlaceholder = false @@ -3551,7 +3556,7 @@ public final class EmojiPagerContentComponent: Component { vibrancyEffectView.contentView.addSubview(self.mirrorContentScrollView) } - self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75), enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition) + self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.backgroundColor, enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition) transition.setFrame(view: self.backgroundView, frame: backgroundFrame) self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition) diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift index 440c3a4787..ed42e4b1cd 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift @@ -74,7 +74,7 @@ public final class EntityKeyboardComponent: Component { } public let theme: PresentationTheme - public let bottomInset: CGFloat + public let containerInsets: UIEdgeInsets public let emojiContent: EmojiPagerContentComponent public let stickerContent: EmojiPagerContentComponent? public let gifContent: GifPagerContentComponent? @@ -93,7 +93,7 @@ public final class EntityKeyboardComponent: Component { public init( theme: PresentationTheme, - bottomInset: CGFloat, + containerInsets: UIEdgeInsets, emojiContent: EmojiPagerContentComponent, stickerContent: EmojiPagerContentComponent?, gifContent: GifPagerContentComponent?, @@ -111,7 +111,7 @@ public final class EntityKeyboardComponent: Component { isExpanded: Bool ) { self.theme = theme - self.bottomInset = bottomInset + self.containerInsets = containerInsets self.emojiContent = emojiContent self.stickerContent = stickerContent self.gifContent = gifContent @@ -133,7 +133,7 @@ public final class EntityKeyboardComponent: Component { if lhs.theme !== rhs.theme { return false } - if lhs.bottomInset != rhs.bottomInset { + if lhs.containerInsets != rhs.containerInsets { return false } if lhs.emojiContent != rhs.emojiContent { @@ -213,7 +213,7 @@ public final class EntityKeyboardComponent: Component { var contents: [AnyComponentWithIdentity<(EntityKeyboardChildEnvironment, PagerComponentChildEnvironment)>] = [] var contentTopPanels: [AnyComponentWithIdentity] = [] - var contentIcons: [AnyComponentWithIdentity] = [] + var contentIcons: [PagerComponentContentIcon] = [] var contentAccessoryLeftButtons: [AnyComponentWithIdentity] = [] var contentAccessoryRightButtons: [AnyComponentWithIdentity] = [] @@ -233,7 +233,7 @@ public final class EntityKeyboardComponent: Component { id: "recent", isReorderable: false, content: AnyComponent(EntityKeyboardIconTopPanelComponent( - imageName: "Chat/Input/Media/RecentTabIcon", + icon: .recent, theme: component.theme, title: "Recent", pressed: { [weak self] in @@ -246,7 +246,7 @@ public final class EntityKeyboardComponent: Component { id: "trending", isReorderable: false, content: AnyComponent(EntityKeyboardIconTopPanelComponent( - imageName: "Chat/Input/Media/TrendingGifs", + icon: .trending, theme: component.theme, title: "Trending", pressed: { [weak self] in @@ -285,16 +285,12 @@ public final class EntityKeyboardComponent: Component { contentTopPanels.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(EntityKeyboardTopPanelComponent( theme: component.theme, items: topGifItems, - defaultActiveItemId: defaultActiveGifItemId, + forceActiveItemId: defaultActiveGifItemId, activeContentItemIdUpdated: gifsContentItemIdUpdated, reorderItems: { _ in } )))) - contentIcons.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(BundleIconComponent( - name: "Chat/Input/Media/EntityInputGifsIcon", - tintColor: component.theme.chat.inputMediaPanel.panelIconColor, - maxSize: nil - )))) + contentIcons.append(PagerComponentContentIcon(id: "gifs", imageName: "Chat/Input/Media/EntityInputGifsIcon")) contentAccessoryLeftButtons.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(Button( content: AnyComponent(BundleIconComponent( name: "Chat/Input/Media/EntityInputSearchIcon", @@ -310,12 +306,26 @@ public final class EntityKeyboardComponent: Component { if let stickerContent = component.stickerContent { var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = [] + //TODO:localize + topStickerItems.append(EntityKeyboardTopPanelComponent.Item( + id: "featuredTop", + isReorderable: false, + content: AnyComponent(EntityKeyboardIconTopPanelComponent( + icon: .featured, + theme: component.theme, + title: "Featured", + pressed: { [weak self] in + self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured() + } + )) + )) + for itemGroup in stickerContent.itemGroups { if let id = itemGroup.supergroupId.base as? String { - let iconMapping: [String: String] = [ - "saved": "Chat/Input/Media/SavedStickersTabIcon", - "recent": "Chat/Input/Media/RecentTabIcon", - "premium": "Peer Info/PremiumIcon" + let iconMapping: [String: EntityKeyboardIconTopPanelComponent.Icon] = [ + "saved": .saved, + "recent": .recent, + "premium": .premium ] //TODO:localize let titleMapping: [String: String] = [ @@ -323,12 +333,12 @@ public final class EntityKeyboardComponent: Component { "recent": "Recent", "premium": "Premium" ] - if let iconName = iconMapping[id], let title = titleMapping[id] { + if let icon = iconMapping[id], let title = titleMapping[id] { topStickerItems.append(EntityKeyboardTopPanelComponent.Item( id: itemGroup.supergroupId, isReorderable: false, content: AnyComponent(EntityKeyboardIconTopPanelComponent( - imageName: iconName, + icon: icon, theme: component.theme, title: title, pressed: { [weak self] in @@ -365,6 +375,7 @@ public final class EntityKeyboardComponent: Component { contentTopPanels.append(AnyComponentWithIdentity(id: "stickers", component: AnyComponent(EntityKeyboardTopPanelComponent( theme: component.theme, items: topStickerItems, + defaultActiveItemId: stickerContent.itemGroups.first?.groupId, activeContentItemIdUpdated: stickersContentItemIdUpdated, reorderItems: { [weak self] items in guard let strongSelf = self else { @@ -373,11 +384,7 @@ public final class EntityKeyboardComponent: Component { strongSelf.reorderPacks(category: .stickers, items: items) } )))) - contentIcons.append(AnyComponentWithIdentity(id: "stickers", component: AnyComponent(BundleIconComponent( - name: "Chat/Input/Media/EntityInputStickersIcon", - tintColor: component.theme.chat.inputMediaPanel.panelIconColor, - maxSize: nil - )))) + contentIcons.append(PagerComponentContentIcon(id: "stickers", imageName: "Chat/Input/Media/EntityInputStickersIcon")) contentAccessoryLeftButtons.append(AnyComponentWithIdentity(id: "stickers", component: AnyComponent(Button( content: AnyComponent(BundleIconComponent( name: "Chat/Input/Media/EntityInputSearchIcon", @@ -407,19 +414,19 @@ public final class EntityKeyboardComponent: Component { if !itemGroup.items.isEmpty { if let id = itemGroup.groupId.base as? String { if id == "recent" { - let iconMapping: [String: String] = [ - "recent": "Chat/Input/Media/RecentTabIcon", + let iconMapping: [String: EntityKeyboardIconTopPanelComponent.Icon] = [ + "recent": .recent, ] //TODO:localize let titleMapping: [String: String] = [ "recent": "Recent", ] - if let iconName = iconMapping[id], let title = titleMapping[id] { + if let icon = iconMapping[id], let title = titleMapping[id] { topEmojiItems.append(EntityKeyboardTopPanelComponent.Item( id: itemGroup.supergroupId, isReorderable: false, content: AnyComponent(EntityKeyboardIconTopPanelComponent( - imageName: iconName, + icon: icon, theme: component.theme, title: title, pressed: { [weak self] in @@ -479,11 +486,7 @@ public final class EntityKeyboardComponent: Component { strongSelf.reorderPacks(category: .emoji, items: items) } )))) - contentIcons.append(AnyComponentWithIdentity(id: "emoji", component: AnyComponent(BundleIconComponent( - name: "Chat/Input/Media/EntityInputEmojiIcon", - tintColor: component.theme.chat.inputMediaPanel.panelIconColor, - maxSize: nil - )))) + contentIcons.append(PagerComponentContentIcon(id: "emoji", imageName: "Chat/Input/Media/EntityInputEmojiIcon")) contentAccessoryLeftButtons.append(AnyComponentWithIdentity(id: "emoji", component: AnyComponent(Button( content: AnyComponent(BundleIconComponent( name: "Chat/Input/Media/EntityInputGlobeIcon", @@ -525,7 +528,7 @@ public final class EntityKeyboardComponent: Component { let pagerSize = self.pagerView.update( transition: transition, component: AnyComponent(PagerComponent( - contentInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0), + contentInsets: component.containerInsets, contents: contents, contentTopPanels: contentTopPanels, contentIcons: contentIcons, @@ -544,7 +547,7 @@ public final class EntityKeyboardComponent: Component { externalTopPanelContainer: component.externalTopPanelContainer, bottomPanel: AnyComponent(EntityKeyboardBottomPanelComponent( theme: component.theme, - bottomInset: component.bottomInset, + containerInsets: component.containerInsets, deleteBackwards: { [weak self] in self?.component?.emojiContent.inputInteractionHolder.inputInteraction?.deleteBackwards() AudioServicesPlaySystemSound(0x451) diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift index a1925f41d8..5cc31d874b 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift @@ -10,19 +10,31 @@ import ComponentDisplayAdapters import BundleIconComponent private final class BottomPanelIconComponent: Component { - let content: AnyComponent + let imageName: String + let isHighlighted: Bool + let theme: PresentationTheme let action: () -> Void init( - content: AnyComponent, + imageName: String, + isHighlighted: Bool, + theme: PresentationTheme, action: @escaping () -> Void ) { - self.content = content + self.imageName = imageName + self.isHighlighted = isHighlighted + self.theme = theme self.action = action } static func ==(lhs: BottomPanelIconComponent, rhs: BottomPanelIconComponent) -> Bool { - if lhs.content != rhs.content { + if lhs.imageName != rhs.imageName { + return false + } + if lhs.isHighlighted != rhs.isHighlighted { + return false + } + if lhs.theme !== rhs.theme { return false } @@ -30,12 +42,12 @@ private final class BottomPanelIconComponent: Component { } final class View: UIView { - let contentView: ComponentHostView + let contentView: UIImageView var component: BottomPanelIconComponent? override init(frame: CGRect) { - self.contentView = ComponentHostView() + self.contentView = UIImageView() self.contentView.isUserInteractionEnabled = false super.init(frame: frame) @@ -55,16 +67,27 @@ private final class BottomPanelIconComponent: Component { } func update(component: BottomPanelIconComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { + if self.component?.imageName != component.imageName { + self.contentView.image = UIImage(bundleImageName: component.imageName) + } + self.component = component - let size = CGSize(width: 32.0, height: 32.0) + let size = CGSize(width: 28.0, height: 28.0) - let contentSize = self.contentView.update( - transition: transition, - component: component.content, - environment: {}, - containerSize: size - ) + let color = component.isHighlighted ? component.theme.chat.inputMediaPanel.panelHighlightedIconColor : component.theme.chat.inputMediaPanel.panelIconColor + + if self.contentView.tintColor != color { + if !transition.animation.isImmediate { + UIView.animate(withDuration: 0.15, delay: 0.0, options: [], animations: { + self.contentView.tintColor = color + }, completion: nil) + } else { + self.contentView.tintColor = color + } + } + + let contentSize = self.contentView.image?.size ?? size transition.setFrame(view: self.contentView, frame: CGRect(origin: CGPoint(x: floor((size.width - contentSize.width) / 2.0), y: (size.height - contentSize.height) / 2.0), size: contentSize)) return size @@ -84,16 +107,16 @@ final class EntityKeyboardBottomPanelComponent: Component { typealias EnvironmentType = PagerComponentPanelEnvironment let theme: PresentationTheme - let bottomInset: CGFloat + let containerInsets: UIEdgeInsets let deleteBackwards: () -> Void init( theme: PresentationTheme, - bottomInset: CGFloat, + containerInsets: UIEdgeInsets, deleteBackwards: @escaping () -> Void ) { self.theme = theme - self.bottomInset = bottomInset + self.containerInsets = containerInsets self.deleteBackwards = deleteBackwards } @@ -101,7 +124,7 @@ final class EntityKeyboardBottomPanelComponent: Component { if lhs.theme !== rhs.theme { return false } - if lhs.bottomInset != rhs.bottomInset { + if lhs.containerInsets != rhs.containerInsets { return false } @@ -160,8 +183,8 @@ final class EntityKeyboardBottomPanelComponent: Component { self.highlightedIconBackgroundView.backgroundColor = component.theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor } - let intrinsicHeight: CGFloat = 38.0 - let height = intrinsicHeight + component.bottomInset + let intrinsicHeight: CGFloat = 34.0 + let height = intrinsicHeight + component.containerInsets.bottom let panelEnvironment = environment[PagerComponentPanelEnvironment.self].value let activeContentId = panelEnvironment.activeContentId @@ -194,7 +217,7 @@ final class EntityKeyboardBottomPanelComponent: Component { environment: {}, containerSize: CGSize(width: .greatestFiniteMagnitude, height: intrinsicHeight) ) - leftAccessoryButtonTransition.setFrame(view: leftAccessoryButton.view, frame: CGRect(origin: CGPoint(x: 2.0, y: 2.0), size: leftAccessoryButtonSize)) + leftAccessoryButtonTransition.setFrame(view: leftAccessoryButton.view, frame: CGRect(origin: CGPoint(x: component.containerInsets.left + 2.0, y: 2.0), size: leftAccessoryButtonSize)) } else { self.leftAccessoryButton = nil } @@ -246,7 +269,7 @@ final class EntityKeyboardBottomPanelComponent: Component { environment: {}, containerSize: CGSize(width: .greatestFiniteMagnitude, height: intrinsicHeight) ) - rightAccessoryButtonTransition.setFrame(view: rightAccessoryButton.view, frame: CGRect(origin: CGPoint(x: availableSize.width - 2.0 - rightAccessoryButtonSize.width, y: 2.0), size: rightAccessoryButtonSize)) + rightAccessoryButtonTransition.setFrame(view: rightAccessoryButton.view, frame: CGRect(origin: CGPoint(x: availableSize.width - component.containerInsets.right - 2.0 - rightAccessoryButtonSize.width, y: 2.0), size: rightAccessoryButtonSize)) } else { self.rightAccessoryButton = nil } @@ -296,13 +319,15 @@ final class EntityKeyboardBottomPanelComponent: Component { let iconSize = iconView.update( transition: iconTransition, component: AnyComponent(BottomPanelIconComponent( - content: icon.component, + imageName: icon.imageName, + isHighlighted: icon.id == activeContentId, + theme: component.theme, action: { navigateToContentId(icon.id) } )), environment: {}, - containerSize: CGSize(width: 32.0, height: 32.0) + containerSize: CGSize(width: 28.0, height: 28.0) ) iconInfos[icon.id] = (size: iconSize, transition: iconTransition) @@ -316,8 +341,8 @@ final class EntityKeyboardBottomPanelComponent: Component { } var nextIconOrigin = CGPoint(x: floor((availableSize.width - iconTotalSize.width) / 2.0), y: floor((intrinsicHeight - iconTotalSize.height) / 2.0)) - if component.bottomInset > 0.0 { - nextIconOrigin.y += 2.0 + if component.containerInsets.bottom > 0.0 { + nextIconOrigin.y += 3.0 } if panelEnvironment.contentIcons.count > 1 { @@ -332,6 +357,14 @@ final class EntityKeyboardBottomPanelComponent: Component { if let activeContentId = activeContentId, activeContentId == icon.id { self.highlightedIconBackgroundView.isHidden = false transition.setFrame(view: self.highlightedIconBackgroundView, frame: iconFrame) + + let cornerRadius: CGFloat + if icon.id == AnyHashable("emoji") { + cornerRadius = min(iconFrame.width, iconFrame.height) / 2.0 + } else { + cornerRadius = 10.0 + } + transition.setCornerRadius(layer: self.highlightedIconBackgroundView.layer, cornerRadius: cornerRadius) } nextIconOrigin.x += iconInfo.size.width + iconSpacing diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift index 7057727731..3f7b663927 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift @@ -88,7 +88,7 @@ final class EntityKeyboardTopContainerPanelComponent: Component { } func update(component: EntityKeyboardTopContainerPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { - let intrinsicHeight: CGFloat = 41.0 + let intrinsicHeight: CGFloat = 34.0 let height = intrinsicHeight let panelEnvironment = environment[PagerComponentPanelEnvironment.self].value diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift index 5d6506e888..7286fe13ab 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift @@ -104,6 +104,9 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { let itemEnvironment = environment[EntityKeyboardTopPanelItemEnvironment.self].value + let dimensions = component.file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0) + let displaySize = dimensions.aspectFitted(CGSize(width: 44.0, height: 44.0)) + if self.itemLayer == nil { let itemLayer = EmojiPagerContentComponent.View.ItemLayer( item: EmojiPagerContentComponent.Item( @@ -119,7 +122,7 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { renderer: component.animationRenderer, placeholderColor: .lightGray, blurredBadgeColor: .clear, - pointSize: CGSize(width: 44.0, height: 44.0), + pointSize: displaySize, onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in guard let strongSelf = self else { return @@ -135,8 +138,9 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { } } - let iconSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 28.0, height: 28.0) - let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: 0.0), size: iconSize) + let iconFitSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 26.0, height: 26.0) + let iconSize = dimensions.aspectFitted(iconFitSize) + let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((iconFitSize.height - iconSize.height) / 2.0)), size: iconSize) if let itemLayer = self.itemLayer { transition.setPosition(layer: itemLayer, position: CGPoint(x: iconFrame.midX, y: iconFrame.midY)) @@ -181,9 +185,14 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { } else if let titleView = self.titleView { self.titleView = nil if let view = titleView.view { - transition.setAlpha(view: view, alpha: 0.0, completion: { [weak view] _ in - view?.removeFromSuperview() - }) + if !transition.animation.isImmediate { + view.alpha = 0.0 + view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.08, completion: { [weak view] _ in + view?.removeFromSuperview() + }) + } else { + view.removeFromSuperview() + } } } @@ -234,25 +243,33 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { final class EntityKeyboardIconTopPanelComponent: Component { typealias EnvironmentType = EntityKeyboardTopPanelItemEnvironment - let imageName: String + enum Icon { + case featured + case trending + case recent + case saved + case premium + } + + let icon: Icon let theme: PresentationTheme let title: String let pressed: () -> Void init( - imageName: String, + icon: Icon, theme: PresentationTheme, title: String, pressed: @escaping () -> Void ) { - self.imageName = imageName + self.icon = icon self.theme = theme self.title = title self.pressed = pressed } static func ==(lhs: EntityKeyboardIconTopPanelComponent, rhs: EntityKeyboardIconTopPanelComponent) -> Bool { - if lhs.imageName != rhs.imageName { + if lhs.icon != rhs.icon { return false } if lhs.theme !== rhs.theme { @@ -293,11 +310,19 @@ final class EntityKeyboardIconTopPanelComponent: Component { func update(component: EntityKeyboardIconTopPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { let itemEnvironment = environment[EntityKeyboardTopPanelItemEnvironment.self].value - if self.component?.imageName != component.imageName { - self.iconView.image = generateTintedImage(image: UIImage(bundleImageName: component.imageName), color: component.theme.chat.inputMediaPanel.panelIconColor) - - if component.imageName.hasSuffix("PremiumIcon") { - self.iconView.image = generateImage(CGSize(width: 44.0, height: 42.0), contextGenerator: { size, context in + if self.component?.icon != component.icon { + var image: UIImage? + switch component.icon { + case .featured: + image = UIImage(bundleImageName: "Chat/Input/Media/PanelFeaturedIcon") + case .trending: + image = UIImage(bundleImageName: "Chat/Input/Media/PanelTrendingIcon") + case .recent: + image = UIImage(bundleImageName: "Chat/Input/Media/PanelRecentIcon") + case .saved: + image = UIImage(bundleImageName: "Chat/Input/Media/PanelSavedIcon") + case .premium: + image = generateImage(CGSize(width: 44.0, height: 42.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) if let image = UIImage(bundleImageName: "Peer Info/PremiumIcon") { if let cgImage = image.cgImage { @@ -318,12 +343,26 @@ final class EntityKeyboardIconTopPanelComponent: Component { } }) } + + self.iconView.image = image } self.component = component - let nativeIconSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 28.0, height: 28.0) - let boundingIconSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 38.0, height: 38.0) : CGSize(width: 28.0, height: 28.0) + let color = itemEnvironment.isHighlighted ? component.theme.chat.inputMediaPanel.panelHighlightedIconColor : component.theme.chat.inputMediaPanel.panelIconColor + + if self.iconView.tintColor != color { + if !transition.animation.isImmediate { + UIView.animate(withDuration: 0.15, delay: 0.0, options: [], animations: { + self.iconView.tintColor = color + }, completion: nil) + } else { + self.iconView.tintColor = color + } + } + + let nativeIconSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 24.0, height: 24.0) + let boundingIconSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 38.0, height: 38.0) : CGSize(width: 24.0, height: 24.0) let iconSize = (self.iconView.image?.size ?? nativeIconSize).aspectFitted(boundingIconSize) let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((nativeIconSize.height - iconSize.height) / 2.0)), size: iconSize) @@ -358,9 +397,14 @@ final class EntityKeyboardIconTopPanelComponent: Component { } else if let titleView = self.titleView { self.titleView = nil if let view = titleView.view { - transition.setAlpha(view: view, alpha: 0.0, completion: { [weak view] _ in - view?.removeFromSuperview() - }) + if !transition.animation.isImmediate { + view.alpha = 0.0 + view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.08, completion: { [weak view] _ in + view?.removeFromSuperview() + }) + } else { + view.removeFromSuperview() + } } } @@ -406,6 +450,36 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { } final class View: UIView, UIScrollViewDelegate { + private struct ItemLayout { + var isExpanded: Bool + var isActive: Bool + var baseItemSize: CGFloat + var itemSize: CGFloat + var itemSpacing: CGFloat + var sideInset: CGFloat + var itemOffset: CGFloat + var contentSize: CGSize + + init(isExpanded: Bool, isActive: Bool, width: CGFloat, height: CGFloat, itemCount: Int) { + self.isExpanded = isExpanded + self.isActive = isActive + self.baseItemSize = 42.0 + self.itemSize = isExpanded ? self.baseItemSize : 24.0 + self.itemSpacing = 4.0 + self.sideInset = isExpanded ? 5.0 : 2.0 + self.itemOffset = isExpanded ? -8.0 : 0.0 + self.contentSize = CGSize(width: self.sideInset * 2.0 + CGFloat(itemCount) * self.itemSize + CGFloat(itemCount - 1) * self.itemSpacing, height: height) + } + + func frame(at index: Int) -> CGRect { + var frame = CGRect(origin: CGPoint(x: self.sideInset + CGFloat(index) * (self.itemSize + self.itemSpacing), y: floor(self.contentSize.height - self.itemSize) / 2.0 + self.itemOffset), size: CGSize(width: self.itemSize, height: self.itemSize)) + if self.isActive && !self.isExpanded { + frame = frame.insetBy(dx: 2.0, dy: 2.0) + } + return frame + } + } + private let scrollViewContainer: UIView private let scrollView: UIScrollView private var visibleItemViews: [EmojiPagerContentComponent.StaticEmojiSegment: ComponentView] = [:] @@ -415,6 +489,8 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { private var component: EntityKeyboardStaticStickersPanelComponent? private var itemEnvironment: EntityKeyboardTopPanelItemEnvironment? + private var itemLayout: ItemLayout? + private var ignoreScrolling: Bool = false override init(frame: CGRect) { @@ -452,13 +528,27 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { @objc private func tapGesture(_ recognizer: UITapGestureRecognizer) { if case .ended = recognizer.state { + if !self.bounds.contains(recognizer.location(in: self)) { + return + } let scrollViewLocation = recognizer.location(in: self.scrollView) + var closestItem: (distance: CGFloat, id: EmojiPagerContentComponent.StaticEmojiSegment)? for (id, itemView) in self.visibleItemViews { - if let view = itemView.view, view.frame.insetBy(dx: -4.0, dy: -4.0).contains(scrollViewLocation) { - self.component?.pressed(id) - break + if let view = itemView.view { + let distance = abs(view.center.x - scrollViewLocation.x) + if let closestItemValue = closestItem { + if distance < closestItemValue.distance { + closestItem = (distance, id) + } + } else { + closestItem = (distance, id) + } } } + + if let closestItem = closestItem { + self.component?.pressed(closestItem.id) + } } } @@ -470,25 +560,17 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { } private func updateVisibleItems(transition: Transition, animateAppearingItems: Bool) { - guard let component = self.component, let itemEnvironment = self.itemEnvironment else { + guard let component = self.component, let itemEnvironment = self.itemEnvironment, let itemLayout = self.itemLayout else { return } var validItemIds = Set() let visibleBounds = self.scrollView.bounds - let componentHeight: CGFloat = self.scrollView.contentSize.height - - let isExpanded = componentHeight > 32.0 - let items = EmojiPagerContentComponent.StaticEmojiSegment.allCases - let itemSize: CGFloat = isExpanded ? 42.0 : 32.0 - let itemSpacing: CGFloat = 4.0 - let sideInset: CGFloat = isExpanded ? 5.0 : 2.0 - let itemOffset: CGFloat = isExpanded ? -8.0 : 0.0 for i in 0 ..< items.count { - let itemFrame = CGRect(origin: CGPoint(x: sideInset + CGFloat(i) * (itemSize + itemSpacing), y: floor(componentHeight - itemSize) / 2.0 + itemOffset), size: CGSize(width: itemSize, height: itemSize)) - if visibleBounds.intersects(itemFrame) { + let itemFrame = itemLayout.frame(at: i) + if true/*visibleBounds.intersects(itemFrame)*/ { let item = items[i] validItemIds.insert(item) @@ -503,6 +585,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { itemView = ComponentView() self.visibleItemViews[item] = itemView } + let _ = animateItem let animationName: String switch item { @@ -526,29 +609,45 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { let color: UIColor if itemEnvironment.highlightedSubgroupId == AnyHashable(items[i].rawValue) { - color = component.theme.chat.inputMediaPanel.panelIconColor.mixedWith(component.theme.chat.inputPanel.primaryTextColor, alpha: 0.35) + color = component.theme.chat.inputMediaPanel.panelHighlightedIconColor } else { color = component.theme.chat.inputMediaPanel.panelIconColor } + let _ = itemTransition let _ = itemView.update( - transition: itemTransition, + transition: .immediate, component: AnyComponent(LottieAnimationComponent( animation: LottieAnimationComponent.AnimationItem( name: animationName, - mode: animateItem ? .animating(loop: false) : .still(position: .end) + mode: .still(position: .end) ), colors: ["__allcolors__": color], - size: CGSize(width: itemSize, height: itemSize) + size: CGSize(width: itemLayout.baseItemSize, height: itemLayout.baseItemSize) )), environment: {}, - containerSize: CGSize(width: itemSize, height: itemSize) + containerSize: CGSize(width: itemLayout.baseItemSize, height: itemLayout.baseItemSize) ) if let view = itemView.view { if view.superview == nil { self.scrollView.addSubview(view) } - itemTransition.setFrame(view: view, frame: itemFrame) + + itemTransition.setPosition(view: view, position: CGPoint(x: itemFrame.midX, y: itemFrame.midY)) + itemTransition.setBounds(view: view, bounds: CGRect(origin: CGPoint(), size: CGSize(width: itemLayout.baseItemSize, height: itemLayout.baseItemSize))) + let scaleFactor = itemFrame.width / itemLayout.baseItemSize + itemTransition.setSublayerTransform(view: view, transform: CATransform3DMakeScale(scaleFactor, scaleFactor, 1.0)) + + let isHidden = !visibleBounds.intersects(itemFrame) + if isHidden != view.isHidden { + view.isHidden = isHidden + + if !isHidden { + if let view = view as? LottieAnimationComponent.View { + view.playOnce() + } + } + } } } } @@ -566,9 +665,6 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { } func update(component: EntityKeyboardStaticStickersPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { - transition.setFrame(view: self.scrollViewContainer, frame: CGRect(origin: CGPoint(), size: availableSize)) - transition.setCornerRadius(layer: self.scrollViewContainer.layer, cornerRadius: min(availableSize.width / 2.0, availableSize.height / 2.0)) - let itemEnvironment = environment[EntityKeyboardTopPanelItemEnvironment.self].value var scrollToItem: AnyHashable? @@ -579,30 +675,32 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { self.component = component self.itemEnvironment = itemEnvironment - let isExpanded = itemEnvironment.isExpanded - let itemSize: CGFloat = isExpanded ? 42.0 : 32.0 - let itemSpacing: CGFloat = 4.0 - let sideInset: CGFloat = isExpanded ? 5.0 : 2.0 - let itemCount = EmojiPagerContentComponent.StaticEmojiSegment.allCases.count + let itemLayout = ItemLayout(isExpanded: itemEnvironment.isExpanded, isActive: itemEnvironment.isHighlighted, width: availableSize.width, height: availableSize.height, itemCount: EmojiPagerContentComponent.StaticEmojiSegment.allCases.count) + self.itemLayout = itemLayout + + transition.setFrame(view: self.scrollViewContainer, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: availableSize.width, height: availableSize.height))) + transition.setCornerRadius(layer: self.scrollViewContainer.layer, cornerRadius: min(availableSize.width / 2.0, availableSize.height / 2.0)) self.ignoreScrolling = true - self.scrollView.frame = CGRect(origin: CGPoint(), size: CGSize(width: max(availableSize.width, 160.0), height: availableSize.height)) - self.scrollView.contentSize = CGSize(width: sideInset * 2.0 + itemSize * CGFloat(itemCount) + itemSpacing * CGFloat(itemCount - 1), height: availableSize.height) + self.scrollView.frame = CGRect(origin: CGPoint(), size: CGSize(width: max(availableSize.width, 126.0), height: availableSize.height)) + self.scrollView.contentSize = itemLayout.contentSize self.ignoreScrolling = false self.updateVisibleItems(transition: transition, animateAppearingItems: false) - if (!itemEnvironment.isHighlighted || isExpanded) && self.scrollView.contentOffset.x != 0.0 { + if (!itemEnvironment.isHighlighted || itemLayout.isExpanded) && self.scrollView.contentOffset.x != 0.0 { self.scrollView.setContentOffset(CGPoint(), animated: true) scrollToItem = nil } + self.scrollView.isUserInteractionEnabled = itemEnvironment.isHighlighted && !itemLayout.isExpanded + if let scrollToItem = scrollToItem { let items = EmojiPagerContentComponent.StaticEmojiSegment.allCases for i in 0 ..< items.count { if AnyHashable(items[i].rawValue) == scrollToItem { - let itemFrame = CGRect(origin: CGPoint(x: sideInset + CGFloat(i) * (itemSize + itemSpacing), y: 0.0), size: CGSize(width: itemSize, height: itemSize)) - self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: -sideInset, dy: 0.0), animated: true) + let itemFrame = itemLayout.frame(at: i) + self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: -itemLayout.sideInset, dy: 0.0), animated: true) break } } @@ -636,9 +734,14 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { } else if let titleView = self.titleView { self.titleView = nil if let view = titleView.view { - transition.setAlpha(view: view, alpha: 0.0, completion: { [weak view] _ in - view?.removeFromSuperview() - }) + if !transition.animation.isImmediate { + view.alpha = 0.0 + view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.08, completion: { [weak view] _ in + view?.removeFromSuperview() + }) + } else { + view.removeFromSuperview() + } } } @@ -908,6 +1011,7 @@ final class EntityKeyboardTopPanelComponent: Component { let theme: PresentationTheme let items: [Item] let defaultActiveItemId: AnyHashable? + let forceActiveItemId: AnyHashable? let activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)> let reorderItems: ([Item]) -> Void @@ -915,12 +1019,14 @@ final class EntityKeyboardTopPanelComponent: Component { theme: PresentationTheme, items: [Item], defaultActiveItemId: AnyHashable? = nil, + forceActiveItemId: AnyHashable? = nil, activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>, reorderItems: @escaping ([Item]) -> Void ) { self.theme = theme self.items = items self.defaultActiveItemId = defaultActiveItemId + self.forceActiveItemId = forceActiveItemId self.activeContentItemIdUpdated = activeContentItemIdUpdated self.reorderItems = reorderItems } @@ -935,6 +1041,9 @@ final class EntityKeyboardTopPanelComponent: Component { if lhs.defaultActiveItemId != rhs.defaultActiveItemId { return false } + if lhs.forceActiveItemId != rhs.forceActiveItemId { + return false + } if lhs.activeContentItemIdUpdated !== rhs.activeContentItemIdUpdated { return false } @@ -954,28 +1063,30 @@ final class EntityKeyboardTopPanelComponent: Component { var innerFrame: CGRect } + let topInset: CGFloat = -3.0 let sideInset: CGFloat = 7.0 let itemSize: CGSize let staticItemSize: CGSize let staticExpandedItemSize: CGSize let innerItemSize: CGSize - let itemSpacing: CGFloat = 15.0 + let itemSpacing: CGFloat let contentSize: CGSize let isExpanded: Bool let items: [Item] init(isExpanded: Bool, height: CGFloat, items: [ItemDescription]) { self.isExpanded = isExpanded - self.itemSize = self.isExpanded ? CGSize(width: 54.0, height: 68.0) : CGSize(width: 32.0, height: 32.0) + self.itemSize = self.isExpanded ? CGSize(width: 54.0, height: 68.0) : CGSize(width: 28.0, height: 28.0) self.staticItemSize = self.itemSize - self.staticExpandedItemSize = self.isExpanded ? self.staticItemSize : CGSize(width: 160.0, height: 32.0) - self.innerItemSize = self.isExpanded ? CGSize(width: 50.0, height: 62.0) : CGSize(width: 28.0, height: 28.0) + self.staticExpandedItemSize = self.isExpanded ? self.staticItemSize : CGSize(width: 126.0, height: 28.0) + self.innerItemSize = self.isExpanded ? CGSize(width: 50.0, height: 62.0) : CGSize(width: 24.0, height: 24.0) + self.itemSpacing = 8.0 var contentSize = CGSize(width: sideInset, height: height) var resultItems: [Item] = [] var isFirst = true - let itemY = floor((contentSize.height - self.itemSize.height) / 2.0) + let itemY = self.topInset + floor((contentSize.height - self.itemSize.height) / 2.0) for item in items { if isFirst { isFirst = false @@ -1446,8 +1557,8 @@ final class EntityKeyboardTopPanelComponent: Component { } var visibleBounds = self.scrollView.bounds - visibleBounds.origin.x -= 200.0 - visibleBounds.size.width += 400.0 + visibleBounds.origin.x -= 280.0 + visibleBounds.size.width += 560.0 let scale = max(0.01, self.visibilityFraction) @@ -1504,14 +1615,16 @@ final class EntityKeyboardTopPanelComponent: Component { self.component = component self.state = state - if let defaultActiveItemId = component.defaultActiveItemId { + if let forceActiveItemId = component.forceActiveItemId { + self.activeContentItemId = forceActiveItemId + } else if self.activeContentItemId == nil, let defaultActiveItemId = component.defaultActiveItemId { self.activeContentItemId = defaultActiveItemId } let panelEnvironment = environment[EntityKeyboardTopContainerPanelEnvironment.self].value self.environment = panelEnvironment - let isExpanded = availableSize.height > 41.0 + let isExpanded = availableSize.height > 34.0 let wasExpanded = self.isExpanded self.isExpanded = isExpanded @@ -1576,8 +1689,8 @@ final class EntityKeyboardTopPanelComponent: Component { } var visibleBounds = self.scrollView.bounds - visibleBounds.origin.x -= 200.0 - visibleBounds.size.width += 400.0 + visibleBounds.origin.x -= 280.0 + visibleBounds.size.width += 560.0 let previousVisibleRange = previousItemLayout.visibleItemRange(for: visibleBounds) if previousVisibleRange.minIndex <= previousVisibleRange.maxIndex { @@ -1626,8 +1739,8 @@ final class EntityKeyboardTopPanelComponent: Component { updatedBounds = newBounds var updatedVisibleBounds = newBounds - updatedVisibleBounds.origin.x -= 200.0 - updatedVisibleBounds.size.width += 400.0 + updatedVisibleBounds.origin.x -= 280.0 + updatedVisibleBounds.size.width += 560.0 let updatedVisibleRange = itemLayout.visibleItemRange(for: updatedVisibleBounds) if useRightAnchor { diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift index 7f8c132158..8171d8976e 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift @@ -755,7 +755,7 @@ public final class GifPagerContentComponent: Component { guard let theme = self.theme else { return } - self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75), enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition) + self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.backgroundColor, enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition) transition.setFrame(view: self.backgroundView, frame: backgroundFrame) self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition) } diff --git a/submodules/TelegramUI/Components/LottieAnimationCache/Sources/LottieAnimationCache.swift b/submodules/TelegramUI/Components/LottieAnimationCache/Sources/LottieAnimationCache.swift index bc09070b5b..7856c916f0 100644 --- a/submodules/TelegramUI/Components/LottieAnimationCache/Sources/LottieAnimationCache.swift +++ b/submodules/TelegramUI/Components/LottieAnimationCache/Sources/LottieAnimationCache.swift @@ -17,7 +17,7 @@ public func cacheLottieAnimation(data: Data, width: Int, height: Int, writer: An let frameSkip: Int if animation.frameRate >= 60 { - if ProcessInfo.processInfo.activeProcessorCount > 2 { + if ProcessInfo.processInfo.processorCount > 2 { frameSkip = 1 } else { frameSkip = 2 diff --git a/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationMetalRenderer.swift b/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationMetalRenderer.swift index df715c5a18..00f1837d90 100644 --- a/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationMetalRenderer.swift +++ b/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationMetalRenderer.swift @@ -779,7 +779,7 @@ public final class MultiAnimationMetalRendererImpl: MultiAnimationRenderer { } public init() { - if !ProcessInfo.processInfo.isLowPowerModeEnabled && ProcessInfo.processInfo.activeProcessorCount > 2 { + if !ProcessInfo.processInfo.isLowPowerModeEnabled && ProcessInfo.processInfo.processorCount > 2 { self.frameSkip = 1 } else { self.frameSkip = 2 diff --git a/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationRenderer.swift b/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationRenderer.swift index b76800a424..126894163b 100644 --- a/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationRenderer.swift +++ b/submodules/TelegramUI/Components/MultiAnimationRenderer/Sources/MultiAnimationRenderer.swift @@ -131,7 +131,9 @@ private final class ItemAnimationContext { let blurredWidth = 12 let blurredHeight = 12 let context = DrawingContext(size: CGSize(width: CGFloat(blurredWidth), height: CGFloat(blurredHeight)), scale: 1.0, opaque: true, bytesPerRow: bytesPerRow) - + + let size = CGSize(width: CGFloat(blurredWidth), height: CGFloat(blurredHeight)) + data.withUnsafeBytes { bytes -> Void in if let dataProvider = CGDataProvider(dataInfo: nil, data: bytes.baseAddress!, size: bytes.count, releaseData: { _, _, _ in }) { let image = CGImage( @@ -148,7 +150,6 @@ private final class ItemAnimationContext { intent: .defaultIntent ) if let image = image { - let size = CGSize(width: CGFloat(blurredWidth), height: CGFloat(blurredHeight)) context.withFlippedContext { c in c.setFillColor((color ?? .white).cgColor) c.fill(CGRect(origin: CGPoint(), size: size)) @@ -202,6 +203,11 @@ private final class ItemAnimationContext { } vImageMatrixMultiply_ARGB8888(&destinationBuffer, &destinationBuffer, &matrix, divisor, nil, nil, vImage_Flags(kvImageDoNotTile)) + + context.withFlippedContext { c in + c.setFillColor((color ?? .white).withMultipliedAlpha(0.6).cgColor) + c.fill(CGRect(origin: CGPoint(), size: size)) + } } self.blurredRepresentationValue = context.generateImage() @@ -556,7 +562,7 @@ public final class MultiAnimationRendererImpl: MultiAnimationRenderer { } public init() { - if !ProcessInfo.processInfo.isLowPowerModeEnabled && ProcessInfo.processInfo.activeProcessorCount > 2 { + if !ProcessInfo.processInfo.isLowPowerModeEnabled && ProcessInfo.processInfo.processorCount > 2 { self.frameSkip = 1 } else { self.frameSkip = 2 diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/Contents.json index f93f8f8fb7..d4b2093823 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "ic_clear.pdf", + "filename" : "backspace_24.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/backspace_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/backspace_24.svg new file mode 100644 index 0000000000..3907ddf696 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/backspace_24.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/ic_clear.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/ic_clear.pdf deleted file mode 100644 index 559ad92734..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputClearIcon.imageset/ic_clear.pdf +++ /dev/null @@ -1,107 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 3.180420 6.169983 cm -0.000000 0.000000 0.000000 scn -7.131522 16.439991 m -8.015658 17.225891 9.157463 17.660004 10.340398 17.660004 c -19.819601 17.660004 l -22.487137 17.660004 24.649601 15.497540 24.649601 12.830004 c -24.649601 4.830004 l -24.649601 2.162468 22.487137 0.000004 19.819601 0.000004 c -10.340399 0.000004 l -9.157463 0.000004 8.015657 0.434116 7.131521 1.220016 c -0.949850 6.714835 l --0.316617 7.840584 -0.316617 9.819424 0.949850 10.945172 c -7.131522 16.439991 l -h -10.340398 16.000004 m -9.564020 16.000004 8.814637 15.715089 8.234365 15.199291 c -2.052694 9.704473 l -1.529102 9.239058 1.529102 8.420950 2.052694 7.955535 c -8.234365 2.460716 l -8.814637 1.944919 9.564020 1.660004 10.340399 1.660004 c -19.819601 1.660004 l -21.570343 1.660004 22.989601 3.079261 22.989601 4.830004 c -22.989601 12.830004 l -22.989601 14.580747 21.570343 16.000004 19.819601 16.000004 c -10.340398 16.000004 l -h -10.732702 12.916903 m -11.056838 13.241037 11.582364 13.241037 11.906500 12.916903 c -14.819601 10.003801 l -17.732702 12.916903 l -18.056837 13.241037 18.582365 13.241037 18.906500 12.916903 c -19.230635 12.592768 19.230635 12.067240 18.906500 11.743105 c -15.993399 8.830004 l -18.906500 5.916903 l -19.230635 5.592768 19.230635 5.067240 18.906500 4.743105 c -18.582365 4.418970 18.056837 4.418970 17.732702 4.743105 c -14.819601 7.656206 l -11.906500 4.743105 l -11.582364 4.418970 11.056838 4.418970 10.732702 4.743105 c -10.408567 5.067241 10.408567 5.592767 10.732702 5.916903 c -13.645803 8.830004 l -10.732702 11.743105 l -10.408567 12.067240 10.408567 12.592768 10.732702 12.916903 c -h -f* -n -Q - -endstream -endobj - -3 0 obj - 1651 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000001741 00000 n -0000001764 00000 n -0000001937 00000 n -0000002011 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -2070 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/Contents.json index 8d1829694d..bf55af4ccb 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "ic_emoji.pdf", + "filename" : "emoji.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/emoji.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/emoji.svg new file mode 100644 index 0000000000..cf7371e770 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/emoji.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/ic_emoji.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/ic_emoji.pdf deleted file mode 100644 index 51dd673605..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputEmojiIcon.imageset/ic_emoji.pdf +++ /dev/null @@ -1,123 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 7.292999 5.741058 cm -0.000000 0.000000 0.000000 scn -7.706251 7.052563 m -9.859218 7.052563 11.806032 7.518116 13.204300 7.852490 c -14.570075 8.179095 15.412500 8.380550 15.412500 7.900764 c -15.412500 3.644719 11.962295 0.194514 7.706251 0.194514 c -3.450206 0.194514 0.000000 3.644719 0.000000 7.900764 c -0.000000 8.380550 0.842425 8.179095 2.208200 7.852490 c -3.606467 7.518116 5.553283 7.052563 7.706251 7.052563 c -h -12.468611 6.348519 m -11.392131 6.066849 9.742197 5.635127 7.697002 5.635127 c -5.651808 5.635127 4.001874 6.066849 2.925394 6.348519 c -2.030582 6.582655 1.532002 6.713113 1.532002 6.405752 c -1.532002 3.455799 6.013958 3.323253 7.697002 3.323253 c -9.586575 3.323253 13.862001 3.456314 13.862001 6.405752 c -13.862001 6.713113 13.363423 6.582655 12.468611 6.348519 c -h -f* -n -Q -q -1.000000 0.000000 -0.000000 1.000000 2.669983 2.669983 cm -0.000000 0.000000 0.000000 scn -12.330000 23.000004 m -6.437122 23.000004 1.660000 18.222881 1.660000 12.330004 c -1.660000 6.437126 6.437122 1.660004 12.330000 1.660004 c -18.222878 1.660004 23.000000 6.437126 23.000000 12.330004 c -23.000000 18.222881 18.222878 23.000004 12.330000 23.000004 c -h -0.000000 12.330004 m -0.000000 19.139675 5.520329 24.660004 12.330000 24.660004 c -19.139671 24.660004 24.660000 19.139675 24.660000 12.330004 c -24.660000 5.520332 19.139671 0.000004 12.330000 0.000004 c -5.520329 0.000004 0.000000 5.520332 0.000000 12.330004 c -h -f* -n -Q -q -1.000000 0.000000 -0.000000 1.000000 10.000000 16.250000 cm -0.000000 0.000000 0.000000 scn -3.000000 1.750000 m -3.000000 0.783502 2.328427 0.000000 1.500000 0.000000 c -0.671573 0.000000 0.000000 0.783502 0.000000 1.750000 c -0.000000 2.716498 0.671573 3.500000 1.500000 3.500000 c -2.328427 3.500000 3.000000 2.716498 3.000000 1.750000 c -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 17.000000 16.250000 cm -0.000000 0.000000 0.000000 scn -3.000000 1.750000 m -3.000000 0.783502 2.328427 0.000000 1.500000 0.000000 c -0.671573 0.000000 0.000000 0.783502 0.000000 1.750000 c -0.000000 2.716498 0.671573 3.500000 1.500000 3.500000 c -2.328427 3.500000 3.000000 2.716498 3.000000 1.750000 c -h -f -n -Q - -endstream -endobj - -3 0 obj - 2167 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000002257 00000 n -0000002280 00000 n -0000002453 00000 n -0000002527 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -2586 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/Contents.json index 35222f8570..1e503c705b 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "ic_gifs.pdf", + "filename" : "gifs.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/gifs.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/gifs.svg new file mode 100644 index 0000000000..b1f69cab65 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/gifs.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/ic_gifs.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/ic_gifs.pdf deleted file mode 100644 index 410ff918fa..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGifsIcon.imageset/ic_gifs.pdf +++ /dev/null @@ -1,128 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 2.669983 2.670013 cm -0.000000 0.000000 0.000000 scn -12.330000 22.999989 m -6.437122 22.999989 1.660000 18.222866 1.660000 12.329988 c -1.660000 6.437111 6.437122 1.659988 12.330000 1.659988 c -18.222878 1.659988 23.000000 6.437111 23.000000 12.329988 c -23.000000 18.222866 18.222878 22.999989 12.330000 22.999989 c -h -0.000000 12.329988 m -0.000000 19.139660 5.520329 24.659988 12.330000 24.659988 c -19.139671 24.659988 24.660000 19.139660 24.660000 12.329988 c -24.660000 5.520317 19.139671 -0.000011 12.330000 -0.000011 c -5.520329 -0.000011 0.000000 5.520317 0.000000 12.329988 c -h -17.108725 15.659992 m -17.129999 15.659988 l -18.830000 15.659988 l -19.288397 15.659988 19.660000 15.288384 19.660000 14.829988 c -19.660000 14.371593 19.288397 13.999989 18.830000 13.999989 c -17.160000 13.999989 l -17.160000 13.159988 l -18.830000 13.159988 l -19.288397 13.159988 19.660000 12.788384 19.660000 12.329988 c -19.660000 11.871593 19.288397 11.499989 18.830000 11.499989 c -17.160000 11.499989 l -17.160000 9.829988 l -17.160000 9.371592 16.788397 8.999989 16.330000 8.999989 c -15.871604 8.999989 15.500000 9.371592 15.500000 9.829988 c -15.500000 12.329988 l -15.500000 14.029988 l -15.499996 14.051264 l -15.499962 14.172362 15.499924 14.307926 15.509568 14.425976 c -15.520575 14.560680 15.548159 14.743810 15.644961 14.933796 c -15.772472 15.184052 15.975937 15.387516 16.226192 15.515027 c -16.416180 15.611830 16.599308 15.639414 16.734013 15.650420 c -16.852062 15.660065 16.987627 15.660027 17.108725 15.659992 c -h -13.330000 15.659988 m -13.788396 15.659988 14.160000 15.288384 14.160000 14.829988 c -14.160000 9.829988 l -14.160000 9.371592 13.788396 8.999989 13.330000 8.999989 c -12.871604 8.999989 12.500000 9.371592 12.500000 9.829988 c -12.500000 14.829988 l -12.500000 15.288384 12.871604 15.659988 13.330000 15.659988 c -h -8.330000 15.659988 m -6.490891 15.659988 5.000000 14.169097 5.000000 12.329988 c -5.000000 10.490880 6.490891 8.999989 8.330000 8.999989 c -9.670162 8.999989 11.076591 9.880583 11.385777 11.507551 c -11.393431 11.547824 l -11.397078 11.588655 l -11.427523 11.929440 l -11.486586 12.590580 10.965777 13.159988 10.302004 13.159988 c -9.330000 13.159988 l -8.871603 13.159988 8.500000 12.788385 8.500000 12.329988 c -8.500000 11.871592 8.871603 11.499989 9.330000 11.499989 c -9.657213 11.499989 l -9.421404 10.962639 8.887941 10.659988 8.330000 10.659988 c -7.407684 10.659988 6.660000 11.407673 6.660000 12.329988 c -6.660000 13.252304 7.407684 13.999989 8.330000 13.999989 c -8.609308 13.999989 8.870320 13.932076 9.099771 13.812578 c -9.506336 13.600842 10.007568 13.758780 10.219306 14.165344 c -10.431044 14.571908 10.273106 15.073140 9.866541 15.284878 c -9.405935 15.524760 8.882543 15.659988 8.330000 15.659988 c -h -f* -n -Q - -endstream -endobj - -3 0 obj - 2783 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000002873 00000 n -0000002896 00000 n -0000003069 00000 n -0000003143 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -3202 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/Contents.json index 28fd472ac9..a4c1cddbca 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "planet.pdf", + "filename" : "keyboard_24.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/keyboard_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/keyboard_24.svg new file mode 100644 index 0000000000..6134e3e7fa --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/keyboard_24.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/planet.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/planet.pdf deleted file mode 100644 index c2225439d8..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputGlobeIcon.imageset/planet.pdf +++ /dev/null @@ -1,255 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 3.500000 1.839844 cm -0.000000 0.000000 0.000000 scn -22.170000 13.160156 m -22.170000 7.267279 17.392878 2.490156 11.500000 2.490156 c -11.500000 0.830156 l -18.309671 0.830156 23.830000 6.350485 23.830000 13.160156 c -22.170000 13.160156 l -h -11.500000 2.490156 m -5.607122 2.490156 0.830000 7.267279 0.830000 13.160156 c --0.830000 13.160156 l --0.830000 6.350485 4.690329 0.830156 11.500000 0.830156 c -11.500000 2.490156 l -h -0.830000 13.160156 m -0.830000 19.053034 5.607122 23.830156 11.500000 23.830156 c -11.500000 25.490156 l -4.690329 25.490156 -0.830000 19.969828 -0.830000 13.160156 c -0.830000 13.160156 l -h -11.500000 23.830156 m -17.392878 23.830156 22.170000 19.053034 22.170000 13.160156 c -23.830000 13.160156 l -23.830000 19.969828 18.309671 25.490156 11.500000 25.490156 c -11.500000 23.830156 l -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 8.500000 1.839844 cm -0.000000 0.000000 0.000000 scn -12.170000 13.160156 m -12.170000 10.100716 11.467313 7.371819 10.373627 5.436836 c -9.265684 3.476629 7.863927 2.490156 6.500000 2.490156 c -6.500000 0.830156 l -8.725924 0.830156 10.574167 2.418047 11.818761 4.620020 c -13.077613 6.847219 13.830000 9.868322 13.830000 13.160156 c -12.170000 13.160156 l -h -6.500000 2.490156 m -5.136073 2.490156 3.734316 3.476629 2.626373 5.436836 c -1.532687 7.371819 0.830000 10.100716 0.830000 13.160156 c --0.830000 13.160156 l --0.830000 9.868322 -0.077613 6.847219 1.181239 4.620020 c -2.425833 2.418047 4.274076 0.830156 6.500000 0.830156 c -6.500000 2.490156 l -h -0.830000 13.160156 m -0.830000 16.219597 1.532687 18.948494 2.626373 20.883476 c -3.734316 22.843683 5.136073 23.830156 6.500000 23.830156 c -6.500000 25.490156 l -4.274076 25.490156 2.425833 23.902266 1.181239 21.700291 c --0.077613 19.473093 -0.830000 16.451990 -0.830000 13.160156 c -0.830000 13.160156 l -h -6.500000 23.830156 m -7.863927 23.830156 9.265684 22.843683 10.373627 20.883476 c -11.467313 18.948494 12.170000 16.219597 12.170000 13.160156 c -13.830000 13.160156 l -13.830000 16.451990 13.077613 19.473093 11.818761 21.700291 c -10.574167 23.902266 8.725924 25.490156 6.500000 25.490156 c -6.500000 23.830156 l -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 15.000000 3.500000 cm -0.000000 0.000000 0.000000 scn --0.830000 23.000000 m --0.830000 0.000000 l -0.830000 0.000000 l -0.830000 23.000000 l --0.830000 23.000000 l -h -f -n -Q -q -0.000000 1.000000 -1.000000 0.000000 5.160156 15.000000 cm -0.000000 0.000000 0.000000 scn --0.830000 1.660156 m --0.830000 -21.339844 l -0.830000 -21.339844 l -0.830000 1.660156 l --0.830000 1.660156 l -h -f -n -Q -q -0.000000 1.000000 -1.000000 0.000000 9.019043 8.000000 cm -0.000000 0.000000 0.000000 scn -0.000000 3.519043 m --0.686377 3.052367 -0.686606 3.052704 -0.686827 3.053029 c --0.686890 3.053123 -0.687103 3.053437 -0.687230 3.053624 c --0.687484 3.053999 -0.687707 3.054330 -0.687901 3.054617 c --0.688287 3.055190 -0.688552 3.055586 -0.688699 3.055805 c --0.688991 3.056243 -0.688808 3.055973 -0.688163 3.054991 c --0.686874 3.053027 -0.683741 3.048217 -0.678884 3.040542 c --0.669169 3.025192 -0.652556 2.998377 -0.630008 2.959931 c --0.584915 2.883047 -0.516061 2.759615 -0.431147 2.588317 c --0.261366 2.245815 -0.027114 1.711416 0.209833 0.974417 c -0.683340 -0.498374 1.170000 -2.787649 1.170000 -5.980957 c -2.830000 -5.980957 l -2.830000 -2.615824 2.316660 -0.155099 1.790166 1.482499 c -1.527114 2.300695 1.261366 2.911589 1.056147 3.325581 c -0.953561 3.532529 0.866165 3.690144 0.801883 3.799746 c -0.769744 3.854543 0.743388 3.897330 0.723805 3.928271 c -0.714015 3.943742 0.705917 3.956251 0.699638 3.965818 c -0.696498 3.970602 0.693813 3.974651 0.691598 3.977967 c -0.690490 3.979625 0.689500 3.981099 0.688629 3.982391 c -0.688194 3.983037 0.687788 3.983638 0.687413 3.984192 c -0.687225 3.984469 0.686966 3.984851 0.686872 3.984990 c -0.686621 3.985360 0.686377 3.985719 0.000000 3.519043 c -h -1.170000 -5.980957 m -1.170000 -9.174265 0.683340 -11.463540 0.209833 -12.936331 c --0.027114 -13.673330 -0.261366 -14.207729 -0.431147 -14.550232 c --0.516061 -14.721529 -0.584915 -14.844961 -0.630008 -14.921844 c --0.652556 -14.960291 -0.669169 -14.987106 -0.678884 -15.002457 c --0.683741 -15.010132 -0.686874 -15.014940 -0.688163 -15.016905 c --0.688808 -15.017887 -0.688991 -15.018158 -0.688699 -15.017719 c --0.688552 -15.017500 -0.688287 -15.017103 -0.687901 -15.016531 c --0.687707 -15.016245 -0.687484 -15.015913 -0.687230 -15.015539 c --0.687103 -15.015350 -0.686890 -15.015036 -0.686827 -15.014942 c --0.686606 -15.014618 -0.686377 -15.014280 0.000000 -15.480957 c -0.686377 -15.947634 0.686621 -15.947273 0.686872 -15.946903 c -0.686966 -15.946766 0.687225 -15.946383 0.687413 -15.946106 c -0.687788 -15.945551 0.688194 -15.944952 0.688629 -15.944305 c -0.689500 -15.943014 0.690490 -15.941538 0.691598 -15.939880 c -0.693813 -15.936565 0.696498 -15.932516 0.699638 -15.927732 c -0.705917 -15.918165 0.714015 -15.905657 0.723805 -15.890184 c -0.743388 -15.859243 0.769744 -15.816458 0.801883 -15.761660 c -0.866165 -15.652058 0.953561 -15.494444 1.056147 -15.287495 c -1.261366 -14.873503 1.527114 -14.262609 1.790166 -13.444414 c -2.316660 -11.806815 2.830000 -9.346090 2.830000 -5.980957 c -1.170000 -5.980957 l -h -f -n -Q -q -0.000000 -1.000000 1.000000 0.000000 20.980957 22.000000 cm -0.000000 0.000000 0.000000 scn -0.000000 3.519043 m --0.686377 3.052367 -0.686606 3.052704 -0.686827 3.053029 c --0.686890 3.053123 -0.687103 3.053437 -0.687230 3.053624 c --0.687484 3.053999 -0.687707 3.054330 -0.687901 3.054617 c --0.688287 3.055190 -0.688552 3.055586 -0.688699 3.055805 c --0.688991 3.056243 -0.688808 3.055973 -0.688163 3.054991 c --0.686874 3.053027 -0.683741 3.048217 -0.678884 3.040542 c --0.669169 3.025192 -0.652556 2.998377 -0.630008 2.959931 c --0.584915 2.883047 -0.516061 2.759615 -0.431147 2.588317 c --0.261366 2.245815 -0.027114 1.711416 0.209833 0.974417 c -0.683340 -0.498374 1.170000 -2.787649 1.170000 -5.980957 c -2.830000 -5.980957 l -2.830000 -2.615824 2.316660 -0.155099 1.790166 1.482499 c -1.527114 2.300695 1.261366 2.911589 1.056147 3.325581 c -0.953561 3.532529 0.866165 3.690144 0.801883 3.799746 c -0.769744 3.854543 0.743388 3.897330 0.723805 3.928271 c -0.714015 3.943742 0.705917 3.956251 0.699638 3.965818 c -0.696498 3.970602 0.693813 3.974651 0.691598 3.977967 c -0.690490 3.979625 0.689500 3.981099 0.688629 3.982391 c -0.688194 3.983037 0.687788 3.983638 0.687413 3.984192 c -0.687225 3.984469 0.686966 3.984851 0.686872 3.984990 c -0.686621 3.985360 0.686377 3.985719 0.000000 3.519043 c -h -1.170000 -5.980957 m -1.170000 -9.174265 0.683340 -11.463540 0.209833 -12.936331 c --0.027114 -13.673330 -0.261366 -14.207729 -0.431147 -14.550232 c --0.516061 -14.721529 -0.584915 -14.844961 -0.630008 -14.921844 c --0.652556 -14.960291 -0.669169 -14.987106 -0.678884 -15.002457 c --0.683741 -15.010132 -0.686874 -15.014940 -0.688163 -15.016905 c --0.688808 -15.017887 -0.688991 -15.018158 -0.688699 -15.017719 c --0.688552 -15.017500 -0.688287 -15.017103 -0.687901 -15.016531 c --0.687707 -15.016245 -0.687484 -15.015913 -0.687230 -15.015539 c --0.687103 -15.015350 -0.686890 -15.015036 -0.686827 -15.014942 c --0.686606 -15.014618 -0.686377 -15.014280 0.000000 -15.480957 c -0.686377 -15.947634 0.686621 -15.947273 0.686872 -15.946903 c -0.686966 -15.946766 0.687225 -15.946383 0.687413 -15.946106 c -0.687788 -15.945551 0.688194 -15.944952 0.688629 -15.944305 c -0.689500 -15.943014 0.690490 -15.941538 0.691598 -15.939880 c -0.693813 -15.936565 0.696498 -15.932516 0.699638 -15.927732 c -0.705917 -15.918165 0.714015 -15.905657 0.723805 -15.890184 c -0.743388 -15.859243 0.769744 -15.816458 0.801883 -15.761660 c -0.866165 -15.652058 0.953561 -15.494444 1.056147 -15.287495 c -1.261366 -14.873503 1.527114 -14.262609 1.790166 -13.444414 c -2.316660 -11.806815 2.830000 -9.346090 2.830000 -5.980957 c -1.170000 -5.980957 l -h -f -n -Q - -endstream -endobj - -3 0 obj - 7785 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000007875 00000 n -0000007898 00000 n -0000008071 00000 n -0000008145 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -8204 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/Contents.json index 186f60078b..ee96d83980 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "ic_search.pdf", + "filename" : "search_24.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/ic_search.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/ic_search.pdf deleted file mode 100644 index 1e6ad4f2b4..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/ic_search.pdf +++ /dev/null @@ -1,82 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 4.999991 4.221268 cm -0.000000 0.000000 0.000000 scn -2.000000 12.278740 m -2.000000 15.868591 4.910149 18.778740 8.500000 18.778740 c -12.089850 18.778740 15.000000 15.868591 15.000000 12.278740 c -15.000000 8.688890 12.089850 5.778740 8.500000 5.778740 c -4.910149 5.778740 2.000000 8.688890 2.000000 12.278740 c -h -8.500000 20.778740 m -3.805580 20.778740 0.000000 16.973160 0.000000 12.278740 c -0.000000 7.584319 3.805580 3.778740 8.500000 3.778740 c -10.427133 3.778740 12.204475 4.420067 13.630243 5.500938 c -18.676220 0.454960 l -19.131182 0.000000 19.868818 0.000000 20.323780 0.454960 c -20.778740 0.909922 20.778740 1.647558 20.323780 2.102520 c -15.277802 7.148497 l -16.358673 8.574265 17.000000 10.351607 17.000000 12.278740 c -17.000000 16.973160 13.194421 20.778740 8.500000 20.778740 c -h -f* -n -Q - -endstream -endobj - -3 0 obj - 864 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000000954 00000 n -0000000976 00000 n -0000001149 00000 n -0000001223 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -1282 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/search_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/search_24.svg new file mode 100644 index 0000000000..aebf081900 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSearchIcon.imageset/search_24.svg @@ -0,0 +1,3 @@ + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSettingsIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSettingsIcon.imageset/Contents.json index 6044f8aa11..67a1f22d45 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSettingsIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputSettingsIcon.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/Contents.json index 0f561e6972..e87af5cac3 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "filename" : "ic_stickers.pdf", + "filename" : "stickers_24.svg", "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/ic_stickers.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/ic_stickers.pdf deleted file mode 100644 index 24ac31eb23..0000000000 --- a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/ic_stickers.pdf +++ /dev/null @@ -1,431 +0,0 @@ -%PDF-1.7 - -1 0 obj - << >> -endobj - -2 0 obj - << /Length 3 0 R >> -stream -/DeviceRGB CS -/DeviceRGB cs -q -1.000000 0.000000 -0.000000 1.000000 4.000000 2.336044 cm -0.000000 0.000000 0.000000 scn -12.629680 1.768461 m -12.783916 0.952917 l -12.629680 1.768461 l -h -16.593809 4.257765 m -17.180708 3.670866 l -16.593809 4.257765 l -h -14.895066 2.706814 m -14.427451 3.392551 l -14.895066 2.706814 l -h -21.895494 11.034276 m -22.711039 10.880039 l -21.895494 11.034276 l -h -19.406189 7.070145 m -18.819290 7.657043 l -19.406189 7.070145 l -h -20.957142 8.768889 m -20.271404 9.236505 l -20.957142 8.768889 l -h -0.483443 6.107693 m --0.289235 5.804592 l -0.483443 6.107693 l -h -4.443737 2.147398 m -4.140636 1.374722 l -4.443737 2.147398 l -h -21.516558 19.220219 m -22.289234 19.523319 l -21.516558 19.220219 l -h -3.962814 22.970737 m -3.602690 23.718542 l -3.962814 22.970737 l -h -0.693218 19.701141 m --0.054586 20.061266 l -0.693218 19.701141 l -h -11.000000 22.833956 m -11.668203 22.833956 l -11.668203 24.493956 l -11.000000 24.493956 l -11.000000 22.833956 l -h -0.830000 11.995752 m -0.830000 12.663956 l --0.830000 12.663956 l --0.830000 11.995752 l -0.830000 11.995752 l -h -18.819290 7.657043 m -16.006910 4.844664 l -17.180708 3.670866 l -19.993088 6.483246 l -18.819290 7.657043 l -h -10.331797 0.833956 m -11.464174 0.833956 12.137112 0.830593 12.783916 0.952917 c -12.475444 2.584003 l -12.017082 2.497318 11.526485 2.493956 10.331797 2.493956 c -10.331797 0.833956 l -h -16.006910 4.844664 m -15.162139 3.999891 14.812858 3.655367 14.427451 3.392551 c -15.362681 2.021076 l -15.906537 2.391941 16.379997 2.870155 17.180708 3.670866 c -16.006910 4.844664 l -h -12.783916 0.952917 m -13.707870 1.127657 14.585788 1.491302 15.362681 2.021076 c -14.427451 3.392551 l -13.839379 2.991537 13.174834 2.716274 12.475444 2.584003 c -12.783916 0.952917 l -h -21.170000 13.332159 m -21.170000 12.137469 21.166637 11.646873 21.079952 11.188512 c -22.711039 10.880039 l -22.833363 11.526844 22.830000 12.199781 22.830000 13.332159 c -21.170000 13.332159 l -h -19.993088 6.483246 m -20.793798 7.283958 21.272015 7.757419 21.642879 8.301274 c -20.271404 9.236505 l -20.008589 8.851098 19.664062 8.501816 18.819290 7.657043 c -19.993088 6.483246 l -h -21.079952 11.188512 m -20.947681 10.489121 20.672419 9.824576 20.271404 9.236505 c -21.642879 8.301274 l -22.172653 9.078168 22.536299 9.956086 22.711039 10.880039 c -21.079952 11.188512 l -h --0.830000 11.995752 m --0.830000 10.454670 -0.830408 9.259295 -0.767823 8.296148 c --0.704785 7.326029 -0.575355 6.533985 -0.289235 5.804592 c -1.256120 6.410791 l -1.058798 6.913816 0.946507 7.513920 0.888684 8.403788 c -0.830408 9.300627 0.830000 10.433072 0.830000 11.995752 c --0.830000 11.995752 l -h -10.331797 2.493956 m -8.769116 2.493956 7.636671 2.494364 6.739831 2.552639 c -5.849965 2.610462 5.249860 2.722754 4.746836 2.920076 c -4.140636 1.374722 l -4.870029 1.088600 5.662074 0.959171 6.632193 0.896133 c -7.595339 0.833548 8.790714 0.833956 10.331797 0.833956 c -10.331797 2.493956 l -h --0.289235 5.804592 m -0.506586 3.775846 2.111891 2.170542 4.140636 1.374722 c -4.746836 2.920076 l -3.148195 3.547178 1.883223 4.812151 1.256120 6.410791 c --0.289235 5.804592 l -h -11.668203 22.833956 m -13.230883 22.833956 14.363329 22.833548 15.260168 22.775272 c -16.150036 22.717449 16.750139 22.605158 17.253164 22.407835 c -17.859364 23.953190 l -17.129971 24.239311 16.337927 24.368740 15.367807 24.431778 c -14.404661 24.494364 13.209285 24.493956 11.668203 24.493956 c -11.668203 22.833956 l -h -22.830000 13.332159 m -22.830000 14.873241 22.830408 16.068617 22.767822 17.031763 c -22.704784 18.001881 22.575356 18.793926 22.289234 19.523319 c -20.743879 18.917120 l -20.941202 18.414095 21.053493 17.813992 21.111317 16.924124 c -21.169592 16.027285 21.170000 14.894838 21.170000 13.332159 c -22.830000 13.332159 l -h -17.253164 22.407835 m -18.851805 21.780733 20.116777 20.515760 20.743879 18.917120 c -22.289234 19.523319 l -21.493414 21.552065 19.888109 23.157370 17.859364 23.953190 c -17.253164 22.407835 l -h -11.000000 24.493956 m -9.147122 24.493956 7.709934 24.494541 6.557355 24.404799 c -5.395766 24.314354 4.453906 24.128466 3.602690 23.718542 c -4.322937 22.222933 l -4.911203 22.506227 5.622035 22.666948 6.686217 22.749807 c -7.759411 22.833370 9.121075 22.833956 11.000000 22.833956 c -11.000000 24.493956 l -h -0.830000 12.663956 m -0.830000 14.542881 0.830586 15.904545 0.914148 16.977737 c -0.997008 18.041920 1.157728 18.752752 1.441022 19.341019 c --0.054586 20.061266 l --0.464510 19.210049 -0.650399 18.268190 -0.740843 17.106600 c --0.830586 15.954021 -0.830000 14.516833 -0.830000 12.663956 c -0.830000 12.663956 l -h -3.602690 23.718542 m -2.004527 22.948908 0.715049 21.659428 -0.054586 20.061266 c -1.441022 19.341019 l -2.047490 20.600363 3.063593 21.616465 4.322937 22.222933 c -3.602690 23.718542 l -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 14.000000 3.169342 cm -0.000000 0.000000 0.000000 scn -2.895337 1.513170 m -2.155802 1.889982 l -2.895337 1.513170 l -h -2.349067 0.966900 m -2.725879 0.227365 l -2.349067 0.966900 l -h -4.396603 9.526595 m -4.019791 10.266130 l -4.396603 9.526595 l -h -3.304063 8.434055 m -2.564527 8.810867 l -3.304063 8.434055 l -h -11.863758 10.481591 m -11.124223 10.858403 l -11.863758 10.481591 l -h -11.317488 9.935321 m -11.694300 9.195786 l -11.317488 9.935321 l -h -11.170000 12.830658 m -11.170000 11.799080 l -12.830000 11.799080 l -12.830000 12.830658 l -11.170000 12.830658 l -h -10.000000 10.629079 m -7.031581 10.629079 l -7.031581 8.969079 l -10.000000 8.969079 l -10.000000 10.629079 l -h -2.201579 5.799079 m -2.201579 2.830659 l -3.861579 2.830659 l -3.861579 5.799079 l -2.201579 5.799079 l -h -1.031579 1.660658 m -0.000000 1.660658 l -0.000000 0.000658 l -1.031579 0.000658 l -1.031579 1.660658 l -h -2.201579 2.830659 m -2.201579 2.466930 2.200933 2.244051 2.187305 2.077250 c -2.180954 1.999516 2.172969 1.952377 2.166202 1.923643 c -2.162982 1.909968 2.160270 1.901502 2.158613 1.896861 c -2.157021 1.892399 2.156040 1.890450 2.155802 1.889982 c -3.634872 1.136358 l -3.772548 1.406561 3.820568 1.682304 3.841792 1.942073 c -3.862224 2.192151 3.861579 2.494322 3.861579 2.830659 c -2.201579 2.830659 l -h -1.031579 0.000658 m -1.367916 0.000658 1.670086 0.000012 1.920165 0.020445 c -2.179933 0.041669 2.455676 0.089689 2.725879 0.227365 c -1.972255 1.706435 l -1.971787 1.706197 1.969838 1.705216 1.965376 1.703624 c -1.960735 1.701967 1.952269 1.699255 1.938594 1.696035 c -1.909860 1.689268 1.862720 1.681283 1.784988 1.674932 c -1.618186 1.661304 1.395307 1.660658 1.031579 1.660658 c -1.031579 0.000658 l -h -2.155802 1.889982 m -2.115535 1.810954 2.051283 1.746702 1.972255 1.706435 c -2.725879 0.227365 l -3.117256 0.426782 3.435456 0.744981 3.634872 1.136358 c -2.155802 1.889982 l -h -7.031581 10.629079 m -6.345211 10.629079 5.780515 10.629725 5.321996 10.592262 c -4.853787 10.554008 4.423688 10.471928 4.019791 10.266130 c -4.773415 8.787060 l -4.904296 8.853747 5.091620 8.907908 5.457173 8.937775 c -5.832415 8.968433 6.317819 8.969079 7.031581 8.969079 c -7.031581 10.629079 l -h -3.861579 5.799079 m -3.861579 6.512841 3.862224 6.998244 3.892883 7.373486 c -3.922750 7.739038 3.976911 7.926362 4.043598 8.057243 c -2.564527 8.810867 l -2.358731 8.406969 2.276650 7.976871 2.238396 7.508663 c -2.200933 7.050144 2.201579 6.485449 2.201579 5.799079 c -3.861579 5.799079 l -h -4.019791 10.266130 m -3.393211 9.946873 2.883785 9.437447 2.564527 8.810867 c -4.043598 8.057243 l -4.203707 8.371473 4.459184 8.626951 4.773415 8.787060 c -4.019791 10.266130 l -h -11.170000 11.799080 m -11.170000 11.435350 11.169354 11.212472 11.155726 11.045670 c -11.149375 10.967937 11.141390 10.920798 11.134623 10.892064 c -11.131403 10.878389 11.128691 10.869923 11.127034 10.865282 c -11.125442 10.860820 11.124461 10.858871 11.124223 10.858403 c -12.603293 10.104778 l -12.740969 10.374982 12.788989 10.650725 12.810213 10.910493 c -12.830646 11.160572 12.830000 11.462742 12.830000 11.799080 c -11.170000 11.799080 l -h -10.000000 8.969079 m -10.336337 8.969079 10.638507 8.968433 10.888586 8.988866 c -11.148354 9.010090 11.424097 9.058110 11.694300 9.195786 c -10.940676 10.674856 l -10.940208 10.674618 10.938259 10.673637 10.933797 10.672045 c -10.929156 10.670388 10.920690 10.667677 10.907015 10.664455 c -10.878281 10.657689 10.831141 10.649704 10.753409 10.643353 c -10.586607 10.629725 10.363729 10.629079 10.000000 10.629079 c -10.000000 8.969079 l -h -11.124223 10.858403 m -11.083956 10.779375 11.019704 10.715123 10.940676 10.674856 c -11.694300 9.195786 l -12.085677 9.395203 12.403876 9.713402 12.603293 10.104778 c -11.124223 10.858403 l -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 10.000000 16.250000 cm -0.000000 0.000000 0.000000 scn -3.000000 1.750000 m -3.000000 0.783502 2.328427 0.000000 1.500000 0.000000 c -0.671573 0.000000 0.000000 0.783502 0.000000 1.750000 c -0.000000 2.716498 0.671573 3.500000 1.500000 3.500000 c -2.328427 3.500000 3.000000 2.716498 3.000000 1.750000 c -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 17.000000 16.250000 cm -0.000000 0.000000 0.000000 scn -3.000000 1.750000 m -3.000000 0.783502 2.328427 0.000000 1.500000 0.000000 c -0.671573 0.000000 0.000000 0.783502 0.000000 1.750000 c -0.000000 2.716498 0.671573 3.500000 1.500000 3.500000 c -2.328427 3.500000 3.000000 2.716498 3.000000 1.750000 c -h -f -n -Q -q -1.000000 0.000000 -0.000000 1.000000 11.000000 8.230942 cm -0.000000 0.000000 0.000000 scn -0.664000 4.267058 m -0.388962 4.633775 -0.131283 4.708096 -0.498000 4.433058 c --0.864717 4.158020 -0.939038 3.637775 -0.664000 3.271058 c -0.664000 4.267058 l -h -4.000000 1.769054 m -3.999999 0.939054 l -4.000000 0.939054 l -4.000000 1.769054 l -h -6.332036 1.389412 m -6.752154 1.572791 6.944070 2.062022 6.760692 2.482140 c -6.577314 2.902259 6.088083 3.094175 5.667964 2.910796 c -6.332036 1.389412 l -h -0.000000 3.769058 m --0.664000 3.271058 -0.663799 3.270791 -0.663593 3.270516 c --0.663516 3.270414 -0.663304 3.270131 -0.663150 3.269927 c --0.662843 3.269519 -0.662512 3.269080 -0.662157 3.268610 c --0.661448 3.267670 -0.660643 3.266607 -0.659743 3.265423 c --0.657943 3.263054 -0.655763 3.260200 -0.653203 3.256877 c --0.648084 3.250230 -0.641445 3.241700 -0.633302 3.231414 c --0.617020 3.210848 -0.594689 3.183217 -0.566423 3.149538 c --0.509945 3.082245 -0.429440 2.990409 -0.325813 2.882277 c --0.119243 2.666726 0.183137 2.382302 0.574317 2.097807 c -1.353481 1.531142 2.521308 0.939057 3.999999 0.939054 c -4.000001 2.599054 l -2.978692 2.599056 2.146519 3.006973 1.550683 3.440309 c -1.254363 3.655814 1.025493 3.871391 0.872688 4.030839 c -0.796627 4.110207 0.740414 4.174622 0.705095 4.216704 c -0.687462 4.237712 0.675126 4.253050 0.668214 4.261781 c -0.664761 4.266143 0.662671 4.268843 0.661961 4.269765 c -0.661607 4.270226 0.661598 4.270240 0.661937 4.269794 c -0.662106 4.269571 0.662363 4.269233 0.662706 4.268778 c -0.662878 4.268550 0.663072 4.268293 0.663288 4.268007 c -0.663395 4.267863 0.663574 4.267626 0.663627 4.267555 c -0.663811 4.267310 0.664000 4.267058 0.000000 3.769058 c -h -4.000000 0.939054 m -4.844985 0.939054 5.627935 1.082078 6.332036 1.389412 c -5.667964 2.910796 l -5.208086 2.710063 4.657703 2.599054 4.000000 2.599054 c -4.000000 0.939054 l -h -f -n -Q - -endstream -endobj - -3 0 obj - 10900 -endobj - -4 0 obj - << /Annots [] - /Type /Page - /MediaBox [ 0.000000 0.000000 30.000000 30.000000 ] - /Resources 1 0 R - /Contents 2 0 R - /Parent 5 0 R - >> -endobj - -5 0 obj - << /Kids [ 4 0 R ] - /Count 1 - /Type /Pages - >> -endobj - -6 0 obj - << /Pages 5 0 R - /Type /Catalog - >> -endobj - -xref -0 7 -0000000000 65535 f -0000000010 00000 n -0000000034 00000 n -0000010990 00000 n -0000011014 00000 n -0000011187 00000 n -0000011261 00000 n -trailer -<< /ID [ (some) (id) ] - /Root 6 0 R - /Size 7 ->> -startxref -11320 -%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/stickers_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/stickers_24.svg new file mode 100644 index 0000000000..9ef1751164 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/EntityInputStickersIcon.imageset/stickers_24.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/Contents.json new file mode 100644 index 0000000000..4a012887e4 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "trending_24.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/trending_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/trending_24.svg new file mode 100644 index 0000000000..347b33ad8b --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelFeaturedIcon.imageset/trending_24.svg @@ -0,0 +1,3 @@ + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/Contents.json new file mode 100644 index 0000000000..a306f2cfb1 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "recent_24.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/recent_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/recent_24.svg new file mode 100644 index 0000000000..af321b3e8c --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelRecentIcon.imageset/recent_24.svg @@ -0,0 +1,3 @@ + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/Contents.json new file mode 100644 index 0000000000..e8a3780f19 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "favourites_24.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/favourites_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/favourites_24.svg new file mode 100644 index 0000000000..af8623783e --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSavedIcon.imageset/favourites_24.svg @@ -0,0 +1,3 @@ + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Contents.json new file mode 100644 index 0000000000..d4c2fc76ea --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Locked.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Locked.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Locked.svg new file mode 100644 index 0000000000..b6181f185b --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelSectionLockIcon.imageset/Locked.svg @@ -0,0 +1,4 @@ + + + + diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/Contents.json new file mode 100644 index 0000000000..5ae583d444 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "trendinggifs_24.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/trendinggifs_24.svg b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/trendinggifs_24.svg new file mode 100644 index 0000000000..fddeaac987 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Input/Media/PanelTrendingIcon.imageset/trendinggifs_24.svg @@ -0,0 +1,3 @@ + + + diff --git a/submodules/TelegramUI/Resources/Animations/anim_botToKey.tgs b/submodules/TelegramUI/Resources/Animations/anim_botToKey.tgs new file mode 100644 index 0000000000..20939237d6 Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_botToKey.tgs differ diff --git a/submodules/TelegramUI/Resources/Animations/anim_keyToBot.tgs b/submodules/TelegramUI/Resources/Animations/anim_keyToBot.tgs new file mode 100644 index 0000000000..2cc3eed104 Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_keyToBot.tgs differ diff --git a/submodules/TelegramUI/Resources/Animations/anim_keyToSmile.tgs b/submodules/TelegramUI/Resources/Animations/anim_keyToSmile.tgs new file mode 100644 index 0000000000..07c99e1a72 Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_keyToSmile.tgs differ diff --git a/submodules/TelegramUI/Resources/Animations/anim_keyToSticker.tgs b/submodules/TelegramUI/Resources/Animations/anim_keyToSticker.tgs new file mode 100644 index 0000000000..8863943a7d Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_keyToSticker.tgs differ diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index e298dea3ac..7f5f65bc9d 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -3090,7 +3090,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G break } } - strongSelf.editMessageDisposable.set((strongSelf.context.engine.messages.requestEditMessage(messageId: messageId, text: message.text, media: .keep, entities: entities, disableUrlPreview: false, scheduleTime: time) |> deliverOnMainQueue).start(next: { result in + + let inlineStickers: [MediaId: TelegramMediaFile] = [:] + strongSelf.editMessageDisposable.set((strongSelf.context.engine.messages.requestEditMessage(messageId: messageId, text: message.text, media: .keep, entities: entities, inlineStickers: inlineStickers, disableUrlPreview: false, scheduleTime: time) |> deliverOnMainQueue).start(next: { result in }, error: { error in })) } @@ -7105,6 +7107,44 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G entitiesAttribute = TextEntitiesMessageAttribute(entities: entities) } + var inlineStickers: [MediaId: TelegramMediaFile] = [:] + var firstLockedPremiumEmoji: TelegramMediaFile? + text.enumerateAttribute(ChatTextInputAttributes.customEmoji, in: NSRange(location: 0, length: text.length), using: { value, _, _ in + if let value = value as? ChatTextInputTextCustomEmojiAttribute { + if let file = value.file { + inlineStickers[file.fileId] = file + if file.isPremiumEmoji && !strongSelf.presentationInterfaceState.isPremium { + if firstLockedPremiumEmoji == nil { + firstLockedPremiumEmoji = file + } + } + } + } + }) + + if let firstLockedPremiumEmoji = firstLockedPremiumEmoji { + //let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } + //TODO:localize + strongSelf.controllerInteraction?.displayUndo(.sticker(context: strongSelf.context, file: firstLockedPremiumEmoji, title: nil, text: "Subscribe to Telegram Premium to unlock premium emoji.", undoText: "More", customAction: { + guard let strongSelf = self else { + return + } + strongSelf.chatDisplayNode.dismissTextInput() + + var replaceImpl: ((ViewController) -> Void)? + let controller = PremiumDemoScreen(context: strongSelf.context, subject: .animatedEmoji, action: { + let controller = PremiumIntroScreen(context: strongSelf.context, source: .animatedEmoji) + replaceImpl?(controller) + }) + replaceImpl = { [weak controller] c in + controller?.replace(with: c) + } + strongSelf.present(controller, in: .window(.root), with: nil) + })) + + return + } + var updatingMedia = false let media: RequestEditMessageMedia if let editMediaReference = strongSelf.presentationInterfaceState.editMessageState?.mediaReference { @@ -7121,7 +7161,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if let currentMessage = currentMessage { let currentEntities = currentMessage.textEntitiesAttribute?.entities ?? [] if currentMessage.text != text.string || currentEntities != entities || updatingMedia { - strongSelf.context.account.pendingUpdateMessageManager.add(messageId: editMessage.messageId, text: text.string, media: media, entities: entitiesAttribute, disableUrlPreview: disableUrlPreview) + strongSelf.context.account.pendingUpdateMessageManager.add(messageId: editMessage.messageId, text: text.string, media: media, entities: entitiesAttribute, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview) } } diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index 775821121c..d9ff15c6ca 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -1374,6 +1374,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { case .overPanels: self.inputContextPanelContainer.addSubnode(inputContextPanelNode) case .overTextInput: + inputContextPanelNode.view.disablesInteractiveKeyboardGestureRecognizer = true self.inputContextOverTextPanelContainer.addSubnode(inputContextPanelNode) } immediatelyLayoutInputContextPanelAndAnimateAppearance = true @@ -1604,7 +1605,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { var apparentInputBackgroundFrame = inputBackgroundFrame var apparentNavigateButtonsFrame = navigateButtonsFrame if case let .media(_, maybeExpanded, _) = self.chatPresentationInterfaceState.inputMode, let expanded = maybeExpanded, case .search = expanded, let inputPanelFrame = inputPanelFrame { - let verticalOffset = -inputPanelFrame.height - 41.0 + let verticalOffset = -inputPanelFrame.height - 34.0 apparentInputPanelFrame = inputPanelFrame.offsetBy(dx: 0.0, dy: verticalOffset) apparentInputBackgroundFrame.size.height -= verticalOffset apparentInputBackgroundFrame.origin.y += verticalOffset diff --git a/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift b/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift index 6decb7096e..a55fcff8de 100644 --- a/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift +++ b/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift @@ -945,6 +945,8 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { fileprivate var emojiInputInteraction: EmojiPagerContentComponent.InputInteraction? private var stickerInputInteraction: EmojiPagerContentComponent.InputInteraction? + private weak var currentUndoOverlayController: UndoOverlayController? + init(context: AccountContext, currentInputData: InputData, updatedInputData: Signal, defaultToEmojiTab: Bool, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, chatPeerId: PeerId?) { self.context = context self.currentInputData = currentInputData @@ -956,7 +958,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { super.init() - self.topBackgroundExtension = 41.0 + self.topBackgroundExtension = 34.0 self.followsDefaultHeight = true self.view.addSubview(self.entityKeyboardView) @@ -973,9 +975,9 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { |> distinctUntilChanged self.emojiInputInteraction = EmojiPagerContentComponent.InputInteraction( - performItemAction: { [weak interfaceInteraction, weak controllerInteraction] _, item, _, _, _ in + performItemAction: { [weak self, weak interfaceInteraction, weak controllerInteraction] _, item, _, _, _ in let _ = (hasPremium |> take(1) |> deliverOnMainQueue).start(next: { hasPremium in - guard let controllerInteraction = controllerInteraction, let interfaceInteraction = interfaceInteraction else { + guard let strongSelf = self, let controllerInteraction = controllerInteraction, let interfaceInteraction = interfaceInteraction else { return } @@ -994,10 +996,17 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { } if file.isPremiumEmoji && !hasPremium { + var animateInAsReplacement = false + if let currentUndoOverlayController = strongSelf.currentUndoOverlayController { + currentUndoOverlayController.dismissWithCommitActionAndReplacementAnimation() + strongSelf.currentUndoOverlayController = nil + animateInAsReplacement = true + } + //TODO:localize let presentationData = context.sharedContext.currentPresentationData.with { $0 } - controllerInteraction.presentController(UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: "Subscribe to Telegram Premium to unlock this emoji.", undoText: "More", customAction: { [weak controllerInteraction] in + let controller = UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: "Subscribe to Telegram Premium to unlock this emoji.", undoText: "More", customAction: { [weak controllerInteraction] in guard let controllerInteraction = controllerInteraction else { return } @@ -1014,7 +1023,9 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { /*let controller = PremiumIntroScreen(context: context, source: .stickers) controllerInteraction.navigationController()?.pushViewController(controller)*/ - }), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) + }), elevatedLayout: false, animateInAsReplacement: animateInAsReplacement, action: { _ in return false }) + strongSelf.currentUndoOverlayController = controller + controllerInteraction.presentController(controller, nil) return } @@ -1036,6 +1047,8 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { }, openStickerSettings: { }, + openFeatured: { + }, addGroupAction: { [weak self, weak controllerInteraction] groupId, isPremiumLocked in guard let controllerInteraction = controllerInteraction, let collectionId = groupId.base as? ItemCollectionId else { return @@ -1180,6 +1193,22 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { controller.navigationPresentation = .modal controllerInteraction.navigationController()?.pushViewController(controller) }, + openFeatured: { [weak controllerInteraction] in + guard let controllerInteraction = controllerInteraction else { + return + } + + controllerInteraction.navigationController()?.pushViewController(FeaturedStickersScreen( + context: context, + highlightedPackId: nil, + sendSticker: { [weak controllerInteraction] fileReference, sourceNode, sourceRect in + guard let controllerInteraction = controllerInteraction else { + return false + } + return controllerInteraction.sendSticker(fileReference, false, false, nil, false, sourceNode, sourceRect, nil) + } + )) + }, addGroupAction: { groupId, isPremiumLocked in guard let controllerInteraction = controllerInteraction, let collectionId = groupId.base as? ItemCollectionId else { return @@ -1492,7 +1521,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { transition: mappedTransition, component: AnyComponent(EntityKeyboardComponent( theme: interfaceState.theme, - bottomInset: bottomInset, + containerInsets: UIEdgeInsets(top: 0.0, left: leftInset, bottom: bottomInset, right: rightInset), emojiContent: self.currentInputData.emoji, stickerContent: stickerContent, gifContent: gifContent?.component, @@ -1841,6 +1870,8 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV }, openStickerSettings: { }, + openFeatured: { + }, addGroupAction: { _, _ in }, clearGroup: { _ in diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index 6ad731637f..f176b3ba38 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -394,7 +394,7 @@ private func textInputBackgroundImage(backgroundColor: UIColor?, inputBackground context.setBlendMode(.normal) context.setStrokeColor(strokeColor.cgColor) - let strokeWidth: CGFloat = 1.0 + let strokeWidth: CGFloat = UIScreenPixel context.setLineWidth(strokeWidth) context.strokeEllipse(in: CGRect(x: strokeWidth / 2.0, y: strokeWidth / 2.0, width: diameter - strokeWidth, height: diameter - strokeWidth)) })?.stretchableImage(withLeftCapWidth: Int(diameter) / 2, topCapHeight: Int(diameter) / 2) diff --git a/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift b/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift index d854ea3a58..8b68f2a4ac 100644 --- a/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift +++ b/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift @@ -111,18 +111,22 @@ private final class EffectImageLayer: SimpleLayer, GradientBackgroundPatternOver private func updateFilters() { let useSoftlight: Bool + let useFilter: Bool switch self.softlightMode { case .whileAnimating: useSoftlight = self.isAnimating + useFilter = useSoftlight case .always: useSoftlight = true + useFilter = useSoftlight case .never: - useSoftlight = false + useSoftlight = true + useFilter = false } if self.isUsingSoftlight != useSoftlight { self.isUsingSoftlight = useSoftlight - if self.isUsingSoftlight { + if self.isUsingSoftlight && useFilter { self.compositingFilter = "softLightBlendMode" } else { self.compositingFilter = nil @@ -191,18 +195,18 @@ private final class EffectImageLayer: SimpleLayer, GradientBackgroundPatternOver private static var cachedComposedImage: (size: CGSize, patternContentImage: UIImage, backgroundImageHash: String, image: UIImage)? private func updateComposedImage() { - if self.suspendCompositionUpdates { - self.needsCompositionUpdate = true - return - } - switch self.softlightMode { - case .always: + case .always, .never: return default: break } + if self.suspendCompositionUpdates { + self.needsCompositionUpdate = true + return + } + guard let (size, backgroundImage, backgroundImageHash) = self.compositionData, let patternContentImage = self.patternContentImage else { return } @@ -840,7 +844,7 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode if self.patternImageLayer.contents != nil { self.patternImageLayer.backgroundColor = nil } else { - self.patternImageLayer.backgroundColor = UIColor.black.cgColor + self.patternImageLayer.backgroundColor = nil } } else { self.backgroundColor = nil