mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix preview when forwarding from Saved Messages
This commit is contained in:
parent
49f272be5b
commit
383b555437
@ -59,7 +59,7 @@ public final class TelegramThemeSettings: Codable, Equatable {
|
|||||||
self.baseTheme = TelegramBaseTheme(rawValue: try container.decode(Int32.self, forKey: "baseTheme")) ?? .classic
|
self.baseTheme = TelegramBaseTheme(rawValue: try container.decode(Int32.self, forKey: "baseTheme")) ?? .classic
|
||||||
self.accentColor = UInt32(bitPattern: try container.decode(Int32.self, forKey: "accent"))
|
self.accentColor = UInt32(bitPattern: try container.decode(Int32.self, forKey: "accent"))
|
||||||
self.outgoingAccentColor = (try container.decodeIfPresent(Int32.self, forKey: "outgoingAccent")).flatMap { UInt32(bitPattern: $0) }
|
self.outgoingAccentColor = (try container.decodeIfPresent(Int32.self, forKey: "outgoingAccent")).flatMap { UInt32(bitPattern: $0) }
|
||||||
let messageColors = try container.decode([Int32].self, forKey: "messageColors")
|
let messageColors = try container.decodeIfPresent([Int32].self, forKey: "messageColors") ?? []
|
||||||
if !messageColors.isEmpty {
|
if !messageColors.isEmpty {
|
||||||
self.messageColors = messageColors.map(UInt32.init(bitPattern:))
|
self.messageColors = messageColors.map(UInt32.init(bitPattern:))
|
||||||
} else {
|
} else {
|
||||||
@ -69,7 +69,7 @@ public final class TelegramThemeSettings: Codable, Equatable {
|
|||||||
self.messageColors = []
|
self.messageColors = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.animateMessageColors = try container.decode(Int32.self, forKey: "animateMessageColors") != 0
|
self.animateMessageColors = (try container.decodeIfPresent(Int32.self, forKey: "animateMessageColors") ?? 0) != 0
|
||||||
|
|
||||||
self.wallpaper = (try container.decodeIfPresent(TelegramWallpaperNativeCodable.self, forKey: "wallpaper"))?.value
|
self.wallpaper = (try container.decodeIfPresent(TelegramWallpaperNativeCodable.self, forKey: "wallpaper"))?.value
|
||||||
}
|
}
|
||||||
|
@ -5753,8 +5753,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
uniquePeerIds.insert(author.id)
|
uniquePeerIds.insert(author.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if message.id.peerId == accountPeerId && author.id == accountPeerId {
|
if message.id.peerId == accountPeerId && message.forwardInfo == nil {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hasNotOwnMessages = true
|
hasNotOwnMessages = true
|
||||||
}
|
}
|
||||||
@ -12042,13 +12041,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
var hasNotOwnMessages = false
|
var hasNotOwnMessages = false
|
||||||
for message in messages {
|
for message in messages {
|
||||||
if let author = message.effectiveAuthor {
|
if message.id.peerId == accountPeerId && message.forwardInfo == nil {
|
||||||
if message.id.peerId == accountPeerId && author.id == accountPeerId {
|
|
||||||
} else {
|
} else {
|
||||||
hasNotOwnMessages = true
|
hasNotOwnMessages = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if case .peer(peerId) = strongSelf.chatLocation, strongSelf.parentController == nil, !isPinnedMessages {
|
if case .peer(peerId) = strongSelf.chatLocation, strongSelf.parentController == nil, !isPinnedMessages {
|
||||||
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.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withUpdatedForwardMessageIds(messages.map { $0.id }).withUpdatedForwardOptionsState(ChatInterfaceForwardOptionsState(hideNames: !hasNotOwnMessages, hideCaptions: false, unhideNamesOnCaptionChange: false)).withoutSelectionState() }).updatedSearch(nil) })
|
||||||
|
@ -281,11 +281,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var hideNames = options.hideNames
|
var hideNames = options.hideNames
|
||||||
if let author = message.effectiveAuthor {
|
if message.id.peerId == accountPeer.id && message.forwardInfo == nil {
|
||||||
if message.id.peerId == accountPeer.id && author.id == accountPeer.id {
|
|
||||||
hideNames = true
|
hideNames = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var messageText = message.text
|
var messageText = message.text
|
||||||
var messageMedia = message.media
|
var messageMedia = message.media
|
||||||
@ -309,8 +307,11 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var forwardInfo = message.forwardInfo
|
var forwardInfo: MessageForwardInfo?
|
||||||
if forwardInfo == nil {
|
if let existingForwardInfo = message.forwardInfo {
|
||||||
|
forwardInfo = MessageForwardInfo(author: existingForwardInfo.author, source: existingForwardInfo.source, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
|
||||||
|
}
|
||||||
|
else {
|
||||||
forwardInfo = MessageForwardInfo(author: message.author, source: nil, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
|
forwardInfo = MessageForwardInfo(author: message.author, source: nil, sourceMessageId: nil, date: 0, authorSignature: nil, psaType: nil, flags: [])
|
||||||
}
|
}
|
||||||
if hideNames && !hasDice {
|
if hideNames && !hasDice {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user