mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Further attach menu refinements
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public struct MessageMediaEditingOptions: OptionSet {
|
||||
public var rawValue: Int32
|
||||
|
||||
public init(rawValue: Int32) {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
public static let imageOrVideo = MessageMediaEditingOptions(rawValue: 1 << 0)
|
||||
public static let file = MessageMediaEditingOptions(rawValue: 1 << 1)
|
||||
}
|
||||
|
||||
public enum ChatEditInterfaceMessageStateContent: Equatable {
|
||||
case plaintext
|
||||
case media(mediaOptions: MessageMediaEditingOptions)
|
||||
}
|
||||
|
||||
public final class ChatEditInterfaceMessageState: Equatable {
|
||||
public let content: ChatEditInterfaceMessageStateContent
|
||||
public let mediaReference: AnyMediaReference?
|
||||
|
||||
public init(content: ChatEditInterfaceMessageStateContent, mediaReference: AnyMediaReference?) {
|
||||
self.content = content
|
||||
self.mediaReference = mediaReference
|
||||
}
|
||||
|
||||
public static func ==(lhs: ChatEditInterfaceMessageState, rhs: ChatEditInterfaceMessageState) -> Bool {
|
||||
if lhs.content != rhs.content {
|
||||
return false
|
||||
}
|
||||
if let lhsMedia = lhs.mediaReference, let rhsMedia = rhs.mediaReference {
|
||||
if !lhsMedia.media.isEqual(to: rhsMedia.media) {
|
||||
return false
|
||||
}
|
||||
} else if (lhs.mediaReference != nil) != (rhs.mediaReference != nil) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user