mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +00:00
[skip ci]
This commit is contained in:
parent
3c297b2b88
commit
a2fd66d45e
@ -8,6 +8,7 @@ private let typeAnimated: Int32 = 3
|
|||||||
private let typeVideo: Int32 = 4
|
private let typeVideo: Int32 = 4
|
||||||
private let typeAudio: Int32 = 5
|
private let typeAudio: Int32 = 5
|
||||||
private let typeHasLinkedStickers: Int32 = 6
|
private let typeHasLinkedStickers: Int32 = 6
|
||||||
|
private let typeHintFileIsLarge: Int32 = 7
|
||||||
|
|
||||||
public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
||||||
case id(id: Int64, accessHash: Int64)
|
case id(id: Int64, accessHash: Int64)
|
||||||
@ -129,6 +130,7 @@ public enum TelegramMediaFileAttribute: PostboxCoding {
|
|||||||
case Video(duration: Int, size: PixelDimensions, flags: TelegramMediaVideoFlags)
|
case Video(duration: Int, size: PixelDimensions, flags: TelegramMediaVideoFlags)
|
||||||
case Audio(isVoice: Bool, duration: Int, title: String?, performer: String?, waveform: MemoryBuffer?)
|
case Audio(isVoice: Bool, duration: Int, title: String?, performer: String?, waveform: MemoryBuffer?)
|
||||||
case HasLinkedStickers
|
case HasLinkedStickers
|
||||||
|
case hintFileIsLarge
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
let type: Int32 = decoder.decodeInt32ForKey("t", orElse: 0)
|
let type: Int32 = decoder.decodeInt32ForKey("t", orElse: 0)
|
||||||
@ -152,6 +154,8 @@ public enum TelegramMediaFileAttribute: PostboxCoding {
|
|||||||
self = .Audio(isVoice: decoder.decodeInt32ForKey("iv", orElse: 0) != 0, duration: Int(decoder.decodeInt32ForKey("du", orElse: 0)), title: decoder.decodeOptionalStringForKey("ti"), performer: decoder.decodeOptionalStringForKey("pe"), waveform: waveform)
|
self = .Audio(isVoice: decoder.decodeInt32ForKey("iv", orElse: 0) != 0, duration: Int(decoder.decodeInt32ForKey("du", orElse: 0)), title: decoder.decodeOptionalStringForKey("ti"), performer: decoder.decodeOptionalStringForKey("pe"), waveform: waveform)
|
||||||
case typeHasLinkedStickers:
|
case typeHasLinkedStickers:
|
||||||
self = .HasLinkedStickers
|
self = .HasLinkedStickers
|
||||||
|
case typeHintFileIsLarge:
|
||||||
|
self = .hintFileIsLarge
|
||||||
default:
|
default:
|
||||||
preconditionFailure()
|
preconditionFailure()
|
||||||
}
|
}
|
||||||
@ -202,6 +206,8 @@ public enum TelegramMediaFileAttribute: PostboxCoding {
|
|||||||
}
|
}
|
||||||
case .HasLinkedStickers:
|
case .HasLinkedStickers:
|
||||||
encoder.encodeInt32(typeHasLinkedStickers, forKey: "t")
|
encoder.encodeInt32(typeHasLinkedStickers, forKey: "t")
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
encoder.encodeInt32(typeHintFileIsLarge, forKey: "t")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -521,6 +521,8 @@ private func decryptedAttributes46(_ attributes: [TelegramMediaFileAttribute], t
|
|||||||
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
||||||
case .HasLinkedStickers:
|
case .HasLinkedStickers:
|
||||||
break
|
break
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@ -576,6 +578,8 @@ private func decryptedAttributes73(_ attributes: [TelegramMediaFileAttribute], t
|
|||||||
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
||||||
case .HasLinkedStickers:
|
case .HasLinkedStickers:
|
||||||
break
|
break
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@ -631,6 +635,8 @@ private func decryptedAttributes101(_ attributes: [TelegramMediaFileAttribute],
|
|||||||
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
result.append(.documentAttributeAudio(flags: flags, duration: Int32(duration), title: title, performer: performer, waveform: waveformBuffer))
|
||||||
case .HasLinkedStickers:
|
case .HasLinkedStickers:
|
||||||
break
|
break
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@ -487,6 +487,8 @@ func inputDocumentAttributesFromFileAttributes(_ fileAttributes: [TelegramMediaF
|
|||||||
attributes.append(.documentAttributeSticker(flags: flags, alt: displayText, stickerset: stickerSet, maskCoords: inputMaskCoords))
|
attributes.append(.documentAttributeSticker(flags: flags, alt: displayText, stickerset: stickerSet, maskCoords: inputMaskCoords))
|
||||||
case .HasLinkedStickers:
|
case .HasLinkedStickers:
|
||||||
attributes.append(.documentAttributeHasStickers)
|
attributes.append(.documentAttributeHasStickers)
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
break
|
||||||
case let .Video(duration, size, videoFlags):
|
case let .Video(duration, size, videoFlags):
|
||||||
var flags: Int32 = 0
|
var flags: Int32 = 0
|
||||||
if videoFlags.contains(.instantRoundVideo) {
|
if videoFlags.contains(.instantRoundVideo) {
|
||||||
@ -588,9 +590,18 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||||||
} else if let resource = file.resource as? LocalFileReferenceMediaResource, let size = resource.size {
|
} else if let resource = file.resource as? LocalFileReferenceMediaResource, let size = resource.size {
|
||||||
hintSize = Int(size)
|
hintSize = Int(size)
|
||||||
}
|
}
|
||||||
if (file.resource.headerSize != 0 || file.mimeType.hasPrefix("video/mp4")) && !file.isAnimated {
|
|
||||||
hintFileIsLarge = true
|
loop: for attr in file.attributes {
|
||||||
|
switch attr {
|
||||||
|
case .hintFileIsLarge:
|
||||||
|
hintFileIsLarge = true
|
||||||
|
break loop
|
||||||
|
default:
|
||||||
|
break loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let fileReference: AnyMediaReference
|
let fileReference: AnyMediaReference
|
||||||
if let partialReference = file.partialReference {
|
if let partialReference = file.partialReference {
|
||||||
fileReference = partialReference.mediaReference(file)
|
fileReference = partialReference.mediaReference(file)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user