Skip to content

Commit c0250aa

Browse files
committed
gifs collections
1 parent 99192d8 commit c0250aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2056
-301
lines changed

Telegram-Mac/ChatController.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,14 +2619,14 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
26192619
if let suggest = presentation.interfaceState.suggestPost {
26202620
switch suggest.mode {
26212621
case let .edit(id), let .suggest(id):
2622-
reply = .init(messageId: id, quote: nil)
2622+
reply = .init(messageId: id, quote: nil, todoItemId: nil)
26232623
default:
26242624
break
26252625
}
26262626
}
26272627

26282628
if reply == nil, let threadId64 = threadId64(), !presentation.isMonoforum {
2629-
reply = .init(messageId: MessageId(peerId: chatLocation().peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId64)), quote: nil)
2629+
reply = .init(messageId: MessageId(peerId: chatLocation().peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId64)), quote: nil, todoItemId: nil)
26302630
}
26312631
return reply
26322632
}
@@ -5171,6 +5171,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
51715171
}
51725172

51735173
var fromIndex: MessageIndex?
5174+
let innerId: Int32?
51745175

51755176
if let fromId = fromId, let message = strongSelf.messageInCurrentHistoryView(fromId) {
51765177
fromIndex = MessageIndex(message)
@@ -5179,6 +5180,11 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
51795180
fromIndex = MessageIndex(message)
51805181
}
51815182
}
5183+
if let fromId = fromId, let message = strongSelf.messageInCurrentHistoryView(fromId) {
5184+
innerId = message.replyAttribute?.todoItemId
5185+
} else {
5186+
innerId = nil
5187+
}
51825188
if let fromIndex = fromIndex {
51835189
let historyView = preloadedChatHistoryViewForLocation(.InitialSearch(location: .id(focusTarget.messageId, focusTarget.string), count: strongSelf.requestCount), context: context, chatLocation: strongSelf.chatLocation, chatLocationContextHolder: strongSelf.chatLocationContextHolder, tag: strongSelf.locationValue?.tag, additionalData: [])
51845190

@@ -5212,7 +5218,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
52125218
let toIndex = MessageIndex(message)
52135219
let requestCount = strongSelf.requestCount
52145220
let scroll = state
5215-
.swap(to: ChatHistoryEntryId.message(message)).text(string: focusTarget.string)
5221+
.swap(to: ChatHistoryEntryId.message(message)).text(string: focusTarget.string, innerId: innerId)
52165222
.focus(action: { [weak strongSelf] view in
52175223
if let strongSelf {
52185224
let content: ChatHistoryLocation = .Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: .none(nil), count: requestCount, animated: state.animated)
@@ -5670,7 +5676,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
56705676
let media = TelegramMediaContact(firstName: myPeer.firstName ?? "", lastName: myPeer.lastName ?? "", phoneNumber: myPeer.phone ?? "", peerId: myPeer.id, vCardData: nil)
56715677
let canSend = peer.canSendMessage(strongSelf.mode.isThreadMode, media: media, threadData: strongSelf.chatInteraction.presentation.threadInfo, cachedData: strongSelf.chatInteraction.presentation.cachedData)
56725678
if canSend {
5673-
_ = Sender.enqueue(message: EnqueueMessage.message(text: "", attributes: [], inlineStickers: [:], mediaReference: AnyMediaReference.standalone(media: media), threadId: threadId64(), replyToMessageId: replyId.flatMap { .init(messageId: $0, quote: nil) }, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []), context: context, peerId: peerId).start(completed: scrollAfterSend)
5679+
_ = Sender.enqueue(message: EnqueueMessage.message(text: "", attributes: [], inlineStickers: [:], mediaReference: AnyMediaReference.standalone(media: media), threadId: threadId64(), replyToMessageId: replyId.flatMap { .init(messageId: $0, quote: nil, todoItemId: nil) }, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []), context: context, peerId: peerId).start(completed: scrollAfterSend)
56745680
strongSelf.nextTransaction.set(handler: afterSentTransition)
56755681
}
56765682
}
@@ -8276,7 +8282,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
82768282
if message.requestsSetupReply {
82778283
if message.id != current.interfaceState.dismissedForceReplyId {
82788284
current = current.updatedInterfaceState({
8279-
$0.withUpdatedReplyMessageId(.init(messageId: message.id, quote: nil))
8285+
$0.withUpdatedReplyMessageId(.init(messageId: message.id, quote: nil, todoItemId: nil))
82808286
})
82818287
}
82828288
}
@@ -9211,7 +9217,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
92119217
let result:KeyHandlerResult = currentReplyId != nil ? .invoked : .rejected
92129218
let subject: EngineMessageReplySubject?
92139219
if let currentReplyId = currentReplyId {
9214-
subject = .init(messageId: currentReplyId.id, quote: nil)
9220+
subject = .init(messageId: currentReplyId.id, quote: nil, todoItemId: nil)
92159221
} else {
92169222
subject = nil
92179223
}
@@ -9239,7 +9245,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
92399245
let result:KeyHandlerResult = currentReplyId != nil ? .invoked : .rejected
92409246
let subject: EngineMessageReplySubject?
92419247
if let currentReplyId = currentReplyId {
9242-
subject = .init(messageId: currentReplyId.id, quote: nil)
9248+
subject = .init(messageId: currentReplyId.id, quote: nil, todoItemId: nil)
92439249
} else {
92449250
subject = nil
92459251
}

Telegram-Mac/ChatInterfaceInteraction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ final class ChatInteraction : InterfaceObserver {
785785

786786
case .text:
787787
let replyId = strongSelf.presentation.interfaceState.messageActionsState.processedSetupReplyMessageId
788-
_ = (enqueueMessages(account: strongSelf.context.account, peerId: strongSelf.peerId, messages: [EnqueueMessage.message(text: button.title, attributes: [], inlineStickers: [:], mediaReference: nil, threadId: threadId, replyToMessageId: replyId.flatMap { .init(messageId: $0, quote: nil) }, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])]) |> deliverOnMainQueue).start(next: { [weak strongSelf] _ in
788+
_ = (enqueueMessages(account: strongSelf.context.account, peerId: strongSelf.peerId, messages: [EnqueueMessage.message(text: button.title, attributes: [], inlineStickers: [:], mediaReference: nil, threadId: threadId, replyToMessageId: replyId.flatMap { .init(messageId: $0, quote: nil, todoItemId: nil) }, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])]) |> deliverOnMainQueue).start(next: { [weak strongSelf] _ in
789789
strongSelf?.scrollToLatest(true)
790790
})
791791
case .requestPhone:

Telegram-Mac/ChatMessageMenuItems.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ func chatMenuItems(for message: Message, entry: ChatHistoryEntry?, textLayout: (
390390
let entities = messageTextEntitiesInRange(entities: ChatTextInputState(attributedText: attributed, selectionRange: 0..<0).messageTextEntities(), range: attributed.range, onlyQuoteable: true)
391391

392392
let quote = EngineMessageReplyQuote(text: attributed.string, offset: nil, entities: entities, media: message.media.first)
393-
chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: quote))
393+
chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: quote, todoItemId: nil))
394394

395395
}
396396

@@ -577,8 +577,17 @@ func chatMenuItems(for message: Message, entry: ChatHistoryEntry?, textLayout: (
577577

578578

579579
if canReplyMessage(data.message, peerId: data.peerId, chatLocation: data.chatLocation, mode: data.chatMode, threadData: chatInteraction.presentation.threadInfo) && !data.isLogInteraction {
580+
581+
let todoItemId: Int32?
582+
switch source {
583+
case let .todo(taskId):
584+
todoItemId = taskId
585+
default:
586+
todoItemId = nil
587+
}
588+
580589
firstBlock.append(ContextMenuItem(strings().messageContextReply1, handler: {
581-
data.chatInteraction.setupReplyMessage(data.message, .init(messageId: data.message.id, quote: nil))
590+
data.chatInteraction.setupReplyMessage(data.message, .init(messageId: data.message.id, quote: nil, todoItemId: todoItemId))
582591
}, itemImage: MenuAnimation.menu_reply.value, keyEquivalent: .cmdr))
583592
}
584593

Telegram-Mac/ChatRowItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3351,7 +3351,7 @@ class ChatRowItem: TableRowItem {
33513351

33523352
func replyAction() -> Bool {
33533353
if chatInteraction.presentation.canReplyInRestrictedMode, chatInteraction.chatLocation.threadMsgId != effectiveCommentMessage?.id, let message = message {
3354-
chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: nil))
3354+
chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: nil, todoItemId: nil))
33553355
return true
33563356
}
33573357
return false

Telegram-Mac/ChatRowView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ class ChatRowView: TableRowView, Notifable, MultipleSelectable, ViewDisplayDeleg
18031803

18041804
override func doubleClick(in location: NSPoint) {
18051805
if let item = self.item as? ChatRowItem, isAllowedToDoubleAction(location), let message = item.message {
1806-
item.chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: nil))
1806+
item.chatInteraction.setupReplyMessage(message, .init(messageId: message.id, quote: nil, todoItemId: nil))
18071807
}
18081808
}
18091809

0 commit comments

Comments
 (0)