Update localization

This commit is contained in:
Isaac 2024-04-11 14:22:45 +04:00
parent a340133bd9
commit 3a73b76f35
13 changed files with 194 additions and 190 deletions

View File

@ -1158,32 +1158,14 @@ private final class NotificationServiceHandler {
} }
let _ = messageId let _ = messageId
/*if (peerId != 0 && messageId != 0 && parsedAttachment != nil && attachmentData != nil) {
userInfo[@"peerId"] = @(peerId);
userInfo[@"messageId.namespace"] = @(0);
userInfo[@"messageId.id"] = @(messageId);
userInfo[@"media"] = [attachmentData base64EncodedStringWithOptions:0];
if (isExpandableMedia) {
if ([categoryString isEqualToString:@"r"]) {
_bestAttemptContent.categoryIdentifier = @"withReplyMedia";
} else if ([categoryString isEqualToString:@"m"]) {
_bestAttemptContent.categoryIdentifier = @"withMuteMedia";
}
}
}*/
} }
/*if (accountInfos.accounts.count > 1) {
if (_bestAttemptContent.title.length != 0 && account.peerName.length != 0) {
_bestAttemptContent.title = [NSString stringWithFormat:@"%@ → %@", _bestAttemptContent.title, account.peerName];
}
}*/
if let storyId { if let storyId {
content.category = "st" if content.category == "t" {
content.category = "str"
} else {
content.category = "st"
}
action = .pollStories(peerId: peerId, content: content, storyId: storyId) action = .pollStories(peerId: peerId, content: content, storyId: storyId)
} else { } else {
action = .poll(peerId: peerId, content: content, messageId: messageIdValue) action = .poll(peerId: peerId, content: content, messageId: messageIdValue)

View File

@ -267,11 +267,11 @@
"PUSH_MESSAGE_STORY" = "%1$@|shared a story with you"; "PUSH_MESSAGE_STORY" = "%1$@|shared a story with you";
"PUSH_MESSAGE_STORY_MENTION" = "%1$@|mentioned you in a story"; "PUSH_MESSAGE_STORY_MENTION" = "%1$@|mentioned you in a story";
"PUSH_CHANNEL_MESSAGE_STORY" = "%1$@|shared a story"; "PUSH_CHANNEL_MESSAGE_STORY" = "%1$@|shared a story";
"PUSH_CHAT_MESSAGE_STORY" = "%2$@|%1$@ shared a story to the group";
"PUSH_REACT_HIDDEN" = "New reaction to your message"; "PUSH_REACT_HIDDEN" = "New reaction to your message";
"PUSH_REACT_STORY" = "%1$@|%2$@ to your story"; "PUSH_REACT_STORY" = "%1$@|%2$@ to your story";
"PUSH_REACT_STORY_HIDDEN" = "New reaction to your story"; "PUSH_REACT_STORY_HIDDEN" = "New reaction to your story";
"PUSH_CHAT_REACT_STORY" = "%2$@|%1$@ %3$@ to your story";
"LOCAL_MESSAGE_FWDS" = "%1$@ forwarded you %2$d messages"; "LOCAL_MESSAGE_FWDS" = "%1$@ forwarded you %2$d messages";
"LOCAL_CHANNEL_MESSAGE_FWDS" = "%1$@ posted %2$d forwarded messages"; "LOCAL_CHANNEL_MESSAGE_FWDS" = "%1$@ posted %2$d forwarded messages";
@ -11910,3 +11910,94 @@ Sorry for the inconvenience.";
"Conversation.ViewEmojis" = "VIEW EMOJIS"; "Conversation.ViewEmojis" = "VIEW EMOJIS";
"MediaEditor.StickersTooMuch" = "Sorry, you've reached the maximum number of stickers in this set. Try a different one."; "MediaEditor.StickersTooMuch" = "Sorry, you've reached the maximum number of stickers in this set. Try a different one.";
"ChatList.ChannelsSection" = "Channels";
"ChatList.Search.FilterChannels" = "Channels";
"ChatList.Search.SectionRecommendedChannels" = "RECOMMENDED CHANNELS";
"ChatList.Search.SectionLocalChannels" = "CHANNELS YOU JOINED";
"ChatList.Search.SectionActionShowLess" = "Show Less";
"ChatList.Search.SectionActionShowMore" = "Show More";
"ChatList.Search.RecommendedChannelsEmpty.Title" = "No Channels Yet...";
"ChatList.Search.RecommendedChannelsEmpty.Text" = "You are not currently subscribed to any channel.";
"Notifications.Reactions" = "Reactions";
"Notifications.Reactions.SubtitleStories" = "Stories";
"Notifications.Reactions.SubtitleMessages" = "Messages";
"Notifications.Stories.SettingsHeader" = "NOTIFY ME ABOUT...";
"Notifications.Stories.GlobalSetting" = "New Stories";
"Notifications.Stories.Important" = "Important Stories";
"Notifications.Stories.DisplayName" = "Show Sender's Name";
"Notifications.Reactions.Title" = "Reactions";
"Notifications.Reactions.SettingsHeader" = "NOTIFY ME ABOUT...";
"Notifications.Reactions.SubtitleContacts" = "From My Contacts";
"Notifications.Reactions.SubtitleEveryone" = "From Everyone";
"Notifications.Reactions.ItemMessages" = "Reactions to my Messages";
"Notifications.Reactions.ItemStories" = "Reactions to my Stories";
"Notifications.Reactions.SheetTitleMessages" = "Notify about reactions to my messages from";
"Notifications.Reactions.SheetTitleStories" = "Notify about reactions to my stories from";
"Notifications.Reactions.SheetValueEveryone" = "Everyone";
"Notifications.Reactions.SheetValueContacts" = "My Contacts";
"PeerInfo.AllowedReactions.MaxCountSectionTitle" = "MAXIMUM REACTIONS PER POST";
"PeerInfo.AllowedReactions.MaxCountSectionFooter" = "Limit the number of different reactions that can be added to a post, including already published posts.";
"PeerInfo.AllowedReactions.MaxCountValue_1" = "1 reaction";
"PeerInfo.AllowedReactions.MaxCountValue_any" = "%d reactions";
"PeerInfo.PaneArchivedStories" = "Archived Posts";
"StoryList.ItemAction.Archive" = "Archive";
"StoryList.ItemAction.Unarchive" = "Unarchive";
"StoryList.ItemAction.Pin" = "Pin";
"StoryList.ItemAction.Unpin" = "Unpin";
"StoryList.ItemAction.Forward" = "Forward";
"StoryList.ItemAction.Edit" = "Edit";
"StoryList.ItemAction.Delete" = "Delete";
"StoryList.ToastUnarchived.Text_1" = "Story unarchived.";
"StoryList.ToastUnarchived.Text_any" = "%d stories unarchived.";
"StoryList.ToastArchived.Text_1" = "Story archived.";
"StoryList.ToastArchived.Text_any" = "%d stories archived.";
"StoryList.ToastPinLimit.Text_1" = "You can't pin more than 1 post.";
"StoryList.ToastPinLimit.Text_any" = "You can't pin more than %d posts.";
"StoryList.ToastUnpinned.Text_1" = "Story unpinned.";
"StoryList.ToastUnpinned.Text_any" = "%d stories unpinned.";
"StoryList.ToastPinned.Title_1" = "Story pinned";
"StoryList.ToastPinned.Title_any" = "%d stories pinned";
"StoryList.ToastPinned.Text_1" = "Now it will always be shown on the top.";
"StoryList.ToastPinned.Text_any" = "Now they will always be shown on the top.";
"StoryList.DeleteConfirmation.Title_1" = "Delete 1 story?";
"StoryList.DeleteConfirmation.Title_any" = "Delete %d stories?";
"StoryList.DeleteConfirmation.Action" = "Delete";
"StoryList.ActionPanel.Pin" = "Pin";
"StoryList.ActionPanel.Unpin" = "Unpin";
"StoryList.ActionPanel.Archive" = "Archive";
"StoryList.ActionPanel.Unarchive" = "Unarchive";
"StoryList.ActionPanel.Delete" = "Delete";
"Settings.MyProfile" = "My Profile";
"MyProfile.UsernameActionEdit" = "Edit Username";
"MyProfile.UsernameActionCopy" = "Copy Username";
"MyProfile.BioActionEdit" = "Edit Bio";
"MyProfile.BioActionCopy" = "Copy Bio";
"MyProfile.ToastBioCopied" = "Bio copied to clipboard.";
"MyProfile.HoursActionEdit" = "Edit Hours";
"MyProfile.HoursActionCopy" = "Copy Hours";
"MyProfile.HoursActionRemove" = "Remove";
"MyProfile.HoursRemoveConfirmation.Title" = "Are you sure you want to remove business hours?";
"MyProfile.HoursRemoveConfirmation.Action" = "Remove";
"MyProfile.ToastHoursCopied" = "Hours copied to clipboard.";
"MyProfile.LocationActionOpen" = "Open in Maps";
"MyProfile.LocationActionEdit" = "Edit Location";
"MyProfile.LocationActionCopy" = "Copy Address";
"MyProfile.LocationActionRemove" = "Remove";
"MyProfile.LocationRemoveConfirmation.Title" = "Are you sure you want to remove location?";
"MyProfile.LocationRemoveConfirmation.Action" = "Remove";
"MyProfile.ToastLocationCopied" = "Location copied to clipboard.";
"MyProfile.BirthdayActionEdit" = "Edit Birthday";
"MyProfile.BirthdayActionCopy" = "Copy";
"MyProfile.ToastBirthdayCopied" = "Birthday copied to clipboard.";
"MyProfile.PhoneActionEdit" = "Change Number";
"MyProfile.PhoneActionCopy" = "Copy Number";
"MyProfile.ToastPhoneCopied" = "Birthday copied to clipboard.";

View File

@ -64,8 +64,7 @@ public enum ChatListSearchItemHeaderType {
case .chats: case .chats:
return strings.Cache_ByPeerHeader return strings.Cache_ByPeerHeader
case .channels: case .channels:
//TODO:localize return strings.ChatList_ChannelsSection
return "Channels"
case .chatTypes: case .chatTypes:
return strings.ChatList_ChatTypesSection return strings.ChatList_ChatTypesSection
case .faq: case .faq:

View File

@ -85,8 +85,7 @@ private final class ItemNode: ASDisplayNode {
title = presentationData.strings.ChatList_Search_FilterChats title = presentationData.strings.ChatList_Search_FilterChats
icon = nil icon = nil
case .channels: case .channels:
//TODO:localize title = presentationData.strings.ChatList_Search_FilterChannels
title = "Channels"
icon = nil icon = nil
case .media: case .media:
title = presentationData.strings.ChatList_Search_FilterMedia title = presentationData.strings.ChatList_Search_FilterMedia

View File

@ -238,11 +238,9 @@ private enum ChatListRecentEntry: Comparable, Identifiable {
let header: ChatListSearchItemHeader? let header: ChatListSearchItemHeader?
if case .channels = key { if case .channels = key {
if case .recommendedChannels = section { if case .recommendedChannels = section {
//TODO:localize header = ChatListSearchItemHeader(type: .text(presentationData.strings.ChatList_Search_SectionRecommendedChannels, 1), theme: theme, strings: strings)
header = ChatListSearchItemHeader(type: .text("RECOMMENDED CHANNELS", 1), theme: theme, strings: strings)
} else { } else {
//TODO:localize header = ChatListSearchItemHeader(type: .text(presentationData.strings.ChatList_Search_SectionLocalChannels, 0), theme: theme, strings: strings, actionTitle: isChannelsTabExpanded ? presentationData.strings.ChatList_Search_SectionActionShowLess : presentationData.strings.ChatList_Search_SectionActionShowMore, action: {
header = ChatListSearchItemHeader(type: .text("CHANNELS YOU JOINED", 0), theme: theme, strings: strings, actionTitle: isChannelsTabExpanded ? "Show less" : "Show more", action: {
toggleChannelsTabExpanded() toggleChannelsTabExpanded()
}) })
} }
@ -1273,10 +1271,9 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
self.emptyResultsAnimationNode.isHidden = true self.emptyResultsAnimationNode.isHidden = true
if key == .channels { if key == .channels {
//TODO:localize
let emptyRecentTitleNode = ImmediateTextNode() let emptyRecentTitleNode = ImmediateTextNode()
emptyRecentTitleNode.displaysAsynchronously = false emptyRecentTitleNode.displaysAsynchronously = false
emptyRecentTitleNode.attributedText = NSAttributedString(string: "No Channels Yet...", font: Font.semibold(17.0), textColor: self.presentationData.theme.list.freeTextColor) emptyRecentTitleNode.attributedText = NSAttributedString(string: presentationData.strings.ChatList_Search_RecommendedChannelsEmpty_Title, font: Font.semibold(17.0), textColor: self.presentationData.theme.list.freeTextColor)
emptyRecentTitleNode.textAlignment = .center emptyRecentTitleNode.textAlignment = .center
emptyRecentTitleNode.isHidden = true emptyRecentTitleNode.isHidden = true
self.emptyRecentTitleNode = emptyRecentTitleNode self.emptyRecentTitleNode = emptyRecentTitleNode
@ -1286,7 +1283,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
emptyRecentTextNode.maximumNumberOfLines = 0 emptyRecentTextNode.maximumNumberOfLines = 0
emptyRecentTextNode.textAlignment = .center emptyRecentTextNode.textAlignment = .center
emptyRecentTextNode.isHidden = true emptyRecentTextNode.isHidden = true
emptyRecentTextNode.attributedText = NSAttributedString(string: "You are not currently subscribed to any channel.", font: Font.regular(15.0), textColor: presentationData.theme.list.freeTextColor) emptyRecentTextNode.attributedText = NSAttributedString(string: presentationData.strings.ChatList_Search_RecommendedChannelsEmpty_Text, font: Font.regular(15.0), textColor: presentationData.theme.list.freeTextColor)
self.emptyRecentTextNode = emptyRecentTextNode self.emptyRecentTextNode = emptyRecentTextNode
let emptyRecentAnimationNode = DefaultAnimatedStickerNodeImpl() let emptyRecentAnimationNode = DefaultAnimatedStickerNodeImpl()

View File

@ -579,7 +579,6 @@ private func notificationsAndSoundsEntries(authorizationStatus: AccessType, warn
entries.append(.stories(presentationData.theme, presentationData.strings.Notifications_Stories, !exceptions.stories.isEmpty ? presentationData.strings.Notifications_CategoryExceptions(Int32(exceptions.stories.peerIds.count)) : "", storiesValue)) entries.append(.stories(presentationData.theme, presentationData.strings.Notifications_Stories, !exceptions.stories.isEmpty ? presentationData.strings.Notifications_CategoryExceptions(Int32(exceptions.stories.peerIds.count)) : "", storiesValue))
//TODO:localize
var reactionsValue: String = "" var reactionsValue: String = ""
var hasReactionNotifications = false var hasReactionNotifications = false
switch globalSettings.reactionSettings.messages { switch globalSettings.reactionSettings.messages {
@ -590,7 +589,7 @@ private func notificationsAndSoundsEntries(authorizationStatus: AccessType, warn
reactionsValue.append(", ") reactionsValue.append(", ")
} }
hasReactionNotifications = true hasReactionNotifications = true
reactionsValue.append("Messages") reactionsValue.append(presentationData.strings.Notifications_Reactions_SubtitleMessages)
} }
switch globalSettings.reactionSettings.stories { switch globalSettings.reactionSettings.stories {
case .nobody: case .nobody:
@ -600,9 +599,9 @@ private func notificationsAndSoundsEntries(authorizationStatus: AccessType, warn
reactionsValue.append(", ") reactionsValue.append(", ")
} }
hasReactionNotifications = true hasReactionNotifications = true
reactionsValue.append("Stories") reactionsValue.append(presentationData.strings.Notifications_Reactions_SubtitleStories)
} }
entries.append(.reactions(presentationData.theme, "Reactions", reactionsValue, hasReactionNotifications ? "On" : "Off")) entries.append(.reactions(presentationData.theme, presentationData.strings.Notifications_Reactions, reactionsValue, hasReactionNotifications ? presentationData.strings.Notifications_On : presentationData.strings.Notifications_Off))
entries.append(.inAppHeader(presentationData.theme, presentationData.strings.Notifications_InAppNotifications.uppercased())) entries.append(.inAppHeader(presentationData.theme, presentationData.strings.Notifications_InAppNotifications.uppercased()))
entries.append(.inAppSounds(presentationData.theme, presentationData.strings.Notifications_InAppNotificationsSounds, inAppSettings.playSounds)) entries.append(.inAppSounds(presentationData.theme, presentationData.strings.Notifications_InAppNotificationsSounds, inAppSettings.playSounds))

View File

@ -344,8 +344,7 @@ private func notificationsPeerCategoryEntries(category: NotificationsPeerCategor
} }
if case .stories = category { if case .stories = category {
//TODO:localize entries.append(.enableHeader(presentationData.strings.Notifications_Stories_SettingsHeader))
entries.append(.enableHeader("NOTIFY ME ABOUT..."))
var allEnabled = false var allEnabled = false
var importantEnabled = false var importantEnabled = false
@ -362,16 +361,16 @@ private func notificationsPeerCategoryEntries(category: NotificationsPeerCategor
importantEnabled = true importantEnabled = true
} }
entries.append(.enable(presentationData.theme, "New Stories", allEnabled)) entries.append(.enable(presentationData.theme, presentationData.strings.Notifications_Stories_GlobalSetting, allEnabled))
if !allEnabled { if !allEnabled {
entries.append(.enableImportant(presentationData.theme, "Important Stories", importantEnabled)) entries.append(.enableImportant(presentationData.theme, presentationData.strings.Notifications_Stories_Important, importantEnabled))
entries.append(.importantInfo(presentationData.theme, presentationData.strings.NotificationSettings_Stories_ShowImportantFooter)) entries.append(.importantInfo(presentationData.theme, presentationData.strings.NotificationSettings_Stories_ShowImportantFooter))
} }
if notificationSettings.enabled || !notificationExceptions.isEmpty { if notificationSettings.enabled || !notificationExceptions.isEmpty {
entries.append(.optionsHeader(presentationData.theme, presentationData.strings.Notifications_Options.uppercased())) entries.append(.optionsHeader(presentationData.theme, presentationData.strings.Notifications_Options.uppercased()))
entries.append(.previews(presentationData.theme, "Show Sender's Name", notificationSettings.storySettings.hideSender != .hide)) entries.append(.previews(presentationData.theme, presentationData.strings.Notifications_Stories_DisplayName, notificationSettings.storySettings.hideSender != .hide))
entries.append(.sound(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, notificationSoundList: notificationSoundList, sound: filteredGlobalSound(notificationSettings.storySettings.sound)), filteredGlobalSound(notificationSettings.storySettings.sound))) entries.append(.sound(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, notificationSoundList: notificationSoundList, sound: filteredGlobalSound(notificationSettings.storySettings.sound)), filteredGlobalSound(notificationSettings.storySettings.sound)))
} }
} else { } else {

View File

@ -206,8 +206,7 @@ private func reactionNotificationSettingsEntries(
) -> [ReactionNotificationSettingsEntry] { ) -> [ReactionNotificationSettingsEntry] {
var entries: [ReactionNotificationSettingsEntry] = [] var entries: [ReactionNotificationSettingsEntry] = []
//TODO:localize entries.append(.categoriesHeader(presentationData.strings.Notifications_Reactions_SettingsHeader))
entries.append(.categoriesHeader("NOTIFY ME ABOUT..."))
let messagesText: String? let messagesText: String?
let messagesValue: Bool let messagesValue: Bool
@ -216,10 +215,10 @@ private func reactionNotificationSettingsEntries(
messagesText = nil messagesText = nil
messagesValue = false messagesValue = false
case .contacts: case .contacts:
messagesText = "From My Contacts" messagesText = presentationData.strings.Notifications_Reactions_SubtitleContacts
messagesValue = true messagesValue = true
case .everyone: case .everyone:
messagesText = "From Everyone" messagesText = presentationData.strings.Notifications_Reactions_SubtitleEveryone
messagesValue = true messagesValue = true
} }
@ -230,21 +229,20 @@ private func reactionNotificationSettingsEntries(
storiesText = nil storiesText = nil
storiesValue = false storiesValue = false
case .contacts: case .contacts:
storiesText = "From My Contacts" storiesText = presentationData.strings.Notifications_Reactions_SubtitleContacts
storiesValue = true storiesValue = true
case .everyone: case .everyone:
storiesText = "From Everyone" storiesText = presentationData.strings.Notifications_Reactions_SubtitleEveryone
storiesValue = true storiesValue = true
} }
entries.append(.messages(title: "Reactions to my Messages", text: messagesText, value: messagesValue)) entries.append(.messages(title: presentationData.strings.Notifications_Reactions_ItemMessages, text: messagesText, value: messagesValue))
entries.append(.stories(title: "Reactions to my Stories", text: storiesText, value: storiesValue)) entries.append(.stories(title: presentationData.strings.Notifications_Reactions_ItemStories, text: storiesText, value: storiesValue))
if messagesValue || storiesValue { if messagesValue || storiesValue {
entries.append(.optionsHeader(presentationData.strings.Notifications_Options.uppercased())) entries.append(.optionsHeader(presentationData.strings.Notifications_Options.uppercased()))
//TODO:localize entries.append(.previews(presentationData.strings.Notifications_Stories_DisplayName, globalSettings.reactionSettings.hideSender != .hide))
entries.append(.previews("Show Sender's Name", globalSettings.reactionSettings.hideSender != .hide))
entries.append(.sound(presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, notificationSoundList: notificationSoundList, sound: filteredGlobalSound(globalSettings.reactionSettings.sound)), filteredGlobalSound(globalSettings.reactionSettings.sound))) entries.append(.sound(presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, notificationSoundList: notificationSoundList, sound: filteredGlobalSound(globalSettings.reactionSettings.sound)), filteredGlobalSound(globalSettings.reactionSettings.sound)))
} }
@ -274,19 +272,19 @@ public func reactionNotificationSettingsController(
let _ = updateState let _ = updateState
let openCategory: (Bool) -> Void = { isMessages in let openCategory: (Bool) -> Void = { isMessages in
//TODO:localize let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let text: String let text: String
if isMessages { if isMessages {
text = "Notify about reactions to my messages from" text = presentationData.strings.Notifications_Reactions_SheetTitleMessages
} else { } else {
text = "Notify about reactions to my stories from" text = presentationData.strings.Notifications_Reactions_SheetTitleStories
} }
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let actionSheet = ActionSheetController(presentationData: presentationData) let actionSheet = ActionSheetController(presentationData: presentationData)
actionSheet.setItemGroups([ActionSheetItemGroup(items: [ actionSheet.setItemGroups([ActionSheetItemGroup(items: [
ActionSheetTextItem(title: text), ActionSheetTextItem(title: text),
ActionSheetButtonItem(title: "Everyone", color: .accent, action: { [weak actionSheet] in ActionSheetButtonItem(title: presentationData.strings.Notifications_Reactions_SheetValueEveryone, color: .accent, action: { [weak actionSheet] in
actionSheet?.dismissAnimated() actionSheet?.dismissAnimated()
let _ = updateGlobalNotificationSettingsInteractively(postbox: context.account.postbox, { settings in let _ = updateGlobalNotificationSettingsInteractively(postbox: context.account.postbox, { settings in
@ -299,7 +297,7 @@ public func reactionNotificationSettingsController(
return settings return settings
}).start() }).start()
}), }),
ActionSheetButtonItem(title: "My Contacts", color: .accent, action: { [weak actionSheet] in ActionSheetButtonItem(title: presentationData.strings.Notifications_Reactions_SheetValueContacts, color: .accent, action: { [weak actionSheet] in
actionSheet?.dismissAnimated() actionSheet?.dismissAnimated()
let _ = updateGlobalNotificationSettingsInteractively(postbox: context.account.postbox, { settings in let _ = updateGlobalNotificationSettingsInteractively(postbox: context.account.postbox, { settings in
@ -398,8 +396,7 @@ public func reactionNotificationSettingsController(
leftNavigationButton = nil leftNavigationButton = nil
rightNavigationButton = nil rightNavigationButton = nil
//TODO:localize let title: String = presentationData.strings.Notifications_Reactions_Title
let title: String = "Reactions"
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(title), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true) let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(title), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: entries, style: .blocks) let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: entries, style: .blocks)

View File

@ -797,20 +797,14 @@ final class PeerAllowedReactionsScreenComponent: Component {
let reactionCountValueList = (1 ... 11).map { i -> String in let reactionCountValueList = (1 ... 11).map { i -> String in
return "\(i)" return "\(i)"
} }
//TODO:localize let sliderTitle: String = environment.strings.PeerInfo_AllowedReactions_MaxCountValue(Int32(self.allowedReactionCount))
let sliderTitle: String
if self.allowedReactionCount == 1 {
sliderTitle = "1 reaction"
} else {
sliderTitle = "\(self.allowedReactionCount) reactions"
}
let reactionCountSectionSize = reactionCountSection.update( let reactionCountSectionSize = reactionCountSection.update(
transition: transition, transition: transition,
component: AnyComponent(ListSectionComponent( component: AnyComponent(ListSectionComponent(
theme: environment.theme, theme: environment.theme,
header: AnyComponent(MultilineTextComponent( header: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString( text: .plain(NSAttributedString(
string: "MAXIMUM REACTIONS PER POST", string: environment.strings.PeerInfo_AllowedReactions_MaxCountSectionTitle,
font: Font.regular(13.0), font: Font.regular(13.0),
textColor: environment.theme.list.freeTextColor textColor: environment.theme.list.freeTextColor
)), )),
@ -818,7 +812,7 @@ final class PeerAllowedReactionsScreenComponent: Component {
)), )),
footer: AnyComponent(MultilineTextComponent( footer: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString( text: .plain(NSAttributedString(
string: "Limit the number of different reactions that can be added to a post, including already published posts.", string: environment.strings.PeerInfo_AllowedReactions_MaxCountSectionFooter,
font: Font.regular(13.0), font: Font.regular(13.0),
textColor: environment.theme.list.freeTextColor textColor: environment.theme.list.freeTextColor
)), )),

View File

@ -58,17 +58,6 @@ final class PeerInfoPaneTabsContainerPaneNode: ASDisplayNode {
self.addSubnode(self.buttonNode) self.addSubnode(self.buttonNode)
self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside) self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside)
/*self.buttonNode.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if highlighted && !strongSelf.isSelected {
strongSelf.titleNode.layer.removeAnimation(forKey: "opacity")
strongSelf.titleNode.alpha = 0.4
} else {
strongSelf.titleNode.alpha = 1.0
strongSelf.titleNode.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
}
}
}*/
} }
@objc private func buttonPressed() { @objc private func buttonPressed() {
@ -1033,7 +1022,6 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat
if let availablePanes = data?.availablePanes, let currentPaneKey = strongSelf.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey), let paneIndex = availablePanes.firstIndex(of: key), abs(paneIndex - currentIndex) <= 1 { if let availablePanes = data?.availablePanes, let currentPaneKey = strongSelf.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey), let paneIndex = availablePanes.firstIndex(of: key), abs(paneIndex - currentIndex) <= 1 {
} else { } else {
if let pane = strongSelf.currentPanes.removeValue(forKey: key) { if let pane = strongSelf.currentPanes.removeValue(forKey: key) {
//print("remove \(key)")
pane.node.removeFromSupernode() pane.node.removeFromSupernode()
} }
} }
@ -1097,8 +1085,7 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat
case .stories: case .stories:
title = presentationData.strings.PeerInfo_PaneStories title = presentationData.strings.PeerInfo_PaneStories
case .storyArchive: case .storyArchive:
//TODO:localize title = presentationData.strings.PeerInfo_PaneArchivedStories
title = "Archived Posts"
case .media: case .media:
title = presentationData.strings.PeerInfo_PaneMedia title = presentationData.strings.PeerInfo_PaneMedia
case .files: case .files:

View File

@ -874,8 +874,7 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
})) }))
} }
//TODO:localize items[.myProfile]!.append(PeerInfoScreenDisclosureItem(id: 0, text: presentationData.strings.Settings_MyProfile, icon: PresentationResourcesSettings.myProfile, action: {
items[.myProfile]!.append(PeerInfoScreenDisclosureItem(id: 0, text: "My Profile", icon: PresentationResourcesSettings.myProfile, action: {
interaction.openSettings(.profile) interaction.openSettings(.profile)
})) }))
@ -6940,14 +6939,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
UIPasteboard.general.string = "@\(username)" UIPasteboard.general.string = "@\(username)"
//TODO:localize self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.Conversation_UsernameCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: "Username copied"), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if self.isMyProfile { if self.isMyProfile {
items.append(.action(ContextMenuActionItem(text: "Edit Username", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_UsernameActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -6957,8 +6955,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}))) })))
} }
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_UsernameActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy Username", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
@ -6997,15 +6994,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
UIPasteboard.general.string = bioText UIPasteboard.general.string = bioText
//TODO:localize self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.MyProfile_ToastBioCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: "Bio copied"), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if self.isMyProfile { if self.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_BioActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Edit Bio", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7026,8 +7021,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}))) })))
} }
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_BioActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy Bio", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
@ -7062,15 +7056,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
UIPasteboard.general.string = businessHoursTextToCopy(businessHours: businessHours, presentationData: self.presentationData, displayLocalTimezone: false) UIPasteboard.general.string = businessHoursTextToCopy(businessHours: businessHours, presentationData: self.presentationData, displayLocalTimezone: false)
//TODO:localize self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.MyProfile_ToastHoursCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: "Working hours copied."), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if self.isMyProfile { if self.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_HoursActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Edit Hours", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7081,26 +7073,29 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}))) })))
} }
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_HoursActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy Hours", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
}))) })))
if self.isMyProfile { if self.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_HoursActionRemove, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _
items.append(.action(ContextMenuActionItem(text: "Remove", textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _ in in
guard let self else {
return
}
var subItems: [ContextMenuItem] = [] var subItems: [ContextMenuItem] = []
let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil
subItems.append(.action(ContextMenuActionItem( subItems.append(.action(ContextMenuActionItem(
text: "Are you sure you want to remove business hours?", text: self.presentationData.strings.MyProfile_HoursRemoveConfirmation_Title,
textLayout: .multiline, textLayout: .multiline,
textFont: .small, textFont: .small,
icon: { _ in nil }, icon: { _ in nil },
action: noAction action: noAction
))) )))
subItems.append(.action(ContextMenuActionItem(text: "Remove", textColor: .destructive, icon: { _ in nil }, action: { [weak self] c, _ in subItems.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_HoursRemoveConfirmation_Action, textColor: .destructive, icon: { _ in nil }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7141,15 +7136,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
UIPasteboard.general.string = businessLocation.address UIPasteboard.general.string = businessLocation.address
//TODO:localize self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.MyProfile_ToastLocationCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: "Working hours copied."), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if businessLocation.coordinates != nil { if businessLocation.coordinates != nil {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_LocationActionOpen, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Media Editor/LocationSmall"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Open in Maps", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Media Editor/LocationSmall"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss(completion: { c.dismiss(completion: {
guard let self else { guard let self else {
return return
@ -7160,8 +7153,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
if !businessLocation.address.isEmpty { if !businessLocation.address.isEmpty {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_LocationActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy Address", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
@ -7169,8 +7161,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
if self.isMyProfile { if self.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_LocationActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Edit Location", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7180,18 +7171,21 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
}))) })))
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_LocationActionRemove, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Remove", textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _ in guard let self else {
return
}
var subItems: [ContextMenuItem] = [] var subItems: [ContextMenuItem] = []
let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil
subItems.append(.action(ContextMenuActionItem( subItems.append(.action(ContextMenuActionItem(
text: "Are you sure you want to remove location?", text: self.presentationData.strings.MyProfile_LocationRemoveConfirmation_Title,
textLayout: .multiline, textLayout: .multiline,
textFont: .small, textFont: .small,
icon: { _ in nil }, icon: { _ in nil },
action: noAction action: noAction
))) )))
subItems.append(.action(ContextMenuActionItem(text: "Remove", textColor: .destructive, icon: { _ in nil }, action: { [weak self] c, _ in subItems.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_LocationRemoveConfirmation_Action, textColor: .destructive, icon: { _ in nil }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7235,15 +7229,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
UIPasteboard.general.string = text UIPasteboard.general.string = text
//TODO:localize self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.MyProfile_ToastBirthdayCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: "Birthday copied."), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if self.isMyProfile { if self.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_BirthdayActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Edit Birthday", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7255,8 +7247,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}))) })))
} }
//TODO:localize items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_BirthdayActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
@ -7343,8 +7334,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
if strongSelf.isMyProfile { if strongSelf.isMyProfile {
//TODO:localize items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.MyProfile_PhoneActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: "Change Number", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss { c.dismiss {
guard let self else { guard let self else {
return return
@ -7378,8 +7368,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} else { } else {
isAnonymousNumber = true isAnonymousNumber = true
} }
//TODO:localize items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.MyProfile_PhoneActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
items.append(.action(ContextMenuActionItem(text: "Copy Number", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }
@ -7398,9 +7387,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} else { } else {
isAnonymousNumber = true isAnonymousNumber = true
} }
//TODO:localize
items.append( items.append(
.action(ContextMenuActionItem(text: "Copy Number", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in .action(ContextMenuActionItem(text: strongSelf.presentationData.strings.MyProfile_PhoneActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss { c.dismiss {
copyAction() copyAction()
} }

View File

@ -1798,10 +1798,8 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
var items: [ContextMenuItem] = [] var items: [ContextMenuItem] = []
//TODO:localize
if canManage { if canManage {
items.append(.action(ContextMenuActionItem(text: !self.isArchive ? "Archive" : "Unarchive", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: self.isArchive ? "Chat/Context Menu/Archive" : "Chat/Context Menu/Unarchive"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in items.append(.action(ContextMenuActionItem(text: !self.isArchive ? self.presentationData.strings.StoryList_ItemAction_Archive : self.presentationData.strings.StoryList_ItemAction_Unarchive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: self.isArchive ? "Chat/Context Menu/Archive" : "Chat/Context Menu/Unarchive"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in
guard let self else { guard let self else {
f(.default) f(.default)
return return
@ -1814,12 +1812,12 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
} }
let _ = self.context.engine.messages.updateStoriesArePinned(peerId: self.peerId, ids: [item.id: item], isPinned: self.isArchive ? true : false).startStandalone() let _ = self.context.engine.messages.updateStoriesArePinned(peerId: self.peerId, ids: [item.id: item], isPinned: self.isArchive ? true : false).startStandalone()
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: self.isArchive ? "Story unarchived." : "Story archived.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: self.presentationData, content: .actionSucceeded(title: nil, text: self.isArchive ? self.presentationData.strings.StoryList_ToastUnarchived_Text(1) : self.presentationData.strings.StoryList_ToastArchived_Text(1), cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
}))) })))
if !self.isArchive { if !self.isArchive {
let isPinned = self.pinnedIds.contains(item.id) let isPinned = self.pinnedIds.contains(item.id)
items.append(.action(ContextMenuActionItem(text: isPinned ? "Unpin" : "Pin", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: isPinned ? "Chat/Context Menu/Unpin" : "Chat/Context Menu/Pin"), color: theme.contextMenu.primaryColor) }, action: { [weak self, weak itemLayer] _, f in items.append(.action(ContextMenuActionItem(text: isPinned ? self.presentationData.strings.StoryList_ItemAction_Unpin : self.presentationData.strings.StoryList_ItemAction_Pin, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: isPinned ? "Chat/Context Menu/Unpin" : "Chat/Context Menu/Pin"), color: theme.contextMenu.primaryColor) }, action: { [weak self, weak itemLayer] _, f in
itemLayer?.isHidden = false itemLayer?.isHidden = false
guard let self else { guard let self else {
f(.default) f(.default)
@ -1830,7 +1828,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
f(.default) f(.default)
let presentationData = self.presentationData let presentationData = self.presentationData
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "You can't pin more than 3 posts.", timeout: nil, customUndoText: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.StoryList_ToastPinLimit_Text(Int32(3)), timeout: nil, customUndoText: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
return return
} }
@ -1845,23 +1843,22 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
} }
let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone() let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone()
//TODO:localize
let presentationData = self.presentationData let presentationData = self.presentationData
let toastTitle: String? let toastTitle: String?
let toastText: String let toastText: String
if isPinned { if isPinned {
toastTitle = nil toastTitle = nil
toastText = "Story unpinned." toastText = presentationData.strings.StoryList_ToastUnpinned_Text(1)
} else { } else {
toastTitle = "Story pinned" toastTitle = presentationData.strings.StoryList_ToastPinned_Title(1)
toastText = "Now it will always be shown on the top." toastText = presentationData.strings.StoryList_ToastPinned_Text(1)
} }
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: isPinned ? "anim_toastunpin" : "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: isPinned ? "anim_toastunpin" : "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
}))) })))
} }
/*items.append(.action(ContextMenuActionItem(text: "Edit", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in /*items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.StoryList_ItemAction_Edit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss(completion: { c.dismiss(completion: {
guard let self else { guard let self else {
return return
@ -1874,7 +1871,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
} }
if !item.isForwardingDisabled, case .everyone = item.privacy?.base { if !item.isForwardingDisabled, case .everyone = item.privacy?.base {
items.append(.action(ContextMenuActionItem(text: "Forward", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.StoryList_ItemAction_Forward, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c.dismiss(completion: { c.dismiss(completion: {
guard let self else { guard let self else {
return return
@ -1916,7 +1913,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
} }
if canManage { if canManage {
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Conversation_ContextMenuDelete, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _ in items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.StoryList_ItemAction_Delete, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] c, _ in
c.dismiss(completion: { c.dismiss(completion: {
guard let self else { guard let self else {
return return
@ -2414,18 +2411,12 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
controller?.dismissAnimated() controller?.dismissAnimated()
} }
//TODO:localize let title: String = presentationData.strings.StoryList_DeleteConfirmation_Title(Int32(ids.count))
let title: String
if ids.count == 1 {
title = "Delete 1 story?"
} else {
title = "Delete \(ids.count) stories?"
}
controller.setItemGroups([ controller.setItemGroups([
ActionSheetItemGroup(items: [ ActionSheetItemGroup(items: [
ActionSheetTextItem(title: title), ActionSheetTextItem(title: title),
ActionSheetButtonItem(title: "Delete", color: .destructive, action: { [weak self] in ActionSheetButtonItem(title: presentationData.strings.StoryList_DeleteConfirmation_Action, color: .destructive, action: { [weak self] in
dismissAction() dismissAction()
guard let self else { guard let self else {
@ -2465,7 +2456,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
selectionItems.append(BottomActionsPanelComponent.Item( selectionItems.append(BottomActionsPanelComponent.Item(
id: "pin-unpin", id: "pin-unpin",
color: .accent, color: .accent,
title: actionIsPin ? "Pin" : "Unpin", title: actionIsPin ? presentationData.strings.StoryList_ActionPanel_Pin : presentationData.strings.StoryList_ActionPanel_Unpin,
isEnabled: !selectedIds.isEmpty, isEnabled: !selectedIds.isEmpty,
action: { [weak self] in action: { [weak self] in
guard let self, let selectedIds = self.itemInteraction.selectedIds else { guard let self, let selectedIds = self.itemInteraction.selectedIds else {
@ -2479,23 +2470,16 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
if updatedPinnedIds.count > 3 { if updatedPinnedIds.count > 3 {
let presentationData = self.presentationData let presentationData = self.presentationData
let animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor let animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor
let toastText = "You can't pin more than 3 posts." let toastText = presentationData.strings.StoryList_ToastPinLimit_Text(3)
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_infotip", scale: 1.0, colors: ["info1.info1.stroke": animationBackgroundColor, "info2.info2.Fill": animationBackgroundColor], title: nil, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_infotip", scale: 1.0, colors: ["info1.info1.stroke": animationBackgroundColor, "info2.info2.Fill": animationBackgroundColor], title: nil, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} else { } else {
let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone() let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone()
//TODO:localize
let presentationData = self.presentationData let presentationData = self.presentationData
let toastTitle: String let toastTitle = presentationData.strings.StoryList_ToastPinned_Title(Int32(selectedIds.count))
let toastText: String let toastText = presentationData.strings.StoryList_ToastPinned_Text(Int32(selectedIds.count))
if selectedIds.count == 1 {
toastTitle = "Story Pinned"
toastText = "Now it will always be shown on the top."
} else {
toastTitle = "Stories Pinned"
toastText = "Now they will always be shown on the top."
}
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
if let parentController = self.parentController as? PeerInfoScreen { if let parentController = self.parentController as? PeerInfoScreen {
@ -2509,18 +2493,11 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
} }
let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone() let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone()
//TODO:localize
let presentationData = self.presentationData let presentationData = self.presentationData
let toastTitle: String? let toastTitle: String? = nil
let toastText: String let toastText: String = presentationData.strings.StoryList_ToastUnpinned_Text(Int32(selectedIds.count))
if selectedIds.count == 1 {
toastTitle = nil
toastText = "Story unpinned."
} else {
toastTitle = nil
toastText = "Stories unpinned."
}
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastunpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastunpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
if let parentController = self.parentController as? PeerInfoScreen { if let parentController = self.parentController as? PeerInfoScreen {
@ -2532,7 +2509,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
selectionItems.append(BottomActionsPanelComponent.Item( selectionItems.append(BottomActionsPanelComponent.Item(
id: "archive", id: "archive",
color: .accent, color: .accent,
title: self.isArchive ? "Unarchive" : "Archive", title: self.isArchive ? presentationData.strings.StoryList_ActionPanel_Unarchive : presentationData.strings.StoryList_ActionPanel_Archive,
isEnabled: !selectedIds.isEmpty, isEnabled: !selectedIds.isEmpty,
action: { [weak self] in action: { [weak self] in
guard let self, let _ = self.itemInteraction.selectedIds else { guard let self, let _ = self.itemInteraction.selectedIds else {
@ -2549,17 +2526,9 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
let text: String let text: String
if self.isArchive { if self.isArchive {
if items.count == 1 { text = presentationData.strings.StoryList_ToastUnarchived_Text(Int32(items.count))
text = "Story unarchived."
} else {
text = "Stories unarchived."
}
} else { } else {
if items.count == 1 { text = presentationData.strings.StoryList_ToastArchived_Text(Int32(items.count))
text = "Story archived."
} else {
text = "Stories archived."
}
} }
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: text, cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: text, cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
} }
@ -2567,7 +2536,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
selectionItems.append(BottomActionsPanelComponent.Item( selectionItems.append(BottomActionsPanelComponent.Item(
id: "delete", id: "delete",
color: .destructive, color: .destructive,
title: "Delete", title: presentationData.strings.StoryList_ActionPanel_Delete,
isEnabled: !selectedIds.isEmpty, isEnabled: !selectedIds.isEmpty,
action: { [weak self] in action: { [weak self] in
guard let self, let selectedIds = self.itemInteraction.selectedIds else { guard let self, let selectedIds = self.itemInteraction.selectedIds else {

View File

@ -2565,11 +2565,11 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
return settings.displayNameOnLockscreen return settings.displayNameOnLockscreen
} }
|> deliverOnMainQueue).start(next: { displayNames in |> deliverOnMainQueue).start(next: { displayNames in
self.registerForNotifications(replyString: presentationData.strings.Notification_Reply, messagePlaceholderString: presentationData.strings.Conversation_InputTextPlaceholder, hiddenContentString: presentationData.strings.Watch_MessageView_Title, hiddenReactionContentString: presentationData.strings.Notification_LockScreenReactionPlaceholder, hiddenStoryContentString: presentationData.strings.Notification_LockScreenStoryPlaceholder, includeNames: displayNames, authorize: authorize, completion: completion) self.registerForNotifications(replyString: presentationData.strings.Notification_Reply, messagePlaceholderString: presentationData.strings.Conversation_InputTextPlaceholder, hiddenContentString: presentationData.strings.Watch_MessageView_Title, hiddenReactionContentString: presentationData.strings.Notification_LockScreenReactionPlaceholder, hiddenStoryContentString: presentationData.strings.Notification_LockScreenStoryPlaceholder, hiddenStoryReactionContentString: presentationData.strings.PUSH_REACT_STORY_HIDDEN, includeNames: displayNames, authorize: authorize, completion: completion)
}) })
} }
private func registerForNotifications(replyString: String, messagePlaceholderString: String, hiddenContentString: String, hiddenReactionContentString: String, hiddenStoryContentString: String, includeNames: Bool, authorize: Bool = true, completion: @escaping (Bool) -> Void = { _ in }) { private func registerForNotifications(replyString: String, messagePlaceholderString: String, hiddenContentString: String, hiddenReactionContentString: String, hiddenStoryContentString: String, hiddenStoryReactionContentString: String, includeNames: Bool, authorize: Bool = true, completion: @escaping (Bool) -> Void = { _ in }) {
let notificationCenter = UNUserNotificationCenter.current() let notificationCenter = UNUserNotificationCenter.current()
Logger.shared.log("App \(self.episodeId)", "register for notifications: get settings (authorize: \(authorize))") Logger.shared.log("App \(self.episodeId)", "register for notifications: get settings (authorize: \(authorize))")
notificationCenter.getNotificationSettings(completionHandler: { settings in notificationCenter.getNotificationSettings(completionHandler: { settings in
@ -2600,6 +2600,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
let channelMessageCategory: UNNotificationCategory let channelMessageCategory: UNNotificationCategory
let reactionMessageCategory: UNNotificationCategory let reactionMessageCategory: UNNotificationCategory
let storyCategory: UNNotificationCategory let storyCategory: UNNotificationCategory
let storyReactionCategory: UNNotificationCategory
var options: UNNotificationCategoryOptions = [] var options: UNNotificationCategoryOptions = []
if includeNames { if includeNames {
@ -2620,6 +2621,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
channelMessageCategory = UNNotificationCategory(identifier: "c", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: options) channelMessageCategory = UNNotificationCategory(identifier: "c", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: options)
reactionMessageCategory = UNNotificationCategory(identifier: "t", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenReactionContentString, options: options) reactionMessageCategory = UNNotificationCategory(identifier: "t", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenReactionContentString, options: options)
storyCategory = UNNotificationCategory(identifier: "st", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenStoryContentString, options: options) storyCategory = UNNotificationCategory(identifier: "st", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenStoryContentString, options: options)
storyReactionCategory = UNNotificationCategory(identifier: "str", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenStoryReactionContentString, options: options)
UNUserNotificationCenter.current().setNotificationCategories([ UNUserNotificationCenter.current().setNotificationCategories([
unknownMessageCategory, unknownMessageCategory,
@ -2629,7 +2631,8 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
reactionMessageCategory, reactionMessageCategory,
groupRepliableMessageCategory, groupRepliableMessageCategory,
groupRepliableMediaMessageCategory, groupRepliableMediaMessageCategory,
storyCategory storyCategory,
storyReactionCategory
]) ])
Logger.shared.log("App \(self.episodeId)", "register for notifications: invoke registerForRemoteNotifications") Logger.shared.log("App \(self.episodeId)", "register for notifications: invoke registerForRemoteNotifications")