mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix message content kind detection
This commit is contained in:
parent
171d1f1241
commit
dc8a9f16a7
@ -117,7 +117,8 @@ public func mediaContentKind(_ media: EngineMedia, message: EngineMessage? = nil
|
|||||||
return .image
|
return .image
|
||||||
case let .file(file):
|
case let .file(file):
|
||||||
var fileName: String = ""
|
var fileName: String = ""
|
||||||
var isAnimation = false
|
|
||||||
|
var result: MessageContentKind?
|
||||||
for attribute in file.attributes {
|
for attribute in file.attributes {
|
||||||
switch attribute {
|
switch attribute {
|
||||||
case let .Sticker(text, _, _):
|
case let .Sticker(text, _, _):
|
||||||
@ -138,20 +139,20 @@ public func mediaContentKind(_ media: EngineMedia, message: EngineMessage? = nil
|
|||||||
}
|
}
|
||||||
case let .Video(_, _, flags):
|
case let .Video(_, _, flags):
|
||||||
if file.isAnimated {
|
if file.isAnimated {
|
||||||
isAnimation = true
|
result = .animation
|
||||||
} else {
|
} else {
|
||||||
if flags.contains(.instantRoundVideo) {
|
if flags.contains(.instantRoundVideo) {
|
||||||
return .videoMessage
|
result = .videoMessage
|
||||||
} else {
|
} else {
|
||||||
return .video
|
result = .video
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isAnimation {
|
if let result = result {
|
||||||
return .animation
|
return result
|
||||||
}
|
}
|
||||||
if file.isVideoSticker || file.isAnimatedSticker {
|
if file.isVideoSticker || file.isAnimatedSticker {
|
||||||
return .sticker("")
|
return .sticker("")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user