Story covers

This commit is contained in:
Ilya Laktyushin
2024-07-19 17:43:17 +04:00
parent d8d68722ae
commit 3e448e833e
57 changed files with 1196 additions and 152 deletions

View File

@@ -701,7 +701,7 @@ func inputDocumentAttributesFromFileAttributes(_ fileAttributes: [TelegramMediaF
attributes.append(.documentAttributeSticker(flags: flags, alt: displayText, stickerset: stickerSet, maskCoords: inputMaskCoords))
case .HasLinkedStickers:
attributes.append(.documentAttributeHasStickers)
case let .Video(duration, size, videoFlags, preloadSize):
case let .Video(duration, size, videoFlags, preloadSize, coverTime):
var flags: Int32 = 0
if videoFlags.contains(.instantRoundVideo) {
flags |= (1 << 0)
@@ -715,8 +715,10 @@ func inputDocumentAttributesFromFileAttributes(_ fileAttributes: [TelegramMediaF
if videoFlags.contains(.isSilent) {
flags |= (1 << 3)
}
attributes.append(.documentAttributeVideo(flags: flags, duration: duration, w: Int32(size.width), h: Int32(size.height), preloadPrefixSize: preloadSize, videoStartTs: nil))
if let coverTime = coverTime, coverTime > 0.0 {
flags |= (1 << 4)
}
attributes.append(.documentAttributeVideo(flags: flags, duration: duration, w: Int32(size.width), h: Int32(size.height), preloadPrefixSize: preloadSize, videoStartTs: coverTime))
case let .Audio(isVoice, duration, title, performer, waveform):
var flags: Int32 = 0
if isVoice {
@@ -786,7 +788,7 @@ public func statsCategoryForFileWithAttributes(_ attributes: [TelegramMediaFileA
} else {
return .audio
}
case let .Video(_, _, flags, _):
case let .Video(_, _, flags, _, _):
if flags.contains(TelegramMediaVideoFlags.instantRoundVideo) {
return .voiceMessages
} else {