mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-24 20:20:51 +00:00
Various improvements
This commit is contained in:
parent
a05b846703
commit
c2a10931b6
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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: "",
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user