Various improvements

This commit is contained in:
Ilya Laktyushin 2025-06-29 11:57:12 +02:00
parent a05b846703
commit c2a10931b6
4 changed files with 23 additions and 9 deletions

View File

@ -1447,7 +1447,7 @@ public struct PresentationResourcesChat {
public static func chatServiceMessageTodoAppendedIcon(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.chatServiceMessageTodoAppendedIcon.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/ServiceTodoIncompleted"), color: .white)
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/ServiceTodoAppended"), color: .white)
})
}

View File

@ -978,6 +978,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} else if let incompletedTaskId = incompleted.first {
todoTaskId = incompletedTaskId
}
} else if case let .todoAppendTasks(tasks) = action.action {
if let task = tasks.first {
todoTaskId = task.id
}
}
self.navigateToMessage(from: message.id, to: .id(attribute.messageId, NavigateToMessageParams(timestamp: nil, quote: attribute.isQuote ? attribute.quote.flatMap { quote in NavigateToMessageParams.Quote(string: quote.text, offset: quote.offset) } : nil, todoTaskId: todoTaskId)))
break

View File

@ -2132,7 +2132,19 @@ extension ChatControllerImpl {
guard let self else {
return
}
if canEdit {
func areItemsOnlyAppended(existing: [TelegramMediaTodo.Item], updated: [TelegramMediaTodo.Item]) -> Bool {
guard updated.count >= existing.count else {
return false
}
for (index, existingItem) in existing.enumerated() {
if index >= updated.count || updated[index] != existingItem {
return false
}
}
return true
}
if canEdit && !areItemsOnlyAppended(existing: existingTodo.items, updated: todo.items) {
let _ = self.context.engine.messages.requestEditMessage(
messageId: messageId,
text: "",

View File

@ -328,11 +328,6 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
params.blockInteraction.set(.single(true))
var presentInCurrent = false
if let channel = params.message.peers[params.message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
presentInCurrent = true
}
let _ = (gallery
|> deliverOnMainQueue).startStandalone(next: { gallery in
params.blockInteraction.set(.single(false))
@ -340,13 +335,16 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
gallery.centralItemUpdated = { messageId in
params.centralItemUpdated?(messageId)
}
params.present(gallery, GalleryControllerPresentationArguments(transitionArguments: { messageId, media in
let arguments = GalleryControllerPresentationArguments(transitionArguments: { messageId, media in
let selectedTransitionNode = params.transitionNode(messageId, media, false)
if let selectedTransitionNode = selectedTransitionNode {
return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: params.addToTransitionSurface)
}
return nil
}), presentInCurrent ? .current : .window(.root))
})
params.present(gallery, arguments, .window(.root))
})
return true
case let .secretGallery(gallery):