Improve giveaway localization

This commit is contained in:
Ilya Laktyushin 2023-12-23 21:40:24 +04:00
parent 624155ae99
commit ca31e5eac8
5 changed files with 13 additions and 15 deletions

View File

@ -10379,6 +10379,8 @@ Sorry for the inconvenience.";
"Chat.Giveaway.Message.PrizeText" = "%1$@ for %2$@."; "Chat.Giveaway.Message.PrizeText" = "%1$@ for %2$@.";
"Chat.Giveaway.Message.Subscriptions_1" = "**%@** Telegram Premium Subscription"; "Chat.Giveaway.Message.Subscriptions_1" = "**%@** Telegram Premium Subscription";
"Chat.Giveaway.Message.Subscriptions_any" = "**%@** Telegram Premium Subscriptions"; "Chat.Giveaway.Message.Subscriptions_any" = "**%@** Telegram Premium Subscriptions";
"Chat.Giveaway.Message.WithSubscriptions_1" = "**%@** Telegram Premium Subscription";
"Chat.Giveaway.Message.WithSubscriptions_any" = "**%@** Telegram Premium Subscriptions";
"Chat.Giveaway.Message.Months_1" = "**%@** month"; "Chat.Giveaway.Message.Months_1" = "**%@** month";
"Chat.Giveaway.Message.Months_any" = "**%@** months"; "Chat.Giveaway.Message.Months_any" = "**%@** months";
"Chat.Giveaway.Message.ParticipantsTitle" = "Participants"; "Chat.Giveaway.Message.ParticipantsTitle" = "Participants";
@ -10392,6 +10394,8 @@ Sorry for the inconvenience.";
"Chat.Giveaway.Message.DateTitle" = "Winners Selection Date"; "Chat.Giveaway.Message.DateTitle" = "Winners Selection Date";
"Chat.Giveaway.Message.LearnMore" = "LEARN MORE"; "Chat.Giveaway.Message.LearnMore" = "LEARN MORE";
"Chat.Giveaway.Message.With" = "with"; "Chat.Giveaway.Message.With" = "with";
"Chat.Giveaway.Message.CustomPrizeQuantity_1" = "%@";
"Chat.Giveaway.Message.CustomPrizeQuantity_any" = "%@";
"GiftLink.Title" = "Gift Link"; "GiftLink.Title" = "Gift Link";
"GiftLink.UsedTitle" = "Used Gift Link"; "GiftLink.UsedTitle" = "Used Gift Link";

View File

@ -298,7 +298,8 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode,
var trimSubscriptionCount = false var trimSubscriptionCount = false
if let prizeDescription { if let prizeDescription {
additionalPrizeSeparatorString = NSAttributedString(string: item.presentationData.strings.Chat_Giveaway_Message_With, font: textFont, textColor: secondaryTextColor) additionalPrizeSeparatorString = NSAttributedString(string: item.presentationData.strings.Chat_Giveaway_Message_With, font: textFont, textColor: secondaryTextColor)
additionalPrizeTextString = parseMarkdownIntoAttributedString("**\(giveaway.quantity)** \(prizeDescription)", attributes: MarkdownAttributes( let quantityString = item.presentationData.strings.Chat_Giveaway_Message_CustomPrizeQuantity(giveaway.quantity)
additionalPrizeTextString = parseMarkdownIntoAttributedString("**\(quantityString)** \(prizeDescription)", attributes: MarkdownAttributes(
body: MarkdownAttributeSet(font: textFont, textColor: textColor), body: MarkdownAttributeSet(font: textFont, textColor: textColor),
bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor),
link: MarkdownAttributeSet(font: textFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: textColor),
@ -311,6 +312,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode,
var subscriptionsString = item.presentationData.strings.Chat_Giveaway_Message_Subscriptions(giveaway.quantity) var subscriptionsString = item.presentationData.strings.Chat_Giveaway_Message_Subscriptions(giveaway.quantity)
if trimSubscriptionCount { if trimSubscriptionCount {
subscriptionsString = item.presentationData.strings.Chat_Giveaway_Message_WithSubscriptions(giveaway.quantity)
subscriptionsString = subscriptionsString.replacingOccurrences(of: "**\(giveaway.quantity)** ", with: "") subscriptionsString = subscriptionsString.replacingOccurrences(of: "**\(giveaway.quantity)** ", with: "")
} }

View File

@ -126,7 +126,7 @@ final class MediaEditorComposer {
} }
var previousAdditionalInput: Input? var previousAdditionalInput: Input?
func process(main: Input, additional: Input?, pool: CVPixelBufferPool?, completion: @escaping (CVPixelBuffer?) -> Void) { func process(main: Input, additional: Input?, timestamp: CMTime, pool: CVPixelBufferPool?, completion: @escaping (CVPixelBuffer?) -> Void) {
guard let pool, let ciContext = self.ciContext else { guard let pool, let ciContext = self.ciContext else {
completion(nil) completion(nil)
return return
@ -148,9 +148,7 @@ final class MediaEditorComposer {
CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, pool, &pixelBuffer) CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, pool, &pixelBuffer)
if let pixelBuffer { if let pixelBuffer {
let time = main.timestamp makeEditorImageFrameComposition(context: ciContext, inputImage: ciImage, drawingImage: self.drawingImage, dimensions: self.dimensions, outputDimensions: self.outputDimensions, values: self.values, entities: self.entities, time: timestamp, completion: { compositedImage in
makeEditorImageFrameComposition(context: ciContext, inputImage: ciImage, drawingImage: self.drawingImage, dimensions: self.dimensions, outputDimensions: self.outputDimensions, values: self.values, entities: self.entities, time: time, completion: { compositedImage in
if var compositedImage { if var compositedImage {
let scale = self.outputDimensions.width / compositedImage.extent.width let scale = self.outputDimensions.width / compositedImage.extent.width
compositedImage = compositedImage.samplingLinear().transformed(by: CGAffineTransform(scaleX: scale, y: scale)) compositedImage = compositedImage.samplingLinear().transformed(by: CGAffineTransform(scaleX: scale, y: scale))

View File

@ -797,6 +797,7 @@ public final class MediaEditorVideoExport {
composer.process( composer.process(
main: mainInput!, main: mainInput!,
additional: additionalInput, additional: additionalInput,
timestamp: timestamp,
pool: writer.pixelBufferPool, pool: writer.pixelBufferPool,
completion: { pixelBuffer in completion: { pixelBuffer in
if let pixelBuffer { if let pixelBuffer {
@ -805,10 +806,6 @@ public final class MediaEditorVideoExport {
appendFailed = true appendFailed = true
} }
} else { } else {
// if !writer.appendVideoBuffer(sampleBuffer) {
// writer.markVideoAsFinished()
// appendFailed = true
// }
appendFailed = true appendFailed = true
} }
self.semaphore.signal() self.semaphore.signal()
@ -882,9 +879,6 @@ public final class MediaEditorVideoExport {
self.internalStatus = .exporting self.internalStatus = .exporting
if let timeRange = self.reader?.timeRange {
print("reader timerange: \(timeRange)")
}
writer.startSession(atSourceTime: self.reader?.timeRange.start ?? .zero) writer.startSession(atSourceTime: self.reader?.timeRange.start ?? .zero)
var videoCompleted = false var videoCompleted = false

View File

@ -595,9 +595,9 @@ final class StoryItemSetViewListComponent: Component {
component.openPeer(peer) component.openPeer(peer)
} }
}, },
contextAction: item.peer.id != component.context.account.peerId ? { peer, view, gesture in contextAction: component.peerId.isGroupOrChannel || item.peer.id == component.context.account.peerId ? nil : { peer, view, gesture in
component.peerContextAction(peer, view, gesture) component.peerContextAction(peer, view, gesture)
} : nil, },
openStories: { [weak self] peer, avatarNode in openStories: { [weak self] peer, avatarNode in
guard let self, let component = self.component else { guard let self, let component = self.component else {
return return