mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
InvertMediaAttribute
This commit is contained in:
parent
62ff5b04ec
commit
63c36a394e
@ -219,6 +219,7 @@ private var declaredEncodables: Void = {
|
||||
declareEncodable(TelegramMediaGiveaway.self, f: { TelegramMediaGiveaway(decoder: $0) })
|
||||
declareEncodable(TelegramMediaGiveawayResults.self, f: { TelegramMediaGiveawayResults(decoder: $0) })
|
||||
declareEncodable(WebpagePreviewMessageAttribute.self, f: { WebpagePreviewMessageAttribute(decoder: $0) })
|
||||
declareEncodable(InvertMediaMessageAttribute.self, f: { InvertMediaMessageAttribute(decoder: $0) })
|
||||
declareEncodable(DerivedDataMessageAttribute.self, f: { DerivedDataMessageAttribute(decoder: $0) })
|
||||
declareEncodable(TelegramApplicationIcons.self, f: { TelegramApplicationIcons(decoder: $0) })
|
||||
declareEncodable(OutgoingQuickReplyMessageAttribute.self, f: { OutgoingQuickReplyMessageAttribute(decoder: $0) })
|
||||
|
@ -781,6 +781,12 @@ extension StoreMessage {
|
||||
attributes.append(WebpagePreviewMessageAttribute(leadingPreview: leadingPreview, forceLargeMedia: webpageAttributes.forceLargeMedia, isManuallyAdded: webpageAttributes.isManuallyAdded, isSafe: webpageAttributes.isSafe))
|
||||
}
|
||||
}
|
||||
|
||||
let leadingPreview = (flags & (1 << 27)) != 0
|
||||
if leadingPreview {
|
||||
attributes.append(InvertMediaMessageAttribute())
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
|
||||
public class InvertMediaMessageAttribute: MessageAttribute, Equatable {
|
||||
public let associatedPeerIds: [PeerId] = []
|
||||
public let associatedMediaIds: [MediaId] = []
|
||||
|
||||
|
||||
public init() {
|
||||
}
|
||||
|
||||
required public init(decoder: PostboxDecoder) {
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
}
|
||||
|
||||
public static func ==(lhs: InvertMediaMessageAttribute, rhs: InvertMediaMessageAttribute) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
@ -248,6 +248,8 @@ private func filterMessageAttributesForOutgoingMessage(_ attributes: [MessageAtt
|
||||
return true
|
||||
case _ as WebpagePreviewMessageAttribute:
|
||||
return true
|
||||
case _ as InvertMediaMessageAttribute:
|
||||
return true
|
||||
case _ as EffectMessageAttribute:
|
||||
return true
|
||||
default:
|
||||
|
@ -1328,6 +1328,9 @@ public final class PendingMessageManager {
|
||||
flags |= 1 << 16
|
||||
}
|
||||
}
|
||||
if message.invertMedia {
|
||||
flags |= 1 << 16
|
||||
}
|
||||
|
||||
var quickReplyShortcut: Api.InputQuickReplyShortcut?
|
||||
if let quickReply {
|
||||
@ -1409,6 +1412,9 @@ public final class PendingMessageManager {
|
||||
flags |= 1 << 16
|
||||
}
|
||||
}
|
||||
if message.invertMedia {
|
||||
flags |= 1 << 16
|
||||
}
|
||||
|
||||
var quickReplyShortcut: Api.InputQuickReplyShortcut?
|
||||
if let quickReply {
|
||||
|
@ -523,6 +523,14 @@ public extension Message {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var invertMedia: Bool {
|
||||
for attribute in self.attributes {
|
||||
if let _ = attribute as? InvertMediaMessageAttribute {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public extension Message {
|
||||
|
Loading…
x
Reference in New Issue
Block a user