Various improvements

This commit is contained in:
Ilya Laktyushin 2024-02-23 06:31:35 +04:00
parent 4dbe7344e5
commit ae7df78e97
11 changed files with 33 additions and 22 deletions

View File

@ -11376,3 +11376,7 @@ to respond to messages faster.";
"ChannelBoost.Title" = "Boost Channel";
"ChannelBoost.Info" = "Subscribers of your channel can **boost** it so that it **levels up** and gets **exclusive features**.";
"Conversation.BoostToUnrestrictText" = "Boost this group to send messages";
"Settings.Business" = "Telegram Business";

View File

@ -2260,12 +2260,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
hasDraft = true
authorAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_Draft, font: textFont, textColor: theme.messageDraftTextColor)
//TODO:localize
switch mediaDraftContentType {
case .audio:
attributedText = NSAttributedString(string: "Voice Message", font: textFont, textColor: theme.messageTextColor)
attributedText = NSAttributedString(string: item.presentationData.strings.Message_VoiceMessage, font: textFont, textColor: theme.messageTextColor)
case .video:
attributedText = NSAttributedString(string: "Video Message", font: textFont, textColor: theme.messageTextColor)
attributedText = NSAttributedString(string: item.presentationData.strings.Message_VideoMessage, font: textFont, textColor: theme.messageTextColor)
}
} else if inlineAuthorPrefix == nil, let draftState = draftState {
hasDraft = true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -546,7 +546,7 @@ final class BusinessPageComponent: CombinedComponent {
state.isDisplaying = environment.isDisplaying
let theme = context.component.theme
// let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let topInset: CGFloat = 56.0
@ -604,10 +604,9 @@ final class BusinessPageComponent: CombinedComponent {
transition: context.transition
)
//TODO:localize
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(string: "Telegram Business", font: Font.semibold(20.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: strings.Premium_Business, font: Font.semibold(20.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center,
truncationType: .end,
maximumNumberOfLines: 1

View File

@ -309,6 +309,10 @@ class GiftOptionItemNode: ItemListRevealOptionsItemNode {
textConstrainedWidth -= 54.0
subtitleConstrainedWidth -= 30.0
}
if let _ = item.titleBadge {
textConstrainedWidth -= 32.0
subtitleConstrainedWidth -= 32.0
}
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: textConstrainedWidth, height: .greatestFiniteMagnitude)))
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: subtitleConstrainedWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))

View File

@ -2167,7 +2167,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
size.height += 8.0
let status = state.peer?.emojiStatus
// let statusColor = state.peer?.nameColor.flatMap { context.component.context.peerNameColors.get($0, dark: environment.theme.overallDarkAppearance).main } ?? .blue
let accentColor = environment.theme.list.itemAccentColor
var perksItems: [AnyComponentWithIdentity<Empty>] = []
@ -2347,7 +2346,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
} else {
layoutPerks()
let textPadding: CGFloat = 13.0
let infoTitle = infoTitle.update(

View File

@ -825,6 +825,9 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
order = [
(.canChangeInfo, self.presentationData.strings.Channel_AdminLog_CanChangeInfo),
(.canDeleteMessages, self.presentationData.strings.Channel_AdminLog_CanDeleteMessages),
(.canPostStories, self.presentationData.strings.Channel_AdminLog_CanPostStories),
(.canDeleteStories, self.presentationData.strings.Channel_AdminLog_CanDeleteStoriesOfOthers),
(.canEditStories, self.presentationData.strings.Channel_AdminLog_CanEditStoriesOfOthers),
(.canBanUsers, self.presentationData.strings.Channel_AdminLog_CanBanUsers),
(.canInviteUsers, self.presentationData.strings.Channel_AdminLog_CanInviteUsersViaLink),
(.canPinMessages, self.presentationData.strings.Channel_AdminLog_CanPinMessages),

View File

@ -929,11 +929,10 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 100, label: .text(""), text: presentationData.strings.Settings_Premium, icon: PresentationResourcesSettings.premium, action: {
interaction.openSettings(.premium)
}))
//TODO:localize
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 101, label: .text(""), additionalBadgeLabel: presentationData.strings.Settings_New, text: "Telegram Business", icon: PresentationResourcesSettings.business, action: {
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 101, label: .text(""), additionalBadgeLabel: presentationData.strings.Settings_New, text: presentationData.strings.Settings_Business, icon: PresentationResourcesSettings.business, action: {
interaction.openSettings(.businessSetup)
}))
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 102, label: .text(""), additionalBadgeLabel: presentationData.strings.Settings_New, text: presentationData.strings.Settings_PremiumGift, icon: PresentationResourcesSettings.premiumGift, action: {
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 102, label: .text(""), text: presentationData.strings.Settings_PremiumGift, icon: PresentationResourcesSettings.premiumGift, action: {
interaction.openSettings(.premiumGift)
}))
}

View File

@ -442,7 +442,7 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
let sideInset: CGFloat = params.leftInset + 10.0
let iconSize = CGSize(width: 32.0, height: 32.0)
let spacing = (params.width - sideInset * 2.0 - iconSize.width * CGFloat(itemsPerRow)) / CGFloat(itemsPerRow - 1)
let spacing = floorToScreenPixels((params.width - sideInset * 2.0 - iconSize.width * CGFloat(itemsPerRow)) / CGFloat(itemsPerRow - 1))
var origin = CGPoint(x: sideInset, y: 10.0)

View File

@ -15468,14 +15468,20 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forEveryone).startStandalone()
}
if let giveaway {
Queue.mainQueue().after(0.2) {
let dateString = stringForDate(timestamp: giveaway.untilDate, timeZone: .current, strings: strongSelf.presentationData.strings)
strongSelf.present(textAlertController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, title: strongSelf.presentationData.strings.Chat_Giveaway_DeleteConfirmation_Title, text: strongSelf.presentationData.strings.Chat_Giveaway_DeleteConfirmation_Text(dateString).string, actions: [TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.Common_Delete, action: {
commit()
}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
})], parseMarkdown: true), in: .window(.root))
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
if currentTime < giveaway.untilDate {
Queue.mainQueue().after(0.2) {
let dateString = stringForDate(timestamp: giveaway.untilDate, timeZone: .current, strings: strongSelf.presentationData.strings)
strongSelf.present(textAlertController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, title: strongSelf.presentationData.strings.Chat_Giveaway_DeleteConfirmation_Title, text: strongSelf.presentationData.strings.Chat_Giveaway_DeleteConfirmation_Text(dateString).string, actions: [TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.Common_Delete, action: {
commit()
}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
})], parseMarkdown: true), in: .window(.root))
}
f(.default)
} else {
f(.dismissWithoutContent)
commit()
}
f(.default)
} else {
if "".isEmpty {
f(.dismissWithoutContent)

View File

@ -91,11 +91,10 @@ final class ChatRestrictedInputPanelNode: ChatInputPanelNode {
} else if personal {
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Conversation_RestrictedText, font: Font.regular(13.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
} else {
if "".isEmpty {
//TODO:localize
if (self.presentationInterfaceState?.boostsToUnrestrict ?? 0) > 0 {
iconSpacing = 0.0
iconImage = PresentationResourcesChat.chatPanelBoostIcon(interfaceState.theme)
self.textNode.attributedText = NSAttributedString(string: "Boost this group to send messages", font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.panelControlAccentColor)
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Conversation_BoostToUnrestrictText, font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.panelControlAccentColor)
isUserInteractionEnabled = true
} else {
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Conversation_DefaultRestrictedText, font: Font.regular(13.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)