diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 73d9a81a03..b997b6cd41 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -6725,3 +6725,21 @@ Sorry for the inconvenience."; "Chat.NavigationNoChannels" = "You have no unread channels"; "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"; diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift index 532bbd96ae..c46940e4a9 100644 --- a/submodules/Display/Source/ListView.swift +++ b/submodules/Display/Source/ListView.swift @@ -604,7 +604,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture } } if toIndex != reorderItemNode.index { - if let reorderLastTimestamp = self.reorderLastTimestamp, timestamp < reorderLastTimestamp + 0.1 { + if let reorderLastTimestamp = self.reorderLastTimestamp, timestamp < reorderLastTimestamp + 0.3 { return } if reorderNode.currentState?.0 != reorderItemIndex || reorderNode.currentState?.1 != toIndex { diff --git a/submodules/TelegramUI/Sources/ChatMediaInputMetaSectionItemNode.swift b/submodules/TelegramUI/Sources/ChatMediaInputMetaSectionItemNode.swift index 3718b56930..61029979fa 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputMetaSectionItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputMetaSectionItemNode.swift @@ -23,6 +23,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { let inputNodeInteraction: ChatMediaInputNodeInteraction let type: ChatMediaInputMetaSectionItemType let theme: PresentationTheme + let strings: PresentationStrings let expanded: Bool let selectedItem: () -> Void @@ -30,12 +31,13 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { 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.inputNodeInteraction = inputNodeInteraction self.type = type self.selectedItem = selected self.theme = theme + self.strings = strings self.expanded = expanded } @@ -45,7 +47,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { Queue.mainQueue().async { node.inputNodeInteraction = self.inputNodeInteraction 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.updateAppearanceTransition(transition: .immediate) @@ -65,7 +67,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { Queue.mainQueue().async { completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: node().insets), { _ in (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) 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 { case .savedStickers: self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelSavedStickersIcon(theme) - title = "Favorites" + title = strings.Stickers_Favorites case .recentStickers: self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme) - title = "Recent" + title = strings.Stickers_Recent case .stickersMode: self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelStickersModeIcon(theme) - title = "Stickers" + title = strings.Stickers_Stickers case .savedGifs: self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelRecentStickersIcon(theme) - title = "GIFs" + title = strings.Stickers_Gifs case .trendingGifs: self.imageNode.image = PresentationResourcesChat.chatInputMediaPanelTrendingGifsIcon(theme) - title = "Trending" + title = strings.Stickers_Trending case let .gifEmoji(emoji, file): switch emoji { case "😡": - title = "Angry" + title = strings.Gif_Emotion_Angry case "😮": - title = "Surprised" + title = strings.Gif_Emotion_Surprised case "😂": - title = "Joy" + title = strings.Gif_Emotion_Joy case "😘": - title = "Kiss" + title = strings.Gif_Emotion_Kiss case "😍": - title = "Hearts" + title = strings.Gif_Emotion_Hearts case "👍": - title = "Thumbs Up" + title = strings.Gif_Emotion_ThumbsUp case "👎": - title = "Thumbs Down" + title = strings.Gif_Emotion_ThumbsDown case "🙄": - title = "Roll-eyes" + title = strings.Gif_Emotion_RollEyes case "😎": - title = "Cool" + title = strings.Gif_Emotion_Cool case "🥳": - title = "Party" + title = strings.Gif_Emotion_Party default: break } self.imageNode.image = nil if let file = file { - let loopAnimatedStickers = self.inputNodeInteraction?.stickerSettings?.loopAnimatedStickers ?? false let animatedStickerNode: AnimatedStickerNode if let current = self.animatedStickerNode { diff --git a/submodules/TelegramUI/Sources/ChatMediaInputNode.swift b/submodules/TelegramUI/Sources/ChatMediaInputNode.swift index 249ddf1ae8..6cfc2bae2a 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputNode.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputNode.swift @@ -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) } -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] = [] if hasGifs { - entries.append(.recentGifs(theme, expanded)) + entries.append(.recentGifs(theme, strings, expanded)) } if trendingIsDismissed { - entries.append(.trending(true, theme, expanded)) + entries.append(.trending(true, theme, strings, expanded)) } if let savedStickers = savedStickers, !savedStickers.items.isEmpty { - entries.append(.savedStickers(theme, expanded)) + entries.append(.savedStickers(theme, strings, expanded)) } var savedStickerIds = Set() if let savedStickers = savedStickers, !savedStickers.items.isEmpty { @@ -192,7 +192,7 @@ func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: Ordere } } if found { - entries.append(.recentPacks(theme, expanded)) + entries.append(.recentPacks(theme, strings, expanded)) } } if let peerSpecificPack = peerSpecificPack { @@ -236,19 +236,19 @@ func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: Ordere } if hasSettings { - entries.append(.settings(theme, expanded)) + entries.append(.settings(theme, strings, expanded)) } 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] = [] - entries.append(.stickersMode(theme, expanded)) - entries.append(.savedGifs(theme, expanded)) - entries.append(.trendingGifs(theme, expanded)) + entries.append(.stickersMode(theme, strings, expanded)) + entries.append(.savedGifs(theme, strings, expanded)) + entries.append(.trendingGifs(theme, strings, expanded)) 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 @@ -1134,8 +1134,8 @@ final class ChatMediaInputNode: ChatInputNode { 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 gifPaneEntries = chatMediaInputPanelGifModeEntries(theme: theme, reactions: reactions, animatedEmojiStickers: animatedEmojiStickers, 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, 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) if view.higher == nil { diff --git a/submodules/TelegramUI/Sources/ChatMediaInputPanelEntries.swift b/submodules/TelegramUI/Sources/ChatMediaInputPanelEntries.swift index 6b797d6d23..2320f8e217 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputPanelEntries.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputPanelEntries.swift @@ -31,18 +31,18 @@ enum ChatMediaInputPanelEntryStableId: Hashable { } enum ChatMediaInputPanelEntry: Comparable, Identifiable { - case recentGifs(PresentationTheme, Bool) - case savedStickers(PresentationTheme, Bool) - case recentPacks(PresentationTheme, Bool) - case trending(Bool, PresentationTheme, Bool) - case settings(PresentationTheme, Bool) + case recentGifs(PresentationTheme, PresentationStrings, Bool) + case savedStickers(PresentationTheme, PresentationStrings, Bool) + case recentPacks(PresentationTheme, PresentationStrings, Bool) + case trending(Bool, PresentationTheme, PresentationStrings, Bool) + case settings(PresentationTheme, PresentationStrings, Bool) case peerSpecific(theme: PresentationTheme, peer: Peer, expanded: Bool) case stickerPack(index: Int, info: StickerPackCollectionInfo, topItem: StickerPackItem?, theme: PresentationTheme, expanded: Bool) - case stickersMode(PresentationTheme, Bool) - case savedGifs(PresentationTheme, Bool) - case trendingGifs(PresentationTheme, Bool) - case gifEmotion(Int, PresentationTheme, String, TelegramMediaFile?, Bool) + case stickersMode(PresentationTheme, PresentationStrings, Bool) + case savedGifs(PresentationTheme, PresentationStrings, Bool) + case trendingGifs(PresentationTheme, PresentationStrings, Bool) + case gifEmotion(Int, PresentationTheme, PresentationStrings, String, TelegramMediaFile?, Bool) var stableId: ChatMediaInputPanelEntryStableId { switch self { @@ -66,39 +66,39 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { return .savedGifs case .trendingGifs: return .trendingGifs - case let .gifEmotion(_, _, emoji, _, _): + case let .gifEmotion(_, _, _, emoji, _, _): return .gifEmotion(emoji) } } static func ==(lhs: ChatMediaInputPanelEntry, rhs: ChatMediaInputPanelEntry) -> Bool { switch lhs { - case let .recentGifs(lhsTheme, lhsExpanded): - if case let .recentGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .recentGifs(lhsTheme, lhsStrings, lhsExpanded): + if case let .recentGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .savedStickers(lhsTheme, lhsExpanded): - if case let .savedStickers(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .savedStickers(lhsTheme, lhsStrings, lhsExpanded): + if case let .savedStickers(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .recentPacks(lhsTheme, lhsExpanded): - if case let .recentPacks(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .recentPacks(lhsTheme, lhsStrings, lhsExpanded): + if case let .recentPacks(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .trending(lhsElevated, lhsTheme, lhsExpanded): - if case let .trending(rhsElevated, rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsElevated == rhsElevated, lhsExpanded == rhsExpanded { + case let .trending(lhsElevated, lhsTheme, lhsStrings, lhsExpanded): + if case let .trending(rhsElevated, rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsElevated == rhsElevated, lhsExpanded == rhsExpanded { return true } else { return false } - case let .settings(lhsTheme, lhsExpanded): - if case let .settings(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .settings(lhsTheme, lhsStrings, lhsExpanded): + if case let .settings(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false @@ -115,26 +115,26 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { } else { return false } - case let .stickersMode(lhsTheme, lhsExpanded): - if case let .stickersMode(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .stickersMode(lhsTheme, lhsStrings, lhsExpanded): + if case let .stickersMode(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .savedGifs(lhsTheme, lhsExpanded): - if case let .savedGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .savedGifs(lhsTheme, lhsStrings, lhsExpanded): + if case let .savedGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .trendingGifs(lhsTheme, lhsExpanded): - if case let .trendingGifs(rhsTheme, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded { + case let .trendingGifs(lhsTheme, lhsStrings, lhsExpanded): + if case let .trendingGifs(rhsTheme, rhsStrings, rhsExpanded) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsExpanded == rhsExpanded { return true } else { return false } - case let .gifEmotion(lhsIndex, lhsTheme, lhsEmoji, lhsFile, lhsExpanded): - if case let .gifEmotion(rhsIndex, rhsTheme, rhsEmoji, rhsFile, rhsExpanded) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsEmoji == rhsEmoji, lhsExpanded == rhsExpanded { + case let .gifEmotion(lhsIndex, lhsTheme, lhsStrings, lhsEmoji, lhsFile, lhsExpanded): + 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 !lhsFile.isEqual(to: rhsFile) { return false @@ -162,7 +162,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { switch rhs { case .recentGifs, savedStickers: return false - case let .trending(elevated, _, _) where elevated: + case let .trending(elevated, _, _, _) where elevated: return false default: return true @@ -171,7 +171,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { switch rhs { case .recentGifs, .savedStickers, recentPacks: return false - case let .trending(elevated, _, _) where elevated: + case let .trending(elevated, _, _, _) where elevated: return false default: return true @@ -180,7 +180,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { switch rhs { case .recentGifs, .savedStickers, recentPacks, .peerSpecific: return false - case let .trending(elevated, _, _) where elevated: + case let .trending(elevated, _, _, _) where elevated: return false default: return true @@ -189,7 +189,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { switch rhs { case .recentGifs, .savedStickers, .recentPacks, .peerSpecific: return false - case let .trending(elevated, _, _): + case let .trending(elevated, _, _, _): if elevated { return false } else { @@ -206,7 +206,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { default: return true } - case let .trending(elevated, _, _): + case let .trending(elevated, _, _, _): if elevated { switch rhs { case .recentGifs, .trending: @@ -237,11 +237,11 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { default: return true } - case let .gifEmotion(lhsIndex, _, _, _, _): + case let .gifEmotion(lhsIndex, _, _, _, _, _): switch rhs { case .stickersMode, .savedGifs, .trendingGifs: return false - case let .gifEmotion(rhsIndex, _, _, _, _): + case let .gifEmotion(rhsIndex, _, _, _, _, _): return lhsIndex < rhsIndex default: return true @@ -257,28 +257,28 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable { func item(context: AccountContext, inputNodeInteraction: ChatMediaInputNodeInteraction) -> ListViewItem { switch self { - case let .recentGifs(theme, expanded): - return ChatMediaInputRecentGifsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, expanded: expanded, selected: { + case let .recentGifs(theme, strings, expanded): + return ChatMediaInputRecentGifsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, strings: strings, expanded: expanded, selected: { let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.recentGifs.rawValue, id: 0) inputNodeInteraction.navigateToCollectionId(collectionId) }) - case let .savedStickers(theme, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedStickers, theme: theme, expanded: expanded, selected: { + case let .savedStickers(theme, strings, expanded): + 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) inputNodeInteraction.navigateToCollectionId(collectionId) }) - case let .recentPacks(theme, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .recentStickers, theme: theme, expanded: expanded, selected: { + case let .recentPacks(theme, strings, expanded): + 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) inputNodeInteraction.navigateToCollectionId(collectionId) }) - case let .trending(elevated, theme, expanded): - return ChatMediaInputTrendingItem(inputNodeInteraction: inputNodeInteraction, elevated: elevated, theme: theme, expanded: expanded, selected: { + case let .trending(elevated, theme, strings, expanded): + return ChatMediaInputTrendingItem(inputNodeInteraction: inputNodeInteraction, elevated: elevated, theme: theme, strings: strings, expanded: expanded, selected: { let collectionId = ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0) inputNodeInteraction.navigateToCollectionId(collectionId) }) - case let .settings(theme, expanded): - return ChatMediaInputSettingsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, expanded: expanded, selected: { + case let .settings(theme, strings, expanded): + return ChatMediaInputSettingsItem(inputNodeInteraction: inputNodeInteraction, theme: theme, strings: strings, expanded: expanded, selected: { inputNodeInteraction.openSettings() }) 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: { inputNodeInteraction.navigateToCollectionId(info.id) }) - case let .stickersMode(theme, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .stickersMode, theme: theme, expanded: expanded, selected: { + case let .stickersMode(theme, strings, expanded): + return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .stickersMode, theme: theme, strings: strings, expanded: expanded, selected: { inputNodeInteraction.navigateBackToStickers() }) - case let .savedGifs(theme, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedGifs, theme: theme, expanded: expanded, selected: { + case let .savedGifs(theme, strings, expanded): + return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .savedGifs, theme: theme, strings: strings, expanded: expanded, selected: { inputNodeInteraction.setGifMode(.recent) }) - case let .trendingGifs(theme, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .trendingGifs, theme: theme, expanded: expanded, selected: { + case let .trendingGifs(theme, strings, expanded): + return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .trendingGifs, theme: theme, strings: strings, expanded: expanded, selected: { inputNodeInteraction.setGifMode(.trending) }) - case let .gifEmotion(_, theme, emoji, file, expanded): - return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .gifEmoji(emoji, file), theme: theme, expanded: expanded, selected: { + case let .gifEmotion(_, theme, strings, emoji, file, expanded): + return ChatMediaInputMetaSectionItem(account: context.account, inputNodeInteraction: inputNodeInteraction, type: .gifEmoji(emoji, file), theme: theme, strings: strings, expanded: expanded, selected: { inputNodeInteraction.setGifMode(.emojiSearch(emoji)) }) } diff --git a/submodules/TelegramUI/Sources/ChatMediaInputRecentGifsItem.swift b/submodules/TelegramUI/Sources/ChatMediaInputRecentGifsItem.swift index cfb9ccaa7f..c2d3ac7817 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputRecentGifsItem.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputRecentGifsItem.swift @@ -12,15 +12,17 @@ final class ChatMediaInputRecentGifsItem: ListViewItem { let selectedItem: () -> Void let expanded: Bool let theme: PresentationTheme + let strings: PresentationStrings var selectable: Bool { 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.selectedItem = selected self.theme = theme + self.strings = strings self.expanded = expanded } @@ -33,7 +35,7 @@ final class ChatMediaInputRecentGifsItem: ListViewItem { node.updateIsHighlighted() node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { - node.updateTheme(theme: self.theme, expanded: self.expanded) + node.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded) completion(node, { 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) { Queue.mainQueue().async { 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 { } - func updateTheme(theme: PresentationTheme, expanded: Bool) { + func updateTheme(theme: PresentationTheme, strings: PresentationStrings, expanded: Bool) { if self.theme !== theme { self.theme = theme self.highlightNode.image = PresentationResourcesChat.chatMediaInputPanelHighlightedIconImage(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) diff --git a/submodules/TelegramUI/Sources/ChatMediaInputSettingsItem.swift b/submodules/TelegramUI/Sources/ChatMediaInputSettingsItem.swift index 77a0c95c80..b374d760d8 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputSettingsItem.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputSettingsItem.swift @@ -12,15 +12,17 @@ final class ChatMediaInputSettingsItem: ListViewItem { let selectedItem: () -> Void let expanded: Bool let theme: PresentationTheme + let strings: PresentationStrings var selectable: Bool { 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.selectedItem = selected self.theme = theme + self.strings = strings self.expanded = expanded } @@ -32,7 +34,7 @@ final class ChatMediaInputSettingsItem: ListViewItem { node.inputNodeInteraction = self.inputNodeInteraction node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { - node.updateTheme(theme: self.theme, expanded: self.expanded) + node.updateTheme(theme: self.theme, strings: self.strings, expanded: self.expanded) completion(node, { 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) { Queue.mainQueue().async { 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) } - 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) 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.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) diff --git a/submodules/TelegramUI/Sources/ChatMediaInputTrendingItem.swift b/submodules/TelegramUI/Sources/ChatMediaInputTrendingItem.swift index ad8158ce84..5a440d6254 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputTrendingItem.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputTrendingItem.swift @@ -13,17 +13,19 @@ final class ChatMediaInputTrendingItem: ListViewItem { let elevated: Bool let expanded: Bool let theme: PresentationTheme + let strings: PresentationStrings var selectable: Bool { 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.elevated = elevated self.selectedItem = selected self.expanded = expanded 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?, (ListViewItemApply) -> Void)) -> Void) { @@ -35,7 +37,7 @@ final class ChatMediaInputTrendingItem: ListViewItem { node.updateIsHighlighted() node.updateAppearanceTransition(transition: .immediate) 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, { 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) { Queue.mainQueue().async { 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) } - 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 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 @@ -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.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 { diff --git a/submodules/TelegramUI/Sources/DrawingStickersScreen.swift b/submodules/TelegramUI/Sources/DrawingStickersScreen.swift index b03661ce5b..3dbcb071f0 100644 --- a/submodules/TelegramUI/Sources/DrawingStickersScreen.swift +++ b/submodules/TelegramUI/Sources/DrawingStickersScreen.swift @@ -589,7 +589,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode { 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 (previousPanelEntries, previousGridEntries) = previousStickerEntries.swap((panelEntries, gridEntries)) @@ -624,7 +624,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode { 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 (previousPanelEntries, previousGridEntries) = previousMaskEntries.swap((panelEntries, gridEntries)) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index f3a76fa9b6..084b3f1904 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3495,7 +3495,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD canChangeColors = false } - if canChangeColors { + if false, canChangeColors { items.append(.action(ContextMenuActionItem(text: presentationData.strings.UserInfo_ChangeColors, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ApplyTheme"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in