mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various Fixes
This commit is contained in:
@@ -252,54 +252,51 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.inputContextPanelContainer = ChatControllerTitlePanelNodeContainer()
|
||||
|
||||
var source: ChatHistoryListSource
|
||||
if case let .forwardedMessages(messageIds, hideNames, hideCaptions) = subject {
|
||||
let messages = combineLatest(context.account.postbox.messagesAtIds(messageIds), context.account.postbox.loadedPeerWithId(context.account.peerId))
|
||||
|> mapToSignal { messages, accountPeer -> Signal<([Message], Int32, Bool), NoError> in
|
||||
return combineLatest(hideNames, hideCaptions)
|
||||
|> map { hideNames, hideCaptions -> ([Message], Int32, Bool) in
|
||||
var messages = messages
|
||||
messages.sort(by: { lhsMessage, rhsMessage in
|
||||
return lhsMessage.timestamp > rhsMessage.timestamp
|
||||
if case let .forwardedMessages(messageIds, options) = subject {
|
||||
let messages = combineLatest(context.account.postbox.messagesAtIds(messageIds), context.account.postbox.loadedPeerWithId(context.account.peerId), options)
|
||||
|> map { messages, accountPeer, options -> ([Message], Int32, Bool) in
|
||||
var messages = messages
|
||||
messages.sort(by: { lhsMessage, rhsMessage in
|
||||
return lhsMessage.timestamp > rhsMessage.timestamp
|
||||
})
|
||||
messages = messages.map { message in
|
||||
var flags = message.flags
|
||||
flags.remove(.Incoming)
|
||||
|
||||
var attributes = message.attributes
|
||||
attributes.append(OutgoingScheduleInfoMessageAttribute(scheduleTime: scheduleWhenOnlineTimestamp))
|
||||
attributes = attributes.filter({ attribute in
|
||||
if attribute is EditedMessageAttribute {
|
||||
return false
|
||||
}
|
||||
if attribute is ReplyMessageAttribute {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
messages = messages.map { message in
|
||||
var flags = message.flags
|
||||
flags.remove(.Incoming)
|
||||
|
||||
var attributes = message.attributes
|
||||
attributes.append(OutgoingScheduleInfoMessageAttribute(scheduleTime: scheduleWhenOnlineTimestamp))
|
||||
attributes = attributes.filter({ attribute in
|
||||
if attribute is EditedMessageAttribute {
|
||||
return false
|
||||
}
|
||||
if attribute is ReplyMessageAttribute {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
var messageText = message.text
|
||||
var forwardInfo = message.forwardInfo
|
||||
if forwardInfo == nil {
|
||||
forwardInfo = MessageForwardInfo(author: message.author, source: nil, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
|
||||
}
|
||||
if hideNames {
|
||||
forwardInfo = nil
|
||||
}
|
||||
|
||||
if hideNames && hideCaptions {
|
||||
for media in message.media {
|
||||
if media is TelegramMediaImage || media is TelegramMediaFile {
|
||||
messageText = ""
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message.withUpdatedFlags(flags).withUpdatedText(messageText).withUpdatedTimestamp(scheduleWhenOnlineTimestamp).withUpdatedAttributes(attributes).withUpdatedAuthor(accountPeer).withUpdatedForwardInfo(forwardInfo)
|
||||
|
||||
var messageText = message.text
|
||||
var forwardInfo = message.forwardInfo
|
||||
if forwardInfo == nil {
|
||||
forwardInfo = MessageForwardInfo(author: message.author, source: nil, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
|
||||
}
|
||||
if options.hideNames {
|
||||
forwardInfo = nil
|
||||
}
|
||||
|
||||
return (messages, Int32(messages.count), false)
|
||||
if options.hideNames && options.hideCaptions {
|
||||
for media in message.media {
|
||||
if media is TelegramMediaImage || media is TelegramMediaFile {
|
||||
messageText = ""
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message.withUpdatedFlags(flags).withUpdatedText(messageText).withUpdatedTimestamp(scheduleWhenOnlineTimestamp).withUpdatedAttributes(attributes).withUpdatedAuthor(accountPeer).withUpdatedForwardInfo(forwardInfo)
|
||||
}
|
||||
|
||||
return (messages, Int32(messages.count), false)
|
||||
}
|
||||
source = .custom(messages: messages, messageId: MessageId(peerId: PeerId(0), namespace: 0, id: 0), loadMore: nil)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user