mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Use peer name localization
This commit is contained in:
parent
120135b8fe
commit
284db5aba8
@ -130,7 +130,7 @@ func personWithUser(stableId: String, user: TelegramUser) -> INPerson {
|
|||||||
} else if let username = user.username {
|
} else if let username = user.username {
|
||||||
personHandle = INPersonHandle(value: "@\(username)", type: .unknown)
|
personHandle = INPersonHandle(value: "@\(username)", type: .unknown)
|
||||||
} else {
|
} else {
|
||||||
personHandle = INPersonHandle(value: user.displayTitle, type: .unknown)
|
personHandle = INPersonHandle(value: user.nameOrPhone, type: .unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
return INPerson(personHandle: personHandle, nameComponents: nameComponents, displayName: user.debugDisplayTitle, image: nil, contactIdentifier: stableId, customIdentifier: "tg\(user.id.toInt64())")
|
return INPerson(personHandle: personHandle, nameComponents: nameComponents, displayName: user.debugDisplayTitle, image: nil, contactIdentifier: stableId, customIdentifier: "tg\(user.id.toInt64())")
|
||||||
|
@ -150,7 +150,7 @@ private func callWithTelegramMessage(_ telegramMessage: Message, account: Accoun
|
|||||||
personHandle = INPersonHandle(value: user.phone ?? "", type: .phoneNumber)
|
personHandle = INPersonHandle(value: user.phone ?? "", type: .phoneNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
let caller = INPerson(personHandle: personHandle, nameComponents: nil, displayName: user.displayTitle, image: nil, contactIdentifier: nil, customIdentifier: "tg\(user.id.toInt64())")
|
let caller = INPerson(personHandle: personHandle, nameComponents: nil, displayName: user.nameOrPhone, image: nil, contactIdentifier: nil, customIdentifier: "tg\(user.id.toInt64())")
|
||||||
let date = Date(timeIntervalSince1970: TimeInterval(telegramMessage.timestamp))
|
let date = Date(timeIntervalSince1970: TimeInterval(telegramMessage.timestamp))
|
||||||
|
|
||||||
var duration: Int32?
|
var duration: Int32?
|
||||||
@ -190,7 +190,7 @@ private func messageWithTelegramMessage(_ telegramMessage: Message) -> INMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
let personIdentifier = "tg\(user.id.toInt64())"
|
let personIdentifier = "tg\(user.id.toInt64())"
|
||||||
let sender = INPerson(personHandle: personHandle, nameComponents: nil, displayName: user.displayTitle, image: nil, contactIdentifier: personIdentifier, customIdentifier: personIdentifier)
|
let sender = INPerson(personHandle: personHandle, nameComponents: nil, displayName: user.nameOrPhone, image: nil, contactIdentifier: personIdentifier, customIdentifier: personIdentifier)
|
||||||
let date = Date(timeIntervalSince1970: TimeInterval(telegramMessage.timestamp))
|
let date = Date(timeIntervalSince1970: TimeInterval(telegramMessage.timestamp))
|
||||||
|
|
||||||
let message: INMessage
|
let message: INMessage
|
||||||
|
@ -239,7 +239,7 @@ private func botCheckoutControllerEntries(presentationData: PresentationData, st
|
|||||||
|
|
||||||
var botName = ""
|
var botName = ""
|
||||||
if let botPeer = botPeer {
|
if let botPeer = botPeer {
|
||||||
botName = botPeer.displayTitle
|
botName = botPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
entries.append(.header(presentationData.theme, invoice, botName))
|
entries.append(.header(presentationData.theme, invoice, botName))
|
||||||
|
|
||||||
@ -852,7 +852,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
|||||||
}
|
}
|
||||||
|
|
||||||
let amount = NSDecimalNumber(value: Double(totalAmount) * 0.01)
|
let amount = NSDecimalNumber(value: Double(totalAmount) * 0.01)
|
||||||
items.append(PKPaymentSummaryItem(label: botPeer.displayTitle, amount: amount))
|
items.append(PKPaymentSummaryItem(label: botPeer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder), amount: amount))
|
||||||
|
|
||||||
request.paymentSummaryItems = items
|
request.paymentSummaryItems = items
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
|||||||
if value {
|
if value {
|
||||||
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
||||||
} else {
|
} else {
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.Checkout_LiabilityAlertTitle, text: strongSelf.presentationData.strings.Checkout_LiabilityAlert(botPeer.displayTitle, providerPeer.displayTitle).0, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.Checkout_LiabilityAlertTitle, text: strongSelf.presentationData.strings.Checkout_LiabilityAlert(botPeer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder), providerPeer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).0, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let _ = ApplicationSpecificNotice.setBotPaymentLiability(accountManager: strongSelf.context.sharedContext.accountManager, peerId: strongSelf.messageId.peerId).start()
|
let _ = ApplicationSpecificNotice.setBotPaymentLiability(accountManager: strongSelf.context.sharedContext.accountManager, peerId: strongSelf.messageId.peerId).start()
|
||||||
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
||||||
|
@ -176,7 +176,7 @@ private func botReceiptControllerEntries(presentationData: PresentationData, inv
|
|||||||
|
|
||||||
var botName = ""
|
var botName = ""
|
||||||
if let botPeer = botPeer {
|
if let botPeer = botPeer {
|
||||||
botName = botPeer.displayTitle
|
botName = botPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
entries.append(.header(presentationData.theme, invoice, botName))
|
entries.append(.header(presentationData.theme, invoice, botName))
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import AccountContext
|
|||||||
import AlertUI
|
import AlertUI
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
public enum CallListControllerMode {
|
public enum CallListControllerMode {
|
||||||
case tab
|
case tab
|
||||||
|
@ -83,7 +83,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, source: ChatC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isSavedMessages, let peer = peer as? TelegramUser, !peer.flags.contains(.isSupport) && peer.botInfo == nil {
|
if !isSavedMessages, let peer = peer as? TelegramUser, !peer.flags.contains(.isSupport) && peer.botInfo == nil && !peer.isDeleted {
|
||||||
if !transaction.isPeerContact(peerId: peer.id) {
|
if !transaction.isPeerContact(peerId: peer.id) {
|
||||||
items.append(.action(ContextMenuActionItem(text: strings.ChatList_Context_AddToContacts, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/AddUser"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
items.append(.action(ContextMenuActionItem(text: strings.ChatList_Context_AddToContacts, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/AddUser"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||||
context.sharedContext.openAddPersonContact(context: context, peerId: peerId, pushController: { controller in
|
context.sharedContext.openAddPersonContact(context: context, peerId: peerId, pushController: { controller in
|
||||||
|
@ -1390,7 +1390,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: mainPeer, chatPeer: chatPeer, action: .delete, strings: strongSelf.presentationData.strings))
|
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: mainPeer, chatPeer: chatPeer, action: .delete, strings: strongSelf.presentationData.strings, nameDisplayOrder: strongSelf.presentationData.nameDisplayOrder))
|
||||||
if canClear {
|
if canClear {
|
||||||
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.DialogList_ClearHistoryConfirmation, color: .accent, action: { [weak actionSheet] in
|
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.DialogList_ClearHistoryConfirmation, color: .accent, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
@ -1444,7 +1444,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
let actionSheet = ActionSheetController(presentationTheme: strongSelf.presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: strongSelf.presentationData.theme)
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
|
|
||||||
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: mainPeer, chatPeer: chatPeer, action: .clearHistory, strings: strongSelf.presentationData.strings))
|
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: mainPeer, chatPeer: chatPeer, action: .clearHistory, strings: strongSelf.presentationData.strings, nameDisplayOrder: strongSelf.presentationData.nameDisplayOrder))
|
||||||
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.ChatList_DeleteForEveryone(mainPeer.compactDisplayTitle).0, color: .destructive, action: { [weak actionSheet] in
|
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.ChatList_DeleteForEveryone(mainPeer.compactDisplayTitle).0, color: .destructive, action: { [weak actionSheet] in
|
||||||
beginClear(.forEveryone)
|
beginClear(.forEveryone)
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
|
@ -4,6 +4,7 @@ import TelegramCore
|
|||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
import TelegramStringFormatting
|
import TelegramStringFormatting
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, message: Message?, chatPeer: RenderedPeer, accountPeerId: PeerId, enableMediaEmoji: Bool = true, isPeerGroup: Bool = false) -> (peer: Peer?, hideAuthor: Bool, messageText: String) {
|
public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, message: Message?, chatPeer: RenderedPeer, accountPeerId: PeerId, enableMediaEmoji: Bool = true, isPeerGroup: Bool = false) -> (peer: Peer?, hideAuthor: Bool, messageText: String) {
|
||||||
let peer: Peer?
|
let peer: Peer?
|
||||||
|
@ -7,6 +7,7 @@ import Display
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import ChatTitleActivityNode
|
import ChatTitleActivityNode
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let textFont = Font.regular(15.0)
|
private let textFont = Font.regular(15.0)
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import Display
|
|||||||
import AlertUI
|
import AlertUI
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import OverlayStatusController
|
import OverlayStatusController
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
func contactContextMenuItems(context: AccountContext, peerId: PeerId, contactsController: ContactsController?) -> Signal<[ContextMenuItem], NoError> {
|
func contactContextMenuItems(context: AccountContext, peerId: PeerId, contactsController: ContactsController?) -> Signal<[ContextMenuItem], NoError> {
|
||||||
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
|
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
|
||||||
|
@ -4,6 +4,7 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AvatarNode
|
import AvatarNode
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
@ -18,17 +19,19 @@ public final class DeleteChatPeerActionSheetItem: ActionSheetItem {
|
|||||||
let chatPeer: Peer
|
let chatPeer: Peer
|
||||||
let action: DeleteChatPeerAction
|
let action: DeleteChatPeerAction
|
||||||
let strings: PresentationStrings
|
let strings: PresentationStrings
|
||||||
|
let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
|
|
||||||
public init(context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction, strings: PresentationStrings) {
|
public init(context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.chatPeer = chatPeer
|
self.chatPeer = chatPeer
|
||||||
self.action = action
|
self.action = action
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
}
|
}
|
||||||
|
|
||||||
public func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
public func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
||||||
return DeleteChatPeerActionSheetItemNode(theme: theme, strings: self.strings, context: self.context, peer: self.peer, chatPeer: self.chatPeer, action: self.action)
|
return DeleteChatPeerActionSheetItemNode(theme: theme, strings: self.strings, nameOrder: self.nameDisplayOrder, context: self.context, peer: self.peer, chatPeer: self.chatPeer, action: self.action)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateNode(_ node: ActionSheetItemNode) {
|
public func updateNode(_ node: ActionSheetItemNode) {
|
||||||
@ -46,7 +49,7 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
private let accessibilityArea: AccessibilityAreaNode
|
private let accessibilityArea: AccessibilityAreaNode
|
||||||
|
|
||||||
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction) {
|
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, nameOrder: PresentationPersonNameOrder, context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
|
||||||
@ -82,15 +85,17 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode {
|
|||||||
case .delete:
|
case .delete:
|
||||||
if chatPeer.id == context.account.peerId {
|
if chatPeer.id == context.account.peerId {
|
||||||
text = (strings.ChatList_DeleteSavedMessagesConfirmation, [])
|
text = (strings.ChatList_DeleteSavedMessagesConfirmation, [])
|
||||||
} else if chatPeer is TelegramGroup || chatPeer is TelegramChannel {
|
} else if let chatPeer = chatPeer as? TelegramGroup {
|
||||||
text = strings.ChatList_LeaveGroupConfirmation(peer.displayTitle)
|
text = strings.ChatList_LeaveGroupConfirmation(chatPeer.title)
|
||||||
|
} else if let chatPeer = chatPeer as? TelegramChannel {
|
||||||
|
text = strings.ChatList_LeaveGroupConfirmation(chatPeer.title)
|
||||||
} else if chatPeer is TelegramSecretChat {
|
} else if chatPeer is TelegramSecretChat {
|
||||||
text = strings.ChatList_DeleteSecretChatConfirmation(peer.displayTitle)
|
text = strings.ChatList_DeleteSecretChatConfirmation(peer.displayTitle(strings: strings, displayOrder: nameOrder))
|
||||||
} else {
|
} else {
|
||||||
text = strings.ChatList_DeleteChatConfirmation(peer.displayTitle)
|
text = strings.ChatList_DeleteChatConfirmation(peer.displayTitle(strings: strings, displayOrder: nameOrder))
|
||||||
}
|
}
|
||||||
case .clearHistory:
|
case .clearHistory:
|
||||||
text = strings.ChatList_ClearChatConfirmation(peer.displayTitle)
|
text = strings.ChatList_ClearChatConfirmation(peer.displayTitle(strings: strings, displayOrder: nameOrder))
|
||||||
}
|
}
|
||||||
let attributedText = NSMutableAttributedString(attributedString: NSAttributedString(string: text.0, font: Font.regular(14.0), textColor: theme.primaryTextColor))
|
let attributedText = NSMutableAttributedString(attributedString: NSAttributedString(string: text.0, font: Font.regular(14.0), textColor: theme.primaryTextColor))
|
||||||
for (_, range) in text.1 {
|
for (_, range) in text.1 {
|
||||||
|
@ -7,6 +7,7 @@ import TelegramCore
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Photos
|
import Photos
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import TelegramStringFormatting
|
import TelegramStringFormatting
|
||||||
import AccountContext
|
import AccountContext
|
||||||
@ -14,6 +15,7 @@ import RadialStatusNode
|
|||||||
import ShareController
|
import ShareController
|
||||||
import OpenInExternalAppUI
|
import OpenInExternalAppUI
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let deleteImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: .white)
|
private let deleteImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: .white)
|
||||||
private let actionImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: .white)
|
private let actionImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: .white)
|
||||||
@ -105,6 +107,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
|||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
|
private var nameOrder: PresentationPersonNameOrder
|
||||||
private var dateTimeFormat: PresentationDateTimeFormat
|
private var dateTimeFormat: PresentationDateTimeFormat
|
||||||
|
|
||||||
private let deleteButton: UIButton
|
private let deleteButton: UIButton
|
||||||
@ -241,6 +244,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
|||||||
self.context = context
|
self.context = context
|
||||||
self.theme = presentationData.theme
|
self.theme = presentationData.theme
|
||||||
self.strings = presentationData.strings
|
self.strings = presentationData.strings
|
||||||
|
self.nameOrder = presentationData.nameDisplayOrder
|
||||||
self.dateTimeFormat = presentationData.dateTimeFormat
|
self.dateTimeFormat = presentationData.dateTimeFormat
|
||||||
|
|
||||||
self.deleteButton = UIButton()
|
self.deleteButton = UIButton()
|
||||||
@ -439,9 +443,9 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
|||||||
var authorNameText: String?
|
var authorNameText: String?
|
||||||
|
|
||||||
if let author = message.effectiveAuthor {
|
if let author = message.effectiveAuthor {
|
||||||
authorNameText = author.displayTitle
|
authorNameText = author.displayTitle(strings: self.strings, displayOrder: self.nameOrder)
|
||||||
} else if let peer = message.peers[message.id.peerId] {
|
} else if let peer = message.peers[message.id.peerId] {
|
||||||
authorNameText = peer.displayTitle
|
authorNameText = peer.displayTitle(strings: self.strings, displayOrder: self.nameOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
let dateText = humanReadableStringForTimestamp(strings: self.strings, dateTimeFormat: self.dateTimeFormat, timestamp: message.timestamp)
|
let dateText = humanReadableStringForTimestamp(strings: self.strings, dateTimeFormat: self.dateTimeFormat, timestamp: message.timestamp)
|
||||||
|
@ -172,7 +172,7 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese
|
|||||||
}
|
}
|
||||||
|
|
||||||
let caption = galleryCaptionStringWithAppliedEntities(text, entities: entities)
|
let caption = galleryCaptionStringWithAppliedEntities(text, entities: entities)
|
||||||
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle, timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: caption, hideControls: hideControls, fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, playbackCompleted: playbackCompleted, performAction: performAction, openActionOptions: openActionOptions)
|
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: caption, hideControls: hideControls, fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, playbackCompleted: playbackCompleted, performAction: performAction, openActionOptions: openActionOptions)
|
||||||
} else {
|
} else {
|
||||||
if let fileName = file.fileName, (fileName as NSString).pathExtension.lowercased() == "json" {
|
if let fileName = file.fileName, (fileName as NSString).pathExtension.lowercased() == "json" {
|
||||||
return ChatAnimationGalleryItem(context: context, presentationData: presentationData, message: message, location: location)
|
return ChatAnimationGalleryItem(context: context, presentationData: presentationData, message: message, location: location)
|
||||||
@ -211,7 +211,7 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let content = content {
|
if let content = content {
|
||||||
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle, timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, performAction: performAction, openActionOptions: openActionOptions)
|
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, performAction: performAction, openActionOptions: openActionOptions)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import AccountContext
|
|||||||
import RadialStatusNode
|
import RadialStatusNode
|
||||||
import ScreenCaptureDetection
|
import ScreenCaptureDetection
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private func galleryMediaForMedia(media: Media) -> Media? {
|
private func galleryMediaForMedia(media: Media) -> Media? {
|
||||||
if let media = media as? TelegramMediaImage {
|
if let media = media as? TelegramMediaImage {
|
||||||
|
@ -42,7 +42,7 @@ final class HashtagSearchControllerNode: ASDisplayNode {
|
|||||||
if peer?.id == context.account.peerId {
|
if peer?.id == context.account.peerId {
|
||||||
items.append(presentationData.strings.Conversation_SavedMessages)
|
items.append(presentationData.strings.Conversation_SavedMessages)
|
||||||
} else {
|
} else {
|
||||||
items.append(peer?.displayTitle ?? "")
|
items.append(peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) ?? "")
|
||||||
}
|
}
|
||||||
items.append(strings.HashtagSearch_AllChats)
|
items.append(strings.HashtagSearch_AllChats)
|
||||||
self.segmentedControlNode = SegmentedControlNode(theme: SegmentedControlTheme(theme: theme), items: items.map { SegmentedControlItem(title: $0) }, selectedIndex: 0)
|
self.segmentedControlNode = SegmentedControlNode(theme: SegmentedControlTheme(theme: theme), items: items.map { SegmentedControlItem(title: $0) }, selectedIndex: 0)
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageAnchorItem: InstantPageItem {
|
final class InstantPageAnchorItem: InstantPageItem {
|
||||||
@ -26,7 +27,7 @@ final class InstantPageAnchorItem: InstantPageItem {
|
|||||||
func drawInTile(context: CGContext) {
|
func drawInTile(context: CGContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageArticleItem: InstantPageItem {
|
final class InstantPageArticleItem: InstantPageItem {
|
||||||
@ -31,7 +32,7 @@ final class InstantPageArticleItem: InstantPageItem {
|
|||||||
self.rtl = rtl
|
self.rtl = rtl
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageArticleNode(context: context, item: self, webPage: self.webPage, strings: strings, theme: theme, contentItems: self.contentItems, contentSize: self.contentSize, cover: self.cover, url: self.url, webpageId: self.webpageId, rtl: self.rtl, openUrl: openUrl)
|
return InstantPageArticleNode(context: context, item: self, webPage: self.webPage, strings: strings, theme: theme, contentItems: self.contentItems, contentSize: self.contentSize, cover: self.cover, url: self.url, webpageId: self.webpageId, rtl: self.rtl, openUrl: openUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageAudioItem: InstantPageItem {
|
final class InstantPageAudioItem: InstantPageItem {
|
||||||
@ -22,7 +23,7 @@ final class InstantPageAudioItem: InstantPageItem {
|
|||||||
self.medias = [media]
|
self.medias = [media]
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageAudioNode(context: context, strings: strings, theme: theme, webPage: self.webpage, media: self.media, openMedia: openMedia)
|
return InstantPageAudioNode(context: context, strings: strings, theme: theme, webPage: self.webpage, media: self.media, openMedia: openMedia)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,13 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageContentNode : ASDisplayNode {
|
final class InstantPageContentNode : ASDisplayNode {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private let theme: InstantPageTheme
|
private let theme: InstantPageTheme
|
||||||
|
|
||||||
private let openMedia: (InstantPageMedia) -> Void
|
private let openMedia: (InstantPageMedia) -> Void
|
||||||
@ -37,9 +39,10 @@ final class InstantPageContentNode : ASDisplayNode {
|
|||||||
|
|
||||||
private var previousVisibleBounds: CGRect?
|
private var previousVisibleBounds: CGRect?
|
||||||
|
|
||||||
init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, items: [InstantPageItem], contentSize: CGSize, inOverlayPanel: Bool = false, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void) {
|
init(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, items: [InstantPageItem], contentSize: CGSize, inOverlayPanel: Bool = false, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
self.openMedia = openMedia
|
self.openMedia = openMedia
|
||||||
@ -183,7 +186,7 @@ final class InstantPageContentNode : ASDisplayNode {
|
|||||||
if itemNode == nil {
|
if itemNode == nil {
|
||||||
let itemIndex = itemIndex
|
let itemIndex = itemIndex
|
||||||
let detailsIndex = detailsIndex
|
let detailsIndex = detailsIndex
|
||||||
if let newNode = item.node(context: self.context, strings: self.strings, theme: theme, openMedia: { [weak self] media in
|
if let newNode = item.node(context: self.context, strings: self.strings, nameDisplayOrder: self.nameDisplayOrder, theme: theme, openMedia: { [weak self] media in
|
||||||
self?.openMedia(media)
|
self?.openMedia(media)
|
||||||
}, longPressMedia: { [weak self] media in
|
}, longPressMedia: { [weak self] media in
|
||||||
self?.longPressMedia(media)
|
self?.longPressMedia(media)
|
||||||
|
@ -95,7 +95,7 @@ public final class InstantPageController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func loadDisplayNode() {
|
override public func loadDisplayNode() {
|
||||||
self.displayNode = InstantPageControllerNode(context: self.context, settings: self.settings, themeSettings: self.themeSettings, presentationTheme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, statusBar: self.statusBar, sourcePeerType: self.sourcePeerType, getNavigationController: { [weak self] in
|
self.displayNode = InstantPageControllerNode(context: self.context, settings: self.settings, themeSettings: self.themeSettings, presentationTheme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, statusBar: self.statusBar, sourcePeerType: self.sourcePeerType, getNavigationController: { [weak self] in
|
||||||
return self?.navigationController as? NavigationController
|
return self?.navigationController as? NavigationController
|
||||||
}, present: { [weak self] c, a in
|
}, present: { [weak self] c, a in
|
||||||
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
||||||
|
@ -21,6 +21,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
private var themeSettings: PresentationThemeSettings?
|
private var themeSettings: PresentationThemeSettings?
|
||||||
private var presentationTheme: PresentationTheme
|
private var presentationTheme: PresentationTheme
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
|
private var nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private var dateTimeFormat: PresentationDateTimeFormat
|
private var dateTimeFormat: PresentationDateTimeFormat
|
||||||
private var theme: InstantPageTheme?
|
private var theme: InstantPageTheme?
|
||||||
private let sourcePeerType: MediaAutoDownloadPeerType
|
private let sourcePeerType: MediaAutoDownloadPeerType
|
||||||
@ -85,10 +86,11 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
return InstantPageStoredState(contentOffset: Double(self.scrollNode.view.contentOffset.y), details: details)
|
return InstantPageStoredState(contentOffset: Double(self.scrollNode.view.contentOffset.y), details: details)
|
||||||
}
|
}
|
||||||
|
|
||||||
init(context: AccountContext, settings: InstantPagePresentationSettings?, themeSettings: PresentationThemeSettings?, presentationTheme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, statusBar: StatusBar, sourcePeerType: MediaAutoDownloadPeerType, getNavigationController: @escaping () -> NavigationController?, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, openPeer: @escaping (PeerId) -> Void, navigateBack: @escaping () -> Void) {
|
init(context: AccountContext, settings: InstantPagePresentationSettings?, themeSettings: PresentationThemeSettings?, presentationTheme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, statusBar: StatusBar, sourcePeerType: MediaAutoDownloadPeerType, getNavigationController: @escaping () -> NavigationController?, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, openPeer: @escaping (PeerId) -> Void, navigateBack: @escaping () -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.presentationTheme = presentationTheme
|
self.presentationTheme = presentationTheme
|
||||||
self.dateTimeFormat = dateTimeFormat
|
self.dateTimeFormat = dateTimeFormat
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
let themeReferenceDate = Date()
|
let themeReferenceDate = Date()
|
||||||
@ -532,7 +534,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
let itemIndex = itemIndex
|
let itemIndex = itemIndex
|
||||||
let embedIndex = embedIndex
|
let embedIndex = embedIndex
|
||||||
let detailsIndex = detailsIndex
|
let detailsIndex = detailsIndex
|
||||||
if let newNode = item.node(context: self.context, strings: self.strings, theme: theme, openMedia: { [weak self] media in
|
if let newNode = item.node(context: self.context, strings: self.strings, nameDisplayOrder: self.nameDisplayOrder, theme: theme, openMedia: { [weak self] media in
|
||||||
self?.openMedia(media)
|
self?.openMedia(media)
|
||||||
}, longPressMedia: { [weak self] media in
|
}, longPressMedia: { [weak self] media in
|
||||||
self?.longPressMedia(media)
|
self?.longPressMedia(media)
|
||||||
|
@ -5,6 +5,7 @@ import TelegramCore
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageDetailsItem: InstantPageItem {
|
final class InstantPageDetailsItem: InstantPageItem {
|
||||||
@ -32,12 +33,12 @@ final class InstantPageDetailsItem: InstantPageItem {
|
|||||||
self.index = index
|
self.index = index
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
var expanded: Bool?
|
var expanded: Bool?
|
||||||
if let expandedDetails = currentExpandedDetails, let currentlyExpanded = expandedDetails[self.index] {
|
if let expandedDetails = currentExpandedDetails, let currentlyExpanded = expandedDetails[self.index] {
|
||||||
expanded = currentlyExpanded
|
expanded = currentlyExpanded
|
||||||
}
|
}
|
||||||
return InstantPageDetailsNode(context: context, strings: strings, theme: theme, item: self, openMedia: openMedia, longPressMedia: longPressMedia, openPeer: openPeer, openUrl: openUrl, currentlyExpanded: expanded, updateDetailsExpanded: updateDetailsExpanded)
|
return InstantPageDetailsNode(context: context, strings: strings, nameDisplayOrder: nameDisplayOrder, theme: theme, item: self, openMedia: openMedia, longPressMedia: longPressMedia, openPeer: openPeer, openUrl: openUrl, currentlyExpanded: expanded, updateDetailsExpanded: updateDetailsExpanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchesAnchor(_ anchor: String) -> Bool {
|
func matchesAnchor(_ anchor: String) -> Bool {
|
||||||
|
@ -6,6 +6,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
private let detailsInset: CGFloat = 17.0
|
private let detailsInset: CGFloat = 17.0
|
||||||
@ -14,6 +15,7 @@ private let titleInset: CGFloat = 22.0
|
|||||||
final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode {
|
final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private let theme: InstantPageTheme
|
private let theme: InstantPageTheme
|
||||||
let item: InstantPageDetailsItem
|
let item: InstantPageDetailsItem
|
||||||
|
|
||||||
@ -33,9 +35,10 @@ final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode {
|
|||||||
|
|
||||||
var requestLayoutUpdate: ((Bool) -> Void)?
|
var requestLayoutUpdate: ((Bool) -> Void)?
|
||||||
|
|
||||||
init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, item: InstantPageDetailsItem, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, currentlyExpanded: Bool?, updateDetailsExpanded: @escaping (Bool) -> Void) {
|
init(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, item: InstantPageDetailsItem, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, currentlyExpanded: Bool?, updateDetailsExpanded: @escaping (Bool) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.item = item
|
self.item = item
|
||||||
|
|
||||||
@ -62,7 +65,7 @@ final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode {
|
|||||||
self.arrowNode = InstantPageDetailsArrowNode(color: theme.controlColor, open: self.expanded)
|
self.arrowNode = InstantPageDetailsArrowNode(color: theme.controlColor, open: self.expanded)
|
||||||
self.separatorNode = ASDisplayNode()
|
self.separatorNode = ASDisplayNode()
|
||||||
|
|
||||||
self.contentNode = InstantPageContentNode(context: context, strings: strings, theme: theme, items: item.items, contentSize: CGSize(width: item.frame.width, height: item.frame.height - item.titleHeight), openMedia: openMedia, longPressMedia: longPressMedia, openPeer: openPeer, openUrl: openUrl)
|
self.contentNode = InstantPageContentNode(context: context, strings: strings, nameDisplayOrder: nameDisplayOrder, theme: theme, items: item.items, contentSize: CGSize(width: item.frame.width, height: item.frame.height - item.titleHeight), openMedia: openMedia, longPressMedia: longPressMedia, openPeer: openPeer, openUrl: openUrl)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageFeedbackItem: InstantPageItem {
|
final class InstantPageFeedbackItem: InstantPageItem {
|
||||||
@ -19,7 +20,7 @@ final class InstantPageFeedbackItem: InstantPageItem {
|
|||||||
self.webPage = webPage
|
self.webPage = webPage
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageFeedbackNode(context: context, strings: strings, theme: theme, webPage: self.webPage, openUrl: openUrl)
|
return InstantPageFeedbackNode(context: context, strings: strings, theme: theme, webPage: self.webPage, openUrl: openUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
protocol InstantPageImageAttribute {
|
protocol InstantPageImageAttribute {
|
||||||
@ -43,7 +44,7 @@ final class InstantPageImageItem: InstantPageItem {
|
|||||||
self.fit = fit
|
self.fit = fit
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageImageNode(context: context, theme: theme, webPage: self.webPage, media: self.media, attributes: self.attributes, interactive: self.interactive, roundCorners: self.roundCorners, fit: self.fit, openMedia: openMedia, longPressMedia: longPressMedia)
|
return InstantPageImageNode(context: context, theme: theme, webPage: self.webPage, media: self.media, attributes: self.attributes, interactive: self.interactive, roundCorners: self.roundCorners, fit: self.fit, openMedia: openMedia, longPressMedia: longPressMedia)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
protocol InstantPageItem {
|
protocol InstantPageItem {
|
||||||
@ -14,7 +15,7 @@ protocol InstantPageItem {
|
|||||||
|
|
||||||
func matchesAnchor(_ anchor: String) -> Bool
|
func matchesAnchor(_ anchor: String) -> Bool
|
||||||
func drawInTile(context: CGContext)
|
func drawInTile(context: CGContext)
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)?
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)?
|
||||||
func matchesNode(_ node: InstantPageNode) -> Bool
|
func matchesNode(_ node: InstantPageNode) -> Bool
|
||||||
func linkSelectionRects(at point: CGPoint) -> [CGRect]
|
func linkSelectionRects(at point: CGPoint) -> [CGRect]
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPagePeerReferenceItem: InstantPageItem {
|
final class InstantPagePeerReferenceItem: InstantPageItem {
|
||||||
@ -25,8 +26,8 @@ final class InstantPagePeerReferenceItem: InstantPageItem {
|
|||||||
self.rtl = rtl
|
self.rtl = rtl
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPagePeerReferenceNode(context: context, strings: strings, theme: theme, initialPeer: self.initialPeer, safeInset: self.safeInset, transparent: self.transparent, rtl: self.rtl, openPeer: openPeer)
|
return InstantPagePeerReferenceNode(context: context, strings: strings, nameDisplayOrder: nameDisplayOrder, theme: theme, initialPeer: self.initialPeer, safeInset: self.safeInset, transparent: self.transparent, rtl: self.rtl, openPeer: openPeer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchesAnchor(_ anchor: String) -> Bool {
|
func matchesAnchor(_ anchor: String) -> Bool {
|
||||||
|
@ -6,6 +6,7 @@ import SwiftSignalKit
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import ActivityIndicator
|
import ActivityIndicator
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import AppBundle
|
import AppBundle
|
||||||
@ -52,6 +53,7 @@ final class InstantPagePeerReferenceNode: ASDisplayNode, InstantPageNode {
|
|||||||
private let transparent: Bool
|
private let transparent: Bool
|
||||||
private let rtl: Bool
|
private let rtl: Bool
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
|
private var nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private var theme: InstantPageTheme
|
private var theme: InstantPageTheme
|
||||||
private let openPeer: (PeerId) -> Void
|
private let openPeer: (PeerId) -> Void
|
||||||
|
|
||||||
@ -68,9 +70,10 @@ final class InstantPagePeerReferenceNode: ASDisplayNode, InstantPageNode {
|
|||||||
private let joinDisposable = MetaDisposable()
|
private let joinDisposable = MetaDisposable()
|
||||||
private var joinState: JoinState = .none
|
private var joinState: JoinState = .none
|
||||||
|
|
||||||
init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, initialPeer: Peer, safeInset: CGFloat, transparent: Bool, rtl: Bool, openPeer: @escaping (PeerId) -> Void) {
|
init(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, initialPeer: Peer, safeInset: CGFloat, transparent: Bool, rtl: Bool, openPeer: @escaping (PeerId) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.peer = initialPeer
|
self.peer = initialPeer
|
||||||
self.safeInset = safeInset
|
self.safeInset = safeInset
|
||||||
@ -208,7 +211,7 @@ final class InstantPagePeerReferenceNode: ASDisplayNode, InstantPageNode {
|
|||||||
private func applyThemeAndStrings(themeUpdated: Bool) {
|
private func applyThemeAndStrings(themeUpdated: Bool) {
|
||||||
if let peer = self.peer {
|
if let peer = self.peer {
|
||||||
let textColor = self.transparent ? UIColor.white : self.theme.panelPrimaryColor
|
let textColor = self.transparent ? UIColor.white : self.theme.panelPrimaryColor
|
||||||
self.nameNode.attributedText = NSAttributedString(string: peer.displayTitle, font: Font.medium(17.0), textColor: textColor)
|
self.nameNode.attributedText = NSAttributedString(string: peer.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder), font: Font.medium(17.0), textColor: textColor)
|
||||||
}
|
}
|
||||||
let accentColor = self.transparent ? UIColor.white : self.theme.panelAccentColor
|
let accentColor = self.transparent ? UIColor.white : self.theme.panelAccentColor
|
||||||
self.joinNode.setAttributedTitle(NSAttributedString(string: self.strings.Channel_JoinChannel, font: Font.medium(17.0), textColor: accentColor), for: [])
|
self.joinNode.setAttributedTitle(NSAttributedString(string: self.strings.Channel_JoinChannel, font: Font.medium(17.0), textColor: accentColor), for: [])
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPagePlayableVideoItem: InstantPageItem {
|
final class InstantPagePlayableVideoItem: InstantPageItem {
|
||||||
@ -27,7 +28,7 @@ final class InstantPagePlayableVideoItem: InstantPageItem {
|
|||||||
self.interactive = interactive
|
self.interactive = interactive
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPagePlayableVideoNode(context: context, webPage: self.webPage, theme: theme, media: self.media, interactive: self.interactive, openMedia: openMedia)
|
return InstantPagePlayableVideoNode(context: context, webPage: self.webPage, theme: theme, media: self.media, interactive: self.interactive, openMedia: openMedia)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ class InstantPageReferenceControllerNode: ViewControllerTracingNode, UIScrollVie
|
|||||||
|
|
||||||
let sideInset: CGFloat = 16.0
|
let sideInset: CGFloat = 16.0
|
||||||
let (_, items, contentSize) = layoutTextItemWithString(self.anchorText, boundingWidth: width - sideInset * 2.0, offset: CGPoint(x: sideInset, y: sideInset), media: media, webpage: self.webPage)
|
let (_, items, contentSize) = layoutTextItemWithString(self.anchorText, boundingWidth: width - sideInset * 2.0, offset: CGPoint(x: sideInset, y: sideInset), media: media, webpage: self.webPage)
|
||||||
let contentNode = InstantPageContentNode(context: self.context, strings: self.presentationData.strings, theme: self.theme, items: items, contentSize: CGSize(width: width, height: contentSize.height), inOverlayPanel: true, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in })
|
let contentNode = InstantPageContentNode(context: self.context, strings: self.presentationData.strings, nameDisplayOrder: self.presentationData.nameDisplayOrder, theme: self.theme, items: items, contentSize: CGSize(width: width, height: contentSize.height), inOverlayPanel: true, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in })
|
||||||
transition.updateFrame(node: contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: titleAreaHeight), size: CGSize(width: width, height: contentSize.height)))
|
transition.updateFrame(node: contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: titleAreaHeight), size: CGSize(width: width, height: contentSize.height)))
|
||||||
self.contentContainerNode.insertSubnode(contentNode, at: 0)
|
self.contentContainerNode.insertSubnode(contentNode, at: 0)
|
||||||
self.contentNode = contentNode
|
self.contentNode = contentNode
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
enum InstantPageShape {
|
enum InstantPageShape {
|
||||||
@ -60,7 +61,7 @@ final class InstantPageShapeItem: InstantPageItem {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageSlideshowItem: InstantPageItem {
|
final class InstantPageSlideshowItem: InstantPageItem {
|
||||||
@ -19,7 +20,7 @@ final class InstantPageSlideshowItem: InstantPageItem {
|
|||||||
self.medias = medias
|
self.medias = medias
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageSlideshowNode(context: context, theme: theme, webPage: webPage, medias: self.medias, openMedia: openMedia, longPressMedia: longPressMedia)
|
return InstantPageSlideshowNode(context: context, theme: theme, webPage: webPage, medias: self.medias, openMedia: openMedia, longPressMedia: longPressMedia)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import TelegramCore
|
|||||||
import Postbox
|
import Postbox
|
||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
private struct TableSide: OptionSet {
|
private struct TableSide: OptionSet {
|
||||||
@ -198,12 +199,12 @@ final class InstantPageTableItem: InstantPageScrollableItem {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
var additionalNodes: [InstantPageNode] = []
|
var additionalNodes: [InstantPageNode] = []
|
||||||
for cell in self.cells {
|
for cell in self.cells {
|
||||||
for item in cell.additionalItems {
|
for item in cell.additionalItems {
|
||||||
if item.wantsNode {
|
if item.wantsNode {
|
||||||
if let node = item.node(context: context, strings: strings, theme: theme, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in}, updateWebEmbedHeight: { _ in }, updateDetailsExpanded: { _ in }, currentExpandedDetails: nil) {
|
if let node = item.node(context: context, strings: strings, nameDisplayOrder: nameDisplayOrder, theme: theme, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in}, updateWebEmbedHeight: { _ in }, updateDetailsExpanded: { _ in }, currentExpandedDetails: nil) {
|
||||||
node.frame = item.frame.offsetBy(dx: cell.frame.minX, dy: cell.frame.minY)
|
node.frame = item.frame.offsetBy(dx: cell.frame.minX, dy: cell.frame.minY)
|
||||||
additionalNodes.append(node)
|
additionalNodes.append(node)
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
@ -340,7 +341,7 @@ final class InstantPageTextItem: InstantPageItem {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,11 +390,11 @@ final class InstantPageScrollableTextItem: InstantPageScrollableItem {
|
|||||||
context.restoreGState()
|
context.restoreGState()
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (ASDisplayNode & InstantPageNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
var additionalNodes: [InstantPageNode] = []
|
var additionalNodes: [InstantPageNode] = []
|
||||||
for item in additionalItems {
|
for item in additionalItems {
|
||||||
if item.wantsNode {
|
if item.wantsNode {
|
||||||
if let node = item.node(context: context, strings: strings, theme: theme, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in}, updateWebEmbedHeight: { _ in }, updateDetailsExpanded: { _ in }, currentExpandedDetails: nil) {
|
if let node = item.node(context: context, strings: strings, nameDisplayOrder: nameDisplayOrder, theme: theme, openMedia: { _ in }, longPressMedia: { _ in }, openPeer: { _ in }, openUrl: { _ in}, updateWebEmbedHeight: { _ in }, updateDetailsExpanded: { _ in }, currentExpandedDetails: nil) {
|
||||||
node.frame = item.frame
|
node.frame = item.frame
|
||||||
additionalNodes.append(node)
|
additionalNodes.append(node)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
final class InstantPageWebEmbedItem: InstantPageItem {
|
final class InstantPageWebEmbedItem: InstantPageItem {
|
||||||
@ -23,7 +24,7 @@ final class InstantPageWebEmbedItem: InstantPageItem {
|
|||||||
self.enableScrolling = enableScrolling
|
self.enableScrolling = enableScrolling
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
func node(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? {
|
||||||
return InstantPageWebEmbedNode(frame: self.frame, url: self.url, html: self.html, enableScrolling: self.enableScrolling, updateWebEmbedHeight: updateWebEmbedHeight)
|
return InstantPageWebEmbedNode(frame: self.frame, url: self.url, html: self.html, enableScrolling: self.enableScrolling, updateWebEmbedHeight: updateWebEmbedHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ public enum ItemListAvatarAndNameInfoItemTitleType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ItemListAvatarAndNameInfoItemName: Equatable {
|
public enum ItemListAvatarAndNameInfoItemName: Equatable {
|
||||||
case personName(firstName: String, lastName: String)
|
case personName(firstName: String, lastName: String, phone: String)
|
||||||
case title(title: String, type: ItemListAvatarAndNameInfoItemTitleType)
|
case title(title: String, type: ItemListAvatarAndNameInfoItemTitleType)
|
||||||
|
|
||||||
public init(_ peer: Peer) {
|
public init(_ peer: Peer) {
|
||||||
switch peer.indexName {
|
switch peer.indexName {
|
||||||
case let .personName(first, last, _, _):
|
case let .personName(first, last, _, phone):
|
||||||
self = .personName(firstName: first, lastName: last)
|
self = .personName(firstName: first, lastName: last, phone: phone ?? "")
|
||||||
case let .title(title, _):
|
case let .title(title, _):
|
||||||
let type: ItemListAvatarAndNameInfoItemTitleType
|
let type: ItemListAvatarAndNameInfoItemTitleType
|
||||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
@ -46,7 +46,7 @@ public enum ItemListAvatarAndNameInfoItemName: Equatable {
|
|||||||
|
|
||||||
public var composedTitle: String {
|
public var composedTitle: String {
|
||||||
switch self {
|
switch self {
|
||||||
case let .personName(firstName, lastName):
|
case let .personName(firstName, lastName, phone):
|
||||||
if !firstName.isEmpty && !lastName.isEmpty {
|
if !firstName.isEmpty && !lastName.isEmpty {
|
||||||
return firstName + " " + lastName
|
return firstName + " " + lastName
|
||||||
} else if !firstName.isEmpty {
|
} else if !firstName.isEmpty {
|
||||||
@ -61,7 +61,21 @@ public enum ItemListAvatarAndNameInfoItemName: Equatable {
|
|||||||
|
|
||||||
public func composedDisplayTitle(strings: PresentationStrings) -> String {
|
public func composedDisplayTitle(strings: PresentationStrings) -> String {
|
||||||
switch self {
|
switch self {
|
||||||
case let .personName(firstName, lastName):
|
case let .personName(firstName, lastName, phone):
|
||||||
|
if !firstName.isEmpty {
|
||||||
|
if !lastName.isEmpty {
|
||||||
|
return "\(firstName) \(lastName)"
|
||||||
|
} else {
|
||||||
|
return firstName
|
||||||
|
}
|
||||||
|
} else if !lastName.isEmpty {
|
||||||
|
return lastName
|
||||||
|
} else if !phone.isEmpty {
|
||||||
|
return formatPhoneNumber("+\(phone)")
|
||||||
|
} else {
|
||||||
|
return strings.User_DeletedAccount
|
||||||
|
}
|
||||||
|
|
||||||
if !firstName.isEmpty && !lastName.isEmpty {
|
if !firstName.isEmpty && !lastName.isEmpty {
|
||||||
return firstName + " " + lastName
|
return firstName + " " + lastName
|
||||||
} else if !firstName.isEmpty {
|
} else if !firstName.isEmpty {
|
||||||
@ -76,10 +90,10 @@ public enum ItemListAvatarAndNameInfoItemName: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isEmpty: Bool {
|
public var isEmpty: Bool {
|
||||||
switch self {
|
switch self {
|
||||||
case let .personName(firstName, _):
|
case let .personName(firstName, lastName, phone):
|
||||||
return firstName.isEmpty
|
return firstName.isEmpty && lastName.isEmpty && phone.isEmpty
|
||||||
case let .title(title, _):
|
case let .title(title, _):
|
||||||
return title.isEmpty
|
return title.isEmpty
|
||||||
}
|
}
|
||||||
@ -559,7 +573,9 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if item.call != nil {
|
if item.call != nil {
|
||||||
strongSelf.addSubnode(strongSelf.callButton)
|
if strongSelf.callButton.supernode == nil {
|
||||||
|
strongSelf.addSubnode(strongSelf.callButton)
|
||||||
|
}
|
||||||
|
|
||||||
strongSelf.callButton.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - 44.0 - 10.0, y: floor((contentSize.height - 44.0) / 2.0) - 2.0), size: CGSize(width: 44.0, height: 44.0))
|
strongSelf.callButton.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - 44.0 - 10.0, y: floor((contentSize.height - 44.0) / 2.0) - 2.0), size: CGSize(width: 44.0, height: 44.0))
|
||||||
} else if strongSelf.callButton.supernode != nil {
|
} else if strongSelf.callButton.supernode != nil {
|
||||||
@ -695,7 +711,7 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
|
|||||||
}
|
}
|
||||||
let keyboardAppearance = item.theme.rootController.keyboardColor.keyboardAppearance
|
let keyboardAppearance = item.theme.rootController.keyboardColor.keyboardAppearance
|
||||||
switch editingName {
|
switch editingName {
|
||||||
case let .personName(firstName, lastName):
|
case let .personName(firstName, lastName, _):
|
||||||
if strongSelf.inputSeparator == nil {
|
if strongSelf.inputSeparator == nil {
|
||||||
let inputSeparator = ASDisplayNode()
|
let inputSeparator = ASDisplayNode()
|
||||||
inputSeparator.isLayerBacked = true
|
inputSeparator.isLayerBacked = true
|
||||||
@ -1006,7 +1022,7 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
|
|||||||
if let item = self.item, let currentEditingName = item.state.editingName {
|
if let item = self.item, let currentEditingName = item.state.editingName {
|
||||||
var editingName: ItemListAvatarAndNameInfoItemName?
|
var editingName: ItemListAvatarAndNameInfoItemName?
|
||||||
if let inputFirstField = self.inputFirstField, let inputSecondField = self.inputSecondField {
|
if let inputFirstField = self.inputFirstField, let inputSecondField = self.inputSecondField {
|
||||||
editingName = .personName(firstName: inputFirstField.text ?? "", lastName: inputSecondField.text ?? "")
|
editingName = .personName(firstName: inputFirstField.text ?? "", lastName: inputSecondField.text ?? "", phone: "")
|
||||||
} else if let inputFirstField = self.inputFirstField {
|
} else if let inputFirstField = self.inputFirstField {
|
||||||
if case let .title(_, type) = currentEditingName {
|
if case let .title(_, type) = currentEditingName {
|
||||||
editingName = .title(title: inputFirstField.text ?? "", type: type)
|
editingName = .title(title: inputFirstField.text ?? "", type: type)
|
||||||
|
@ -5,33 +5,54 @@ import TelegramPresentationData
|
|||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
|
|
||||||
public extension Peer {
|
public extension Peer {
|
||||||
|
var compactDisplayTitle: String {
|
||||||
|
switch self {
|
||||||
|
case let user as TelegramUser:
|
||||||
|
if let firstName = user.firstName, !firstName.isEmpty {
|
||||||
|
return firstName
|
||||||
|
} else if let lastName = user.lastName, !lastName.isEmpty {
|
||||||
|
return lastName
|
||||||
|
} else if let phone = user.phone {
|
||||||
|
return formatPhoneNumber("+\(phone)")
|
||||||
|
} else {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
case let group as TelegramGroup:
|
||||||
|
return group.title
|
||||||
|
case let channel as TelegramChannel:
|
||||||
|
return channel.title
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func displayTitle(strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) -> String {
|
func displayTitle(strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) -> String {
|
||||||
switch self {
|
switch self {
|
||||||
case let user as TelegramUser:
|
case let user as TelegramUser:
|
||||||
if let firstName = user.firstName {
|
if let firstName = user.firstName, !firstName.isEmpty {
|
||||||
if let lastName = user.lastName {
|
if let lastName = user.lastName, !lastName.isEmpty {
|
||||||
switch displayOrder {
|
switch displayOrder {
|
||||||
case .firstLast:
|
case .firstLast:
|
||||||
return "\(firstName) \(lastName)"
|
return "\(firstName) \(lastName)"
|
||||||
case .lastFirst:
|
case .lastFirst:
|
||||||
return "\(lastName) \(firstName)"
|
return "\(lastName) \(firstName)"
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return firstName
|
|
||||||
}
|
}
|
||||||
} else if let lastName = user.lastName {
|
|
||||||
return lastName
|
|
||||||
} else if let phone = user.phone {
|
|
||||||
return "+\(phone)"
|
|
||||||
} else {
|
} else {
|
||||||
return strings.User_DeletedAccount
|
return firstName
|
||||||
}
|
}
|
||||||
case let group as TelegramGroup:
|
} else if let lastName = user.lastName, !lastName.isEmpty {
|
||||||
return group.title
|
return lastName
|
||||||
case let channel as TelegramChannel:
|
} else if let phone = user.phone {
|
||||||
return channel.title
|
return formatPhoneNumber("+\(phone)")
|
||||||
default:
|
} else {
|
||||||
return ""
|
return strings.User_DeletedAccount
|
||||||
|
}
|
||||||
|
case let group as TelegramGroup:
|
||||||
|
return group.title
|
||||||
|
case let channel as TelegramChannel:
|
||||||
|
return channel.title
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import AsyncDisplayKit
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import ActivityIndicator
|
import ActivityIndicator
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
self.activityIndicator.isHidden = true
|
self.activityIndicator.isHidden = true
|
||||||
|
|
||||||
self.scrollNode = ASScrollNode()
|
self.scrollNode = ASScrollNode()
|
||||||
self.headerNode = SecureIdAuthHeaderNode(account: context.account, theme: presentationData.theme, strings: presentationData.strings)
|
self.headerNode = SecureIdAuthHeaderNode(account: context.account, theme: presentationData.theme, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder)
|
||||||
self.acceptNode = SecureIdAuthAcceptNode(title: presentationData.strings.Passport_Authorize, theme: presentationData.theme)
|
self.acceptNode = SecureIdAuthAcceptNode(title: presentationData.strings.Passport_Authorize, theme: presentationData.theme)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
@ -303,7 +304,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
current.updateValues(formData.values)
|
current.updateValues(formData.values)
|
||||||
contentNode = current
|
contentNode = current
|
||||||
} else {
|
} else {
|
||||||
let current = SecureIdAuthFormContentNode(theme: self.presentationData.theme, strings: self.presentationData.strings, peer: encryptedFormData.servicePeer, privacyPolicyUrl: encryptedFormData.form.termsUrl, form: formData, primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, openField: { [weak self] field in
|
let current = SecureIdAuthFormContentNode(theme: self.presentationData.theme, strings: self.presentationData.strings, nameDisplayOrder: self.presentationData.nameDisplayOrder, peer: encryptedFormData.servicePeer, privacyPolicyUrl: encryptedFormData.form.termsUrl, form: formData, primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, openField: { [weak self] field in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
switch field {
|
switch field {
|
||||||
case .identity, .address:
|
case .identity, .address:
|
||||||
|
@ -5,6 +5,7 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import Markdown
|
import Markdown
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ final class SecureIdAuthFormContentNode: ASDisplayNode, SecureIdAuthContentNode,
|
|||||||
private let requestLayout: () -> Void
|
private let requestLayout: () -> Void
|
||||||
private var validLayout: CGFloat?
|
private var validLayout: CGFloat?
|
||||||
|
|
||||||
init(theme: PresentationTheme, strings: PresentationStrings, peer: Peer, privacyPolicyUrl: String?, form: SecureIdForm, primaryLanguageByCountry: [String: String], openField: @escaping (SecureIdParsedRequestedFormField) -> Void, openURL: @escaping (String) -> Void, openMention: @escaping (TelegramPeerMention) -> Void, requestLayout: @escaping () -> Void) {
|
init(theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, peer: Peer, privacyPolicyUrl: String?, form: SecureIdForm, primaryLanguageByCountry: [String: String], openField: @escaping (SecureIdParsedRequestedFormField) -> Void, openURL: @escaping (String) -> Void, openMention: @escaping (TelegramPeerMention) -> Void, requestLayout: @escaping () -> Void) {
|
||||||
self.requestLayout = requestLayout
|
self.requestLayout = requestLayout
|
||||||
|
|
||||||
self.primaryLanguageByCountry = primaryLanguageByCountry
|
self.primaryLanguageByCountry = primaryLanguageByCountry
|
||||||
@ -56,13 +57,13 @@ final class SecureIdAuthFormContentNode: ASDisplayNode, SecureIdAuthContentNode,
|
|||||||
let privacyPolicyAttributes = MarkdownAttributeSet(font: infoFont, textColor: theme.list.freeTextColor)
|
let privacyPolicyAttributes = MarkdownAttributeSet(font: infoFont, textColor: theme.list.freeTextColor)
|
||||||
let privacyPolicyLinkAttributes = MarkdownAttributeSet(font: infoFont, textColor: theme.list.itemAccentColor, additionalAttributes: [NSAttributedString.Key.underlineStyle.rawValue: NSUnderlineStyle.single.rawValue as NSNumber, TelegramTextAttributes.URL: privacyPolicyUrl])
|
let privacyPolicyLinkAttributes = MarkdownAttributeSet(font: infoFont, textColor: theme.list.itemAccentColor, additionalAttributes: [NSAttributedString.Key.underlineStyle.rawValue: NSUnderlineStyle.single.rawValue as NSNumber, TelegramTextAttributes.URL: privacyPolicyUrl])
|
||||||
|
|
||||||
text = parseMarkdownIntoAttributedString(strings.Passport_PrivacyPolicy(peer.displayTitle, (peer.addressName ?? "")).0.replacingOccurrences(of: "]", with: "]()"), attributes: MarkdownAttributes(body: privacyPolicyAttributes, bold: privacyPolicyAttributes, link: privacyPolicyLinkAttributes, linkAttribute: { _ in
|
text = parseMarkdownIntoAttributedString(strings.Passport_PrivacyPolicy(peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), (peer.addressName ?? "")).0.replacingOccurrences(of: "]", with: "]()"), attributes: MarkdownAttributes(body: privacyPolicyAttributes, bold: privacyPolicyAttributes, link: privacyPolicyLinkAttributes, linkAttribute: { _ in
|
||||||
return nil
|
return nil
|
||||||
}), textAlignment: .center)
|
}), textAlignment: .center)
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
text = NSAttributedString(string: strings.Passport_AcceptHelp(peer.displayTitle, (peer.addressName ?? "")).0, font: infoFont, textColor: theme.list.freeTextColor, paragraphAlignment: .left)
|
text = NSAttributedString(string: strings.Passport_AcceptHelp(peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), (peer.addressName ?? "")).0, font: infoFont, textColor: theme.list.freeTextColor, paragraphAlignment: .left)
|
||||||
}
|
}
|
||||||
self.textNode.attributedText = text
|
self.textNode.attributedText = text
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AvatarNode
|
import AvatarNode
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ final class SecureIdAuthHeaderNode: ASDisplayNode {
|
|||||||
private let account: Account
|
private let account: Account
|
||||||
private let theme: PresentationTheme
|
private let theme: PresentationTheme
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
|
|
||||||
private let serviceAvatarNode: AvatarNode
|
private let serviceAvatarNode: AvatarNode
|
||||||
private let titleNode: ImmediateTextNode
|
private let titleNode: ImmediateTextNode
|
||||||
@ -24,10 +26,11 @@ final class SecureIdAuthHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
private var verificationState: SecureIdAuthControllerVerificationState?
|
private var verificationState: SecureIdAuthControllerVerificationState?
|
||||||
|
|
||||||
init(account: Account, theme: PresentationTheme, strings: PresentationStrings) {
|
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||||
self.account = account
|
self.account = account
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
|
|
||||||
self.serviceAvatarNode = AvatarNode(font: avatarFont)
|
self.serviceAvatarNode = AvatarNode(font: avatarFont)
|
||||||
self.titleNode = ImmediateTextNode()
|
self.titleNode = ImmediateTextNode()
|
||||||
@ -50,7 +53,7 @@ final class SecureIdAuthHeaderNode: ASDisplayNode {
|
|||||||
func updateState(formData: SecureIdEncryptedFormData?, verificationState: SecureIdAuthControllerVerificationState) {
|
func updateState(formData: SecureIdEncryptedFormData?, verificationState: SecureIdAuthControllerVerificationState) {
|
||||||
if let formData = formData {
|
if let formData = formData {
|
||||||
self.serviceAvatarNode.setPeer(account: self.account, theme: self.theme, peer: formData.servicePeer)
|
self.serviceAvatarNode.setPeer(account: self.account, theme: self.theme, peer: formData.servicePeer)
|
||||||
let titleData = self.strings.Passport_RequestHeader(formData.servicePeer.displayTitle)
|
let titleData = self.strings.Passport_RequestHeader(formData.servicePeer.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder))
|
||||||
|
|
||||||
let titleString = NSMutableAttributedString()
|
let titleString = NSMutableAttributedString()
|
||||||
titleString.append(NSAttributedString(string: titleData.0, font: textFont, textColor: self.theme.list.freeTextColor))
|
titleString.append(NSAttributedString(string: titleData.0, font: textFont, textColor: self.theme.list.freeTextColor))
|
||||||
|
@ -12,6 +12,7 @@ import AlertUI
|
|||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import ItemListAvatarAndNameInfoItem
|
import ItemListAvatarAndNameInfoItem
|
||||||
import Emoji
|
import Emoji
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let rankMaxLength: Int32 = 16
|
private let rankMaxLength: Int32 = 16
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ private enum ChannelAdminsEntry: ItemListNodeEntry {
|
|||||||
if peer.id == participant.peer.id {
|
if peer.id == participant.peer.id {
|
||||||
peerText = strings.Channel_Management_LabelAdministrator
|
peerText = strings.Channel_Management_LabelAdministrator
|
||||||
} else {
|
} else {
|
||||||
peerText = strings.Channel_Management_PromotedBy(peer.displayTitle).0
|
peerText = strings.Channel_Management_PromotedBy(peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)).0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
peerText = ""
|
peerText = ""
|
||||||
@ -527,7 +527,7 @@ public func channelAdminsController(context: AccountContext, peerId: PeerId, loa
|
|||||||
guard let peer = peer, let user = user else {
|
guard let peer = peer, let user = user else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
presentControllerImpl?(UndoOverlayController(presentationData: context.sharedContext.currentPresentationData.with { $0 }, content: .succeed(text: presentationData.strings.Channel_OwnershipTransfer_TransferCompleted(user.displayTitle, peer.displayTitle).0), elevatedLayout: false, action: { _ in }), nil)
|
presentControllerImpl?(UndoOverlayController(presentationData: context.sharedContext.currentPresentationData.with { $0 }, content: .succeed(text: presentationData.strings.Channel_OwnershipTransfer_TransferCompleted(user.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0), elevatedLayout: false, action: { _ in }), nil)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
|||||||
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
||||||
|
|
||||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
||||||
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle, stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).0))
|
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).0))
|
||||||
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
||||||
}
|
}
|
||||||
} else if let group = channelView.peers[channelView.peerId] as? TelegramGroup, let member = memberView.peers[memberView.peerId] {
|
} else if let group = channelView.peers[channelView.peerId] as? TelegramGroup, let member = memberView.peers[memberView.peerId] {
|
||||||
@ -368,7 +368,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
|||||||
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
||||||
|
|
||||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
||||||
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle, stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).0))
|
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).0))
|
||||||
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,7 +686,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
|||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
items.append(ActionSheetTextItem(title: presentationData.strings.GroupPermission_ApplyAlertText(peer.displayTitle).0))
|
items.append(ActionSheetTextItem(title: presentationData.strings.GroupPermission_ApplyAlertText(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0))
|
||||||
items.append(ActionSheetButtonItem(title: presentationData.strings.GroupPermission_ApplyAlertAction, color: .accent, font: .default, enabled: true, action: { [weak actionSheet] in
|
items.append(ActionSheetButtonItem(title: presentationData.strings.GroupPermission_ApplyAlertAction, color: .accent, font: .default, enabled: true, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
applyRights()
|
applyRights()
|
||||||
|
@ -163,7 +163,7 @@ private enum ChannelBlacklistEntry: ItemListNodeEntry {
|
|||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
||||||
text = .text(strings.Channel_Management_RemovedBy(peer.displayTitle).0)
|
text = .text(strings.Channel_Management_RemovedBy(peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)).0)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@ -359,8 +359,8 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
|||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
if !participant.peer.displayTitle.isEmpty {
|
if !participant.peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder).isEmpty {
|
||||||
items.append(ActionSheetTextItem(title: participant.peer.displayTitle))
|
items.append(ActionSheetTextItem(title: participant.peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)))
|
||||||
}
|
}
|
||||||
items.append(ActionSheetButtonItem(title: presentationData.strings.GroupRemoved_ViewUserInfo, action: { [weak actionSheet] in
|
items.append(ActionSheetButtonItem(title: presentationData.strings.GroupRemoved_ViewUserInfo, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
|
@ -6,6 +6,7 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import AvatarNode
|
import AvatarNode
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
@ -14,16 +15,18 @@ final class ChannelDiscussionGroupActionSheetItem: ActionSheetItem {
|
|||||||
let channelPeer: Peer
|
let channelPeer: Peer
|
||||||
let groupPeer: Peer
|
let groupPeer: Peer
|
||||||
let strings: PresentationStrings
|
let strings: PresentationStrings
|
||||||
|
let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
|
|
||||||
init(context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) {
|
init(context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.channelPeer = channelPeer
|
self.channelPeer = channelPeer
|
||||||
self.groupPeer = groupPeer
|
self.groupPeer = groupPeer
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
||||||
return ChannelDiscussionGroupActionSheetItemNode(theme: theme, context: self.context, channelPeer: self.channelPeer, groupPeer: self.groupPeer, strings: self.strings)
|
return ChannelDiscussionGroupActionSheetItemNode(theme: theme, context: self.context, channelPeer: self.channelPeer, groupPeer: self.groupPeer, strings: self.strings, nameDisplayOrder: self.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateNode(_ node: ActionSheetItemNode) {
|
func updateNode(_ node: ActionSheetItemNode) {
|
||||||
@ -40,7 +43,7 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo
|
|||||||
private let groupAvatarNode: AvatarNode
|
private let groupAvatarNode: AvatarNode
|
||||||
private let textNode: ImmediateTextNode
|
private let textNode: ImmediateTextNode
|
||||||
|
|
||||||
init(theme: ActionSheetControllerTheme, context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) {
|
init(theme: ActionSheetControllerTheme, context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
self.channelAvatarNode = AvatarNode(font: avatarFont)
|
self.channelAvatarNode = AvatarNode(font: avatarFont)
|
||||||
@ -67,9 +70,9 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo
|
|||||||
|
|
||||||
let text: (String, [(Int, NSRange)])
|
let text: (String, [(Int, NSRange)])
|
||||||
if let channelPeer = channelPeer as? TelegramChannel, let addressName = channelPeer.addressName, !addressName.isEmpty {
|
if let channelPeer = channelPeer as? TelegramChannel, let addressName = channelPeer.addressName, !addressName.isEmpty {
|
||||||
text = strings.Channel_DiscussionGroup_PublicChannelLink(groupPeer.displayTitle, channelPeer.displayTitle)
|
text = strings.Channel_DiscussionGroup_PublicChannelLink(groupPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), channelPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||||
} else {
|
} else {
|
||||||
text = strings.Channel_DiscussionGroup_PrivateChannelLink(groupPeer.displayTitle, channelPeer.displayTitle)
|
text = strings.Channel_DiscussionGroup_PrivateChannelLink(groupPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), channelPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||||
}
|
}
|
||||||
let attributedText = NSMutableAttributedString(attributedString: NSAttributedString(string: text.0, font: Font.regular(14.0), textColor: theme.primaryTextColor))
|
let attributedText = NSMutableAttributedString(attributedString: NSAttributedString(string: text.0, font: Font.regular(14.0), textColor: theme.primaryTextColor))
|
||||||
for (_, range) in text.1 {
|
for (_, range) in text.1 {
|
||||||
|
@ -168,9 +168,9 @@ private func channelDiscussionGroupSetupControllerEntries(presentationData: Pres
|
|||||||
if let linkedDiscussionPeerId = cachedData.linkedDiscussionPeerId {
|
if let linkedDiscussionPeerId = cachedData.linkedDiscussionPeerId {
|
||||||
if let group = view.peers[linkedDiscussionPeerId] {
|
if let group = view.peers[linkedDiscussionPeerId] {
|
||||||
if case .group = peer.info {
|
if case .group = peer.info {
|
||||||
entries.append(.header(presentationData.theme, presentationData.strings, group.displayTitle, true, presentationData.strings.Channel_DiscussionGroup_HeaderLabel))
|
entries.append(.header(presentationData.theme, presentationData.strings, group.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), true, presentationData.strings.Channel_DiscussionGroup_HeaderLabel))
|
||||||
} else {
|
} else {
|
||||||
entries.append(.header(presentationData.theme, presentationData.strings, group.displayTitle, false, presentationData.strings.Channel_DiscussionGroup_HeaderLabel))
|
entries.append(.header(presentationData.theme, presentationData.strings, group.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), false, presentationData.strings.Channel_DiscussionGroup_HeaderLabel))
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.append(.group(0, presentationData.theme, presentationData.strings, group, presentationData.nameDisplayOrder))
|
entries.append(.group(0, presentationData.theme, presentationData.strings, group, presentationData.nameDisplayOrder))
|
||||||
@ -244,7 +244,8 @@ public func channelDiscussionGroupSetupController(context: AccountContext, peerI
|
|||||||
guard let peer = peer else {
|
guard let peer = peer else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pushControllerImpl?(context.sharedContext.makeCreateGroupController(context: context, peerIds: [], initialTitle: peer.displayTitle + " Chat", mode: .supergroup, completion: { groupId, dismiss in
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
pushControllerImpl?(context.sharedContext.makeCreateGroupController(context: context, peerIds: [], initialTitle: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + " Chat", mode: .supergroup, completion: { groupId, dismiss in
|
||||||
var applySignal = updateGroupDiscussionForChannel(network: context.account.network, postbox: context.account.postbox, channelId: peerId, groupId: groupId)
|
var applySignal = updateGroupDiscussionForChannel(network: context.account.network, postbox: context.account.postbox, channelId: peerId, groupId: groupId)
|
||||||
var cancelImpl: (() -> Void)?
|
var cancelImpl: (() -> Void)?
|
||||||
let progressSignal = Signal<Never, NoError> { subscriber in
|
let progressSignal = Signal<Never, NoError> { subscriber in
|
||||||
@ -305,7 +306,7 @@ public func channelDiscussionGroupSetupController(context: AccountContext, peerI
|
|||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||||
ChannelDiscussionGroupActionSheetItem(context: context, channelPeer: channelPeer, groupPeer: groupPeer, strings: presentationData.strings),
|
ChannelDiscussionGroupActionSheetItem(context: context, channelPeer: channelPeer, groupPeer: groupPeer, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder),
|
||||||
ActionSheetButtonItem(title: presentationData.strings.Channel_DiscussionGroup_LinkGroup, color: .accent, action: { [weak actionSheet] in
|
ActionSheetButtonItem(title: presentationData.strings.Channel_DiscussionGroup_LinkGroup, color: .accent, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ private func channelInfoEntries(account: Account, presentationData: Presentation
|
|||||||
if let addressName = peer.addressName, !addressName.isEmpty {
|
if let addressName = peer.addressName, !addressName.isEmpty {
|
||||||
discussionGroupTitle = "@\(addressName)"
|
discussionGroupTitle = "@\(addressName)"
|
||||||
} else {
|
} else {
|
||||||
discussionGroupTitle = peer.displayTitle
|
discussionGroupTitle = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
discussionGroupTitle = presentationData.strings.Channel_DiscussionGroupAdd
|
discussionGroupTitle = presentationData.strings.Channel_DiscussionGroupAdd
|
||||||
@ -533,7 +533,7 @@ private func channelInfoEntries(account: Account, presentationData: Presentation
|
|||||||
if let addressName = peer.addressName, !addressName.isEmpty {
|
if let addressName = peer.addressName, !addressName.isEmpty {
|
||||||
discussionGroupTitle = "@\(addressName)"
|
discussionGroupTitle = "@\(addressName)"
|
||||||
} else {
|
} else {
|
||||||
discussionGroupTitle = peer.displayTitle
|
discussionGroupTitle = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
} else if canEditChannel {
|
} else if canEditChannel {
|
||||||
discussionGroupTitle = presentationData.strings.Channel_DiscussionGroupAdd
|
discussionGroupTitle = presentationData.strings.Channel_DiscussionGroupAdd
|
||||||
@ -754,7 +754,7 @@ public func channelInfoController(context: AccountContext, peerId: PeerId) -> Vi
|
|||||||
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos, hasViewButton: false, personalPhoto: false, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos, hasViewButton: false, personalPhoto: false, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
||||||
let _ = currentAvatarMixin.swap(mixin)
|
let _ = currentAvatarMixin.swap(mixin)
|
||||||
mixin.requestSearchController = { assetsController in
|
mixin.requestSearchController = { assetsController in
|
||||||
let controller = WebSearchController(context: context, peer: peer, configuration: searchBotsConfiguration, mode: .avatar(initialQuery: peer?.displayTitle, completion: { result in
|
let controller = WebSearchController(context: context, peer: peer, configuration: searchBotsConfiguration, mode: .avatar(initialQuery: peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), completion: { result in
|
||||||
assetsController?.dismiss()
|
assetsController?.dismiss()
|
||||||
completedImpl(result)
|
completedImpl(result)
|
||||||
}))
|
}))
|
||||||
|
@ -732,7 +732,7 @@ final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNod
|
|||||||
if peer.id == participant.peer.id {
|
if peer.id == participant.peer.id {
|
||||||
label = themeAndStrings.1.Channel_Management_LabelAdministrator
|
label = themeAndStrings.1.Channel_Management_LabelAdministrator
|
||||||
} else {
|
} else {
|
||||||
label = themeAndStrings.1.Channel_Management_PromotedBy(peer.displayTitle).0
|
label = themeAndStrings.1.Channel_Management_PromotedBy(peer.displayTitle(strings: themeAndStrings.1, displayOrder: themeAndStrings.3)).0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNod
|
|||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
||||||
label = themeAndStrings.1.Channel_Management_RemovedBy(peer.displayTitle).0
|
label = themeAndStrings.1.Channel_Management_RemovedBy(peer.displayTitle(strings: themeAndStrings.1, displayOrder: themeAndStrings.3)).0
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@ -1012,7 +1012,7 @@ final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNod
|
|||||||
if peer.id == participant.peer.id {
|
if peer.id == participant.peer.id {
|
||||||
label = themeAndStrings.1.Channel_Management_LabelAdministrator
|
label = themeAndStrings.1.Channel_Management_LabelAdministrator
|
||||||
} else {
|
} else {
|
||||||
label = themeAndStrings.1.Channel_Management_PromotedBy(peer.displayTitle).0
|
label = themeAndStrings.1.Channel_Management_PromotedBy(peer.displayTitle(strings: themeAndStrings.1, displayOrder: themeAndStrings.3)).0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1039,7 +1039,7 @@ final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNod
|
|||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
if let banInfo = banInfo, let peer = participant.peers[banInfo.restrictedBy] {
|
||||||
label = themeAndStrings.1.Channel_Management_RemovedBy(peer.displayTitle).0
|
label = themeAndStrings.1.Channel_Management_RemovedBy(peer.displayTitle(strings: themeAndStrings.1, displayOrder: themeAndStrings.3)).0
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -517,10 +517,10 @@ private func confirmChannelOwnershipTransferController(context: AccountContext,
|
|||||||
var text: String
|
var text: String
|
||||||
if isGroup {
|
if isGroup {
|
||||||
title = presentationData.strings.Group_OwnershipTransfer_Title
|
title = presentationData.strings.Group_OwnershipTransfer_Title
|
||||||
text = presentationData.strings.Group_OwnershipTransfer_DescriptionInfo(peer.displayTitle, member.displayTitle).0
|
text = presentationData.strings.Group_OwnershipTransfer_DescriptionInfo(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), member.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0
|
||||||
} else {
|
} else {
|
||||||
title = presentationData.strings.Channel_OwnershipTransfer_Title
|
title = presentationData.strings.Channel_OwnershipTransfer_Title
|
||||||
text = presentationData.strings.Channel_OwnershipTransfer_DescriptionInfo(peer.displayTitle, member.displayTitle).0
|
text = presentationData.strings.Channel_OwnershipTransfer_DescriptionInfo(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), member.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributedTitle = NSAttributedString(string: title, font: Font.medium(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
let attributedTitle = NSAttributedString(string: title, font: Font.medium(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||||
|
@ -17,6 +17,7 @@ import MediaResources
|
|||||||
import ItemListAvatarAndNameInfoItem
|
import ItemListAvatarAndNameInfoItem
|
||||||
import Geocoding
|
import Geocoding
|
||||||
import ItemListAddressItem
|
import ItemListAddressItem
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private enum DeviceContactInfoAction {
|
private enum DeviceContactInfoAction {
|
||||||
case sendMessage
|
case sendMessage
|
||||||
@ -598,7 +599,7 @@ private func deviceContactInfoEntries(account: Account, presentationData: Presen
|
|||||||
var personName: (String, String) = (contactData.basicData.firstName, contactData.basicData.lastName)
|
var personName: (String, String) = (contactData.basicData.firstName, contactData.basicData.lastName)
|
||||||
if let editingName = editingName {
|
if let editingName = editingName {
|
||||||
switch editingName {
|
switch editingName {
|
||||||
case let .personName(firstName, lastName):
|
case let .personName(firstName, lastName, _):
|
||||||
personName = (firstName, lastName)
|
personName = (firstName, lastName)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@ -803,7 +804,7 @@ public func deviceContactInfoController(context: AccountContext, subject: Device
|
|||||||
initialState.nextPhoneNumber += 1
|
initialState.nextPhoneNumber += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initialState.editingState = DeviceContactInfoEditingState(editingName: .personName(firstName: firstName, lastName: lastName))
|
initialState.editingState = DeviceContactInfoEditingState(editingName: .personName(firstName: firstName, lastName: lastName, phone: ""))
|
||||||
}
|
}
|
||||||
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
||||||
let stateValue = Atomic(value: initialState)
|
let stateValue = Atomic(value: initialState)
|
||||||
@ -1053,7 +1054,7 @@ public func deviceContactInfoController(context: AccountContext, subject: Device
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var composedContactData: DeviceContactExtendedData?
|
var composedContactData: DeviceContactExtendedData?
|
||||||
if let editingName = state.editingState?.editingName, case let .personName(firstName, lastName) = editingName, (!firstName.isEmpty || !lastName.isEmpty) {
|
if let editingName = state.editingState?.editingName, case let .personName(firstName, lastName, _) = editingName, (!firstName.isEmpty || !lastName.isEmpty) {
|
||||||
var urls = filteredData.urls
|
var urls = filteredData.urls
|
||||||
if let createForPeer = createForPeer {
|
if let createForPeer = createForPeer {
|
||||||
let appProfile = DeviceContactUrlData(appProfile: createForPeer.id)
|
let appProfile = DeviceContactUrlData(appProfile: createForPeer.id)
|
||||||
|
@ -37,6 +37,7 @@ import NotificationSoundSelectionUI
|
|||||||
import ItemListAddressItem
|
import ItemListAddressItem
|
||||||
import AppBundle
|
import AppBundle
|
||||||
import Markdown
|
import Markdown
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private final class GroupInfoArguments {
|
private final class GroupInfoArguments {
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
@ -872,7 +873,7 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
if let addressName = peer.addressName, !addressName.isEmpty {
|
if let addressName = peer.addressName, !addressName.isEmpty {
|
||||||
peerTitle = "@\(addressName)"
|
peerTitle = "@\(addressName)"
|
||||||
} else {
|
} else {
|
||||||
peerTitle = peer.displayTitle
|
peerTitle = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
entries.append(GroupInfoEntry.linkedChannelSetup(presentationData.theme, presentationData.strings.Group_LinkedChannel, peerTitle))
|
entries.append(GroupInfoEntry.linkedChannelSetup(presentationData.theme, presentationData.strings.Group_LinkedChannel, peerTitle))
|
||||||
}
|
}
|
||||||
@ -1434,7 +1435,7 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos, hasViewButton: false, personalPhoto: false, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos, hasViewButton: false, personalPhoto: false, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
||||||
let _ = currentAvatarMixin.swap(mixin)
|
let _ = currentAvatarMixin.swap(mixin)
|
||||||
mixin.requestSearchController = { assetsController in
|
mixin.requestSearchController = { assetsController in
|
||||||
let controller = WebSearchController(context: context, peer: peer, configuration: searchBotsConfiguration, mode: .avatar(initialQuery: peer?.displayTitle, completion: { result in
|
let controller = WebSearchController(context: context, peer: peer, configuration: searchBotsConfiguration, mode: .avatar(initialQuery: peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), completion: { result in
|
||||||
assetsController?.dismiss()
|
assetsController?.dismiss()
|
||||||
completedImpl(result)
|
completedImpl(result)
|
||||||
}))
|
}))
|
||||||
@ -1627,7 +1628,7 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
let result = ValuePromise<Bool>()
|
let result = ValuePromise<Bool>()
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
if let contactsController = contactsController {
|
if let contactsController = contactsController {
|
||||||
let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.GroupInfo_AddParticipantConfirmation(peer.displayTitle).0, actions: [
|
let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.GroupInfo_AddParticipantConfirmation(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0, actions: [
|
||||||
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {
|
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {
|
||||||
result.set(false)
|
result.set(false)
|
||||||
}),
|
}),
|
||||||
@ -2029,7 +2030,8 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
guard let peer = peerView.peers[peerView.peerId] else {
|
guard let peer = peerView.peers[peerView.peerId] else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: MapVenue(title: peer.displayTitle, address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: MapVenue(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
||||||
let controller = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
let controller = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
||||||
context.sharedContext.applicationBindings.openUrl(url)
|
context.sharedContext.applicationBindings.openUrl(url)
|
||||||
})
|
})
|
||||||
|
@ -8,6 +8,7 @@ import TelegramPresentationData
|
|||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import EncryptionKeyVisualization
|
import EncryptionKeyVisualization
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private func processHexString(_ string: String) -> String {
|
private func processHexString(_ string: String) -> String {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
@ -24,6 +24,7 @@ import PeerAvatarGalleryUI
|
|||||||
import NotificationMuteSettingsUI
|
import NotificationMuteSettingsUI
|
||||||
import NotificationSoundSelectionUI
|
import NotificationSoundSelectionUI
|
||||||
import Markdown
|
import Markdown
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private final class UserInfoControllerArguments {
|
private final class UserInfoControllerArguments {
|
||||||
let account: Account
|
let account: Account
|
||||||
@ -1031,9 +1032,9 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Pe
|
|||||||
} else {
|
} else {
|
||||||
let text: String
|
let text: String
|
||||||
if value {
|
if value {
|
||||||
text = presentationData.strings.UserInfo_BlockConfirmation(peer.displayTitle).0
|
text = presentationData.strings.UserInfo_BlockConfirmation(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0
|
||||||
} else {
|
} else {
|
||||||
text = presentationData.strings.UserInfo_UnblockConfirmation(peer.displayTitle).0
|
text = presentationData.strings.UserInfo_UnblockConfirmation(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).0
|
||||||
}
|
}
|
||||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Yes, action: {
|
presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Yes, action: {
|
||||||
updatePeerBlockedDisposable.set(requestUpdatePeerIsBlocked(account: context.account, peerId: peer.id, isBlocked: value).start())
|
updatePeerBlockedDisposable.set(requestUpdatePeerIsBlocked(account: context.account, peerId: peer.id, isBlocked: value).start())
|
||||||
@ -1254,7 +1255,7 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Pe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let updateName = updateName, case let .personName(firstName, lastName) = updateName {
|
if let updateName = updateName, case let .personName(firstName, lastName, _) = updateName {
|
||||||
updatePeerNameDisposable.set((updateContactName(account: context.account, peerId: peerId, firstName: firstName, lastName: lastName)
|
updatePeerNameDisposable.set((updateContactName(account: context.account, peerId: peerId, firstName: firstName, lastName: lastName)
|
||||||
|> deliverOnMainQueue).start(error: { _ in
|
|> deliverOnMainQueue).start(error: { _ in
|
||||||
updateState { state in
|
updateState { state in
|
||||||
|
@ -10,6 +10,7 @@ import AvatarNode
|
|||||||
import PeerOnlineMarkerNode
|
import PeerOnlineMarkerNode
|
||||||
import LegacyComponents
|
import LegacyComponents
|
||||||
import ContextUI
|
import ContextUI
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 24.0)!
|
private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 24.0)!
|
||||||
private let textFont = Font.regular(11.0)
|
private let textFont = Font.regular(11.0)
|
||||||
@ -86,7 +87,7 @@ public final class SelectablePeerNode: ASDisplayNode {
|
|||||||
didSet {
|
didSet {
|
||||||
if !self.theme.isEqual(to: oldValue) {
|
if !self.theme.isEqual(to: oldValue) {
|
||||||
if let peer = self.peer, let mainPeer = peer.chatMainPeer {
|
if let peer = self.peer, let mainPeer = peer.chatMainPeer {
|
||||||
self.textNode.attributedText = NSAttributedString(string: mainPeer.displayTitle, font: textFont, textColor: self.currentSelected ? self.theme.selectedTextColor : (peer.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
|
self.textNode.attributedText = NSAttributedString(string: mainPeer.debugDisplayTitle, font: textFont, textColor: self.currentSelected ? self.theme.selectedTextColor : (peer.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ func editSettingsController(context: AccountContext, currentName: ItemListAvatar
|
|||||||
}
|
}
|
||||||
|
|
||||||
var updateNameSignal: Signal<Void, NoError> = .complete()
|
var updateNameSignal: Signal<Void, NoError> = .complete()
|
||||||
if let updateName = updateName, case let .personName(firstName, lastName) = updateName {
|
if let updateName = updateName, case let .personName(firstName, lastName, _) = updateName {
|
||||||
updateNameSignal = updateAccountPeerName(account: context.account, firstName: firstName, lastName: lastName)
|
updateNameSignal = updateAccountPeerName(account: context.account, firstName: firstName, lastName: lastName)
|
||||||
}
|
}
|
||||||
var updateBioSignal: Signal<Void, NoError> = .complete()
|
var updateBioSignal: Signal<Void, NoError> = .complete()
|
||||||
|
@ -299,13 +299,13 @@ private func notificationsExceptionEntries(presentationData: PresentationData, s
|
|||||||
var index: Int = 0
|
var index: Int = 0
|
||||||
for (_, value) in state.mode.settings.filter({ (_, value) in
|
for (_, value) in state.mode.settings.filter({ (_, value) in
|
||||||
if let query = query, !query.isEmpty {
|
if let query = query, !query.isEmpty {
|
||||||
return !value.peer.displayTitle.lowercased().components(separatedBy: " ").filter { $0.hasPrefix(query.lowercased())}.isEmpty
|
return !value.peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder).lowercased().components(separatedBy: " ").filter { $0.hasPrefix(query.lowercased())}.isEmpty
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}).sorted(by: { lhs, rhs in
|
}).sorted(by: { lhs, rhs in
|
||||||
let lhsName = lhs.value.peer.displayTitle
|
let lhsName = lhs.value.peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
let rhsName = rhs.value.peer.displayTitle
|
let rhsName = rhs.value.peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
if let lhsDate = lhs.value.date, let rhsDate = rhs.value.date {
|
if let lhsDate = lhs.value.date, let rhsDate = rhs.value.date {
|
||||||
return lhsDate > rhsDate
|
return lhsDate > rhsDate
|
||||||
@ -325,7 +325,7 @@ private func notificationsExceptionEntries(presentationData: PresentationData, s
|
|||||||
|
|
||||||
return lhsName < rhsName
|
return lhsName < rhsName
|
||||||
}) {
|
}) {
|
||||||
if !value.peer.displayTitle.isEmpty {
|
if !value.peer.isDeleted {
|
||||||
var title: String
|
var title: String
|
||||||
var muted = false
|
var muted = false
|
||||||
switch value.settings.muteState {
|
switch value.settings.muteState {
|
||||||
|
@ -50,7 +50,7 @@ func openEditSettings(context: AccountContext, accountsAndPeers: Signal<((Accoun
|
|||||||
}
|
}
|
||||||
openEditingDisposable.set((signal
|
openEditingDisposable.set((signal
|
||||||
|> deliverOnMainQueue).start(next: { peer, cachedData, canAddAccounts in
|
|> deliverOnMainQueue).start(next: { peer, cachedData, canAddAccounts in
|
||||||
pushController(editSettingsController(context: context, currentName: .personName(firstName: peer.firstName ?? "", lastName: peer.lastName ?? ""), currentBioText: cachedData.about ?? "", accountManager: context.sharedContext.accountManager, canAddAccounts: canAddAccounts, focusOnItemTag: focusOnItemTag))
|
pushController(editSettingsController(context: context, currentName: .personName(firstName: peer.firstName ?? "", lastName: peer.lastName ?? "", phone: ""), currentBioText: cachedData.about ?? "", accountManager: context.sharedContext.accountManager, canAddAccounts: canAddAccounts, focusOnItemTag: focusOnItemTag))
|
||||||
}))
|
}))
|
||||||
return openEditingDisposable
|
return openEditingDisposable
|
||||||
}
|
}
|
||||||
|
@ -929,12 +929,14 @@ func selectivePrivacySettingsController(context: AccountContext, kind: Selective
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let peerName = context.account.postbox.transaction { transaction -> String in
|
let peer = context.account.postbox.transaction { transaction -> Peer? in
|
||||||
return (transaction.getPeer(context.account.peerId) as? TelegramUser)?.displayTitle ?? ""
|
return transaction.getPeer(context.account.peerId) as? TelegramUser
|
||||||
}
|
}
|
||||||
|
|
||||||
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), peerName) |> deliverOnMainQueue
|
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), peer) |> deliverOnMainQueue
|
||||||
|> map { presentationData, state, peerName -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
|> map { presentationData, state, peer -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||||
|
|
||||||
|
let peerName = peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
let title: String
|
let title: String
|
||||||
switch kind {
|
switch kind {
|
||||||
@ -952,7 +954,7 @@ func selectivePrivacySettingsController(context: AccountContext, kind: Selective
|
|||||||
title = presentationData.strings.Privacy_PhoneNumber
|
title = presentationData.strings.Privacy_PhoneNumber
|
||||||
}
|
}
|
||||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||||
let listState = ItemListNodeState(entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName), style: .blocks, animateChanges: false)
|
let listState = ItemListNodeState(entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName ?? ""), style: .blocks, animateChanges: false)
|
||||||
|
|
||||||
return (controllerState, (listState, arguments))
|
return (controllerState, (listState, arguments))
|
||||||
} |> afterDisposed {
|
} |> afterDisposed {
|
||||||
|
@ -6,6 +6,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import ActionSheetPeerItem
|
import ActionSheetPeerItem
|
||||||
@ -96,14 +97,14 @@ private struct CollectableExternalShareItem {
|
|||||||
let mediaReference: AnyMediaReference?
|
let mediaReference: AnyMediaReference?
|
||||||
}
|
}
|
||||||
|
|
||||||
private func collectExternalShareItems(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, postbox: Postbox, collectableItems: [CollectableExternalShareItem], takeOne: Bool = true) -> Signal<ExternalShareItemsState, NoError> {
|
private func collectExternalShareItems(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameOrder: PresentationPersonNameOrder, postbox: Postbox, collectableItems: [CollectableExternalShareItem], takeOne: Bool = true) -> Signal<ExternalShareItemsState, NoError> {
|
||||||
var signals: [Signal<ExternalShareItemStatus, NoError>] = []
|
var signals: [Signal<ExternalShareItemStatus, NoError>] = []
|
||||||
let authorsPeerIds = collectableItems.compactMap { $0.author }
|
let authorsPeerIds = collectableItems.compactMap { $0.author }
|
||||||
let authorsPromise = Promise<[PeerId: String]>()
|
let authorsPromise = Promise<[PeerId: String]>()
|
||||||
authorsPromise.set(postbox.transaction { transaction in
|
authorsPromise.set(postbox.transaction { transaction in
|
||||||
var result: [PeerId: String] = [:]
|
var result: [PeerId: String] = [:]
|
||||||
for peerId in authorsPeerIds {
|
for peerId in authorsPeerIds {
|
||||||
if let title = transaction.getPeer(peerId)?.displayTitle {
|
if let title = transaction.getPeer(peerId)?.displayTitle(strings: strings, displayOrder: nameOrder) {
|
||||||
result[peerId] = title
|
result[peerId] = title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,7 +552,7 @@ public final class ShareController: ViewController {
|
|||||||
}
|
}
|
||||||
if !displayedError, case .slowmodeActive = error {
|
if !displayedError, case .slowmodeActive = error {
|
||||||
displayedError = true
|
displayedError = true
|
||||||
strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: strongSelf.presentationData.theme), title: peer.displayTitle, text: strongSelf.presentationData.strings.Chat_SlowmodeSendError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: strongSelf.presentationData.theme), title: peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder), text: strongSelf.presentationData.strings.Chat_SlowmodeSendError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -632,7 +633,7 @@ public final class ShareController: ViewController {
|
|||||||
case .fromExternal:
|
case .fromExternal:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return (collectExternalShareItems(strings: strongSelf.presentationData.strings, dateTimeFormat: strongSelf.presentationData.dateTimeFormat, postbox: strongSelf.currentAccount.postbox, collectableItems: collectableItems, takeOne: !strongSelf.immediateExternalShare)
|
return (collectExternalShareItems(strings: strongSelf.presentationData.strings, dateTimeFormat: strongSelf.presentationData.dateTimeFormat, nameOrder: strongSelf.presentationData.nameDisplayOrder, postbox: strongSelf.currentAccount.postbox, collectableItems: collectableItems, takeOne: !strongSelf.immediateExternalShare)
|
||||||
|> deliverOnMainQueue)
|
|> deliverOnMainQueue)
|
||||||
|> map { state in
|
|> map { state in
|
||||||
switch state {
|
switch state {
|
||||||
|
@ -618,7 +618,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
let animated = self.peersContentNode == nil
|
let animated = self.peersContentNode == nil
|
||||||
let peersContentNode = SharePeersContainerNode(sharedContext: self.sharedContext, account: account, switchableAccounts: switchableAccounts, theme: self.presentationData.theme, strings: self.presentationData.strings, peers: peers, accountPeer: accountPeer, controllerInteraction: self.controllerInteraction!, externalShare: self.externalShare, switchToAnotherAccount: { [weak self] in
|
let peersContentNode = SharePeersContainerNode(sharedContext: self.sharedContext, account: account, switchableAccounts: switchableAccounts, theme: self.presentationData.theme, strings: self.presentationData.strings, nameDisplayOrder: self.presentationData.nameDisplayOrder, peers: peers, accountPeer: accountPeer, controllerInteraction: self.controllerInteraction!, externalShare: self.externalShare, switchToAnotherAccount: { [weak self] in
|
||||||
self?.switchToAnotherAccount?()
|
self?.switchToAnotherAccount?()
|
||||||
})
|
})
|
||||||
self.peersContentNode = peersContentNode
|
self.peersContentNode = peersContentNode
|
||||||
|
@ -6,6 +6,7 @@ import TelegramCore
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import MergeLists
|
import MergeLists
|
||||||
import AvatarNode
|
import AvatarNode
|
||||||
import AccountContext
|
import AccountContext
|
||||||
@ -75,6 +76,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
private let account: Account
|
private let account: Account
|
||||||
private let theme: PresentationTheme
|
private let theme: PresentationTheme
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private let controllerInteraction: ShareControllerInteraction
|
private let controllerInteraction: ShareControllerInteraction
|
||||||
private let switchToAnotherAccount: () -> Void
|
private let switchToAnotherAccount: () -> Void
|
||||||
|
|
||||||
@ -104,11 +106,12 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
|
|
||||||
let peersValue = Promise<[(RenderedPeer, PeerPresence?)]>()
|
let peersValue = Promise<[(RenderedPeer, PeerPresence?)]>()
|
||||||
|
|
||||||
init(sharedContext: SharedAccountContext, account: Account, switchableAccounts: [AccountWithInfo], theme: PresentationTheme, strings: PresentationStrings, peers: [(RenderedPeer, PeerPresence?)], accountPeer: Peer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void) {
|
init(sharedContext: SharedAccountContext, account: Account, switchableAccounts: [AccountWithInfo], theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, peers: [(RenderedPeer, PeerPresence?)], accountPeer: Peer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void) {
|
||||||
self.sharedContext = sharedContext
|
self.sharedContext = sharedContext
|
||||||
self.account = account
|
self.account = account
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.controllerInteraction = controllerInteraction
|
self.controllerInteraction = controllerInteraction
|
||||||
self.accountPeer = accountPeer
|
self.accountPeer = accountPeer
|
||||||
self.switchToAnotherAccount = switchToAnotherAccount
|
self.switchToAnotherAccount = switchToAnotherAccount
|
||||||
@ -372,7 +375,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
if peer.peerId == self.accountPeer.id {
|
if peer.peerId == self.accountPeer.id {
|
||||||
text = self.strings.DialogList_SavedMessages
|
text = self.strings.DialogList_SavedMessages
|
||||||
} else {
|
} else {
|
||||||
text = peer.chatMainPeer?.displayTitle ?? ""
|
text = peer.chatMainPeer?.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder) ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if !string.isEmpty {
|
if !string.isEmpty {
|
||||||
|
@ -5,8 +5,10 @@ import Display
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import Postbox
|
import Postbox
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import Markdown
|
import Markdown
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let titleFont = Font.regular(12.0)
|
private let titleFont = Font.regular(12.0)
|
||||||
private let subtitleFont = Font.regular(10.0)
|
private let subtitleFont = Font.regular(10.0)
|
||||||
@ -20,6 +22,7 @@ final class LocationBroadcastNavigationAccessoryPanel: ASDisplayNode {
|
|||||||
private let accountPeerId: PeerId
|
private let accountPeerId: PeerId
|
||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
|
private var nameDisplayOrder: PresentationPersonNameOrder
|
||||||
|
|
||||||
private let tapAction: () -> Void
|
private let tapAction: () -> Void
|
||||||
private let close: () -> Void
|
private let close: () -> Void
|
||||||
@ -36,10 +39,11 @@ final class LocationBroadcastNavigationAccessoryPanel: ASDisplayNode {
|
|||||||
private var validLayout: (CGSize, CGFloat, CGFloat)?
|
private var validLayout: (CGSize, CGFloat, CGFloat)?
|
||||||
private var peersAndMode: ([Peer], LocationBroadcastNavigationAccessoryPanelMode, Bool)?
|
private var peersAndMode: ([Peer], LocationBroadcastNavigationAccessoryPanelMode, Bool)?
|
||||||
|
|
||||||
init(accountPeerId: PeerId, theme: PresentationTheme, strings: PresentationStrings, tapAction: @escaping () -> Void, close: @escaping () -> Void) {
|
init(accountPeerId: PeerId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, tapAction: @escaping () -> Void, close: @escaping () -> Void) {
|
||||||
self.accountPeerId = accountPeerId
|
self.accountPeerId = accountPeerId
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
|
|
||||||
self.tapAction = tapAction
|
self.tapAction = tapAction
|
||||||
self.close = close
|
self.close = close
|
||||||
@ -115,7 +119,7 @@ final class LocationBroadcastNavigationAccessoryPanel: ASDisplayNode {
|
|||||||
case .summary:
|
case .summary:
|
||||||
let text: String
|
let text: String
|
||||||
if peers.count == 1 {
|
if peers.count == 1 {
|
||||||
text = self.strings.DialogList_LiveLocationSharingTo(peers[0].displayTitle).0
|
text = self.strings.DialogList_LiveLocationSharingTo(peers[0].displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder)).0
|
||||||
} else {
|
} else {
|
||||||
text = self.strings.DialogList_LiveLocationChatsCount(Int32(peers.count))
|
text = self.strings.DialogList_LiveLocationChatsCount(Int32(peers.count))
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ private class MediaHeaderItemNode: ASDisplayNode {
|
|||||||
self.addSubnode(self.subtitleNode)
|
self.addSubnode(self.subtitleNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, playbackItem: SharedMediaPlaylistItem?, transition: ContainedViewLayoutTransition) -> (NSAttributedString?, NSAttributedString?, Bool) {
|
func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, playbackItem: SharedMediaPlaylistItem?, transition: ContainedViewLayoutTransition) -> (NSAttributedString?, NSAttributedString?, Bool) {
|
||||||
var rateButtonHidden = false
|
var rateButtonHidden = false
|
||||||
var titleString: NSAttributedString?
|
var titleString: NSAttributedString?
|
||||||
var subtitleString: NSAttributedString?
|
var subtitleString: NSAttributedString?
|
||||||
@ -48,11 +48,11 @@ private class MediaHeaderItemNode: ASDisplayNode {
|
|||||||
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
||||||
case let .voice(author, peer):
|
case let .voice(author, peer):
|
||||||
rateButtonHidden = false
|
rateButtonHidden = false
|
||||||
let titleText: String = author?.displayTitle ?? ""
|
let titleText: String = author?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||||
let subtitleText: String
|
let subtitleText: String
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
if peer is TelegramGroup || peer is TelegramChannel {
|
if peer is TelegramGroup || peer is TelegramChannel {
|
||||||
subtitleText = peer.displayTitle
|
subtitleText = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
subtitleText = strings.MusicPlayer_VoiceNote
|
subtitleText = strings.MusicPlayer_VoiceNote
|
||||||
}
|
}
|
||||||
@ -64,12 +64,12 @@ private class MediaHeaderItemNode: ASDisplayNode {
|
|||||||
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
||||||
case let .instantVideo(author, peer, timestamp):
|
case let .instantVideo(author, peer, timestamp):
|
||||||
rateButtonHidden = false
|
rateButtonHidden = false
|
||||||
let titleText: String = author?.displayTitle ?? ""
|
let titleText: String = author?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||||
var subtitleText: String
|
var subtitleText: String
|
||||||
|
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
if peer is TelegramGroup || peer is TelegramChannel {
|
if peer is TelegramGroup || peer is TelegramChannel {
|
||||||
subtitleText = peer.displayTitle
|
subtitleText = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
subtitleText = strings.Message_VideoMessage
|
subtitleText = strings.Message_VideoMessage
|
||||||
}
|
}
|
||||||
@ -132,6 +132,7 @@ final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollViewDeleg
|
|||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
private var dateTimeFormat: PresentationDateTimeFormat
|
private var dateTimeFormat: PresentationDateTimeFormat
|
||||||
|
private var nameDisplayOrder: PresentationPersonNameOrder
|
||||||
|
|
||||||
private let scrollNode: ASScrollNode
|
private let scrollNode: ASScrollNode
|
||||||
private var initialContentOffset: CGFloat?
|
private var initialContentOffset: CGFloat?
|
||||||
@ -209,6 +210,7 @@ final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollViewDeleg
|
|||||||
self.theme = presentationData.theme
|
self.theme = presentationData.theme
|
||||||
self.strings = presentationData.strings
|
self.strings = presentationData.strings
|
||||||
self.dateTimeFormat = presentationData.dateTimeFormat
|
self.dateTimeFormat = presentationData.dateTimeFormat
|
||||||
|
self.nameDisplayOrder = presentationData.nameDisplayOrder
|
||||||
|
|
||||||
self.scrollNode = ASScrollNode()
|
self.scrollNode = ASScrollNode()
|
||||||
|
|
||||||
@ -361,6 +363,7 @@ final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollViewDeleg
|
|||||||
func updatePresentationData(_ presentationData: PresentationData) {
|
func updatePresentationData(_ presentationData: PresentationData) {
|
||||||
self.theme = presentationData.theme
|
self.theme = presentationData.theme
|
||||||
self.strings = presentationData.strings
|
self.strings = presentationData.strings
|
||||||
|
self.nameDisplayOrder = presentationData.nameDisplayOrder
|
||||||
self.dateTimeFormat = presentationData.dateTimeFormat
|
self.dateTimeFormat = presentationData.dateTimeFormat
|
||||||
|
|
||||||
let maskImage = generateMaskImage(color: self.theme.rootController.navigationBar.backgroundColor)
|
let maskImage = generateMaskImage(color: self.theme.rootController.navigationBar.backgroundColor)
|
||||||
@ -421,12 +424,12 @@ final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollViewDeleg
|
|||||||
|
|
||||||
let inset: CGFloat = 40.0 + leftInset
|
let inset: CGFloat = 40.0 + leftInset
|
||||||
let constrainedSize = CGSize(width: size.width - inset * 2.0, height: size.height)
|
let constrainedSize = CGSize(width: size.width - inset * 2.0, height: size.height)
|
||||||
let (titleString, subtitleString, rateButtonHidden) = self.currentItemNode.updateLayout(size: constrainedSize, leftInset: leftInset, rightInset: rightInset, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, playbackItem: self.playbackItems?.0, transition: transition)
|
let (titleString, subtitleString, rateButtonHidden) = self.currentItemNode.updateLayout(size: constrainedSize, leftInset: leftInset, rightInset: rightInset, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.0, transition: transition)
|
||||||
self.accessibilityAreaNode.accessibilityLabel = "\(titleString?.string ?? ""). \(subtitleString?.string ?? "")"
|
self.accessibilityAreaNode.accessibilityLabel = "\(titleString?.string ?? ""). \(subtitleString?.string ?? "")"
|
||||||
self.rateButton.isHidden = rateButtonHidden
|
self.rateButton.isHidden = rateButtonHidden
|
||||||
|
|
||||||
let _ = self.previousItemNode.updateLayout(size: constrainedSize, leftInset: 0.0, rightInset: 0.0, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, playbackItem: self.playbackItems?.1, transition: transition)
|
let _ = self.previousItemNode.updateLayout(size: constrainedSize, leftInset: 0.0, rightInset: 0.0, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.1, transition: transition)
|
||||||
let _ = self.nextItemNode.updateLayout(size: constrainedSize, leftInset: 0.0, rightInset: 0.0, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, playbackItem: self.playbackItems?.2, transition: transition)
|
let _ = self.nextItemNode.updateLayout(size: constrainedSize, leftInset: 0.0, rightInset: 0.0, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.2, transition: transition)
|
||||||
|
|
||||||
let constrainedBounds = CGRect(origin: CGPoint(), size: constrainedSize)
|
let constrainedBounds = CGRect(origin: CGPoint(), size: constrainedSize)
|
||||||
transition.updateFrame(node: self.scrollNode, frame: constrainedBounds.offsetBy(dx: inset, dy: 0.0))
|
transition.updateFrame(node: self.scrollNode, frame: constrainedBounds.offsetBy(dx: inset, dy: 0.0))
|
||||||
|
@ -295,7 +295,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
locationBroadcastAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, transition: transition)
|
locationBroadcastAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, transition: transition)
|
||||||
} else {
|
} else {
|
||||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
locationBroadcastAccessoryPanel = LocationBroadcastNavigationAccessoryPanel(accountPeerId: self.context.account.peerId, theme: presentationData.theme, strings: presentationData.strings, tapAction: { [weak self] in
|
locationBroadcastAccessoryPanel = LocationBroadcastNavigationAccessoryPanel(accountPeerId: self.context.account.peerId, theme: presentationData.theme, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder, tapAction: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
switch strongSelf.locationBroadcastPanelSource {
|
switch strongSelf.locationBroadcastPanelSource {
|
||||||
case .none:
|
case .none:
|
||||||
@ -325,7 +325,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let beginTimeAndTimeout = beginTimeAndTimeout {
|
if let beginTimeAndTimeout = beginTimeAndTimeout {
|
||||||
items.append(LocationBroadcastActionSheetItem(context: strongSelf.context, peer: peer, title: peer.displayTitle, beginTimestamp: beginTimeAndTimeout.0, timeout: beginTimeAndTimeout.1, strings: presentationData.strings, action: {
|
items.append(LocationBroadcastActionSheetItem(context: strongSelf.context, peer: peer, title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), beginTimestamp: beginTimeAndTimeout.0, timeout: beginTimeAndTimeout.1, strings: presentationData.strings, action: {
|
||||||
dismissAction()
|
dismissAction()
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
|
presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
|
||||||
@ -382,7 +382,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
if let closePeers = closePeers, !closePeers.isEmpty {
|
if let closePeers = closePeers, !closePeers.isEmpty {
|
||||||
items.append(ActionSheetTextItem(title: presentationData.strings.LiveLocation_MenuChatsCount(Int32(closePeers.count))))
|
items.append(ActionSheetTextItem(title: presentationData.strings.LiveLocation_MenuChatsCount(Int32(closePeers.count))))
|
||||||
for peer in closePeers {
|
for peer in closePeers {
|
||||||
items.append(ActionSheetButtonItem(title: peer.displayTitle, action: {
|
items.append(ActionSheetButtonItem(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), action: {
|
||||||
dismissAction()
|
dismissAction()
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
|
presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
|
||||||
|
@ -171,7 +171,7 @@ final class CallControllerNode: ASDisplayNode {
|
|||||||
self.dimNode.isHidden = true
|
self.dimNode.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.statusNode.title = peer.displayTitle
|
self.statusNode.title = peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)
|
||||||
if hasOther {
|
if hasOther {
|
||||||
self.statusNode.subtitle = self.presentationData.strings.Call_AnsweringWithAccount(accountPeer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
self.statusNode.subtitle = self.presentationData.strings.Call_AnsweringWithAccount(accountPeer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
if let _ = audioSessionControl, previous == nil || previousControl == nil {
|
if let _ = audioSessionControl, previous == nil || previousControl == nil {
|
||||||
if !self.reportedIncomingCall {
|
if !self.reportedIncomingCall {
|
||||||
self.reportedIncomingCall = true
|
self.reportedIncomingCall = true
|
||||||
self.callKitIntegration?.reportIncomingCall(uuid: self.internalId, handle: "\(self.peerId.id)", displayTitle: self.peer?.displayTitle ?? "Unknown", completion: { [weak self] error in
|
self.callKitIntegration?.reportIncomingCall(uuid: self.internalId, handle: "\(self.peerId.id)", displayTitle: self.peer?.debugDisplayTitle ?? "Unknown", completion: { [weak self] error in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
if error.domain == "com.apple.CallKit.error.incomingcall" && (error.code == -3 || error.code == 3) {
|
if error.domain == "com.apple.CallKit.error.incomingcall" && (error.code == -3 || error.code == 3) {
|
||||||
Logger.shared.log("PresentationCall", "reportIncomingCall device in DND mode")
|
Logger.shared.log("PresentationCall", "reportIncomingCall device in DND mode")
|
||||||
|
@ -297,7 +297,7 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
|||||||
guard let strongSelf = self, let peer = peer else {
|
guard let strongSelf = self, let peer = peer else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
strongSelf.callKitIntegration?.startCall(account: account, peerId: peerId, displayTitle: peer.displayTitle)
|
strongSelf.callKitIntegration?.startCall(account: account, peerId: peerId, displayTitle: peer.debugDisplayTitle)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if let currentCall = self.currentCall {
|
if let currentCall = self.currentCall {
|
||||||
|
@ -184,7 +184,7 @@ private struct ResolvedChatListResetRange {
|
|||||||
let previousPeerIds = transaction.resetChatList(keepPeerNamespaces: [Namespaces.Peer.SecretChat], upperBound: range.local.upperBound ?? ChatListIndex.absoluteUpperBound, lowerBound: range.local.lowerBound)
|
let previousPeerIds = transaction.resetChatList(keepPeerNamespaces: [Namespaces.Peer.SecretChat], upperBound: range.local.upperBound ?? ChatListIndex.absoluteUpperBound, lowerBound: range.local.lowerBound)
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
for peerId in previousPeerIds {
|
for peerId in previousPeerIds {
|
||||||
print("pre \(peerId) [\(transaction.getPeer(peerId)?.displayTitle ?? "nil")]")
|
print("pre \(peerId) [\(transaction.getPeer(peerId)?.debugDisplayTitle ?? "nil")]")
|
||||||
}
|
}
|
||||||
print("pre hash \(range.local.hash)")
|
print("pre hash \(range.local.hash)")
|
||||||
print("")
|
print("")
|
||||||
@ -193,7 +193,7 @@ private struct ResolvedChatListResetRange {
|
|||||||
for entry in range.local.entries {
|
for entry in range.local.entries {
|
||||||
switch entry {
|
switch entry {
|
||||||
case let .peer(index, readState, topMessageAttributes, tagSummary, interfaceState):
|
case let .peer(index, readState, topMessageAttributes, tagSummary, interfaceState):
|
||||||
print("val \(index.messageIndex.id.peerId) [\(transaction.getPeer(index.messageIndex.id.peerId)?.displayTitle ?? "nil")]")
|
print("val \(index.messageIndex.id.peerId) [\(transaction.getPeer(index.messageIndex.id.peerId)?.debugDisplayTitle ?? "nil")]")
|
||||||
combineChatListNamespaceEntryHash(index: index, readState: readState, topMessageAttributes: topMessageAttributes, tagSummary: nil, interfaceState: nil, into: &preRecalculatedHash)
|
combineChatListNamespaceEntryHash(index: index, readState: readState, topMessageAttributes: topMessageAttributes, tagSummary: nil, interfaceState: nil, into: &preRecalculatedHash)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@ -220,7 +220,7 @@ private struct ResolvedChatListResetRange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
combineChatListNamespaceEntryHash(index: ChatListIndex(pinningIndex: nil, messageIndex: index), readState: range.remote.readStates[index.id.peerId]?[Namespaces.Message.Cloud], topMessageAttributes: topMessageAttributes, tagSummary: nil, interfaceState: nil, into: &hash)
|
combineChatListNamespaceEntryHash(index: ChatListIndex(pinningIndex: nil, messageIndex: index), readState: range.remote.readStates[index.id.peerId]?[Namespaces.Message.Cloud], topMessageAttributes: topMessageAttributes, tagSummary: nil, interfaceState: nil, into: &hash)
|
||||||
print("upd \(index.id.peerId) [\(transaction.getPeer(index.id.peerId)?.displayTitle ?? "nil")]")
|
print("upd \(index.id.peerId) [\(transaction.getPeer(index.id.peerId)?.debugDisplayTitle ?? "nil")]")
|
||||||
})
|
})
|
||||||
print("upd hash \(hash)")
|
print("upd hash \(hash)")
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,30 +9,7 @@ public extension Peer {
|
|||||||
var debugDisplayTitle: String {
|
var debugDisplayTitle: String {
|
||||||
switch self {
|
switch self {
|
||||||
case let user as TelegramUser:
|
case let user as TelegramUser:
|
||||||
return user.name
|
return user.nameOrPhone
|
||||||
case let group as TelegramGroup:
|
|
||||||
return group.title
|
|
||||||
case let channel as TelegramChannel:
|
|
||||||
return channel.title
|
|
||||||
default:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var displayTitle: String {
|
|
||||||
return self.debugDisplayTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
var compactDisplayTitle: String {
|
|
||||||
switch self {
|
|
||||||
case let user as TelegramUser:
|
|
||||||
if let firstName = user.firstName {
|
|
||||||
return firstName
|
|
||||||
} else if let lastName = user.lastName {
|
|
||||||
return lastName
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
case let group as TelegramGroup:
|
case let group as TelegramGroup:
|
||||||
return group.title
|
return group.title
|
||||||
case let channel as TelegramChannel:
|
case let channel as TelegramChannel:
|
||||||
|
@ -76,7 +76,7 @@ public final class TelegramUser: Peer {
|
|||||||
public let restrictionInfo: PeerAccessRestrictionInfo?
|
public let restrictionInfo: PeerAccessRestrictionInfo?
|
||||||
public let flags: UserInfoFlags
|
public let flags: UserInfoFlags
|
||||||
|
|
||||||
public var name: String {
|
public var nameOrPhone: String {
|
||||||
if let firstName = self.firstName {
|
if let firstName = self.firstName {
|
||||||
if let lastName = self.lastName {
|
if let lastName = self.lastName {
|
||||||
return "\(firstName) \(lastName)"
|
return "\(firstName) \(lastName)"
|
||||||
@ -85,6 +85,20 @@ public final class TelegramUser: Peer {
|
|||||||
}
|
}
|
||||||
} else if let lastName = self.lastName {
|
} else if let lastName = self.lastName {
|
||||||
return lastName
|
return lastName
|
||||||
|
} else if let phone = self.phone, !phone.isEmpty {
|
||||||
|
return phone
|
||||||
|
} else {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var shortNameOrPhone: String {
|
||||||
|
if let firstName = self.firstName {
|
||||||
|
return firstName
|
||||||
|
} else if let lastName = self.lastName {
|
||||||
|
return lastName
|
||||||
|
} else if let phone = self.phone, !phone.isEmpty {
|
||||||
|
return phone
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ import MessageReactionListUI
|
|||||||
import AppBundle
|
import AppBundle
|
||||||
import WalletUI
|
import WalletUI
|
||||||
import WalletUrl
|
import WalletUrl
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
public enum ChatControllerPeekActions {
|
public enum ChatControllerPeekActions {
|
||||||
case standard
|
case standard
|
||||||
@ -824,7 +825,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
case .default:
|
case .default:
|
||||||
strongSelf.openUrl(defaultUrl, concealed: false)
|
strongSelf.openUrl(defaultUrl, concealed: false)
|
||||||
case let .request(domain, bot, requestWriteAccess):
|
case let .request(domain, bot, requestWriteAccess):
|
||||||
let controller = chatMessageActionUrlAuthController(context: strongSelf.context, defaultUrl: defaultUrl, domain: domain, bot: bot, requestWriteAccess: requestWriteAccess, displayName: peer.displayTitle, open: { [weak self] authorize, allowWriteAccess in
|
let controller = chatMessageActionUrlAuthController(context: strongSelf.context, defaultUrl: defaultUrl, domain: domain, bot: bot, requestWriteAccess: requestWriteAccess, displayName: peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder), open: { [weak self] authorize, allowWriteAccess in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if authorize {
|
if authorize {
|
||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
||||||
@ -7689,10 +7690,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
||||||
let _ = (self.context.account.postbox.loadedPeerWithId(peerId)
|
let _ = (self.context.account.postbox.loadedPeerWithId(peerId)
|
||||||
|> deliverOnMainQueue).start(next: { peer in
|
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||||
if let peer = peer as? TelegramUser {
|
if let strongSelf = self, let peer = peer as? TelegramUser {
|
||||||
let recipientHandle = INPersonHandle(value: "tg\(peerId.id)", type: .unknown)
|
let recipientHandle = INPersonHandle(value: "tg\(peerId.id)", type: .unknown)
|
||||||
let recipient = INPerson(personHandle: recipientHandle, nameComponents: nil, displayName: peer.displayTitle, image: nil, contactIdentifier: nil, customIdentifier: "tg\(peerId.id)")
|
let recipient = INPerson(personHandle: recipientHandle, nameComponents: nil, displayName: peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder), image: nil, contactIdentifier: nil, customIdentifier: "tg\(peerId.id)")
|
||||||
let intent = INSendMessageIntent(recipients: [recipient], content: nil, groupName: nil, serviceName: nil, sender: nil)
|
let intent = INSendMessageIntent(recipients: [recipient], content: nil, groupName: nil, serviceName: nil, sender: nil)
|
||||||
let interaction = INInteraction(intent: intent, response: nil)
|
let interaction = INInteraction(intent: intent, response: nil)
|
||||||
interaction.direction = .outgoing
|
interaction.direction = .outgoing
|
||||||
@ -7713,17 +7714,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
let reminderActivity = NSUserActivity(activityType: "RemindAboutChatIntent")
|
let reminderActivity = NSUserActivity(activityType: "RemindAboutChatIntent")
|
||||||
self.reminderActivity = reminderActivity
|
self.reminderActivity = reminderActivity
|
||||||
if peer is TelegramGroup {
|
if peer is TelegramGroup {
|
||||||
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutGroup(peer.displayTitle).0
|
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutGroup(peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
||||||
} else if let channel = peer as? TelegramChannel {
|
} else if let channel = peer as? TelegramChannel {
|
||||||
if case .broadcast = channel.info {
|
if case .broadcast = channel.info {
|
||||||
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutChannel(peer.displayTitle).0
|
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutChannel(peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
||||||
} else {
|
} else {
|
||||||
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutGroup(peer.displayTitle).0
|
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutGroup(peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutUser(peer.displayTitle).0
|
reminderActivity.title = self.presentationData.strings.Activity_RemindAboutUser(peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).0
|
||||||
}
|
}
|
||||||
reminderActivity.userInfo = ["peerId": peerId.toInt64(), "peerTitle": peer.displayTitle]
|
reminderActivity.userInfo = ["peerId": peerId.toInt64(), "peerTitle": peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)]
|
||||||
reminderActivity.isEligibleForHandoff = true
|
reminderActivity.isEligibleForHandoff = true
|
||||||
reminderActivity.becomeCurrent()
|
reminderActivity.becomeCurrent()
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
self.navigationBar?.isHidden = true
|
self.navigationBar?.isHidden = true
|
||||||
}
|
}
|
||||||
if self.overlayNavigationBar == nil {
|
if self.overlayNavigationBar == nil {
|
||||||
let overlayNavigationBar = ChatOverlayNavigationBar(theme: self.chatPresentationInterfaceState.theme, close: { [weak self] in
|
let overlayNavigationBar = ChatOverlayNavigationBar(theme: self.chatPresentationInterfaceState.theme, strings: self.chatPresentationInterfaceState.strings, nameDisplayOrder: self.chatPresentationInterfaceState.nameDisplayOrder, close: { [weak self] in
|
||||||
self?.dismissAsOverlay()
|
self?.dismissAsOverlay()
|
||||||
})
|
})
|
||||||
overlayNavigationBar.peerView = self.peerView
|
overlayNavigationBar.peerView = self.peerView
|
||||||
@ -1190,7 +1190,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
let panelFrame = dismissedInputContextPanelNode.placement == .overTextInput ? inputContextPanelsOverMainPanelFrame : inputContextPanelsFrame
|
let panelFrame = dismissedInputContextPanelNode.placement == .overTextInput ? inputContextPanelsOverMainPanelFrame : inputContextPanelsFrame
|
||||||
if !dismissedInputContextPanelNode.frame.equalTo(panelFrame) {
|
if !dismissedInputContextPanelNode.frame.equalTo(panelFrame) {
|
||||||
dismissedInputContextPanelNode.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, transition: transition, interfaceState: self.chatPresentationInterfaceState)
|
dismissedInputContextPanelNode.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: 0.0, transition: transition, interfaceState: self.chatPresentationInterfaceState)
|
||||||
transition.updateFrame(node: dismissedInputContextPanelNode, frame: panelFrame, completion: { _ in
|
transition.updateFrame(node: dismissedInputContextPanelNode, frame: panelFrame, completion: { _ in
|
||||||
frameCompleted = true
|
frameCompleted = true
|
||||||
completed()
|
completed()
|
||||||
|
@ -6,6 +6,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private protocol ChatEmptyNodeContent {
|
private protocol ChatEmptyNodeContent {
|
||||||
func updateLayout(interfaceState: ChatPresentationInterfaceState, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
|
func updateLayout(interfaceState: ChatPresentationInterfaceState, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
|
||||||
|
@ -6,6 +6,7 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import CheckNode
|
import CheckNode
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
@ -20,6 +21,7 @@ private func formattedText(_ text: String, color: UIColor, textAlignment: NSText
|
|||||||
|
|
||||||
private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
|
private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private let defaultUrl: String
|
private let defaultUrl: String
|
||||||
private let domain: String
|
private let domain: String
|
||||||
private let bot: Peer
|
private let bot: Peer
|
||||||
@ -60,8 +62,9 @@ private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, defaultUrl: String, domain: String, bot: Peer, requestWriteAccess: Bool, displayName: String, actions: [TextAlertAction]) {
|
init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, defaultUrl: String, domain: String, bot: Peer, requestWriteAccess: Bool, displayName: String, actions: [TextAlertAction]) {
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.defaultUrl = defaultUrl
|
self.defaultUrl = defaultUrl
|
||||||
self.domain = domain
|
self.domain = domain
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
@ -160,7 +163,7 @@ private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
|
|||||||
|
|
||||||
self.textNode.attributedText = formattedText(strings.Conversation_OpenBotLinkText(self.defaultUrl).0, color: theme.primaryColor, textAlignment: .center)
|
self.textNode.attributedText = formattedText(strings.Conversation_OpenBotLinkText(self.defaultUrl).0, color: theme.primaryColor, textAlignment: .center)
|
||||||
self.authorizeLabelNode.attributedText = formattedText(strings.Conversation_OpenBotLinkLogin(self.domain, self.displayName).0, color: theme.primaryColor)
|
self.authorizeLabelNode.attributedText = formattedText(strings.Conversation_OpenBotLinkLogin(self.domain, self.displayName).0, color: theme.primaryColor)
|
||||||
self.allowWriteLabelNode.attributedText = formattedText(strings.Conversation_OpenBotLinkAllowMessages(self.bot.displayTitle).0, color: theme.primaryColor)
|
self.allowWriteLabelNode.attributedText = formattedText(strings.Conversation_OpenBotLinkAllowMessages(self.bot.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder)).0, color: theme.primaryColor)
|
||||||
|
|
||||||
self.actionNodesSeparator.backgroundColor = theme.separatorColor
|
self.actionNodesSeparator.backgroundColor = theme.separatorColor
|
||||||
for actionNode in self.actionNodes {
|
for actionNode in self.actionNodes {
|
||||||
@ -314,7 +317,7 @@ func chatMessageActionUrlAuthController(context: AccountContext, defaultUrl: Str
|
|||||||
open(contentNode.authorize, contentNode.allowWriteAccess)
|
open(contentNode.authorize, contentNode.allowWriteAccess)
|
||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
contentNode = ChatMessageActionUrlAuthAlertContentNode(theme: AlertControllerTheme(presentationTheme: theme), ptheme: theme, strings: strings, defaultUrl: defaultUrl, domain: domain, bot: bot, requestWriteAccess: requestWriteAccess, displayName: displayName, actions: actions)
|
contentNode = ChatMessageActionUrlAuthAlertContentNode(theme: AlertControllerTheme(presentationTheme: theme), ptheme: theme, strings: strings, nameDisplayOrder: presentationData.nameDisplayOrder, defaultUrl: defaultUrl, domain: domain, bot: bot, requestWriteAccess: requestWriteAccess, displayName: displayName, actions: actions)
|
||||||
let controller = AlertController(theme: AlertControllerTheme(presentationTheme: theme), contentNode: contentNode!)
|
let controller = AlertController(theme: AlertControllerTheme(presentationTheme: theme), contentNode: contentNode!)
|
||||||
dismissImpl = { [weak controller] animated in
|
dismissImpl = { [weak controller] animated in
|
||||||
if animated {
|
if animated {
|
||||||
|
@ -538,7 +538,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
||||||
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
||||||
|
|
||||||
let nameString = NSAttributedString(string: sourcePeer.displayTitle, font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
let nameString = NSAttributedString(string: sourcePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder), font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
||||||
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -898,7 +898,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
self.item?.controllerInteraction.clickThroughMessage()
|
self.item?.controllerInteraction.clickThroughMessage()
|
||||||
case .longTap, .doubleTap:
|
case .longTap, .doubleTap:
|
||||||
if let item = self.item, self.imageNode.frame.contains(location) {
|
if let item = self.item, self.imageNode.frame.contains(location) {
|
||||||
item.controllerInteraction.openMessageContextMenu(item.message, false, self, self.imageNode.frame, nil)
|
item.controllerInteraction.openMessageContextMenu(item.message, false, self, self.imageNode.frame, recognizer)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case .hold:
|
case .hold:
|
||||||
|
@ -1189,7 +1189,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
} else {
|
} else {
|
||||||
if let currentForwardInfo = currentForwardInfo, forwardInfo.author == nil && currentForwardInfo.0 != nil {
|
if let currentForwardInfo = currentForwardInfo, forwardInfo.author == nil && currentForwardInfo.0 != nil {
|
||||||
forwardSource = nil
|
forwardSource = nil
|
||||||
forwardAuthorSignature = currentForwardInfo.0?.displayTitle
|
forwardAuthorSignature = currentForwardInfo.0?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
forwardSource = forwardInfo.author
|
forwardSource = forwardInfo.author
|
||||||
forwardAuthorSignature = forwardInfo.authorSignature
|
forwardAuthorSignature = forwardInfo.authorSignature
|
||||||
|
@ -266,7 +266,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
||||||
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
||||||
|
|
||||||
let nameString = NSAttributedString(string: sourcePeer.displayTitle, font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
let nameString = NSAttributedString(string: sourcePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder), font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
||||||
|
|
||||||
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
} else {
|
} else {
|
||||||
if let currentForwardInfo = currentForwardInfo, forwardInfo.author == nil && currentForwardInfo.0 != nil {
|
if let currentForwardInfo = currentForwardInfo, forwardInfo.author == nil && currentForwardInfo.0 != nil {
|
||||||
forwardSource = nil
|
forwardSource = nil
|
||||||
forwardAuthorSignature = currentForwardInfo.0?.displayTitle
|
forwardAuthorSignature = currentForwardInfo.0?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
forwardSource = forwardInfo.author
|
forwardSource = forwardInfo.author
|
||||||
forwardAuthorSignature = forwardInfo.authorSignature
|
forwardAuthorSignature = forwardInfo.authorSignature
|
||||||
|
@ -189,7 +189,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let authorName = item.message.author?.displayTitle
|
let authorName = item.message.author?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
if let chatPeer = item.message.peers[item.message.id.peerId] {
|
if let chatPeer = item.message.peers[item.message.id.peerId] {
|
||||||
let (_, _, messageText) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, message: item.message, chatPeer: RenderedPeer(peer: chatPeer), accountPeerId: item.context.account.peerId)
|
let (_, _, messageText) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, message: item.message, chatPeer: RenderedPeer(peer: chatPeer), accountPeerId: item.context.account.peerId)
|
||||||
@ -518,7 +518,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
if label.isEmpty {
|
if label.isEmpty {
|
||||||
if let author = item.message.author {
|
if let author = item.message.author {
|
||||||
if isIncoming {
|
if isIncoming {
|
||||||
label = author.displayTitle
|
label = author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
label = item.presentationData.strings.VoiceOver_Chat_YourMessage
|
label = item.presentationData.strings.VoiceOver_Chat_YourMessage
|
||||||
}
|
}
|
||||||
@ -558,7 +558,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
let replyLabel: String
|
let replyLabel: String
|
||||||
if replyMessage.flags.contains(.Incoming) {
|
if replyMessage.flags.contains(.Incoming) {
|
||||||
if let author = replyMessage.author {
|
if let author = replyMessage.author {
|
||||||
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyFrom(author.displayTitle).0
|
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyFrom(author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)).0
|
||||||
} else {
|
} else {
|
||||||
replyLabel = item.presentationData.strings.VoiceOver_Chat_Reply
|
replyLabel = item.presentationData.strings.VoiceOver_Chat_Reply
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
if let sourcePeer = item.message.peers[attribute.messageId.peerId] {
|
||||||
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
let inlineBotNameColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText
|
||||||
|
|
||||||
let nameString = NSAttributedString(string: sourcePeer.displayTitle, font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
let nameString = NSAttributedString(string: sourcePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder), font: inlineBotPrefixFont, textColor: inlineBotNameColor)
|
||||||
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
viaBotApply = viaBotLayout(TextNodeLayoutArguments(attributedString: nameString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, availableWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,14 @@ import Display
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
|
|
||||||
private let titleFont = Font.semibold(14.0)
|
private let titleFont = Font.semibold(14.0)
|
||||||
|
|
||||||
final class ChatOverlayNavigationBar: ASDisplayNode {
|
final class ChatOverlayNavigationBar: ASDisplayNode {
|
||||||
private let theme: PresentationTheme
|
private let theme: PresentationTheme
|
||||||
|
private let strings: PresentationStrings
|
||||||
|
private let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
private let close: () -> Void
|
private let close: () -> Void
|
||||||
|
|
||||||
private let separatorNode: ASDisplayNode
|
private let separatorNode: ASDisplayNode
|
||||||
@ -24,7 +27,7 @@ final class ChatOverlayNavigationBar: ASDisplayNode {
|
|||||||
var title = ""
|
var title = ""
|
||||||
if let peerView = self.peerView {
|
if let peerView = self.peerView {
|
||||||
if let peer = peerViewMainPeer(peerView) {
|
if let peer = peerViewMainPeer(peerView) {
|
||||||
title = peer.displayTitle
|
title = peer.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.peerTitle != title {
|
if self.peerTitle != title {
|
||||||
@ -36,8 +39,10 @@ final class ChatOverlayNavigationBar: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init(theme: PresentationTheme, close: @escaping () -> Void) {
|
init(theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, close: @escaping () -> Void) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.strings = strings
|
||||||
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.close = close
|
self.close = close
|
||||||
|
|
||||||
self.separatorNode = ASDisplayNode()
|
self.separatorNode = ASDisplayNode()
|
||||||
|
@ -133,14 +133,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedChannelAbout(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedChannelAbout(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupAbout(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupAbout(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -171,14 +171,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedChannelUsername(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedChannelUsername(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupUsername(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupUsername(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -235,14 +235,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
if value {
|
if value {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleInvitesOn(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleInvitesOn(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleInvitesOff(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleInvitesOff(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -262,14 +262,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
if value {
|
if value {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleSignaturesOn(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleSignaturesOn(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleSignaturesOff(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageToggleSignaturesOff(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessagePinned(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessagePinned(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageUnpinned(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageUnpinned(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -372,9 +372,9 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
let titleText: (String, [(Int, NSRange)])
|
let titleText: (String, [(Int, NSRange)])
|
||||||
if mediaUpdated || message.media.isEmpty {
|
if mediaUpdated || message.media.isEmpty {
|
||||||
titleText = self.presentationData.strings.Channel_AdminLog_MessageEdited(author?.displayTitle ?? "")
|
titleText = self.presentationData.strings.Channel_AdminLog_MessageEdited(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "")
|
||||||
} else {
|
} else {
|
||||||
titleText = self.presentationData.strings.Channel_AdminLog_CaptionEdited(author?.displayTitle ?? "")
|
titleText = self.presentationData.strings.Channel_AdminLog_CaptionEdited(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "")
|
||||||
}
|
}
|
||||||
|
|
||||||
appendAttributedText(text: titleText, generateEntities: { index in
|
appendAttributedText(text: titleText, generateEntities: { index in
|
||||||
@ -420,7 +420,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageDeleted(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageDeleted(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prevBanInfo == nil || !prevBanInfo!.rights.flags.contains(.banReadMessages)) && newFlags.contains(.banReadMessages) {
|
if (prevBanInfo == nil || !prevBanInfo!.rights.flags.contains(.banReadMessages)) && newFlags.contains(.banReadMessages) {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageKickedName(new.peer.displayTitle) : self.presentationData.strings.Channel_AdminLog_MessageKickedNameUsername(new.peer.displayTitle, "@" + new.peer.addressName!), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageKickedName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessageKickedNameUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -539,7 +539,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
text += "\n"
|
text += "\n"
|
||||||
} else if isBroadcast, newBanInfo == nil, prevBanInfo != nil {
|
} else if isBroadcast, newBanInfo == nil, prevBanInfo != nil {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageUnkickedName(new.peer.displayTitle) : self.presentationData.strings.Channel_AdminLog_MessageUnkickedNameUsername(new.peer.displayTitle, "@" + new.peer.addressName!), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageUnkickedName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessageUnkickedNameUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -549,7 +549,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
return result
|
return result
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRestrictedName(new.peer.displayTitle) : self.presentationData.strings.Channel_AdminLog_MessageRestrictedNameUsername(new.peer.displayTitle, "@" + new.peer.addressName!), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRestrictedName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessageRestrictedNameUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -635,7 +635,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
if case .member = prev.participant, case .creator = new.participant {
|
if case .member = prev.participant, case .creator = new.participant {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageTransferedName(new.peer.displayTitle) : self.presentationData.strings.Channel_AdminLog_MessageTransferedNameUsername(new.peer.displayTitle, "@" + new.peer.addressName!), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageTransferedName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessageTransferedNameUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -648,7 +648,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var appendedRightsHeader = false
|
var appendedRightsHeader = false
|
||||||
|
|
||||||
if case let .creator(_, prevRank) = prev.participant, case let .creator(_, newRank) = new.participant, prevRank != newRank {
|
if case let .creator(_, prevRank) = prev.participant, case let .creator(_, newRank) = new.participant, prevRank != newRank {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle, newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle, "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -691,7 +691,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
if prevFlags.contains(flag) != newFlags.contains(flag) {
|
if prevFlags.contains(flag) != newFlags.contains(flag) {
|
||||||
if !appendedRightsHeader {
|
if !appendedRightsHeader {
|
||||||
appendedRightsHeader = true
|
appendedRightsHeader = true
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessagePromotedName(new.peer.displayTitle) : self.presentationData.strings.Channel_AdminLog_MessagePromotedNameUsername(new.peer.displayTitle, "@" + new.peer.addressName!), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessagePromotedName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessagePromotedNameUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -726,7 +726,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
return result
|
return result
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle, newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle, "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
result.append(.TextMention(peerId: new.peer.id))
|
result.append(.TextMention(peerId: new.peer.id))
|
||||||
@ -767,14 +767,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
if new != nil {
|
if new != nil {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupStickerPack(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedGroupStickerPack(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageRemovedGroupStickerPack(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageRemovedGroupStickerPack(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -797,14 +797,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
if !value {
|
if !value {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageGroupPreHistoryVisible(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageGroupPreHistoryVisible(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageGroupPreHistoryHidden(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageGroupPreHistoryHidden(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
let titleText: (String, [(Int, NSRange)])
|
let titleText: (String, [(Int, NSRange)])
|
||||||
|
|
||||||
titleText = self.presentationData.strings.Channel_AdminLog_PollStopped(author?.displayTitle ?? "")
|
titleText = self.presentationData.strings.Channel_AdminLog_PollStopped(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "")
|
||||||
|
|
||||||
appendAttributedText(text: titleText, generateEntities: { index in
|
appendAttributedText(text: titleText, generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
@ -931,7 +931,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
if let updated = updated {
|
if let updated = updated {
|
||||||
if let peer = peer as? TelegramChannel, case .group = peer.info {
|
if let peer = peer as? TelegramChannel, case .group = peer.info {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedLinkedChannel(author?.displayTitle ?? "", updated.displayTitle), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedLinkedChannel(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", updated.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
} else if index == 1 {
|
} else if index == 1 {
|
||||||
@ -940,7 +940,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedLinkedGroup(author?.displayTitle ?? "", updated.displayTitle), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedLinkedGroup(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", updated.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
} else if index == 1 {
|
} else if index == 1 {
|
||||||
@ -951,7 +951,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let peer = peer as? TelegramChannel, case .group = peer.info {
|
if let peer = peer as? TelegramChannel, case .group = peer.info {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedUnlinkedChannel(author?.displayTitle ?? "", previous?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedUnlinkedChannel(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", previous?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
} else if index == 1, let previous = previous {
|
} else if index == 1, let previous = previous {
|
||||||
@ -960,7 +960,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedUnlinkedGroup(author?.displayTitle ?? "", previous?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessageChangedUnlinkedGroup(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", previous?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
} else if index == 0, let previous = previous {
|
} else if index == 0, let previous = previous {
|
||||||
@ -1014,14 +1014,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
if let newValue = newValue {
|
if let newValue = newValue {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_SetSlowmode(author?.displayTitle ?? "", shortTimeIntervalString(strings: self.presentationData.strings, value: newValue)), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_SetSlowmode(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", shortTimeIntervalString(strings: self.presentationData.strings, value: newValue)), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
} else {
|
} else {
|
||||||
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_DisabledSlowmode(author?.displayTitle ?? ""), generateEntities: { index in
|
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_DisabledSlowmode(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import AsyncDisplayKit
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private enum ChatReportPeerTitleButton: Equatable {
|
private enum ChatReportPeerTitleButton: Equatable {
|
||||||
case block
|
case block
|
||||||
|
@ -6,6 +6,7 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import SearchBarNode
|
import SearchBarNode
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private let searchBarFont = Font.regular(17.0)
|
private let searchBarFont = Font.regular(17.0)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import ActivityIndicator
|
|||||||
import TelegramStringFormatting
|
import TelegramStringFormatting
|
||||||
import PeerPresenceStatusManager
|
import PeerPresenceStatusManager
|
||||||
import ChatTitleActivityNode
|
import ChatTitleActivityNode
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
enum ChatTitleContent {
|
enum ChatTitleContent {
|
||||||
case peer(peerView: PeerView, onlineMemberCount: Int32?, isScheduledMessages: Bool)
|
case peer(peerView: PeerView, onlineMemberCount: Int32?, isScheduledMessages: Bool)
|
||||||
|
@ -183,7 +183,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
|||||||
displayCountAlert = true
|
displayCountAlert = true
|
||||||
updatedState = updatedState.withToggledPeerId(.peer(peer.id))
|
updatedState = updatedState.withToggledPeerId(.peer(peer.id))
|
||||||
} else {
|
} else {
|
||||||
addedToken = EditableTokenListToken(id: peer.id, title: peer.displayTitle)
|
addedToken = EditableTokenListToken(id: peer.id, title: peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updatedCount = updatedState.selectedPeerIndices.count
|
updatedCount = updatedState.selectedPeerIndices.count
|
||||||
|
@ -219,8 +219,8 @@ public func createChannelController(context: AccountContext) -> ViewController {
|
|||||||
switch editingName {
|
switch editingName {
|
||||||
case let .title(title, type):
|
case let .title(title, type):
|
||||||
current.editingName = .title(title: String(title.prefix(255)), type: type)
|
current.editingName = .title(title: String(title.prefix(255)), type: type)
|
||||||
case let .personName(firstName, lastName):
|
case let .personName(firstName, lastName, _):
|
||||||
current.editingName = .personName(firstName: String(firstName.prefix(255)), lastName: String(lastName.prefix(255)))
|
current.editingName = .personName(firstName: String(firstName.prefix(255)), lastName: String(lastName.prefix(255)), phone: "")
|
||||||
}
|
}
|
||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import SwiftSignalKit
|
|||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
func textStringForForwardedMessage(_ message: Message, strings: PresentationStrings) -> (String, Bool) {
|
func textStringForForwardedMessage(_ message: Message, strings: PresentationStrings) -> (String, Bool) {
|
||||||
for media in message.media {
|
for media in message.media {
|
||||||
|
@ -12,7 +12,7 @@ private func accountInfo(account: Account) -> Signal<StoredAccountInfo, NoError>
|
|||||||
if let addressName = peer.addressName {
|
if let addressName = peer.addressName {
|
||||||
return "\(addressName)"
|
return "\(addressName)"
|
||||||
}
|
}
|
||||||
return peer.displayTitle
|
return peer.debugDisplayTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
let primaryDatacenterId = Int32(account.network.datacenterId)
|
let primaryDatacenterId = Int32(account.network.datacenterId)
|
||||||
|
@ -239,11 +239,11 @@ public final class MediaManagerImpl: NSObject, MediaManager {
|
|||||||
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
||||||
nowPlayingInfo[MPMediaItemPropertyArtist] = subtitleText
|
nowPlayingInfo[MPMediaItemPropertyArtist] = subtitleText
|
||||||
case let .voice(author, _):
|
case let .voice(author, _):
|
||||||
let titleText: String = author?.displayTitle ?? ""
|
let titleText: String = author?.debugDisplayTitle ?? ""
|
||||||
|
|
||||||
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
||||||
case let .instantVideo(author, _, _):
|
case let .instantVideo(author, _, _):
|
||||||
let titleText: String = author?.displayTitle ?? ""
|
let titleText: String = author?.debugDisplayTitle ?? ""
|
||||||
|
|
||||||
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
nowPlayingInfo[MPMediaItemPropertyTitle] = titleText
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import TelegramPresentationData
|
|||||||
import MergeLists
|
import MergeLists
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
private struct MentionChatInputContextPanelEntry: Comparable, Identifiable {
|
private struct MentionChatInputContextPanelEntry: Comparable, Identifiable {
|
||||||
let index: Int
|
let index: Int
|
||||||
@ -58,7 +59,7 @@ final class MentionChatInputContextPanelNode: ChatInputContextPanelNode {
|
|||||||
private var currentEntries: [MentionChatInputContextPanelEntry]?
|
private var currentEntries: [MentionChatInputContextPanelEntry]?
|
||||||
|
|
||||||
private var enqueuedTransitions: [(CommandChatInputContextPanelTransition, Bool)] = []
|
private var enqueuedTransitions: [(CommandChatInputContextPanelTransition, Bool)] = []
|
||||||
private var validLayout: (CGSize, CGFloat, CGFloat)?
|
private var validLayout: (CGSize, CGFloat, CGFloat, CGFloat)?
|
||||||
|
|
||||||
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, mode: MentionChatInputContextPanelMode) {
|
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, mode: MentionChatInputContextPanelMode) {
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
@ -203,9 +204,9 @@ final class MentionChatInputContextPanelNode: ChatInputContextPanelNode {
|
|||||||
return max(size.height - minimumItemHeights, 0.0)
|
return max(size.height - minimumItemHeights, 0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) {
|
override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) {
|
||||||
let hadValidLayout = self.validLayout != nil
|
let hadValidLayout = self.validLayout != nil
|
||||||
self.validLayout = (size, leftInset, rightInset)
|
self.validLayout = (size, leftInset, rightInset, bottomInset)
|
||||||
|
|
||||||
if self.theme !== interfaceState.theme {
|
if self.theme !== interfaceState.theme {
|
||||||
self.theme = interfaceState.theme
|
self.theme = interfaceState.theme
|
||||||
|
@ -16,6 +16,7 @@ import OpenInExternalAppUI
|
|||||||
import PeerInfoUI
|
import PeerInfoUI
|
||||||
import ContextUI
|
import ContextUI
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
public class PeerMediaCollectionController: TelegramBaseController {
|
public class PeerMediaCollectionController: TelegramBaseController {
|
||||||
private var validLayout: ContainerViewLayout?
|
private var validLayout: ContainerViewLayout?
|
||||||
|
@ -127,7 +127,7 @@ final class MessageMediaPlaylistItem: SharedMediaPlaylistItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SharedMediaPlaybackDisplayData.music(title: file.fileName ?? "", performer: self.message.effectiveAuthor?.displayTitle ?? "", albumArt: nil, long: false)
|
return SharedMediaPlaybackDisplayData.music(title: file.fileName ?? "", performer: self.message.effectiveAuthor?.debugDisplayTitle ?? "", albumArt: nil, long: false)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode {
|
|||||||
|
|
||||||
let headerString: String
|
let headerString: String
|
||||||
if let message = message, message.flags.contains(.Incoming), let author = message.author {
|
if let message = message, message.flags.contains(.Incoming), let author = message.author {
|
||||||
headerString = "Reply to message. From: \(author.displayTitle)"
|
headerString = "Reply to message. From: \(author.displayTitle(strings: strings, displayOrder: nameDisplayOrder))"
|
||||||
} else if let message = message, !message.flags.contains(.Incoming) {
|
} else if let message = message, !message.flags.contains(.Incoming) {
|
||||||
headerString = "Reply to your message"
|
headerString = "Reply to your message"
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,6 +5,7 @@ import Display
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import Postbox
|
import Postbox
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
|
import LocalizedPeerData
|
||||||
|
|
||||||
final class SecretChatHandshakeStatusInputPanelNode: ChatInputPanelNode {
|
final class SecretChatHandshakeStatusInputPanelNode: ChatInputPanelNode {
|
||||||
private let button: HighlightableButtonNode
|
private let button: HighlightableButtonNode
|
||||||
|
@ -5,6 +5,7 @@ import SwiftSignalKit
|
|||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import TelegramUIPreferences
|
||||||
import TelegramCallsUI
|
import TelegramCallsUI
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
@ -410,7 +411,7 @@ public final class SharedNotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var currentNotificationCall: (peer: Peer?, internalId: CallSessionInternalId)?
|
private var currentNotificationCall: (peer: Peer?, internalId: CallSessionInternalId)?
|
||||||
private func updateNotificationCall(call: (peer: Peer?, internalId: CallSessionInternalId)?, strings: PresentationStrings) {
|
private func updateNotificationCall(call: (peer: Peer?, internalId: CallSessionInternalId)?, strings: PresentationStrings, nameOrder: PresentationPersonNameOrder) {
|
||||||
if let previousCall = currentNotificationCall {
|
if let previousCall = currentNotificationCall {
|
||||||
if #available(iOS 10.0, *) {
|
if #available(iOS 10.0, *) {
|
||||||
let center = UNUserNotificationCenter.current()
|
let center = UNUserNotificationCenter.current()
|
||||||
@ -428,7 +429,7 @@ public final class SharedNotificationManager {
|
|||||||
self.currentNotificationCall = call
|
self.currentNotificationCall = call
|
||||||
|
|
||||||
if let notificationCall = call {
|
if let notificationCall = call {
|
||||||
let rawText = strings.PUSH_PHONE_CALL_REQUEST(notificationCall.peer?.displayTitle ?? "").0
|
let rawText = strings.PUSH_PHONE_CALL_REQUEST(notificationCall.peer?.displayTitle(strings: strings, displayOrder: nameOrder) ?? "").0
|
||||||
let title: String?
|
let title: String?
|
||||||
let body: String
|
let body: String
|
||||||
if let index = rawText.firstIndex(of: "|") {
|
if let index = rawText.firstIndex(of: "|") {
|
||||||
@ -501,11 +502,11 @@ public final class SharedNotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> distinctUntilChanged(isEqual: { $0?.1 == $1?.1 })).start(next: { [weak self] peerAndInternalId in
|
|> distinctUntilChanged(isEqual: { $0?.1 == $1?.1 })).start(next: { [weak self] peerAndInternalId in
|
||||||
self?.updateNotificationCall(call: peerAndInternalId, strings: strings)
|
self?.updateNotificationCall(call: peerAndInternalId, strings: strings, nameOrder: .firstLast)
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
self.notificationCallStateDisposable.set(nil)
|
self.notificationCallStateDisposable.set(nil)
|
||||||
self.updateNotificationCall(call: nil, strings: strings)
|
self.updateNotificationCall(call: nil, strings: strings, nameOrder: .firstLast)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ private final class ChannelMemberSingleCategoryListContext: ChannelMemberCategor
|
|||||||
switch requestCategory {
|
switch requestCategory {
|
||||||
case .admins:
|
case .admins:
|
||||||
if let query = adminQuery {
|
if let query = adminQuery {
|
||||||
return members?.filter({$0.peer.displayTitle.lowercased().components(separatedBy: " ").contains(where: {$0.hasPrefix(query.lowercased())})})
|
return members?.filter({$0.peer.debugDisplayTitle.lowercased().components(separatedBy: " ").contains(where: {$0.hasPrefix(query.lowercased())})})
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -312,9 +312,9 @@ private func galleryItems(account: Account, results: [ChatContextResult], curren
|
|||||||
return (galleryItems, focusItem)
|
return (galleryItems, focusItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
func presentLegacyWebSearchGallery(context: AccountContext, peer: Peer?, theme: PresentationTheme, results: [ChatContextResult], current: ChatContextResult, selectionContext: TGMediaSelectionContext?, editingContext: TGMediaEditingContext, updateHiddenMedia: @escaping (String?) -> Void, initialLayout: ContainerViewLayout?, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (ChatContextResult) -> Void, present: (ViewController, Any?) -> Void) {
|
func presentLegacyWebSearchGallery(context: AccountContext, peer: Peer?, presentationData: PresentationData, results: [ChatContextResult], current: ChatContextResult, selectionContext: TGMediaSelectionContext?, editingContext: TGMediaEditingContext, updateHiddenMedia: @escaping (String?) -> Void, initialLayout: ContainerViewLayout?, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (ChatContextResult) -> Void, present: (ViewController, Any?) -> Void) {
|
||||||
let legacyController = LegacyController(presentation: .custom, theme: theme, initialLayout: nil)
|
let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme, initialLayout: nil)
|
||||||
legacyController.statusBar.statusBarStyle = theme.rootController.statusBarStyle.style
|
legacyController.statusBar.statusBarStyle = presentationData.theme.rootController.statusBarStyle.style
|
||||||
|
|
||||||
let controller = TGModernGalleryController(context: legacyController.context)!
|
let controller = TGModernGalleryController(context: legacyController.context)!
|
||||||
controller.asyncTransitionIn = true
|
controller.asyncTransitionIn = true
|
||||||
@ -322,9 +322,9 @@ func presentLegacyWebSearchGallery(context: AccountContext, peer: Peer?, theme:
|
|||||||
|
|
||||||
let (items, focusItem) = galleryItems(account: context.account, results: results, current: current, selectionContext: selectionContext, editingContext: editingContext)
|
let (items, focusItem) = galleryItems(account: context.account, results: results, current: current, selectionContext: selectionContext, editingContext: editingContext)
|
||||||
|
|
||||||
let model = TGMediaPickerGalleryModel(context: legacyController.context, items: items, focus: focusItem, selectionContext: selectionContext, editingContext: editingContext, hasCaptions: false, allowCaptionEntities: true, hasTimer: false, onlyCrop: false, inhibitDocumentCaptions: false, hasSelectionPanel: false, hasCamera: false, recipientName: peer?.displayTitle)!
|
let model = TGMediaPickerGalleryModel(context: legacyController.context, items: items, focus: focusItem, selectionContext: selectionContext, editingContext: editingContext, hasCaptions: false, allowCaptionEntities: true, hasTimer: false, onlyCrop: false, inhibitDocumentCaptions: false, hasSelectionPanel: false, hasCamera: false, recipientName: peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder))!
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
model.suggestionContext = legacySuggestionContext(account: context.account, peerId: peer.id)
|
model.suggestionContext = legacySuggestionContext(context: context, peerId: peer.id)
|
||||||
}
|
}
|
||||||
controller.model = model
|
controller.model = model
|
||||||
model.controller = controller
|
model.controller = controller
|
||||||
|
@ -283,7 +283,7 @@ public final class WebSearchController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func loadDisplayNode() {
|
override public func loadDisplayNode() {
|
||||||
self.displayNode = WebSearchControllerNode(context: self.context, theme: self.interfaceState.presentationData.theme, strings: interfaceState.presentationData.strings, controllerInteraction: self.controllerInteraction!, peer: self.peer, mode: self.mode.mode)
|
self.displayNode = WebSearchControllerNode(context: self.context, presentationData: self.interfaceState.presentationData, controllerInteraction: self.controllerInteraction!, peer: self.peer, mode: self.mode.mode)
|
||||||
self.controllerNode.requestUpdateInterfaceState = { [weak self] animated, f in
|
self.controllerNode.requestUpdateInterfaceState = { [weak self] animated, f in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.updateInterfaceState(f)
|
strongSelf.updateInterfaceState(f)
|
||||||
|
@ -129,6 +129,7 @@ class WebSearchControllerNode: ASDisplayNode {
|
|||||||
private let peer: Peer?
|
private let peer: Peer?
|
||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
private var strings: PresentationStrings
|
private var strings: PresentationStrings
|
||||||
|
private var presentationData: PresentationData
|
||||||
private let mode: WebSearchMode
|
private let mode: WebSearchMode
|
||||||
|
|
||||||
private let controllerInteraction: WebSearchControllerInteraction
|
private let controllerInteraction: WebSearchControllerInteraction
|
||||||
@ -177,10 +178,11 @@ class WebSearchControllerNode: ASDisplayNode {
|
|||||||
var cancel: (() -> Void)?
|
var cancel: (() -> Void)?
|
||||||
var dismissInput: (() -> Void)?
|
var dismissInput: (() -> Void)?
|
||||||
|
|
||||||
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: WebSearchControllerInteraction, peer: Peer?, mode: WebSearchMode) {
|
init(context: AccountContext, presentationData: PresentationData, controllerInteraction: WebSearchControllerInteraction, peer: Peer?, mode: WebSearchMode) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.theme = theme
|
self.theme = presentationData.theme
|
||||||
self.strings = strings
|
self.strings = presentationData.strings
|
||||||
|
self.presentationData = presentationData
|
||||||
self.controllerInteraction = controllerInteraction
|
self.controllerInteraction = controllerInteraction
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
@ -266,7 +268,7 @@ class WebSearchControllerNode: ASDisplayNode {
|
|||||||
entries.append(WebSearchRecentQueryEntry(index: i, query: queries[i]))
|
entries.append(WebSearchRecentQueryEntry(index: i, query: queries[i]))
|
||||||
}
|
}
|
||||||
|
|
||||||
let header = ChatListSearchItemHeader(type: .recentPeers, theme: interfaceState.presentationData.theme, strings:interfaceState.presentationData.strings, actionTitle: strings.WebSearch_RecentSectionClear, action: {
|
let header = ChatListSearchItemHeader(type: .recentPeers, theme: interfaceState.presentationData.theme, strings: interfaceState.presentationData.strings, actionTitle: interfaceState.presentationData.strings.WebSearch_RecentSectionClear, action: {
|
||||||
_ = clearRecentWebSearchQueries(postbox: strongSelf.context.account.postbox).start()
|
_ = clearRecentWebSearchQueries(postbox: strongSelf.context.account.postbox).start()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -687,7 +689,7 @@ class WebSearchControllerNode: ASDisplayNode {
|
|||||||
if self.controllerInteraction.selectionState != nil {
|
if self.controllerInteraction.selectionState != nil {
|
||||||
if let state = self.webSearchInterfaceState.state, state.scope == .images {
|
if let state = self.webSearchInterfaceState.state, state.scope == .images {
|
||||||
if let results = self.currentProcessedResults?.results {
|
if let results = self.currentProcessedResults?.results {
|
||||||
presentLegacyWebSearchGallery(context: self.context, peer: self.peer, theme: self.theme, results: results, current: currentResult, selectionContext: self.controllerInteraction.selectionState, editingContext: self.controllerInteraction.editingState, updateHiddenMedia: { [weak self] id in
|
presentLegacyWebSearchGallery(context: self.context, peer: self.peer, presentationData: self.presentationData, results: results, current: currentResult, selectionContext: self.controllerInteraction.selectionState, editingContext: self.controllerInteraction.editingState, updateHiddenMedia: { [weak self] id in
|
||||||
self?.hiddenMediaId.set(.single(id))
|
self?.hiddenMediaId.set(.single(id))
|
||||||
}, initialLayout: self.containerLayout?.0, transitionHostView: { [weak self] in
|
}, initialLayout: self.containerLayout?.0, transitionHostView: { [weak self] in
|
||||||
return self?.gridNode.view
|
return self?.gridNode.view
|
||||||
|
@ -114,7 +114,7 @@ class WebSearchGalleryController: ViewController {
|
|||||||
self?.dismiss(forceAway: true)
|
self?.dismiss(forceAway: true)
|
||||||
}, selectionState: selectionState, editingState: editingState)
|
}, selectionState: selectionState, editingState: editingState)
|
||||||
|
|
||||||
if let title = peer?.displayTitle {
|
if let title = peer?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) {
|
||||||
let recipientNode = GalleryNavigationRecipientNode(color: .white, title: title)
|
let recipientNode = GalleryNavigationRecipientNode(color: .white, title: title)
|
||||||
let leftItem = UIBarButtonItem(customDisplayNode: recipientNode)
|
let leftItem = UIBarButtonItem(customDisplayNode: recipientNode)
|
||||||
self.navigationItem.leftBarButtonItem = leftItem
|
self.navigationItem.leftBarButtonItem = leftItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user