This commit is contained in:
Isaac
2025-01-21 21:08:44 +04:00
parent 8a0643eb53
commit 40828e9037
58 changed files with 1473 additions and 220 deletions

View File

@@ -0,0 +1,18 @@
import Foundation
import Postbox
public class ForwardVideoTimestampAttribute: MessageAttribute {
public let timestamp: Int32
public init(timestamp: Int32) {
self.timestamp = timestamp
}
required public init(decoder: PostboxDecoder) {
self.timestamp = decoder.decodeInt32ForKey("timestamp", orElse: 0)
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.timestamp, forKey: "timestamp")
}
}

View File

@@ -0,0 +1,18 @@
import Foundation
import Postbox
public class LocalMediaPlaybackInfoAttribute: MessageAttribute {
public let data: Data
public init(data: Data) {
self.data = data
}
required public init(decoder: PostboxDecoder) {
self.data = decoder.decodeDataForKey("d") ?? Data()
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeData(self.data, forKey: "d")
}
}

View File

@@ -140,6 +140,7 @@ public struct Namespaces {
public static let cachedPremiumGiftCodeOptions: Int8 = 42
public static let cachedProfileGifts: Int8 = 43
public static let recommendedBots: Int8 = 44
public static let channelsForPublicReaction: Int8 = 45
}
public struct UnorderedItemList {

View File

@@ -113,10 +113,10 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
break
}
}
var derivedData: DerivedDataMessageAttribute?
var previousDerivedData: DerivedDataMessageAttribute?
for attribute in previous {
if let attribute = attribute as? DerivedDataMessageAttribute {
derivedData = attribute
previousDerivedData = attribute
break
}
}
@@ -134,17 +134,16 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
updated.append(audioTranscription)
}
}
if let derivedData = derivedData {
if let previousDerivedData {
var found = false
for i in 0 ..< updated.count {
if let attribute = updated[i] as? DerivedDataMessageAttribute {
updated[i] = derivedData
if let _ = updated[i] as? DerivedDataMessageAttribute {
found = true
break
}
}
if !found {
updated.append(derivedData)
updated.append(previousDerivedData)
}
}
},