Various improvements

This commit is contained in:
Ilya Laktyushin 2026-03-24 06:54:30 +01:00
parent e11c9899e6
commit 67f45ba06d
17 changed files with 189 additions and 114 deletions

View file

@ -9,6 +9,7 @@ import TextFormat
public enum MessageContentKindKey {
case text
case image
case livePhoto
case video
case videoMessage
case audioMessage
@ -36,6 +37,7 @@ public enum MessageContentKindKey {
public enum MessageContentKind: Equatable {
case text(NSAttributedString)
case image
case livePhoto
case video
case videoMessage
case audioMessage
@ -72,6 +74,12 @@ public enum MessageContentKind: Equatable {
} else {
return false
}
case .livePhoto:
if case .livePhoto = other {
return true
} else {
return false
}
case .video:
if case .video = other {
return true
@ -207,6 +215,8 @@ public enum MessageContentKind: Equatable {
return .text
case .image:
return .image
case .livePhoto:
return .livePhoto
case .video:
return .video
case .videoMessage:
@ -316,8 +326,12 @@ public func mediaContentKind(_ media: EngineMedia, message: EngineMessage? = nil
case .videoMessage:
return .expiredVideoMessage
}
case .image:
return .image
case let .image(image):
if let _ = image.video {
return .livePhoto
} else {
return .image
}
case let .file(file):
var fileName: String = ""
@ -429,6 +443,9 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation
return (foldLineBreaks(text), false)
case .image:
return (NSAttributedString(string: strings.Message_Photo), true)
case .livePhoto:
//TODO:localize
return (NSAttributedString(string: "Live Photo"), true)
case .video:
return (NSAttributedString(string: strings.Message_Video), true)
case .videoMessage: