mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update localization
This commit is contained in:
parent
c4e728462e
commit
7f0501d2cb
@ -6725,3 +6725,21 @@ Sorry for the inconvenience.";
|
|||||||
"Chat.NavigationNoChannels" = "You have no unread channels";
|
"Chat.NavigationNoChannels" = "You have no unread channels";
|
||||||
|
|
||||||
"Message.SponsoredLabel" = "sponsored";
|
"Message.SponsoredLabel" = "sponsored";
|
||||||
|
|
||||||
|
"Stickers.Favorites" = "Favorites";
|
||||||
|
"Stickers.Recent" = "Recent";
|
||||||
|
"Stickers.Stickers" = "Stickers";
|
||||||
|
"Stickers.Gifs" = "GIFs";
|
||||||
|
"Stickers.Trending" = "Trending";
|
||||||
|
"Stickers.Settings" = "Settings";
|
||||||
|
|
||||||
|
"Gif.Emotion.Angry" = "Angry";
|
||||||
|
"Gif.Emotion.Surprised" = "Surprised";
|
||||||
|
"Gif.Emotion.Joy" = "Joy";
|
||||||
|
"Gif.Emotion.Kiss" = "Kiss";
|
||||||
|
"Gif.Emotion.Hearts" = "Hearts";
|
||||||
|
"Gif.Emotion.ThumbsUp" = "Thumbs Up";
|
||||||
|
"Gif.Emotion.ThumbsDown" = "Thumbs Down";
|
||||||
|
"Gif.Emotion.RollEyes" = "Roll-Eyes";
|
||||||
|
"Gif.Emotion.Cool" = "Cool";
|
||||||
|
"Gif.Emotion.Party" = "Party";
|
||||||
|
@ -604,7 +604,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if toIndex != reorderItemNode.index {
|
if toIndex != reorderItemNode.index {
|
||||||
if let reorderLastTimestamp = self.reorderLastTimestamp, timestamp < reorderLastTimestamp + 0.1 {
|
if let reorderLastTimestamp = self.reorderLastTimestamp, timestamp < reorderLastTimestamp + 0.3 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if reorderNode.currentState?.0 != reorderItemIndex || reorderNode.currentState?.1 != toIndex {
|
if reorderNode.currentState?.0 != reorderItemIndex || reorderNode.currentState?.1 != toIndex {
|
||||||
|
@ -23,6 +23,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem {
|
|||||||
let inputNodeInteraction: ChatMediaInputNodeInteraction
|
let inputNodeInteraction: ChatMediaInputNodeInteraction
|
||||||
let type: ChatMediaInputMetaSectionItemType
|
let type: ChatMediaInputMetaSectionItemType
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
|
let strings: PresentationStrings
|
||||||
let expanded: Bool
|
let expanded: Bool
|
||||||
let selectedItem: () -> Void
|
let selectedItem: () -> Void
|
||||||
|
|
||||||
@ -30,12 +31,13 @@ final class ChatMediaInputMetaSectionItem: ListViewItem {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
init(account: Account, inputNodeInteraction: ChatMediaInputNodeInteraction, type: ChatMediaInputMetaSectionItemType, theme: PresentationTheme, expanded: Bool, selected: @escaping () -> Void) {
|
init(account: Account, inputNodeInteraction: ChatMediaInputNodeInteraction, type: ChatMediaInputMetaSectionItemType, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool, selected: @escaping () -> Void) {
|
||||||
self.account = account
|
self.account = account
|
||||||
self.inputNodeInteraction = inputNodeInteraction
|
self.inputNodeInteraction = inputNodeInteraction
|
||||||
self.type = type
|
self.type = type
|
||||||
self.selectedItem = selected
|
self.selectedItem = selected
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.strings = strings
|
||||||
self.expanded = expanded
|
self.expanded = expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +47,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem {
|
|||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
node.inputNodeInteraction = self.inputNodeInteraction
|
node.inputNodeInteraction = self.inputNodeInteraction
|
||||||
node.setItem(item: self)
|
node.setItem(item: self)
|
||||||
node.updateTheme(account: self.account, theme: self.theme, expanded: self.expanded)
|
node.updateTheme(account: self.account, theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
node.updateIsHighlighted()
|
node.updateIsHighlighted()
|
||||||
node.updateAppearanceTransition(transition: .immediate)
|
node.updateAppearanceTransition(transition: .immediate)
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem {
|
|||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: node().insets), { _ in
|
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: node().insets), { _ in
|
||||||
(node() as? ChatMediaInputMetaSectionItemNode)?.setItem(item: self)
|
(node() as? ChatMediaInputMetaSectionItemNode)?.setItem(item: self)
|
||||||
(node() as? ChatMediaInputMetaSectionItemNode)?.updateTheme(account: self.account, theme: self.theme, expanded: self.expanded)
|
(node() as? ChatMediaInputMetaSectionItemNode)?.updateTheme(account: self.account, theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +176,7 @@ final class ChatMediaInputMetaSectionItemNode: ListViewItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTheme(account: Account, theme: PresentationTheme, expanded: Bool) {
|
func updateTheme(account: Account, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool) {
|
||||||
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
||||||
self.imageNode.frame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
self.imageNode.frame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
||||||
|
|
||||||
@ -189,48 +191,47 @@ final class ChatMediaInputMetaSectionItemNode: ListViewItemNode {
|
|||||||
switch item.type {
|
switch item.type {
|
||||||
case .savedStickers:
|
case .savedStickers:
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelSavedStickersIcon(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelSavedStickersIcon(theme)
|
||||||
title = "Favorites"
|
title = strings.Stickers_Favorites
|
||||||
case .recentStickers:
|
case .recentStickers:
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme)
|
||||||
title = "Recent"
|
title = strings.Stickers_Recent
|
||||||
case .stickersMode:
|
case .stickersMode:
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelStickersModeIcon(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelStickersModeIcon(theme)
|
||||||
title = "Stickers"
|
title = strings.Stickers_Stickers
|
||||||
case .savedGifs:
|
case .savedGifs:
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme)
|
||||||
title = "GIFs"
|
title = strings.Stickers_Gifs
|
||||||
case .trendingGifs:
|
case .trendingGifs:
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelTrendingGifsIcon(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelTrendingGifsIcon(theme)
|
||||||
title = "Trending"
|
title = strings.Stickers_Trending
|
||||||
case let .gifEmoji(emoji, file):
|
case let .gifEmoji(emoji, file):
|
||||||
switch emoji {
|
switch emoji {
|
||||||
case "😡":
|
case "😡":
|
||||||
title = "Angry"
|
title = strings.Gif_Emotion_Angry
|
||||||
case "😮":
|
case "😮":
|
||||||
title = "Surprised"
|
title = strings.Gif_Emotion_Surprised
|
||||||
case "😂":
|
case "😂":
|
||||||
title = "Joy"
|
title = strings.Gif_Emotion_Joy
|
||||||
case "😘":
|
case "😘":
|
||||||
title = "Kiss"
|
title = strings.Gif_Emotion_Kiss
|
||||||
case "😍":
|
case "😍":
|
||||||
title = "Hearts"
|
title = strings.Gif_Emotion_Hearts
|
||||||
case "👍":
|
case "👍":
|
||||||
title = "Thumbs Up"
|
title = strings.Gif_Emotion_ThumbsUp
|
||||||
case "👎":
|
case "👎":
|
||||||
title = "Thumbs Down"
|
title = strings.Gif_Emotion_ThumbsDown
|
||||||
case "🙄":
|
case "🙄":
|
||||||
title = "Roll-eyes"
|
title = strings.Gif_Emotion_RollEyes
|
||||||
case "😎":
|
case "😎":
|
||||||
title = "Cool"
|
title = strings.Gif_Emotion_Cool
|
||||||
case "🥳":
|
case "🥳":
|
||||||
title = "Party"
|
title = strings.Gif_Emotion_Party
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
self.imageNode.image = nil
|
self.imageNode.image = nil
|
||||||
|
|
||||||
if let file = file {
|
if let file = file {
|
||||||
|
|
||||||
let loopAnimatedStickers = self.inputNodeInteraction?.stickerSettings?.loopAnimatedStickers ?? false
|
let loopAnimatedStickers = self.inputNodeInteraction?.stickerSettings?.loopAnimatedStickers ?? false
|
||||||
let animatedStickerNode: AnimatedStickerNode
|
let animatedStickerNode: AnimatedStickerNode
|
||||||
if let current = self.animatedStickerNode {
|
if let current = self.animatedStickerNode {
|
||||||
|
@ -162,16 +162,16 @@ func preparedChatMediaInputGridEntryTransition(account: Account, view: ItemColle
|
|||||||
return ChatMediaInputGridTransition(deletions: deletions, insertions: insertions, updates: updates, updateFirstIndexInSectionOffset: firstIndexInSectionOffset, stationaryItems: stationaryItems, scrollToItem: scrollToItem, updateOpaqueState: opaqueState, animated: animated)
|
return ChatMediaInputGridTransition(deletions: deletions, insertions: insertions, updates: updates, updateFirstIndexInSectionOffset: firstIndexInSectionOffset, stationaryItems: stationaryItems, scrollToItem: scrollToItem, updateOpaqueState: opaqueState, animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: OrderedItemListView?, recentStickers: OrderedItemListView?, temporaryPackOrder: [ItemCollectionId]? = nil, trendingIsDismissed: Bool = false, peerSpecificPack: PeerSpecificPackData?, canInstallPeerSpecificPack: CanInstallPeerSpecificPack, theme: PresentationTheme, hasGifs: Bool = true, hasSettings: Bool = true, expanded: Bool = false) -> [ChatMediaInputPanelEntry] {
|
func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: OrderedItemListView?, recentStickers: OrderedItemListView?, temporaryPackOrder: [ItemCollectionId]? = nil, trendingIsDismissed: Bool = false, peerSpecificPack: PeerSpecificPackData?, canInstallPeerSpecificPack: CanInstallPeerSpecificPack, theme: PresentationTheme, strings: PresentationStrings, hasGifs: Bool = true, hasSettings: Bool = true, expanded: Bool = false) -> [ChatMediaInputPanelEntry] {
|
||||||
var entries: [ChatMediaInputPanelEntry] = []
|
var entries: [ChatMediaInputPanelEntry] = []
|
||||||
if hasGifs {
|
if hasGifs {
|
||||||
entries.append(.recentGifs(theme, expanded))
|
entries.append(.recentGifs(theme, strings, expanded))
|
||||||
}
|
}
|
||||||
if trendingIsDismissed {
|
if trendingIsDismissed {
|
||||||
entries.append(.trending(true, theme, expanded))
|
entries.append(.trending(true, theme, strings, expanded))
|
||||||
}
|
}
|
||||||
if let savedStickers = savedStickers, !savedStickers.items.isEmpty {
|
if let savedStickers = savedStickers, !savedStickers.items.isEmpty {
|
||||||
entries.append(.savedStickers(theme, expanded))
|
entries.append(.savedStickers(theme, strings, expanded))
|
||||||
}
|
}
|
||||||
var savedStickerIds = Set<Int64>()
|
var savedStickerIds = Set<Int64>()
|
||||||
if let savedStickers = savedStickers, !savedStickers.items.isEmpty {
|
if let savedStickers = savedStickers, !savedStickers.items.isEmpty {
|
||||||
@ -192,7 +192,7 @@ func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: Ordere
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if found {
|
if found {
|
||||||
entries.append(.recentPacks(theme, expanded))
|
entries.append(.recentPacks(theme, strings, expanded))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let peerSpecificPack = peerSpecificPack {
|
if let peerSpecificPack = peerSpecificPack {
|
||||||
@ -236,19 +236,19 @@ func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: Ordere
|
|||||||
}
|
}
|
||||||
|
|
||||||
if hasSettings {
|
if hasSettings {
|
||||||
entries.append(.settings(theme, expanded))
|
entries.append(.settings(theme, strings, expanded))
|
||||||
}
|
}
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
func chatMediaInputPanelGifModeEntries(theme: PresentationTheme, reactions: [String], animatedEmojiStickers: [String: [StickerPackItem]], expanded: Bool) -> [ChatMediaInputPanelEntry] {
|
func chatMediaInputPanelGifModeEntries(theme: PresentationTheme, strings: PresentationStrings, reactions: [String], animatedEmojiStickers: [String: [StickerPackItem]], expanded: Bool) -> [ChatMediaInputPanelEntry] {
|
||||||
var entries: [ChatMediaInputPanelEntry] = []
|
var entries: [ChatMediaInputPanelEntry] = []
|
||||||
entries.append(.stickersMode(theme, expanded))
|
entries.append(.stickersMode(theme, strings, expanded))
|
||||||
entries.append(.savedGifs(theme, expanded))
|
entries.append(.savedGifs(theme, strings, expanded))
|
||||||
entries.append(.trendingGifs(theme, expanded))
|
entries.append(.trendingGifs(theme, strings, expanded))
|
||||||
|
|
||||||
for reaction in reactions {
|
for reaction in reactions {
|
||||||
entries.append(.gifEmotion(entries.count, theme, reaction, animatedEmojiStickers[reaction]?.first?.file, expanded))
|
entries.append(.gifEmotion(entries.count, theme, strings, reaction, animatedEmojiStickers[reaction]?.first?.file, expanded))
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
@ -1134,8 +1134,8 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||||||
trendingIsDismissed = true
|
trendingIsDismissed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, temporaryPackOrder: temporaryPackOrder, trendingIsDismissed: trendingIsDismissed, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, theme: theme, expanded: panelExpanded)
|
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, temporaryPackOrder: temporaryPackOrder, trendingIsDismissed: trendingIsDismissed, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, theme: theme, strings: strings, expanded: panelExpanded)
|
||||||
let gifPaneEntries = chatMediaInputPanelGifModeEntries(theme: theme, reactions: reactions, animatedEmojiStickers: animatedEmojiStickers, expanded: panelExpanded)
|
let gifPaneEntries = chatMediaInputPanelGifModeEntries(theme: theme, strings: strings, reactions: reactions, animatedEmojiStickers: animatedEmojiStickers, expanded: panelExpanded)
|
||||||
var gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, trendingPacks: trendingPacks, installedPacks: installedPacks, trendingIsDismissed: trendingIsDismissed, strings: strings, theme: theme)
|
var gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, trendingPacks: trendingPacks, installedPacks: installedPacks, trendingIsDismissed: trendingIsDismissed, strings: strings, theme: theme)
|
||||||
|
|
||||||
if view.higher == nil {
|
if view.higher == nil {
|
||||||
|
@ -31,18 +31,18 @@ enum ChatMediaInputPanelEntryStableId: Hashable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||||
case recentGifs(PresentationTheme, Bool)
|
case recentGifs(PresentationTheme, PresentationStrings, Bool)
|
||||||
case savedStickers(PresentationTheme, Bool)
|
case savedStickers(PresentationTheme, PresentationStrings, Bool)
|
||||||
case recentPacks(PresentationTheme, Bool)
|
case recentPacks(PresentationTheme, PresentationStrings, Bool)
|
||||||
case trending(Bool, PresentationTheme, Bool)
|
case trending(Bool, PresentationTheme, PresentationStrings, Bool)
|
||||||
case settings(PresentationTheme, Bool)
|
case settings(PresentationTheme, PresentationStrings, Bool)
|
||||||
case peerSpecific(theme: PresentationTheme, peer: Peer, expanded: Bool)
|
case peerSpecific(theme: PresentationTheme, peer: Peer, expanded: Bool)
|
||||||
case stickerPack(index: Int, info: StickerPackCollectionInfo, topItem: StickerPackItem?, theme: PresentationTheme, expanded: Bool)
|
case stickerPack(index: Int, info: StickerPackCollectionInfo, topItem: StickerPackItem?, theme: PresentationTheme, expanded: Bool)
|
||||||
|
|
||||||
case stickersMode(PresentationTheme, Bool)
|
case stickersMode(PresentationTheme, PresentationStrings, Bool)
|
||||||
case savedGifs(PresentationTheme, Bool)
|
case savedGifs(PresentationTheme, PresentationStrings, Bool)
|
||||||
case trendingGifs(PresentationTheme, Bool)
|
case trendingGifs(PresentationTheme, PresentationStrings, Bool)
|
||||||
case gifEmotion(Int, PresentationTheme, String, TelegramMediaFile?, Bool)
|
case gifEmotion(Int, PresentationTheme, PresentationStrings, String, TelegramMediaFile?, Bool)
|
||||||
|
|
||||||
var stableId: ChatMediaInputPanelEntryStableId {
|
var stableId: ChatMediaInputPanelEntryStableId {
|
||||||
switch self {
|
switch self {
|
||||||
@ -66,39 +66,39 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
return .savedGifs
|
return .savedGifs
|
||||||
case .trendingGifs:
|
case .trendingGifs:
|
||||||
return .trendingGifs
|
return .trendingGifs
|
||||||
case let .gifEmotion(_, _, emoji, _, _):
|
case let .gifEmotion(_, _, _, emoji, _, _):
|
||||||
return .gifEmotion(emoji)
|
return .gifEmotion(emoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: ChatMediaInputPanelEntry, rhs: ChatMediaInputPanelEntry) -> Bool {
|
static func ==(lhs: ChatMediaInputPanelEntry, rhs: ChatMediaInputPanelEntry) -> Bool {
|
||||||
switch lhs {
|
switch lhs {
|
||||||
case let .recentGifs(lhsTheme, lhsExpanded):
|
case let .recentGifs(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .recentGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .recentGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .savedStickers(lhsTheme, lhsExpanded):
|
case let .savedStickers(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .savedStickers(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .savedStickers(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .recentPacks(lhsTheme, lhsExpanded):
|
case let .recentPacks(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .recentPacks(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .recentPacks(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .trending(lhsElevated, lhsTheme, lhsExpanded):
|
case let .trending(lhsElevated, lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .trending(rhsElevated, rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsElevated == rhsElevated, lhsExpanded == rhsExpanded {
|
if case let .trending(rhsElevated, rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsElevated == rhsElevated, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .settings(lhsTheme, lhsExpanded):
|
case let .settings(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .settings(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .settings(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@ -115,26 +115,26 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .stickersMode(lhsTheme, lhsExpanded):
|
case let .stickersMode(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .stickersMode(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .stickersMode(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .savedGifs(lhsTheme, lhsExpanded):
|
case let .savedGifs(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .savedGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .savedGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .trendingGifs(lhsTheme, lhsExpanded):
|
case let .trendingGifs(lhsTheme, lhsStrings, lhsExpanded):
|
||||||
if case let .trendingGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
if case let .trendingGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .gifEmotion(lhsIndex, lhsTheme, lhsEmoji, lhsFile, lhsExpanded):
|
case let .gifEmotion(lhsIndex, lhsTheme, lhsStrings, lhsEmoji, lhsFile, lhsExpanded):
|
||||||
if case let .gifEmotion(rhsIndex, rhsTheme, rhsEmoji, rhsFile, rhsExpanded) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsEmoji == rhsEmoji, lhsExpanded == rhsExpanded {
|
if case let .gifEmotion(rhsIndex, rhsTheme, rhsStrings, rhsEmoji, rhsFile, rhsExpanded) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsEmoji == rhsEmoji, lhsExpanded == rhsExpanded {
|
||||||
if let lhsFile = lhsFile, let rhsFile = rhsFile {
|
if let lhsFile = lhsFile, let rhsFile = rhsFile {
|
||||||
if !lhsFile.isEqual(to: rhsFile) {
|
if !lhsFile.isEqual(to: rhsFile) {
|
||||||
return false
|
return false
|
||||||
@ -162,7 +162,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
switch rhs {
|
switch rhs {
|
||||||
case .recentGifs, savedStickers:
|
case .recentGifs, savedStickers:
|
||||||
return false
|
return false
|
||||||
case let .trending(elevated, _, _) where elevated:
|
case let .trending(elevated, _, _, _) where elevated:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
@ -171,7 +171,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
switch rhs {
|
switch rhs {
|
||||||
case .recentGifs, .savedStickers, recentPacks:
|
case .recentGifs, .savedStickers, recentPacks:
|
||||||
return false
|
return false
|
||||||
case let .trending(elevated, _, _) where elevated:
|
case let .trending(elevated, _, _, _) where elevated:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
@ -180,7 +180,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
switch rhs {
|
switch rhs {
|
||||||
case .recentGifs, .savedStickers, recentPacks, .peerSpecific:
|
case .recentGifs, .savedStickers, recentPacks, .peerSpecific:
|
||||||
return false
|
return false
|
||||||
case let .trending(elevated, _, _) where elevated:
|
case let .trending(elevated, _, _, _) where elevated:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
@ -189,7 +189,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
switch rhs {
|
switch rhs {
|
||||||
case .recentGifs, .savedStickers, .recentPacks, .peerSpecific:
|
case .recentGifs, .savedStickers, .recentPacks, .peerSpecific:
|
||||||
return false
|
return false
|
||||||
case let .trending(elevated, _, _):
|
case let .trending(elevated, _, _, _):
|
||||||
if elevated {
|
if elevated {
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
@ -206,7 +206,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
case let .trending(elevated, _, _):
|
case let .trending(elevated, _, _, _):
|
||||||
if elevated {
|
if elevated {
|
||||||
switch rhs {
|
switch rhs {
|
||||||
case .recentGifs, .trending:
|
case .recentGifs, .trending:
|
||||||
@ -237,11 +237,11 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
case let .gifEmotion(lhsIndex, _, _, _, _):
|
case let .gifEmotion(lhsIndex, _, _, _, _, _):
|
||||||
switch rhs {
|
switch rhs {
|
||||||
case .stickersMode, .savedGifs, .trendingGifs:
|
case .stickersMode, .savedGifs, .trendingGifs:
|
||||||
return false
|
return false
|
||||||
case let .gifEmotion(rhsIndex, _, _, _, _):
|
case let .gifEmotion(rhsIndex, _, _, _, _, _):
|
||||||
return lhsIndex < rhsIndex
|
return lhsIndex < rhsIndex
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
@ -257,28 +257,28 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
func item(context: AccountContext, inputNodeInteraction: ChatMediaInputNodeInteraction) -> ListViewItem {
|
func item(context: AccountContext, inputNodeInteraction: ChatMediaInputNodeInteraction) -> ListViewItem {
|
||||||
switch self {
|
switch self {
|
||||||
case let .recentGifs(theme, expanded):
|
case let .recentGifs(theme, strings, expanded):
|
||||||
return ChatMediaInputRecentGifsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputRecentGifsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.recentGifs.rawValue, id: 0)
|
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.recentGifs.rawValue, id: 0)
|
||||||
inputNodeInteraction.navigateToCollectionId(collectionId)
|
inputNodeInteraction.navigateToCollectionId(collectionId)
|
||||||
})
|
})
|
||||||
case let .savedStickers(theme, expanded):
|
case let .savedStickers(theme, strings, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedStickers, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedStickers, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.savedStickers.rawValue, id: 0)
|
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.savedStickers.rawValue, id: 0)
|
||||||
inputNodeInteraction.navigateToCollectionId(collectionId)
|
inputNodeInteraction.navigateToCollectionId(collectionId)
|
||||||
})
|
})
|
||||||
case let .recentPacks(theme, expanded):
|
case let .recentPacks(theme, strings, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .recentStickers, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .recentStickers, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.recentStickers.rawValue, id: 0)
|
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.recentStickers.rawValue, id: 0)
|
||||||
inputNodeInteraction.navigateToCollectionId(collectionId)
|
inputNodeInteraction.navigateToCollectionId(collectionId)
|
||||||
})
|
})
|
||||||
case let .trending(elevated, theme, expanded):
|
case let .trending(elevated, theme, strings, expanded):
|
||||||
return ChatMediaInputTrendingItem(inputNodeInteraction: inputNodeInteraction, elevated: elevated, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputTrendingItem(inputNodeInteraction: inputNodeInteraction, elevated: elevated, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0)
|
let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0)
|
||||||
inputNodeInteraction.navigateToCollectionId(collectionId)
|
inputNodeInteraction.navigateToCollectionId(collectionId)
|
||||||
})
|
})
|
||||||
case let .settings(theme, expanded):
|
case let .settings(theme, strings, expanded):
|
||||||
return ChatMediaInputSettingsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputSettingsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.openSettings()
|
inputNodeInteraction.openSettings()
|
||||||
})
|
})
|
||||||
case let .peerSpecific(theme, peer, expanded):
|
case let .peerSpecific(theme, peer, expanded):
|
||||||
@ -290,20 +290,20 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
|||||||
return ChatMediaInputStickerPackItem(account: context.account, inputNodeInteraction: inputNodeInteraction, collectionId: info.id, collectionInfo: info, stickerPackItem: topItem, index: index, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputStickerPackItem(account: context.account, inputNodeInteraction: inputNodeInteraction, collectionId: info.id, collectionInfo: info, stickerPackItem: topItem, index: index, theme: theme, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.navigateToCollectionId(info.id)
|
inputNodeInteraction.navigateToCollectionId(info.id)
|
||||||
})
|
})
|
||||||
case let .stickersMode(theme, expanded):
|
case let .stickersMode(theme, strings, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .stickersMode, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .stickersMode, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.navigateBackToStickers()
|
inputNodeInteraction.navigateBackToStickers()
|
||||||
})
|
})
|
||||||
case let .savedGifs(theme, expanded):
|
case let .savedGifs(theme, strings, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedGifs, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedGifs, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.setGifMode(.recent)
|
inputNodeInteraction.setGifMode(.recent)
|
||||||
})
|
})
|
||||||
case let .trendingGifs(theme, expanded):
|
case let .trendingGifs(theme, strings, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .trendingGifs, theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .trendingGifs, theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.setGifMode(.trending)
|
inputNodeInteraction.setGifMode(.trending)
|
||||||
})
|
})
|
||||||
case let .gifEmotion(_, theme, emoji, file, expanded):
|
case let .gifEmotion(_, theme, strings, emoji, file, expanded):
|
||||||
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .gifEmoji(emoji, file), theme: theme, expanded: expanded, selected: {
|
return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .gifEmoji(emoji, file), theme: theme, strings: strings, expanded: expanded, selected: {
|
||||||
inputNodeInteraction.setGifMode(.emojiSearch(emoji))
|
inputNodeInteraction.setGifMode(.emojiSearch(emoji))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,17 @@ final class ChatMediaInputRecentGifsItem: ListViewItem {
|
|||||||
let selectedItem: () -> Void
|
let selectedItem: () -> Void
|
||||||
let expanded: Bool
|
let expanded: Bool
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
|
let strings: PresentationStrings
|
||||||
|
|
||||||
var selectable: Bool {
|
var selectable: Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
init(inputNodeInteraction: ChatMediaInputNodeInteraction, theme: PresentationTheme, expanded: Bool, selected: @escaping () -> Void) {
|
init(inputNodeInteraction: ChatMediaInputNodeInteraction, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool, selected: @escaping () -> Void) {
|
||||||
self.inputNodeInteraction = inputNodeInteraction
|
self.inputNodeInteraction = inputNodeInteraction
|
||||||
self.selectedItem = selected
|
self.selectedItem = selected
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.strings = strings
|
||||||
self.expanded = expanded
|
self.expanded = expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ final class ChatMediaInputRecentGifsItem: ListViewItem {
|
|||||||
node.updateIsHighlighted()
|
node.updateIsHighlighted()
|
||||||
node.updateAppearanceTransition(transition: .immediate)
|
node.updateAppearanceTransition(transition: .immediate)
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
node.updateTheme(theme: self.theme, expanded: self.expanded)
|
node.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
completion(node, {
|
completion(node, {
|
||||||
return (nil, { _ in })
|
return (nil, { _ in })
|
||||||
})
|
})
|
||||||
@ -44,7 +46,7 @@ final class ChatMediaInputRecentGifsItem: ListViewItem {
|
|||||||
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
||||||
(node() as? ChatMediaInputRecentGifsItemNode)?.updateTheme(theme: self.theme, expanded: self.expanded)
|
(node() as? ChatMediaInputRecentGifsItemNode)?.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,14 +107,14 @@ final class ChatMediaInputRecentGifsItemNode: ListViewItemNode {
|
|||||||
deinit {
|
deinit {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTheme(theme: PresentationTheme, expanded: Bool) {
|
func updateTheme(theme: PresentationTheme, strings: PresentationStrings, expanded: Bool) {
|
||||||
if self.theme !== theme {
|
if self.theme !== theme {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
self.highlightNode.image = PresentationResourcesChat.chatMediaInputPanelHighlightedIconImage(theme)
|
self.highlightNode.image = PresentationResourcesChat.chatMediaInputPanelHighlightedIconImage(theme)
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentGifsIconImage(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentGifsIconImage(theme)
|
||||||
|
|
||||||
self.titleNode.attributedText = NSAttributedString(string: "GIFs", font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
self.titleNode.attributedText = NSAttributedString(string: strings.Stickers_Gifs, font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
||||||
|
@ -12,15 +12,17 @@ final class ChatMediaInputSettingsItem: ListViewItem {
|
|||||||
let selectedItem: () -> Void
|
let selectedItem: () -> Void
|
||||||
let expanded: Bool
|
let expanded: Bool
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
|
let strings: PresentationStrings
|
||||||
|
|
||||||
var selectable: Bool {
|
var selectable: Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
init(inputNodeInteraction: ChatMediaInputNodeInteraction, theme: PresentationTheme, expanded: Bool, selected: @escaping () -> Void) {
|
init(inputNodeInteraction: ChatMediaInputNodeInteraction, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool, selected: @escaping () -> Void) {
|
||||||
self.inputNodeInteraction = inputNodeInteraction
|
self.inputNodeInteraction = inputNodeInteraction
|
||||||
self.selectedItem = selected
|
self.selectedItem = selected
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.strings = strings
|
||||||
self.expanded = expanded
|
self.expanded = expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ final class ChatMediaInputSettingsItem: ListViewItem {
|
|||||||
node.inputNodeInteraction = self.inputNodeInteraction
|
node.inputNodeInteraction = self.inputNodeInteraction
|
||||||
node.updateAppearanceTransition(transition: .immediate)
|
node.updateAppearanceTransition(transition: .immediate)
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
node.updateTheme(theme: self.theme, expanded: self.expanded)
|
node.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
completion(node, {
|
completion(node, {
|
||||||
return (nil, { _ in })
|
return (nil, { _ in })
|
||||||
})
|
})
|
||||||
@ -43,7 +45,7 @@ final class ChatMediaInputSettingsItem: ListViewItem {
|
|||||||
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
||||||
(node() as? ChatMediaInputSettingsItemNode)?.updateTheme(theme: self.theme, expanded: self.expanded)
|
(node() as? ChatMediaInputSettingsItemNode)?.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +98,7 @@ final class ChatMediaInputSettingsItemNode: ListViewItemNode {
|
|||||||
self.scalingNode.addSubnode(self.imageNode)
|
self.scalingNode.addSubnode(self.imageNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTheme(theme: PresentationTheme, expanded: Bool) {
|
func updateTheme(theme: PresentationTheme, strings: PresentationStrings, expanded: Bool) {
|
||||||
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
let imageSize = CGSize(width: 26.0 * 1.6, height: 26.0 * 1.6)
|
||||||
self.imageNode.frame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
self.imageNode.frame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ final class ChatMediaInputSettingsItemNode: ListViewItemNode {
|
|||||||
|
|
||||||
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelSettingsIconImage(theme)
|
self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelSettingsIconImage(theme)
|
||||||
|
|
||||||
self.titleNode.attributedText = NSAttributedString(string: "Settings", font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
self.titleNode.attributedText = NSAttributedString(string: strings.Stickers_Settings, font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.containerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: expandedBoundingSize)
|
self.containerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: expandedBoundingSize)
|
||||||
|
@ -13,17 +13,19 @@ final class ChatMediaInputTrendingItem: ListViewItem {
|
|||||||
let elevated: Bool
|
let elevated: Bool
|
||||||
let expanded: Bool
|
let expanded: Bool
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
|
let strings: PresentationStrings
|
||||||
|
|
||||||
var selectable: Bool {
|
var selectable: Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
init(inputNodeInteraction: ChatMediaInputNodeInteraction, elevated: Bool, theme: PresentationTheme, expanded: Bool, selected: @escaping () -> Void) {
|
init(inputNodeInteraction: ChatMediaInputNodeInteraction, elevated: Bool, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool, selected: @escaping () -> Void) {
|
||||||
self.inputNodeInteraction = inputNodeInteraction
|
self.inputNodeInteraction = inputNodeInteraction
|
||||||
self.elevated = elevated
|
self.elevated = elevated
|
||||||
self.selectedItem = selected
|
self.selectedItem = selected
|
||||||
self.expanded = expanded
|
self.expanded = expanded
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.strings = strings
|
||||||
}
|
}
|
||||||
|
|
||||||
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
||||||
@ -35,7 +37,7 @@ final class ChatMediaInputTrendingItem: ListViewItem {
|
|||||||
node.updateIsHighlighted()
|
node.updateIsHighlighted()
|
||||||
node.updateAppearanceTransition(transition: .immediate)
|
node.updateAppearanceTransition(transition: .immediate)
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
node.updateTheme(elevated: self.elevated, theme: self.theme, expanded: self.expanded)
|
node.updateTheme(elevated: self.elevated, theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
completion(node, {
|
completion(node, {
|
||||||
return (nil, { _ in })
|
return (nil, { _ in })
|
||||||
})
|
})
|
||||||
@ -46,7 +48,7 @@ final class ChatMediaInputTrendingItem: ListViewItem {
|
|||||||
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
||||||
(node() as? ChatMediaInputTrendingItemNode)?.updateTheme(elevated: self.elevated, theme: self.theme, expanded: self.expanded)
|
(node() as? ChatMediaInputTrendingItemNode)?.updateTheme(elevated: self.elevated, theme: self.theme, strings: self.strings, expanded: self.expanded)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +115,7 @@ final class ChatMediaInputTrendingItemNode: ListViewItemNode {
|
|||||||
self.currentCollectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0)
|
self.currentCollectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTheme(elevated: Bool, theme: PresentationTheme, expanded: Bool) {
|
func updateTheme(elevated: Bool, theme: PresentationTheme, strings: PresentationStrings, expanded: Bool) {
|
||||||
let imageSize = CGSize(width: 26.0 * 1.85, height: 26.0 * 1.85)
|
let imageSize = CGSize(width: 26.0 * 1.85, height: 26.0 * 1.85)
|
||||||
let imageFrame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
let imageFrame = CGRect(origin: CGPoint(x: floor((expandedBoundingSize.width - imageSize.width) / 2.0), y: floor((expandedBoundingSize.height - imageSize.height) / 2.0) + UIScreenPixel), size: imageSize)
|
||||||
self.imageNode.frame = imageFrame
|
self.imageNode.frame = imageFrame
|
||||||
@ -129,7 +131,7 @@ final class ChatMediaInputTrendingItemNode: ListViewItemNode {
|
|||||||
self.badgeBackground.frame = CGRect(origin: CGPoint(x: floor(imageFrame.maxX - image.size.width - 7.0), y: 18.0), size: image.size)
|
self.badgeBackground.frame = CGRect(origin: CGPoint(x: floor(imageFrame.maxX - image.size.width - 7.0), y: 18.0), size: image.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.titleNode.attributedText = NSAttributedString(string: "Trending", font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
self.titleNode.attributedText = NSAttributedString(string: strings.Stickers_Trending, font: Font.regular(11.0), textColor: theme.chat.inputPanel.primaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.elevated != elevated {
|
if self.elevated != elevated {
|
||||||
|
@ -589,7 +589,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
|
|||||||
installedPacks.insert(info.0)
|
installedPacks.insert(info.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, hasGifs: false, hasSettings: false)
|
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, strings: strings, hasGifs: false, hasSettings: false)
|
||||||
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: trendingPacks, installedPacks: installedPacks, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
|
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: trendingPacks, installedPacks: installedPacks, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
|
||||||
|
|
||||||
let (previousPanelEntries, previousGridEntries) = previousStickerEntries.swap((panelEntries, gridEntries))
|
let (previousPanelEntries, previousGridEntries) = previousStickerEntries.swap((panelEntries, gridEntries))
|
||||||
@ -624,7 +624,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
|
|||||||
installedPacks.insert(info.0)
|
installedPacks.insert(info.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, hasGifs: false, hasSettings: false)
|
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, strings: strings, hasGifs: false, hasSettings: false)
|
||||||
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: [], installedPacks: installedPacks, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
|
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: [], installedPacks: installedPacks, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
|
||||||
|
|
||||||
let (previousPanelEntries, previousGridEntries) = previousMaskEntries.swap((panelEntries, gridEntries))
|
let (previousPanelEntries, previousGridEntries) = previousMaskEntries.swap((panelEntries, gridEntries))
|
||||||
|
@ -3495,7 +3495,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
canChangeColors = false
|
canChangeColors = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if canChangeColors {
|
if false, canChangeColors {
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.UserInfo_ChangeColors, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.UserInfo_ChangeColors, icon: { theme in
|
||||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ApplyTheme"), color: theme.contextMenu.primaryColor)
|
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ApplyTheme"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, f in
|
}, action: { [weak self] _, f in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user