Various fixes

This commit is contained in:
Ilya Laktyushin 2024-10-31 20:25:35 +04:00
parent 22b4b03caf
commit bc45193472
8 changed files with 35 additions and 40 deletions

View File

@ -13201,3 +13201,20 @@ Sorry for the inconvenience.";
"Chat.ScheduledForceSendProcessingVideo.Title" = "Wait!";
"Chat.ScheduledForceSendProcessingVideo.Text" = "This video hasn't been converted and optimized yet. If you send it now, the viewers of the video may experience slow download speed.";
"Chat.ScheduledForceSendProcessingVideo.Action" = "Send Anyway";
"Chat.HashtagSuggestion.UseGeneric.Title" = "Use %@";
"Chat.HashtagSuggestion.UseGeneric.Text" = "searches posts from all channels";
"Chat.HashtagSuggestion.UseLocal.Title" = "Use %@";
"Chat.HashtagSuggestion.UseLocal.Channel.Text" = "searches only posts from this channel";
"Chat.HashtagSuggestion.UseLocal.Group.Text" = "searches only posts from this group";
"Gift.Convert.Period.Text" = "Do you want to convert this gift from **%1$@** to **%2$@**?\n\nConversion is available for the next %3$@.\n\nThis will permanently destroy the gift.";
"Gift.Convert.Period.Stars_1" = "%@ Star";
"Gift.Convert.Period.Stars_any" = "%@ Stars";
"Gift.Convert.Period.Days_1" = "%@ day";
"Gift.Convert.Period.Days_any" = "%@ days";
"Gift.Convert.Period.Unavailable.Text" = "Sorry, you can't convert this gift.\n\nStars can only be claimed within %@ after receiving a gift.";
"Gift.Convert.Period.Unavailable.Days_1" = "%@ day";
"Gift.Convert.Period.Unavailable.Days_any" = "%@ days";

View File

@ -19,11 +19,13 @@ open class ChatInputContextPanelNode: ASDisplayNode {
open var interfaceInteraction: ChatPanelInterfaceInteraction?
open var placement: ChatInputContextPanelPlacement = .overPanels
open var theme: PresentationTheme
open var strings: PresentationStrings
open var fontSize: PresentationFontSize
public init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, chatPresentationContext: ChatPresentationContext) {
self.context = context
self.theme = theme
self.strings = strings
self.fontSize = fontSize
super.init()

View File

@ -557,7 +557,7 @@ private final class GiftViewSheetContent: CombinedComponent {
))
}
if savedToProfile {
if incoming && savedToProfile {
tableItems.append(.init(
id: "visibility",
title: strings.Gift_View_Visibility,
@ -1028,19 +1028,11 @@ public class GiftViewScreen: ViewControllerComponentContainer {
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
if currentTime > starsConvertMaxDate {
//TODO:localize
let duration: String
if starsConvertMaxDate == 300 {
duration = "5 minutes"
} else {
duration = "90 days"
}
let days: Int32 = Int32(ceil(Float(configuration.convertToStarsPeriod) / 86400.0))
let controller = textAlertController(
context: self.context,
title: presentationData.strings.Gift_Convert_Title,
text: "Sorry, you can't convert this gift.\n\nStars can only be claimed within \(duration) after receiving a gift.",
text: presentationData.strings.Gift_Convert_Period_Unavailable_Text(presentationData.strings.Gift_Convert_Period_Unavailable_Days(days)).string,
actions: [
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})
],
@ -1049,14 +1041,9 @@ public class GiftViewScreen: ViewControllerComponentContainer {
self.present(controller, in: .window(.root))
} else {
let delta = starsConvertMaxDate - currentTime
let duration: String
if starsConvertMaxDate == 300 {
duration = "\(delta / 60) minutes"
} else {
duration = "\(delta / 86400) days"
}
//TODO:localize
let text = "Do you want to convert this gift from **\(fromPeerName)** to **\(presentationData.strings.Gift_Convert_Stars(Int32(arguments.convertStars)))**?\n\nConversion is available for the next \(duration).\n\nThis will permanently destroy the gift."
let days: Int32 = Int32(ceil(Float(delta) / 86400.0))
let text = presentationData.strings.Gift_Convert_Period_Text(fromPeerName, presentationData.strings.Gift_Convert_Period_Stars(Int32(arguments.convertStars)), presentationData.strings.Gift_Convert_Period_Days(days)).string
let controller = textAlertController(
context: self.context,
title: presentationData.strings.Gift_Convert_Title,

View File

@ -233,7 +233,6 @@ final class ContextResultPanelComponent: Component {
}
if let peer, let addressName = peer.addressName, hashtagIndex < 0 {
//TODO: localize
var isGroup = false
if case let .channel(channel) = peer, case .group = channel.info {
isGroup = true
@ -245,8 +244,8 @@ final class ContextResultPanelComponent: Component {
theme: component.theme,
strings: component.strings,
peer: nil,
title: "Use #\(query)",
subtitle: "searches posts from all channels",
title: component.strings.Chat_HashtagSuggestion_UseGeneric_Title("#\(query)").string,
subtitle: component.strings.Chat_HashtagSuggestion_UseGeneric_Text,
hashtag: query,
hasNext: index != hashtags.count - 1,
action: { [weak self] hashtag, _ in
@ -262,8 +261,8 @@ final class ContextResultPanelComponent: Component {
theme: component.theme,
strings: component.strings,
peer: peer,
title: "Use #\(query)@\(addressName)",
subtitle: isGroup ? "searches only posts from this group" : "searches only posts from this channel",
title: component.strings.Chat_HashtagSuggestion_UseLocal_Title("#\(query)@\(addressName)").string,
subtitle: isGroup ? component.strings.Chat_HashtagSuggestion_UseLocal_Group_Text : component.strings.Chat_HashtagSuggestion_UseLocal_Channel_Text,
hashtag: "\(query)@\(addressName)",
hasNext: index != hashtags.count - 1,
action: { [weak self] hashtag, _ in

View File

@ -1513,7 +1513,6 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
let overallStarsBalance = data.starsRevenueStatsState?.balances.overallRevenue ?? 0
if overallRevenueBalance > 0 || overallStarsBalance > 0 {
//TODO:localize
items[.balances]!.append(PeerInfoScreenHeaderItem(id: 20, text: presentationData.strings.PeerInfo_BotBalance_Title))
if overallRevenueBalance > 0 {
let string = "*\(formatTonAmountText(revenueBalance, dateTimeFormat: presentationData.dateTimeFormat))"

View File

@ -120,15 +120,14 @@ final class HashtagChatInputContextPanelNode: ChatInputContextPanelNode {
if let peer, let _ = peer.addressName {
isAdditionalRecent = true
}
//TODO:localize
if query.count > 3 {
if query.count >= 4 {
if let peer, let addressName = peer.addressName {
let genericEntry = HashtagChatInputContextPanelEntry(
index: 0,
theme: self.theme,
peer: nil,
title: "Use #\(query)",
text: "searches posts from all channels",
title: self.strings.Chat_HashtagSuggestion_UseGeneric_Title("#\(query)").string,
text: self.strings.Chat_HashtagSuggestion_UseGeneric_Text,
badge: nil,
hashtag: query,
revealed: false,
@ -145,9 +144,9 @@ final class HashtagChatInputContextPanelNode: ChatInputContextPanelNode {
index: 1,
theme: self.theme,
peer: peer,
title: "Use #\(query)@\(addressName)",
text: isGroup ? "searches only posts from this group" : "searches only posts from this channel",
badge: "NEW",
title: self.strings.Chat_HashtagSuggestion_UseLocal_Title("#\(query)@\(addressName)").string,
text: isGroup ? self.strings.Chat_HashtagSuggestion_UseLocal_Group_Text : self.strings.Chat_HashtagSuggestion_UseLocal_Channel_Text,
badge: self.strings.ChatList_ContextMenuBadgeNew,
hashtag: "\(query)@\(addressName)",
revealed: false,
isAdditionalRecent: false

View File

@ -82,8 +82,6 @@ private func preparedTransition(from fromEntries: [HorizontalListContextResultsC
}
final class HorizontalListContextResultsChatInputContextPanelNode: ChatInputContextPanelNode {
private var strings: PresentationStrings
private let listView: ListView
private let separatorNode: ASDisplayNode
private var currentExternalResults: ChatContextResultCollection?
@ -96,8 +94,6 @@ final class HorizontalListContextResultsChatInputContextPanelNode: ChatInputCont
private var hasValidLayout = false
override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, chatPresentationContext: ChatPresentationContext) {
self.strings = strings
self.separatorNode = ASDisplayNode()
self.separatorNode.isLayerBacked = true
self.separatorNode.backgroundColor = theme.list.itemPlainSeparatorColor

View File

@ -103,8 +103,6 @@ private func preparedGridEntryTransition(context: AccountContext, from fromEntri
}
final class HorizontalStickersChatContextPanelNode: ChatInputContextPanelNode {
private var strings: PresentationStrings
private let backgroundLeftNode: ASImageNode
private let backgroundNode: ASImageNode
private let backgroundRightNode: ASImageNode
@ -121,8 +119,6 @@ final class HorizontalStickersChatContextPanelNode: ChatInputContextPanelNode {
private var stickerPreviewController: StickerPreviewController?
override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, chatPresentationContext: ChatPresentationContext) {
self.strings = strings
self.backgroundNode = ASImageNode()
self.backgroundNode.displayWithoutProcessing = true
self.backgroundNode.displaysAsynchronously = false