mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various improvements
This commit is contained in:
parent
e11c9899e6
commit
67f45ba06d
17 changed files with 189 additions and 114 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue