Add missing localization

This commit is contained in:
Ali 2022-07-25 00:34:14 +02:00
parent 2a5523b266
commit 985c662ada
8 changed files with 110 additions and 61 deletions

View File

@ -7910,3 +7910,19 @@ Sorry for the inconvenience.";
"StickerPack.EmojiCount_any" = "%@ emoji"; "StickerPack.EmojiCount_any" = "%@ emoji";
"StickerSettings.EmojiContextInfo" = "If you archive an emoji set, you can quickly restore it later from the Archived Emoji section."; "StickerSettings.EmojiContextInfo" = "If you archive an emoji set, you can quickly restore it later from the Archived Emoji section.";
"StickersList.EmojiItem" = "Custom Emoji";
"StickersList.ArchivedEmojiItem" = "Archived Emoji";
"EmojiInput.UnlockPack" = "Unlock %@";
"EmojiInput.AddPack" = "Add %@";
"EmojiInput.PanelTitlePremium" = "Premium";
"EmojiInput.PanelTitleEmoji" = "Emoji";
"EmojiInput.PanelTitleRecent" = "Recent";
"EmojiInput.SectionTitleEmoji" = "Emoji";
"EmojiInput.SectionTitleFavoriteStickers" = "Favorite Stickers";
"EmojiInput.SectionTitlePremiumStickers" = "Premium Stickers";
"EmojiInput.PremiumEmojiToast.Text" = "Subscribe to Telegram Premium to unlock premium emoji.";
"EmojiInput.PremiumEmojiToast.Action" = "More";

View File

@ -568,8 +568,7 @@ private func installedStickerPacksControllerEntries(presentationData: Presentati
} }
entries.append(.masks(presentationData.theme, presentationData.strings.MaskStickerSettings_Title)) entries.append(.masks(presentationData.theme, presentationData.strings.MaskStickerSettings_Title))
//TODO:localize entries.append(.emoji(presentationData.theme, presentationData.strings.StickersList_EmojiItem))
entries.append(.emoji(presentationData.theme, "Emoji"))
entries.append(.quickReaction(presentationData.strings.Settings_QuickReactionSetup_NavigationTitle, quickReactionImage)) entries.append(.quickReaction(presentationData.strings.Settings_QuickReactionSetup_NavigationTitle, quickReactionImage))
@ -614,8 +613,7 @@ private func installedStickerPacksControllerEntries(presentationData: Presentati
} }
case .emoji: case .emoji:
if let archived = archived, !archived.isEmpty { if let archived = archived, !archived.isEmpty {
//TODO:localize entries.append(.archived(presentationData.theme, presentationData.strings.StickersList_ArchivedEmojiItem, Int32(archived.count), archived))
entries.append(.archived(presentationData.theme, "Archived Emoji", Int32(archived.count), archived))
} }
} }

View File

@ -300,8 +300,47 @@ public func foldLineBreaks(_ text: String) -> String {
} }
public func foldLineBreaks(_ text: NSAttributedString) -> NSAttributedString { public func foldLineBreaks(_ text: NSAttributedString) -> NSAttributedString {
//TODO:localize let remainingString = NSMutableAttributedString(attributedString: text)
return text var lines: [NSAttributedString] = []
while true {
if let range = remainingString.string.range(of: "\n") {
let mappedRange = NSRange(range, in: remainingString.string)
lines.append(remainingString.attributedSubstring(from: NSRange(location: 0, length: mappedRange.upperBound)))
remainingString.replaceCharacters(in: NSRange(location: 0, length: mappedRange.upperBound), with: "")
} else {
if lines.isEmpty {
return text
}
if !remainingString.string.isEmpty {
lines.append(remainingString)
}
break
}
}
let result = NSMutableAttributedString()
for line in lines {
if line.string.isEmpty {
continue
}
if result.string.isEmpty {
result.append(line)
} else {
let currentAttributes = line.attributes(at: 0, effectiveRange: nil).filter { key, _ in
switch key {
case .font, .foregroundColor:
return true
default:
return false
}
}
result.append(NSAttributedString(string: " ", attributes: currentAttributes))
result.append(line)
}
}
return result
} }
public func trimToLineCount(_ text: String, lineCount: Int) -> String { public func trimToLineCount(_ text: String, lineCount: Int) -> String {

View File

@ -2144,7 +2144,7 @@ public final class EmojiPagerContentComponent: Component {
private var component: EmojiPagerContentComponent? private var component: EmojiPagerContentComponent?
private weak var state: EmptyComponentState? private weak var state: EmptyComponentState?
private var pagerEnvironment: PagerComponentChildEnvironment? private var pagerEnvironment: PagerComponentChildEnvironment?
private var theme: PresentationTheme? private var keyboardChildEnvironment: EntityKeyboardChildEnvironment?
private var activeItemUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>? private var activeItemUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
private var itemLayout: ItemLayout? private var itemLayout: ItemLayout?
@ -3010,7 +3010,7 @@ public final class EmojiPagerContentComponent: Component {
} }
private func updateVisibleItems(transition: Transition, attemptSynchronousLoads: Bool, previousItemPositions: [ItemLayer.Key: CGPoint]?, updatedItemPositions: [ItemLayer.Key: CGPoint]?) { private func updateVisibleItems(transition: Transition, attemptSynchronousLoads: Bool, previousItemPositions: [ItemLayer.Key: CGPoint]?, updatedItemPositions: [ItemLayer.Key: CGPoint]?) {
guard let component = self.component, let pagerEnvironment = self.pagerEnvironment, let theme = self.theme, let itemLayout = self.itemLayout else { guard let component = self.component, let pagerEnvironment = self.pagerEnvironment, let keyboardChildEnvironment = self.keyboardChildEnvironment, let itemLayout = self.itemLayout else {
return return
} }
@ -3089,7 +3089,7 @@ public final class EmojiPagerContentComponent: Component {
let (groupHeaderSize, centralContentWidth) = groupHeaderView.update( let (groupHeaderSize, centralContentWidth) = groupHeaderView.update(
context: component.context, context: component.context,
theme: theme, theme: keyboardChildEnvironment.theme,
layoutType: itemLayout.layoutType, layoutType: itemLayout.layoutType,
hasTopSeparator: hasTopSeparator, hasTopSeparator: hasTopSeparator,
actionButtonTitle: actionButtonTitle, actionButtonTitle: actionButtonTitle,
@ -3130,7 +3130,7 @@ public final class EmojiPagerContentComponent: Component {
self.scrollView.layer.insertSublayer(groupBorderLayer, at: 0) self.scrollView.layer.insertSublayer(groupBorderLayer, at: 0)
self.mirrorContentScrollView.layer.addSublayer(groupBorderLayer.tintContainerLayer) self.mirrorContentScrollView.layer.addSublayer(groupBorderLayer.tintContainerLayer)
groupBorderLayer.strokeColor = theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.cgColor groupBorderLayer.strokeColor = keyboardChildEnvironment.theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.cgColor
groupBorderLayer.tintContainerLayer.strokeColor = UIColor.white.cgColor groupBorderLayer.tintContainerLayer.strokeColor = UIColor.white.cgColor
groupBorderLayer.lineWidth = 1.6 groupBorderLayer.lineWidth = 1.6
groupBorderLayer.lineCap = .round groupBorderLayer.lineCap = .round
@ -3198,7 +3198,6 @@ public final class EmojiPagerContentComponent: Component {
let groupId = itemGroup.groupId let groupId = itemGroup.groupId
let isPremiumLocked = itemGroup.isPremiumLocked let isPremiumLocked = itemGroup.isPremiumLocked
//TODO:localize
let title: String let title: String
let backgroundColor: UIColor let backgroundColor: UIColor
let backgroundColors: [UIColor] let backgroundColors: [UIColor]
@ -3206,7 +3205,7 @@ public final class EmojiPagerContentComponent: Component {
let animationName: String? let animationName: String?
let gloss: Bool let gloss: Bool
if itemGroup.isPremiumLocked { if itemGroup.isPremiumLocked {
title = "Unlock \(itemGroup.title ?? "Emoji")" title = keyboardChildEnvironment.strings.EmojiInput_UnlockPack(itemGroup.title ?? "Emoji").string
backgroundColors = [ backgroundColors = [
UIColor(rgb: 0x0077ff), UIColor(rgb: 0x0077ff),
UIColor(rgb: 0x6b93ff), UIColor(rgb: 0x6b93ff),
@ -3218,10 +3217,10 @@ public final class EmojiPagerContentComponent: Component {
animationName = "premium_unlock" animationName = "premium_unlock"
gloss = true gloss = true
} else { } else {
title = "Add \(itemGroup.title ?? "Emoji")" title = keyboardChildEnvironment.strings.EmojiInput_AddPack(itemGroup.title ?? "Emoji").string
backgroundColors = [] backgroundColors = []
backgroundColor = theme.list.itemCheckColors.fillColor backgroundColor = keyboardChildEnvironment.theme.list.itemCheckColors.fillColor
foregroundColor = theme.list.itemCheckColors.foregroundColor foregroundColor = keyboardChildEnvironment.theme.list.itemCheckColors.foregroundColor
animationName = nil animationName = nil
gloss = false gloss = false
} }
@ -3291,7 +3290,7 @@ public final class EmojiPagerContentComponent: Component {
} }
let baseItemFrame = itemLayout.frame(groupIndex: groupItems.groupIndex, itemIndex: collapsedItemIndex) let baseItemFrame = itemLayout.frame(groupIndex: groupItems.groupIndex, itemIndex: collapsedItemIndex)
let buttonSize = groupExpandActionButton.update(theme: theme, title: collapsedItemText) let buttonSize = groupExpandActionButton.update(theme: keyboardChildEnvironment.theme, title: collapsedItemText)
let buttonFrame = CGRect(origin: CGPoint(x: baseItemFrame.minX + floor((baseItemFrame.width - buttonSize.width) / 2.0), y: baseItemFrame.minY + floor((baseItemFrame.height - buttonSize.height) / 2.0)), size: buttonSize) let buttonFrame = CGRect(origin: CGPoint(x: baseItemFrame.minX + floor((baseItemFrame.width - buttonSize.width) / 2.0), y: baseItemFrame.minY + floor((baseItemFrame.height - buttonSize.height) / 2.0)), size: buttonSize)
groupExpandActionButtonTransition.setFrame(view: groupExpandActionButton, frame: buttonFrame) groupExpandActionButtonTransition.setFrame(view: groupExpandActionButton, frame: buttonFrame)
} }
@ -3338,8 +3337,8 @@ public final class EmojiPagerContentComponent: Component {
staticEmoji: item.staticEmoji, staticEmoji: item.staticEmoji,
cache: component.animationCache, cache: component.animationCache,
renderer: component.animationRenderer, renderer: component.animationRenderer,
placeholderColor: theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1), placeholderColor: keyboardChildEnvironment.theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1),
blurredBadgeColor: theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5), blurredBadgeColor: keyboardChildEnvironment.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5),
pointSize: item.staticEmoji == nil ? itemPlaybackSize : itemVisibleFitSize, pointSize: item.staticEmoji == nil ? itemPlaybackSize : itemVisibleFitSize,
onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in
guard let strongSelf = self else { guard let strongSelf = self else {
@ -3421,7 +3420,7 @@ public final class EmojiPagerContentComponent: Component {
if itemGroup.displayPremiumBadges, let file = item.file, file.isPremiumSticker { if itemGroup.displayPremiumBadges, let file = item.file, file.isPremiumSticker {
badge = .premium badge = .premium
} }
itemLayer.update(transition: transition, size: itemFrame.size, badge: badge, blurredBadgeColor: UIColor(white: 0.0, alpha: 0.1), blurredBadgeBackgroundColor: theme.list.plainBackgroundColor) itemLayer.update(transition: transition, size: itemFrame.size, badge: badge, blurredBadgeColor: UIColor(white: 0.0, alpha: 0.1), blurredBadgeBackgroundColor: keyboardChildEnvironment.theme.list.plainBackgroundColor)
if let placeholderView = self.visibleItemPlaceholderViews[itemId] { if let placeholderView = self.visibleItemPlaceholderViews[itemId] {
if placeholderView.layer.position != itemPosition || placeholderView.layer.bounds != itemBounds { if placeholderView.layer.position != itemPosition || placeholderView.layer.bounds != itemBounds {
@ -3566,7 +3565,7 @@ public final class EmojiPagerContentComponent: Component {
} }
public func pagerUpdateBackground(backgroundFrame: CGRect, transition: Transition) { public func pagerUpdateBackground(backgroundFrame: CGRect, transition: Transition) {
guard let theme = self.theme else { guard let keyboardChildEnvironment = self.keyboardChildEnvironment else {
return return
} }
@ -3584,7 +3583,7 @@ public final class EmojiPagerContentComponent: Component {
vibrancyEffectView.contentView.addSubview(self.mirrorContentScrollView) vibrancyEffectView.contentView.addSubview(self.mirrorContentScrollView)
} }
self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.backgroundColor, enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition) self.backgroundView.updateColor(color: keyboardChildEnvironment.theme.chat.inputMediaPanel.backgroundColor, enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition)
transition.setFrame(view: self.backgroundView, frame: backgroundFrame) transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition) self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition)
@ -3604,7 +3603,7 @@ public final class EmojiPagerContentComponent: Component {
let keyboardChildEnvironment = environment[EntityKeyboardChildEnvironment.self].value let keyboardChildEnvironment = environment[EntityKeyboardChildEnvironment.self].value
let pagerEnvironment = environment[PagerComponentChildEnvironment.self].value let pagerEnvironment = environment[PagerComponentChildEnvironment.self].value
self.theme = keyboardChildEnvironment.theme self.keyboardChildEnvironment = keyboardChildEnvironment
self.activeItemUpdated = keyboardChildEnvironment.getContentActiveItemUpdated(component.id) self.activeItemUpdated = keyboardChildEnvironment.getContentActiveItemUpdated(component.id)
self.pagerEnvironment = pagerEnvironment self.pagerEnvironment = pagerEnvironment

View File

@ -13,13 +13,16 @@ import SwiftSignalKit
public final class EntityKeyboardChildEnvironment: Equatable { public final class EntityKeyboardChildEnvironment: Equatable {
public let theme: PresentationTheme public let theme: PresentationTheme
public let strings: PresentationStrings
public let getContentActiveItemUpdated: (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>? public let getContentActiveItemUpdated: (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
public init( public init(
theme: PresentationTheme, theme: PresentationTheme,
strings: PresentationStrings,
getContentActiveItemUpdated: @escaping (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>? getContentActiveItemUpdated: @escaping (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
) { ) {
self.theme = theme self.theme = theme
self.strings = strings
self.getContentActiveItemUpdated = getContentActiveItemUpdated self.getContentActiveItemUpdated = getContentActiveItemUpdated
} }
@ -27,6 +30,9 @@ public final class EntityKeyboardChildEnvironment: Equatable {
if lhs.theme !== rhs.theme { if lhs.theme !== rhs.theme {
return false return false
} }
if lhs.strings !== rhs.strings {
return false
}
return true return true
} }
@ -74,6 +80,7 @@ public final class EntityKeyboardComponent: Component {
} }
public let theme: PresentationTheme public let theme: PresentationTheme
public let strings: PresentationStrings
public let containerInsets: UIEdgeInsets public let containerInsets: UIEdgeInsets
public let emojiContent: EmojiPagerContentComponent public let emojiContent: EmojiPagerContentComponent
public let stickerContent: EmojiPagerContentComponent? public let stickerContent: EmojiPagerContentComponent?
@ -93,6 +100,7 @@ public final class EntityKeyboardComponent: Component {
public init( public init(
theme: PresentationTheme, theme: PresentationTheme,
strings: PresentationStrings,
containerInsets: UIEdgeInsets, containerInsets: UIEdgeInsets,
emojiContent: EmojiPagerContentComponent, emojiContent: EmojiPagerContentComponent,
stickerContent: EmojiPagerContentComponent?, stickerContent: EmojiPagerContentComponent?,
@ -111,6 +119,7 @@ public final class EntityKeyboardComponent: Component {
isExpanded: Bool isExpanded: Bool
) { ) {
self.theme = theme self.theme = theme
self.strings = strings
self.containerInsets = containerInsets self.containerInsets = containerInsets
self.emojiContent = emojiContent self.emojiContent = emojiContent
self.stickerContent = stickerContent self.stickerContent = stickerContent
@ -133,6 +142,9 @@ public final class EntityKeyboardComponent: Component {
if lhs.theme !== rhs.theme { if lhs.theme !== rhs.theme {
return false return false
} }
if lhs.strings !== rhs.strings {
return false
}
if lhs.containerInsets != rhs.containerInsets { if lhs.containerInsets != rhs.containerInsets {
return false return false
} }
@ -227,7 +239,6 @@ public final class EntityKeyboardComponent: Component {
if let gifContent = component.gifContent { if let gifContent = component.gifContent {
contents.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(gifContent))) contents.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(gifContent)))
var topGifItems: [EntityKeyboardTopPanelComponent.Item] = [] var topGifItems: [EntityKeyboardTopPanelComponent.Item] = []
//TODO:localize
if component.hasRecentGifs { if component.hasRecentGifs {
topGifItems.append(EntityKeyboardTopPanelComponent.Item( topGifItems.append(EntityKeyboardTopPanelComponent.Item(
id: "recent", id: "recent",
@ -235,7 +246,7 @@ public final class EntityKeyboardComponent: Component {
content: AnyComponent(EntityKeyboardIconTopPanelComponent( content: AnyComponent(EntityKeyboardIconTopPanelComponent(
icon: .recent, icon: .recent,
theme: component.theme, theme: component.theme,
title: "Recent", title: component.strings.Stickers_Recent,
pressed: { [weak self] in pressed: { [weak self] in
self?.component?.switchToGifSubject(.recent) self?.component?.switchToGifSubject(.recent)
} }
@ -248,7 +259,7 @@ public final class EntityKeyboardComponent: Component {
content: AnyComponent(EntityKeyboardIconTopPanelComponent( content: AnyComponent(EntityKeyboardIconTopPanelComponent(
icon: .trending, icon: .trending,
theme: component.theme, theme: component.theme,
title: "Trending", title: component.strings.Stickers_Trending,
pressed: { [weak self] in pressed: { [weak self] in
self?.component?.switchToGifSubject(.trending) self?.component?.switchToGifSubject(.trending)
} }
@ -307,14 +318,13 @@ public final class EntityKeyboardComponent: Component {
if let stickerContent = component.stickerContent { if let stickerContent = component.stickerContent {
var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = [] var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = []
//TODO:localize
topStickerItems.append(EntityKeyboardTopPanelComponent.Item( topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
id: "featuredTop", id: "featuredTop",
isReorderable: false, isReorderable: false,
content: AnyComponent(EntityKeyboardIconTopPanelComponent( content: AnyComponent(EntityKeyboardIconTopPanelComponent(
icon: .featured, icon: .featured,
theme: component.theme, theme: component.theme,
title: "Featured", title: component.strings.Stickers_Trending,
pressed: { [weak self] in pressed: { [weak self] in
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured() self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured()
} }
@ -328,11 +338,10 @@ public final class EntityKeyboardComponent: Component {
"recent": .recent, "recent": .recent,
"premium": .premium "premium": .premium
] ]
//TODO:localize
let titleMapping: [String: String] = [ let titleMapping: [String: String] = [
"saved": "Saved", "saved": component.strings.Stickers_Favorites,
"recent": "Recent", "recent": component.strings.Stickers_Recent,
"premium": "Premium" "premium": component.strings.EmojiInput_PanelTitlePremium
] ]
if let icon = iconMapping[id], let title = titleMapping[id] { if let icon = iconMapping[id], let title = titleMapping[id] {
topStickerItems.append(EntityKeyboardTopPanelComponent.Item( topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
@ -419,9 +428,8 @@ public final class EntityKeyboardComponent: Component {
let iconMapping: [String: EntityKeyboardIconTopPanelComponent.Icon] = [ let iconMapping: [String: EntityKeyboardIconTopPanelComponent.Icon] = [
"recent": .recent, "recent": .recent,
] ]
//TODO:localize
let titleMapping: [String: String] = [ let titleMapping: [String: String] = [
"recent": "Recent", "recent": component.strings.Stickers_Recent,
] ]
if let icon = iconMapping[id], let title = titleMapping[id] { if let icon = iconMapping[id], let title = titleMapping[id] {
topEmojiItems.append(EntityKeyboardTopPanelComponent.Item( topEmojiItems.append(EntityKeyboardTopPanelComponent.Item(
@ -438,13 +446,12 @@ public final class EntityKeyboardComponent: Component {
)) ))
} }
} else if id == "static" { } else if id == "static" {
//TODO:localize
topEmojiItems.append(EntityKeyboardTopPanelComponent.Item( topEmojiItems.append(EntityKeyboardTopPanelComponent.Item(
id: itemGroup.supergroupId, id: itemGroup.supergroupId,
isReorderable: false, isReorderable: false,
content: AnyComponent(EntityKeyboardStaticStickersPanelComponent( content: AnyComponent(EntityKeyboardStaticStickersPanelComponent(
theme: component.theme, theme: component.theme,
title: "Emoji", title: component.strings.EmojiInput_PanelTitleEmoji,
pressed: { [weak self] subgroupId in pressed: { [weak self] subgroupId in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
@ -538,10 +545,7 @@ public final class EntityKeyboardComponent: Component {
contentAccessoryLeftButtons: contentAccessoryLeftButtons, contentAccessoryLeftButtons: contentAccessoryLeftButtons,
contentAccessoryRightButtons: contentAccessoryRightButtons, contentAccessoryRightButtons: contentAccessoryRightButtons,
defaultId: component.defaultToEmojiTab ? "emoji" : "stickers", defaultId: component.defaultToEmojiTab ? "emoji" : "stickers",
contentBackground: nil/*AnyComponent(BlurredBackgroundComponent( contentBackground: nil,
color: component.theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75),
tintContainerView: self.tintContainerView
))*/,
topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent( topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent(
theme: component.theme, theme: component.theme,
overflowHeight: component.hiddenInputHeight, overflowHeight: component.hiddenInputHeight,
@ -573,6 +577,7 @@ public final class EntityKeyboardComponent: Component {
environment: { environment: {
EntityKeyboardChildEnvironment( EntityKeyboardChildEnvironment(
theme: component.theme, theme: component.theme,
strings: component.strings,
getContentActiveItemUpdated: { id in getContentActiveItemUpdated: { id in
if id == AnyHashable("gifs") { if id == AnyHashable("gifs") {
return gifsContentItemIdUpdated return gifsContentItemIdUpdated

View File

@ -7123,9 +7123,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}) })
if let firstLockedPremiumEmoji = firstLockedPremiumEmoji { if let firstLockedPremiumEmoji = firstLockedPremiumEmoji {
//let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
//TODO:localize strongSelf.controllerInteraction?.displayUndo(.sticker(context: strongSelf.context, file: firstLockedPremiumEmoji, title: nil, text: presentationData.strings.EmojiInput_PremiumEmojiToast_Text, undoText: presentationData.strings.EmojiInput_PremiumEmojiToast_Action, customAction: {
strongSelf.controllerInteraction?.displayUndo(.sticker(context: strongSelf.context, file: firstLockedPremiumEmoji, title: nil, text: "Subscribe to Telegram Premium to unlock premium emoji.", undoText: "More", customAction: {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }

View File

@ -2895,9 +2895,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
}) })
if let firstLockedPremiumEmoji = firstLockedPremiumEmoji { if let firstLockedPremiumEmoji = firstLockedPremiumEmoji {
//let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
//TODO:localize self.controllerInteraction.displayUndo(.sticker(context: context, file: firstLockedPremiumEmoji, title: nil, text: presentationData.strings.EmojiInput_PremiumEmojiToast_Text, undoText: presentationData.strings.EmojiInput_PremiumEmojiToast_Action, customAction: { [weak self] in
self.controllerInteraction.displayUndo(.sticker(context: context, file: firstLockedPremiumEmoji, title: nil, text: "Subscribe to Telegram Premium to unlock premium emoji.", undoText: "More", customAction: { [weak self] in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }

View File

@ -99,6 +99,8 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 }) let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
let emojiItems: Signal<EmojiPagerContentComponent, NoError> = combineLatest( let emojiItems: Signal<EmojiPagerContentComponent, NoError> = combineLatest(
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [Namespaces.OrderedItemList.LocalRecentEmoji], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000), context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [Namespaces.OrderedItemList.LocalRecentEmoji], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000),
hasPremium, hasPremium,
@ -160,8 +162,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
itemGroups[groupIndex].items.append(resultItem) itemGroups[groupIndex].items.append(resultItem)
} else { } else {
itemGroupIndexById[groupId] = itemGroups.count itemGroupIndexById[groupId] = itemGroups.count
//TODO:localize itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.Stickers_FrequentlyUsed, subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Recently Used", subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
} }
} }
} }
@ -179,8 +180,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
itemGroups[groupIndex].items.append(resultItem) itemGroups[groupIndex].items.append(resultItem)
} else { } else {
itemGroupIndexById[groupId] = itemGroups.count itemGroupIndexById[groupId] = itemGroups.count
//TODO:localize itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitleEmoji, subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Emoji", subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
} }
} }
} }
@ -418,8 +418,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
itemGroups[groupIndex].items.append(resultItem) itemGroups[groupIndex].items.append(resultItem)
} else { } else {
itemGroupIndexById[groupId] = itemGroups.count itemGroupIndexById[groupId] = itemGroups.count
//TODO:localize itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitleFavoriteStickers, subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Saved", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
} }
} }
} }
@ -444,8 +443,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
itemGroups[groupIndex].items.append(resultItem) itemGroups[groupIndex].items.append(resultItem)
} else { } else {
itemGroupIndexById[groupId] = itemGroups.count itemGroupIndexById[groupId] = itemGroups.count
//TODO:localize itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.Stickers_FrequentlyUsed, subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Recently Used", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
} }
} }
} }
@ -489,8 +487,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
itemGroups[groupIndex].items.append(resultItem) itemGroups[groupIndex].items.append(resultItem)
} else { } else {
itemGroupIndexById[groupId] = itemGroups.count itemGroupIndexById[groupId] = itemGroups.count
//TODO:localize itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitlePremiumStickers, subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Premium", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
} }
} }
} }
@ -1014,11 +1011,9 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
strongSelf.currentUndoOverlayController = nil strongSelf.currentUndoOverlayController = nil
animateInAsReplacement = true animateInAsReplacement = true
} }
//TODO:localize
let presentationData = context.sharedContext.currentPresentationData.with { $0 } let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let controller = UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: "Subscribe to Telegram Premium to unlock this emoji.", undoText: "More", customAction: { [weak controllerInteraction] in let controller = UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: presentationData.strings.EmojiInput_PremiumEmojiToast_Text, undoText: presentationData.strings.EmojiInput_PremiumEmojiToast_Action, customAction: { [weak controllerInteraction] in
guard let controllerInteraction = controllerInteraction else { guard let controllerInteraction = controllerInteraction else {
return return
} }
@ -1545,6 +1540,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
transition: mappedTransition, transition: mappedTransition,
component: AnyComponent(EntityKeyboardComponent( component: AnyComponent(EntityKeyboardComponent(
theme: interfaceState.theme, theme: interfaceState.theme,
strings: interfaceState.strings,
containerInsets: UIEdgeInsets(top: 0.0, left: leftInset, bottom: bottomInset, right: rightInset), containerInsets: UIEdgeInsets(top: 0.0, left: leftInset, bottom: bottomInset, right: rightInset),
emojiContent: self.currentInputData.emoji, emojiContent: self.currentInputData.emoji,
stickerContent: stickerContent, stickerContent: stickerContent,
@ -1993,10 +1989,8 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
} }
if file.isPremiumEmoji && !hasPremium { if file.isPremiumEmoji && !hasPremium {
//TODO:localize
let presentationData = context.sharedContext.currentPresentationData.with { $0 } let presentationData = context.sharedContext.currentPresentationData.with { $0 }
strongSelf.presentController?(UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: "Subscribe to Telegram Premium to unlock this emoji.", undoText: "More", customAction: { strongSelf.presentController?(UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: presentationData.strings.EmojiInput_PremiumEmojiToast_Text, undoText: presentationData.strings.EmojiInput_PremiumEmojiToast_Action, customAction: {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }