Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-11-07 00:11:05 +04:00
parent ab59881d2d
commit b40173084a
10 changed files with 159 additions and 74 deletions

View File

@ -2657,6 +2657,7 @@ Unused sets are archived when you add more.";
"Channel.AdminLog.CaptionEdited" = "%@ edited caption:";
"Channel.AdminLog.MessageDeleted" = "%@ deleted message:";
"Channel.AdminLog.MessagePinned" = "%@ pinned message:";
"Channel.AdminLog.MessageUnpinnedExtended" = "%@ unpinned message:";
"Channel.AdminLog.MessageInvitedName" = "invited %1$@";
"Channel.AdminLog.MessageInvitedNameUsername" = "invited %1$@ (%2$@)";
@ -4848,6 +4849,7 @@ Sorry for the inconvenience.";
"ChatList.Context.Mute" = "Mute";
"ChatList.Context.Unmute" = "Unmute";
"ChatList.Context.JoinChannel" = "Join Channel";
"ChatList.Context.JoinChat" = "Join Chat";
"ChatList.Context.Delete" = "Delete";
"ContactList.Context.SendMessage" = "Send Message";
@ -7051,3 +7053,5 @@ Sorry for the inconvenience.";
"Channel.AdminLog.MessageToggleNoForwardsOff" = "%@ disabled no-forwards";
"VoiceChat.DiscussionGroup" = "discussion group";
"Group.Edit.PrivatePublicLinkAlert" = "Please note that if you choose a public link for your group, anyone will be able to find it in search and join.\n\nDo not create this link if you want your group to stay private.";

View File

@ -328,8 +328,14 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
}
} else {
if case .search = source {
if let _ = peer as? TelegramChannel {
items.append(.action(ContextMenuActionItem(text: strings.ChatList_Context_JoinChannel, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor) }, action: { _, f in
if let peer = peer as? TelegramChannel {
let text: String
if case .broadcast = peer.info {
text = strings.ChatList_Context_JoinChannel
} else {
text = strings.ChatList_Context_JoinChat
}
items.append(.action(ContextMenuActionItem(text: text, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor) }, action: { _, f in
var createSignal = context.peerChannelMemberCategoriesContextsManager.join(engine: context.engine, peerId: peerId, hash: nil)
var cancelImpl: (() -> Void)?
let progressSignal = Signal<Never, NoError> { subscriber in

View File

@ -1012,6 +1012,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
case .sameSection(false):
bottomStripeInset = leftInset + editingOffset
bottomStripeOffset = -separatorHeight
strongSelf.bottomStripeNode.isHidden = !item.displayDecorations
default:
bottomStripeInset = 0.0
bottomStripeOffset = 0.0

View File

@ -1156,7 +1156,13 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta
_ = (ApplicationSpecificNotice.getSetPublicChannelLink(accountManager: context.sharedContext.accountManager) |> deliverOnMainQueue).start(next: { showAlert in
if showAlert {
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Channel_Edit_PrivatePublicLinkAlert, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
let text: String
if case .broadcast = peer.info {
text = presentationData.strings.Channel_Edit_PrivatePublicLinkAlert
} else {
text = presentationData.strings.Group_Edit_PrivatePublicLinkAlert
}
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
} else {
invokeAction()
}
@ -1242,7 +1248,7 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta
_ = (ApplicationSpecificNotice.getSetPublicChannelLink(accountManager: context.sharedContext.accountManager) |> deliverOnMainQueue).start(next: { showAlert in
if showAlert {
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Channel_Edit_PrivatePublicLinkAlert, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Group_Edit_PrivatePublicLinkAlert, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
} else {
invokeAction()
}

View File

@ -5737,6 +5737,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
messagesCount = .single(1)
}
let accountPeerId = strongSelf.context.account.peerId
let items = combineLatest(forwardOptions, strongSelf.context.account.postbox.messagesAtIds(messageIds), messagesCount)
|> map { forwardOptions, messages, messagesCount -> [ContextMenuItem] in
var items: [ContextMenuItem] = []
@ -5745,9 +5746,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var uniquePeerIds = Set<PeerId>()
var hasOther = false
var hasNotOwnMessages = false
for message in messages {
if let author = message.effectiveAuthor, !uniquePeerIds.contains(author.id) {
uniquePeerIds.insert(author.id)
if let author = message.effectiveAuthor {
if !uniquePeerIds.contains(author.id) {
uniquePeerIds.insert(author.id)
}
if message.id.peerId == accountPeerId && author.id == accountPeerId {
} else {
hasNotOwnMessages = true
}
}
var isDice = false
@ -5770,7 +5780,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
let canHideNames = hasOther
let canHideNames = hasNotOwnMessages && hasOther
let hideNames = forwardOptions.hideNames
let hideCaptions = forwardOptions.hideCaptions
@ -12015,11 +12025,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
controller.peerSelected = { [weak self, weak controller] peer in
let peerId = peer.id
guard let strongSelf = self, let strongController = controller else {
return
}
let peerId = peer.id
let accountPeerId = strongSelf.context.account.peerId
if resetCurrent {
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withUpdatedForwardMessageIds(nil).withUpdatedForwardOptionsState(nil) }) })
@ -12030,8 +12040,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
isPinnedMessages = true
}
var hasNotOwnMessages = false
for message in messages {
if let author = message.effectiveAuthor {
if message.id.peerId == accountPeerId && author.id == accountPeerId {
} else {
hasNotOwnMessages = true
}
}
}
if case .peer(peerId) = strongSelf.chatLocation, strongSelf.parentController == nil, !isPinnedMessages {
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withUpdatedForwardMessageIds(messages.map { $0.id }).withoutSelectionState() }).updatedSearch(nil) })
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withUpdatedForwardMessageIds(messages.map { $0.id }).withUpdatedForwardOptionsState(ChatInterfaceForwardOptionsState(hideNames: !hasNotOwnMessages, hideCaptions: false, unhideNamesOnCaptionChange: false)).withoutSelectionState() }).updatedSearch(nil) })
strongSelf.updateItemNodesSearchTextHighlightStates()
strongSelf.searchResultsController = nil
strongController.dismiss()
@ -12094,7 +12114,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
let _ = (ChatInterfaceState.update(engine: strongSelf.context.engine, peerId: peerId, threadId: nil, { currentState in
return currentState.withUpdatedForwardMessageIds(messages.map { $0.id })
return currentState.withUpdatedForwardMessageIds(messages.map { $0.id }).withUpdatedForwardOptionsState(ChatInterfaceForwardOptionsState(hideNames: !hasNotOwnMessages, hideCaptions: false, unhideNamesOnCaptionChange: false))
})
|> deliverOnMainQueue).start(completed: {
if let strongSelf = self {

View File

@ -278,10 +278,17 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
return true
})
var hideNames = options.hideNames
if let author = message.effectiveAuthor {
if message.id.peerId == accountPeer.id && author.id == accountPeer.id {
hideNames = true
}
}
var messageText = message.text
var messageMedia = message.media
var hasDice = false
if options.hideNames {
if hideNames {
for media in message.media {
if options.hideCaptions {
if media is TelegramMediaImage || media is TelegramMediaFile {
@ -304,7 +311,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
if forwardInfo == nil {
forwardInfo = MessageForwardInfo(author: message.author, source: nil, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
}
if options.hideNames && !hasDice {
if hideNames && !hasDice {
forwardInfo = nil
}

View File

@ -1014,7 +1014,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
break
}
}
if let file = media as? TelegramMediaFile {
if let file = media as? TelegramMediaFile, !message.isCopyProtected() {
if file.isVideo {
if file.isAnimated {
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_LinkDialogSave, icon: { theme in

View File

@ -290,7 +290,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
var text: String = ""
var entities: [MessageTextEntity] = []
appendAttributedText(text: self.presentationData.strings.Channel_AdminLog_MessagePinned(author.flatMap(EnginePeer.init)?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
let textFormat: (String) -> PresentationStrings.FormattedString
if let message = message, message.tags.contains(.pinned) {
textFormat = self.presentationData.strings.Channel_AdminLog_MessagePinned
} else {
textFormat = self.presentationData.strings.Channel_AdminLog_MessageUnpinnedExtended
}
appendAttributedText(text: textFormat(author.flatMap(EnginePeer.init)?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
if index == 0, let author = author {
return [.TextMention(peerId: author.id)]
}
@ -764,31 +771,48 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
}
}
for (flag, string) in order {
if prevFlags.contains(flag) != newFlags.contains(flag) {
if !appendedRightsHeader {
appendedRightsHeader = true
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessagePromotedName(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessagePromotedNameUsername(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
var result: [MessageTextEntityType] = []
if index == 0 {
result.append(.TextMention(peerId: new.peer.id))
} else if index == 1 {
result.append(.Mention)
} else if index == 2 {
result.append(.Bold)
}
return result
}, to: &text, entities: &entities)
if !prevFlags.isEmpty && newFlags.isEmpty {
if !appendedRightsHeader {
appendedRightsHeader = true
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRemovedAdminName(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessageRemovedAdminNameUsername(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
var result: [MessageTextEntityType] = []
if index == 0 {
result.append(.TextMention(peerId: new.peer.id))
} else if index == 1 {
result.append(.Mention)
} else if index == 2 {
result.append(.Bold)
}
return result
}, to: &text, entities: &entities)
}
} else {
for (flag, string) in order {
if prevFlags.contains(flag) != newFlags.contains(flag) {
if !appendedRightsHeader {
appendedRightsHeader = true
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessagePromotedName(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)) : self.presentationData.strings.Channel_AdminLog_MessagePromotedNameUsername(EnginePeer(new.peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!), generateEntities: { index in
var result: [MessageTextEntityType] = []
if index == 0 {
result.append(.TextMention(peerId: new.peer.id))
} else if index == 1 {
result.append(.Mention)
} else if index == 2 {
result.append(.Bold)
}
return result
}, to: &text, entities: &entities)
text += "\n"
}
text += "\n"
if !prevFlags.contains(flag) {
text += "+"
} else {
text += "-"
}
appendAttributedText(text: string, withEntities: [.Italic], to: &text, entities: &entities)
}
text += "\n"
if !prevFlags.contains(flag) {
text += "+"
} else {
text += "-"
}
appendAttributedText(text: string, withEntities: [.Italic], to: &text, entities: &entities)
}
}

View File

@ -916,10 +916,12 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
}
final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
let containerNode: ContextControllerSourceNode
let contextSourceNode: ContextReferenceContentNode
private let regularTextNode: ImmediateTextNode
private let whiteTextNode: ImmediateTextNode
private let iconNode: ASImageNode
private var animationNode: AnimationNode?
private var key: PeerInfoHeaderNavigationButtonKey?
private var theme: PresentationTheme?
@ -933,11 +935,13 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
}
}
var action: (() -> Void)?
var action: ((ASDisplayNode, ContextGesture?) -> Void)?
init() {
self.contextSourceNode = ContextReferenceContentNode()
self.containerNode = ContextControllerSourceNode()
self.containerNode.animateScale = false
self.regularTextNode = ImmediateTextNode()
self.whiteTextNode = ImmediateTextNode()
self.whiteTextNode.isHidden = true
@ -951,17 +955,25 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
self.isAccessibilityElement = true
self.accessibilityTraits = .button
self.containerNode.addSubnode(self.contextSourceNode)
self.contextSourceNode.addSubnode(self.regularTextNode)
self.contextSourceNode.addSubnode(self.whiteTextNode)
self.contextSourceNode.addSubnode(self.iconNode)
self.addSubnode(self.contextSourceNode)
self.addSubnode(self.containerNode)
self.containerNode.activated = { [weak self] gesture, _ in
guard let strongSelf = self else {
return
}
strongSelf.action?(strongSelf.contextSourceNode, gesture)
}
self.addTarget(self, action: #selector(self.pressed), forControlEvents: .touchUpInside)
}
@objc private func pressed() {
self.action?()
self.action?(self.contextSourceNode, nil)
}
func update(key: PeerInfoHeaderNavigationButtonKey, presentationData: PresentationData, height: CGFloat) -> CGSize {
@ -973,6 +985,7 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
let text: String
var icon: UIImage?
var isBold = false
var isGestureEnabled = false
switch key {
case .edit:
text = presentationData.strings.Common_Edit
@ -991,8 +1004,10 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
case .more:
text = ""
icon = PresentationResourcesRootController.navigationMoreCircledIcon(presentationData.theme)
isGestureEnabled = true
}
self.accessibilityLabel = text
self.containerNode.isGestureEnabled = isGestureEnabled
let font: UIFont = isBold ? Font.semibold(17.0) : Font.regular(17.0)
@ -1016,10 +1031,12 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
self.iconNode.frame = CGRect(origin: CGPoint(x: inset, y: floor((height - image.size.height) / 2.0)), size: image.size)
let size = CGSize(width: image.size.width + inset * 2.0, height: height)
self.containerNode.frame = CGRect(origin: CGPoint(), size: size)
self.contextSourceNode.frame = CGRect(origin: CGPoint(), size: size)
return size
} else {
let size = CGSize(width: textSize.width + inset * 2.0, height: height)
self.containerNode.frame = CGRect(origin: CGPoint(), size: size)
self.contextSourceNode.frame = CGRect(origin: CGPoint(), size: size)
return size
}
@ -1059,7 +1076,7 @@ final class PeerInfoHeaderNavigationButtonContainerNode: ASDisplayNode {
}
}
var performAction: ((PeerInfoHeaderNavigationButtonKey, ContextReferenceContentNode?) -> Void)?
var performAction: ((PeerInfoHeaderNavigationButtonKey, ContextReferenceContentNode?, ContextGesture?) -> Void)?
func update(size: CGSize, presentationData: PresentationData, buttons: [PeerInfoHeaderNavigationButtonSpec], expandFraction: CGFloat, transition: ContainedViewLayoutTransition) {
let maximumExpandOffset: CGFloat = 14.0
@ -1080,11 +1097,11 @@ final class PeerInfoHeaderNavigationButtonContainerNode: ASDisplayNode {
self.buttonNodes[spec.key] = buttonNode
self.addSubnode(buttonNode)
buttonNode.isWhite = self.isWhite
buttonNode.action = { [weak self] in
buttonNode.action = { [weak self] _, gesture in
guard let strongSelf = self, let buttonNode = strongSelf.buttonNodes[spec.key] else {
return
}
strongSelf.performAction?(spec.key, buttonNode.contextSourceNode)
strongSelf.performAction?(spec.key, buttonNode.contextSourceNode, gesture)
}
}
let buttonSize = buttonNode.update(key: spec.key, presentationData: presentationData, height: size.height)

View File

@ -1884,7 +1884,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
if actions.options.contains(.deleteGlobally) {
let globalTitle: String
if isChannel {
globalTitle = presentationData.strings.Conversation_DeleteMessagesForMe
globalTitle = presentationData.strings.Conversation_DeleteMessagesForEveryone
} else if let personalPeerName = personalPeerName {
globalTitle = presentationData.strings.Conversation_DeleteMessagesFor(personalPeerName).string
} else {
@ -1893,7 +1893,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(.action(ContextMenuActionItem(text: globalTitle, textColor: .destructive, icon: { _ in nil }, action: { c, f in
c.dismiss(completion: {
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forEveryone).start()
}
})
@ -1912,7 +1912,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(.action(ContextMenuActionItem(text: localOptionText, textColor: .destructive, icon: { _ in nil }, action: { c, f in
c.dismiss(completion: {
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forLocalPeer).start()
}
})
@ -2029,7 +2029,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(.action(ContextMenuActionItem(text: globalTitle, textColor: .destructive, icon: { _ in nil }, action: { c, f in
c.dismiss(completion: {
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forEveryone).start()
}
})
@ -2048,7 +2048,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(.action(ContextMenuActionItem(text: localOptionText, textColor: .destructive, icon: { _ in nil }, action: { c, f in
c.dismiss(completion: {
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forLocalPeer).start()
}
})
@ -2530,7 +2530,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
}
self.headerNode.navigationButtonContainer.performAction = { [weak self] key, source in
self.headerNode.navigationButtonContainer.performAction = { [weak self] key, source, gesture in
guard let strongSelf = self else {
return
}
@ -2571,7 +2571,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
strongSelf.view.endEditing(true)
if case .done = key {
guard let data = strongSelf.data else {
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
return
}
if let peer = data.peer as? TelegramUser {
@ -2614,10 +2614,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}))
} else {
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}
} else if data.isContact {
let firstName = strongSelf.headerNode.editingContentNode.editingTextForKey(.firstName) ?? ""
@ -2648,7 +2648,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}, completed: {
dismissStatus?()
@ -2677,14 +2677,14 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
}
}).start()
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}))
}
} else {
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}
} else {
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}
} else if let group = data.peer as? TelegramGroup, canEditPeerInfo(context: strongSelf.context, peer: group) {
let title = strongSelf.headerNode.editingContentNode.editingTextForKey(.title) ?? ""
@ -2735,14 +2735,14 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}, completed: {
dismissStatus?()
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}))
}
} else if let channel = data.peer as? TelegramChannel, canEditPeerInfo(context: strongSelf.context, peer: channel) {
@ -2794,21 +2794,21 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}, completed: {
dismissStatus?()
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}))
}
}
proceed()
} else {
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}
} else {
strongSelf.state = strongSelf.state.withIsEditing(false)
@ -2839,7 +2839,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
strongSelf.activateSearch()
case .more:
if let source = source {
strongSelf.displayMediaGalleryContextMenu(source: source)
strongSelf.displayMediaGalleryContextMenu(source: source, gesture: gesture)
}
case .editPhoto, .editVideo:
break
@ -3120,7 +3120,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
@objc private func editingCancelPressed() {
self.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
self.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
}
private func openMessage(id: MessageId) -> Bool {
@ -4182,7 +4182,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
guard let strongSelf = self else {
return
}
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
let text: String
switch error {
@ -5526,7 +5526,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
case .avatar:
self.openAvatarForEditing()
case .edit:
self.headerNode.navigationButtonContainer.performAction?(.edit, nil)
self.headerNode.navigationButtonContainer.performAction?(.edit, nil, nil)
case .proxy:
self.controller?.push(proxySettingsController(context: self.context))
case .savedMessages:
@ -5785,7 +5785,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(ActionSheetButtonItem(title: globalTitle, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forEveryone).start()
}
}))
@ -5802,7 +5802,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
items.append(ActionSheetButtonItem(title: localOptionText, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = strongSelf.context.engine.messages.deleteMessagesInteractively(messageIds: Array(messageIds), type: .forLocalPeer).start()
}
}))
@ -5918,7 +5918,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: true, text: messageIds.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One : presentationData.strings.Conversation_ForwardTooltip_SavedMessages_Many), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .window(.root))
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let _ = (enqueueMessages(account: strongSelf.context.account, peerId: peerId, messages: messageIds.map { id -> EnqueueMessage in
return .forward(source: id, grouping: .auto, attributes: [], correlationId: nil)
@ -5952,7 +5952,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
})
|> deliverOnMainQueue).start(completed: {
if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
if let navigationController = strongSelf.controller?.navigationController as? NavigationController {
let chatController = ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId))
@ -6091,7 +6091,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}), in: .current)
}
private func displayMediaGalleryContextMenu(source: ContextReferenceContentNode) {
private func displayMediaGalleryContextMenu(source: ContextReferenceContentNode, gesture: ContextGesture?) {
let summaryTags: [MessageTags] = [.photo, .video]
let peerId = self.peerId
let _ = (context.account.postbox.combinedView(keys: summaryTags.map { tag in
@ -6232,7 +6232,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
})))
}
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .reference(PeerInfoContextReferenceContentSource(controller: controller, sourceNode: source)), items: .single(ContextController.Items(items: items)), gesture: nil)
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .reference(PeerInfoContextReferenceContentSource(controller: controller, sourceNode: source)), items: .single(ContextController.Items(items: items)), gesture: gesture)
contextController.passthroughTouchEvent = { sourceView, point in
guard let strongSelf = self else {
return .ignore
@ -6591,7 +6591,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
|> deliverOnMainQueue).start(next: { messages in
if let strongSelf = self, !messages.isEmpty {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil)
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
let shareController = ShareController(context: strongSelf.context, subject: .messages(messages.sorted(by: { lhs, rhs in
return lhs.index < rhs.index