mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-06 17:00:13 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
5986a4d3b1
@ -7913,3 +7913,19 @@ Sorry for the inconvenience.";
|
||||
|
||||
"StickerPack.CopyLinks" = "Copy Links";
|
||||
"Conversation.LinksCopied" = "Links copied to clipboard";
|
||||
|
||||
"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";
|
||||
|
||||
@ -568,8 +568,7 @@ private func installedStickerPacksControllerEntries(presentationData: Presentati
|
||||
}
|
||||
entries.append(.masks(presentationData.theme, presentationData.strings.MaskStickerSettings_Title))
|
||||
|
||||
//TODO:localize
|
||||
entries.append(.emoji(presentationData.theme, "Emoji"))
|
||||
entries.append(.emoji(presentationData.theme, presentationData.strings.StickersList_EmojiItem))
|
||||
|
||||
entries.append(.quickReaction(presentationData.strings.Settings_QuickReactionSetup_NavigationTitle, quickReactionImage))
|
||||
|
||||
@ -614,8 +613,7 @@ private func installedStickerPacksControllerEntries(presentationData: Presentati
|
||||
}
|
||||
case .emoji:
|
||||
if let archived = archived, !archived.isEmpty {
|
||||
//TODO:localize
|
||||
entries.append(.archived(presentationData.theme, "Archived Emoji", Int32(archived.count), archived))
|
||||
entries.append(.archived(presentationData.theme, presentationData.strings.StickersList_ArchivedEmojiItem, Int32(archived.count), archived))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -300,8 +300,47 @@ public func foldLineBreaks(_ text: String) -> String {
|
||||
}
|
||||
|
||||
public func foldLineBreaks(_ text: NSAttributedString) -> NSAttributedString {
|
||||
//TODO:localize
|
||||
return text
|
||||
let remainingString = NSMutableAttributedString(attributedString: 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 {
|
||||
|
||||
@ -1717,35 +1717,38 @@ public final class EmojiPagerContentComponent: Component {
|
||||
private let shimmerView: PortalSourceView?
|
||||
private var placeholderView: PortalView?
|
||||
private let placeholderMaskLayer: SimpleLayer
|
||||
private var placeholderImageView: UIImageView?
|
||||
|
||||
public init(
|
||||
context: AccountContext,
|
||||
file: TelegramMediaFile,
|
||||
shimmerView: PortalSourceView?,
|
||||
color: UIColor?,
|
||||
color: UIColor,
|
||||
size: CGSize
|
||||
) {
|
||||
self.shimmerView = shimmerView
|
||||
self.placeholderView = PortalView()
|
||||
self.placeholderMaskLayer = SimpleLayer()
|
||||
|
||||
super.init(frame: CGRect())
|
||||
|
||||
if let placeholderView = self.placeholderView, let shimmerView = self.shimmerView {
|
||||
if let shimmerView = self.shimmerView, let placeholderView = PortalView() {
|
||||
self.placeholderView = placeholderView
|
||||
|
||||
placeholderView.view.clipsToBounds = true
|
||||
placeholderView.view.layer.mask = self.placeholderMaskLayer
|
||||
self.addSubview(placeholderView.view)
|
||||
shimmerView.addPortal(view: placeholderView)
|
||||
}
|
||||
|
||||
let useDirectContent = self.placeholderView == nil
|
||||
Queue.concurrentDefaultQueue().async { [weak self] in
|
||||
if let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: size, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: color ?? .black) {
|
||||
if let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: size, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: useDirectContent ? color : .black) {
|
||||
Queue.mainQueue().async {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
if let _ = color {
|
||||
if useDirectContent {
|
||||
strongSelf.layer.contents = image.cgImage
|
||||
} else {
|
||||
strongSelf.placeholderMaskLayer.contents = image.cgImage
|
||||
@ -2144,7 +2147,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
private var component: EmojiPagerContentComponent?
|
||||
private weak var state: EmptyComponentState?
|
||||
private var pagerEnvironment: PagerComponentChildEnvironment?
|
||||
private var theme: PresentationTheme?
|
||||
private var keyboardChildEnvironment: EntityKeyboardChildEnvironment?
|
||||
private var activeItemUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
|
||||
private var itemLayout: ItemLayout?
|
||||
|
||||
@ -3010,7 +3013,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@ -3089,7 +3092,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
|
||||
let (groupHeaderSize, centralContentWidth) = groupHeaderView.update(
|
||||
context: component.context,
|
||||
theme: theme,
|
||||
theme: keyboardChildEnvironment.theme,
|
||||
layoutType: itemLayout.layoutType,
|
||||
hasTopSeparator: hasTopSeparator,
|
||||
actionButtonTitle: actionButtonTitle,
|
||||
@ -3130,7 +3133,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
self.scrollView.layer.insertSublayer(groupBorderLayer, at: 0)
|
||||
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.lineWidth = 1.6
|
||||
groupBorderLayer.lineCap = .round
|
||||
@ -3198,7 +3201,6 @@ public final class EmojiPagerContentComponent: Component {
|
||||
let groupId = itemGroup.groupId
|
||||
let isPremiumLocked = itemGroup.isPremiumLocked
|
||||
|
||||
//TODO:localize
|
||||
let title: String
|
||||
let backgroundColor: UIColor
|
||||
let backgroundColors: [UIColor]
|
||||
@ -3206,7 +3208,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
let animationName: String?
|
||||
let gloss: Bool
|
||||
if itemGroup.isPremiumLocked {
|
||||
title = "Unlock \(itemGroup.title ?? "Emoji")"
|
||||
title = keyboardChildEnvironment.strings.EmojiInput_UnlockPack(itemGroup.title ?? "Emoji").string
|
||||
backgroundColors = [
|
||||
UIColor(rgb: 0x0077ff),
|
||||
UIColor(rgb: 0x6b93ff),
|
||||
@ -3218,10 +3220,10 @@ public final class EmojiPagerContentComponent: Component {
|
||||
animationName = "premium_unlock"
|
||||
gloss = true
|
||||
} else {
|
||||
title = "Add \(itemGroup.title ?? "Emoji")"
|
||||
title = keyboardChildEnvironment.strings.EmojiInput_AddPack(itemGroup.title ?? "Emoji").string
|
||||
backgroundColors = []
|
||||
backgroundColor = theme.list.itemCheckColors.fillColor
|
||||
foregroundColor = theme.list.itemCheckColors.foregroundColor
|
||||
backgroundColor = keyboardChildEnvironment.theme.list.itemCheckColors.fillColor
|
||||
foregroundColor = keyboardChildEnvironment.theme.list.itemCheckColors.foregroundColor
|
||||
animationName = nil
|
||||
gloss = false
|
||||
}
|
||||
@ -3291,7 +3293,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
}
|
||||
|
||||
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)
|
||||
groupExpandActionButtonTransition.setFrame(view: groupExpandActionButton, frame: buttonFrame)
|
||||
}
|
||||
@ -3330,6 +3332,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
itemTransition = .immediate
|
||||
animateItemIn = !transition.animation.isImmediate
|
||||
|
||||
let placeholderColor = keyboardChildEnvironment.theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1)
|
||||
itemLayer = ItemLayer(
|
||||
item: item,
|
||||
context: component.context,
|
||||
@ -3338,8 +3341,8 @@ public final class EmojiPagerContentComponent: Component {
|
||||
staticEmoji: item.staticEmoji,
|
||||
cache: component.animationCache,
|
||||
renderer: component.animationRenderer,
|
||||
placeholderColor: theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1),
|
||||
blurredBadgeColor: theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5),
|
||||
placeholderColor: placeholderColor,
|
||||
blurredBadgeColor: keyboardChildEnvironment.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5),
|
||||
pointSize: item.staticEmoji == nil ? itemPlaybackSize : itemVisibleFitSize,
|
||||
onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in
|
||||
guard let strongSelf = self else {
|
||||
@ -3355,7 +3358,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
context: component.context,
|
||||
file: file,
|
||||
shimmerView: strongSelf.shimmerHostView,
|
||||
color: nil,
|
||||
color: placeholderColor,
|
||||
size: itemNativeFitSize
|
||||
)
|
||||
strongSelf.visibleItemPlaceholderViews[itemId] = placeholderView
|
||||
@ -3421,7 +3424,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
if itemGroup.displayPremiumBadges, let file = item.file, file.isPremiumSticker {
|
||||
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 placeholderView.layer.position != itemPosition || placeholderView.layer.bounds != itemBounds {
|
||||
@ -3566,7 +3569,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
}
|
||||
|
||||
public func pagerUpdateBackground(backgroundFrame: CGRect, transition: Transition) {
|
||||
guard let theme = self.theme else {
|
||||
guard let keyboardChildEnvironment = self.keyboardChildEnvironment else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -3584,7 +3587,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
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)
|
||||
self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition)
|
||||
|
||||
@ -3604,7 +3607,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
let keyboardChildEnvironment = environment[EntityKeyboardChildEnvironment.self].value
|
||||
let pagerEnvironment = environment[PagerComponentChildEnvironment.self].value
|
||||
|
||||
self.theme = keyboardChildEnvironment.theme
|
||||
self.keyboardChildEnvironment = keyboardChildEnvironment
|
||||
self.activeItemUpdated = keyboardChildEnvironment.getContentActiveItemUpdated(component.id)
|
||||
|
||||
self.pagerEnvironment = pagerEnvironment
|
||||
|
||||
@ -13,13 +13,16 @@ import SwiftSignalKit
|
||||
|
||||
public final class EntityKeyboardChildEnvironment: Equatable {
|
||||
public let theme: PresentationTheme
|
||||
public let strings: PresentationStrings
|
||||
public let getContentActiveItemUpdated: (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
|
||||
|
||||
public init(
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings,
|
||||
getContentActiveItemUpdated: @escaping (AnyHashable) -> ActionSlot<(AnyHashable, AnyHashable?, Transition)>?
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.getContentActiveItemUpdated = getContentActiveItemUpdated
|
||||
}
|
||||
|
||||
@ -27,6 +30,9 @@ public final class EntityKeyboardChildEnvironment: Equatable {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@ -74,6 +80,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
}
|
||||
|
||||
public let theme: PresentationTheme
|
||||
public let strings: PresentationStrings
|
||||
public let containerInsets: UIEdgeInsets
|
||||
public let emojiContent: EmojiPagerContentComponent
|
||||
public let stickerContent: EmojiPagerContentComponent?
|
||||
@ -93,6 +100,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
|
||||
public init(
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings,
|
||||
containerInsets: UIEdgeInsets,
|
||||
emojiContent: EmojiPagerContentComponent,
|
||||
stickerContent: EmojiPagerContentComponent?,
|
||||
@ -111,6 +119,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
isExpanded: Bool
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.containerInsets = containerInsets
|
||||
self.emojiContent = emojiContent
|
||||
self.stickerContent = stickerContent
|
||||
@ -133,6 +142,9 @@ public final class EntityKeyboardComponent: Component {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
if lhs.containerInsets != rhs.containerInsets {
|
||||
return false
|
||||
}
|
||||
@ -227,7 +239,6 @@ public final class EntityKeyboardComponent: Component {
|
||||
if let gifContent = component.gifContent {
|
||||
contents.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(gifContent)))
|
||||
var topGifItems: [EntityKeyboardTopPanelComponent.Item] = []
|
||||
//TODO:localize
|
||||
if component.hasRecentGifs {
|
||||
topGifItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
id: "recent",
|
||||
@ -235,7 +246,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||
icon: .recent,
|
||||
theme: component.theme,
|
||||
title: "Recent",
|
||||
title: component.strings.Stickers_Recent,
|
||||
pressed: { [weak self] in
|
||||
self?.component?.switchToGifSubject(.recent)
|
||||
}
|
||||
@ -248,7 +259,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||
icon: .trending,
|
||||
theme: component.theme,
|
||||
title: "Trending",
|
||||
title: component.strings.Stickers_Trending,
|
||||
pressed: { [weak self] in
|
||||
self?.component?.switchToGifSubject(.trending)
|
||||
}
|
||||
@ -307,14 +318,13 @@ public final class EntityKeyboardComponent: Component {
|
||||
if let stickerContent = component.stickerContent {
|
||||
var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = []
|
||||
|
||||
//TODO:localize
|
||||
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
id: "featuredTop",
|
||||
isReorderable: false,
|
||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||
icon: .featured,
|
||||
theme: component.theme,
|
||||
title: "Featured",
|
||||
title: component.strings.Stickers_Trending,
|
||||
pressed: { [weak self] in
|
||||
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured()
|
||||
}
|
||||
@ -328,11 +338,10 @@ public final class EntityKeyboardComponent: Component {
|
||||
"recent": .recent,
|
||||
"premium": .premium
|
||||
]
|
||||
//TODO:localize
|
||||
let titleMapping: [String: String] = [
|
||||
"saved": "Saved",
|
||||
"recent": "Recent",
|
||||
"premium": "Premium"
|
||||
"saved": component.strings.Stickers_Favorites,
|
||||
"recent": component.strings.Stickers_Recent,
|
||||
"premium": component.strings.EmojiInput_PanelTitlePremium
|
||||
]
|
||||
if let icon = iconMapping[id], let title = titleMapping[id] {
|
||||
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
@ -419,9 +428,8 @@ public final class EntityKeyboardComponent: Component {
|
||||
let iconMapping: [String: EntityKeyboardIconTopPanelComponent.Icon] = [
|
||||
"recent": .recent,
|
||||
]
|
||||
//TODO:localize
|
||||
let titleMapping: [String: String] = [
|
||||
"recent": "Recent",
|
||||
"recent": component.strings.Stickers_Recent,
|
||||
]
|
||||
if let icon = iconMapping[id], let title = titleMapping[id] {
|
||||
topEmojiItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
@ -438,13 +446,12 @@ public final class EntityKeyboardComponent: Component {
|
||||
))
|
||||
}
|
||||
} else if id == "static" {
|
||||
//TODO:localize
|
||||
topEmojiItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
id: itemGroup.supergroupId,
|
||||
isReorderable: false,
|
||||
content: AnyComponent(EntityKeyboardStaticStickersPanelComponent(
|
||||
theme: component.theme,
|
||||
title: "Emoji",
|
||||
title: component.strings.EmojiInput_PanelTitleEmoji,
|
||||
pressed: { [weak self] subgroupId in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
@ -538,10 +545,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
contentAccessoryLeftButtons: contentAccessoryLeftButtons,
|
||||
contentAccessoryRightButtons: contentAccessoryRightButtons,
|
||||
defaultId: component.defaultToEmojiTab ? "emoji" : "stickers",
|
||||
contentBackground: nil/*AnyComponent(BlurredBackgroundComponent(
|
||||
color: component.theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75),
|
||||
tintContainerView: self.tintContainerView
|
||||
))*/,
|
||||
contentBackground: nil,
|
||||
topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent(
|
||||
theme: component.theme,
|
||||
overflowHeight: component.hiddenInputHeight,
|
||||
@ -573,6 +577,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
environment: {
|
||||
EntityKeyboardChildEnvironment(
|
||||
theme: component.theme,
|
||||
strings: component.strings,
|
||||
getContentActiveItemUpdated: { id in
|
||||
if id == AnyHashable("gifs") {
|
||||
return gifsContentItemIdUpdated
|
||||
|
||||
@ -138,9 +138,9 @@ final class EntityKeyboardAnimationTopPanelComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
let iconFitSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 26.0, height: 26.0)
|
||||
let iconFitSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 24.0, height: 24.0)
|
||||
let iconSize = dimensions.aspectFitted(iconFitSize)
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((iconFitSize.height - iconSize.height) / 2.0)), size: iconSize)
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((iconFitSize.height - iconSize.height) / 2.0)), size: iconSize).insetBy(dx: -1.0, dy: -1.0)
|
||||
|
||||
if let itemLayer = self.itemLayer {
|
||||
transition.setPosition(layer: itemLayer, position: CGPoint(x: iconFrame.midX, y: iconFrame.midY))
|
||||
@ -464,7 +464,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
||||
self.isExpanded = isExpanded
|
||||
self.isActive = isActive
|
||||
self.baseItemSize = 42.0
|
||||
self.itemSize = isExpanded ? self.baseItemSize : 24.0
|
||||
self.itemSize = isExpanded ? self.baseItemSize : 26.0
|
||||
self.itemSpacing = 4.0
|
||||
self.sideInset = isExpanded ? 5.0 : 2.0
|
||||
self.itemOffset = isExpanded ? -8.0 : 0.0
|
||||
@ -608,13 +608,16 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
||||
animationName = "emojicat_flags"
|
||||
}
|
||||
|
||||
let color: UIColor
|
||||
let baseColor: UIColor
|
||||
if itemEnvironment.highlightedSubgroupId == AnyHashable(items[i].rawValue) {
|
||||
color = component.theme.chat.inputMediaPanel.panelHighlightedIconColor
|
||||
baseColor = component.theme.chat.inputMediaPanel.panelHighlightedIconColor
|
||||
} else {
|
||||
color = component.theme.chat.inputMediaPanel.panelIconColor
|
||||
baseColor = component.theme.chat.inputMediaPanel.panelIconColor
|
||||
}
|
||||
|
||||
let baseHighlightedColor = component.theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor.blitOver(component.theme.chat.inputPanel.panelBackgroundColor, alpha: 1.0)
|
||||
let color = baseColor.blitOver(baseHighlightedColor, alpha: 1.0)
|
||||
|
||||
let _ = itemTransition
|
||||
let _ = itemView.update(
|
||||
transition: .immediate,
|
||||
|
||||
@ -7123,9 +7123,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
})
|
||||
|
||||
if let firstLockedPremiumEmoji = firstLockedPremiumEmoji {
|
||||
//let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
//TODO:localize
|
||||
strongSelf.controllerInteraction?.displayUndo(.sticker(context: strongSelf.context, file: firstLockedPremiumEmoji, title: nil, text: "Subscribe to Telegram Premium to unlock premium emoji.", undoText: "More", customAction: {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controllerInteraction?.displayUndo(.sticker(context: strongSelf.context, file: firstLockedPremiumEmoji, title: nil, text: presentationData.strings.EmojiInput_PremiumEmojiToast_Text, undoText: presentationData.strings.EmojiInput_PremiumEmojiToast_Action, customAction: {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -2895,9 +2895,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
})
|
||||
|
||||
if let firstLockedPremiumEmoji = firstLockedPremiumEmoji {
|
||||
//let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
//TODO:localize
|
||||
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
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
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
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -99,6 +99,8 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
|
||||
|
||||
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
|
||||
|
||||
let emojiItems: Signal<EmojiPagerContentComponent, NoError> = combineLatest(
|
||||
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [Namespaces.OrderedItemList.LocalRecentEmoji], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000),
|
||||
hasPremium,
|
||||
@ -160,8 +162,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
//TODO:localize
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Recently Used", subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.Stickers_FrequentlyUsed, subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,8 +180,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
//TODO:localize
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Emoji", subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitleEmoji, subtitle: nil, isPremiumLocked: false, isFeatured: false, isExpandable: false, items: [resultItem]))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -418,8 +418,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
//TODO:localize
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Saved", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitleFavoriteStickers, 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)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
//TODO:localize
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Recently Used", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.Stickers_FrequentlyUsed, 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)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
//TODO:localize
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: "Premium", subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: strings.EmojiInput_SectionTitlePremiumStickers, subtitle: nil, actionButtonTitle: nil, isPremiumLocked: false, isFeatured: false, displayPremiumBadges: false, items: [resultItem]))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1014,11 +1011,9 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
strongSelf.currentUndoOverlayController = nil
|
||||
animateInAsReplacement = true
|
||||
}
|
||||
|
||||
//TODO:localize
|
||||
|
||||
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 {
|
||||
return
|
||||
}
|
||||
@ -1545,6 +1540,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
transition: mappedTransition,
|
||||
component: AnyComponent(EntityKeyboardComponent(
|
||||
theme: interfaceState.theme,
|
||||
strings: interfaceState.strings,
|
||||
containerInsets: UIEdgeInsets(top: 0.0, left: leftInset, bottom: bottomInset, right: rightInset),
|
||||
emojiContent: self.currentInputData.emoji,
|
||||
stickerContent: stickerContent,
|
||||
@ -1993,10 +1989,8 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
|
||||
}
|
||||
|
||||
if file.isPremiumEmoji && !hasPremium {
|
||||
//TODO:localize
|
||||
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -407,6 +407,8 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
if self.visibilityStatus != oldValue {
|
||||
self.updateVisibility()
|
||||
self.haptic?.enabled = self.visibilityStatus == true
|
||||
|
||||
self.replyInfoNode?.visibility = self.visibilityStatus == true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
|
||||
if wasVisible != isVisible {
|
||||
self.interactiveVideoNode.visibility = isVisible
|
||||
self.replyInfoNode?.visibility = isVisible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,25 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
|
||||
private var enableSynchronousImageApply: Bool = false
|
||||
|
||||
override var visibility: ListViewItemNodeVisibility {
|
||||
didSet {
|
||||
let wasVisible = oldValue != .none
|
||||
let isVisible = self.visibility != .none
|
||||
|
||||
if wasVisible != isVisible {
|
||||
self.visibilityStatus = isVisible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var visibilityStatus: Bool? {
|
||||
didSet {
|
||||
if self.visibilityStatus != oldValue {
|
||||
self.replyInfoNode?.visibility = self.visibilityStatus == true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
required init() {
|
||||
self.contextSourceNode = ContextExtractedContentContainingNode()
|
||||
self.containerNode = ContextControllerSourceNode()
|
||||
|
||||
@ -290,7 +290,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
||||
|
||||
var colors: [String: UIColor] = [:]
|
||||
for colorKey in colorKeys {
|
||||
colors[colorKey] = self.theme.chat.inputPanel.inputControlColor
|
||||
colors[colorKey] = self.theme.chat.inputPanel.inputControlColor.blitOver(self.theme.chat.inputPanel.inputBackgroundColor, alpha: 1.0)
|
||||
}
|
||||
|
||||
let animationSize = animationView.update(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user