mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
[WIP] Quotes
This commit is contained in:
@@ -517,30 +517,50 @@ public enum ChatControllerSubject: Equatable {
|
||||
case id(EngineMessage.Id)
|
||||
case timestamp(Int32)
|
||||
}
|
||||
|
||||
public struct ReplyOptions: Equatable {
|
||||
public var hasQuote: Bool
|
||||
|
||||
public init(hasQuote: Bool) {
|
||||
self.hasQuote = hasQuote
|
||||
}
|
||||
}
|
||||
|
||||
public struct ForwardOptions: Equatable {
|
||||
public var hideNames: Bool
|
||||
public var hideCaptions: Bool
|
||||
|
||||
public var replyOptions: ReplyOptions?
|
||||
|
||||
public init(hideNames: Bool, hideCaptions: Bool, replyOptions: ReplyOptions?) {
|
||||
public init(hideNames: Bool, hideCaptions: Bool) {
|
||||
self.hideNames = hideNames
|
||||
self.hideCaptions = hideCaptions
|
||||
self.replyOptions = replyOptions
|
||||
}
|
||||
}
|
||||
|
||||
public struct MessageOptionsInfo: Equatable {
|
||||
public struct ReplyQuote: Equatable {
|
||||
public struct LinkOptions: Equatable {
|
||||
public var messageText: String
|
||||
public var messageEntities: [MessageTextEntity]
|
||||
public var replyMessageId: EngineMessage.Id?
|
||||
public var replyQuote: String?
|
||||
public var url: String
|
||||
public var webpage: TelegramMediaWebpage
|
||||
public var linkBelowText: Bool
|
||||
public var largeMedia: Bool
|
||||
|
||||
public init(
|
||||
messageText: String,
|
||||
messageEntities: [MessageTextEntity],
|
||||
replyMessageId: EngineMessage.Id?,
|
||||
replyQuote: String?,
|
||||
url: String,
|
||||
webpage: TelegramMediaWebpage,
|
||||
linkBelowText: Bool,
|
||||
largeMedia: Bool
|
||||
) {
|
||||
self.messageText = messageText
|
||||
self.messageEntities = messageEntities
|
||||
self.replyMessageId = replyMessageId
|
||||
self.replyQuote = replyQuote
|
||||
self.url = url
|
||||
self.webpage = webpage
|
||||
self.linkBelowText = linkBelowText
|
||||
self.largeMedia = largeMedia
|
||||
}
|
||||
}
|
||||
|
||||
public enum MessageOptionsInfo: Equatable {
|
||||
public struct Quote: Equatable {
|
||||
public let messageId: EngineMessage.Id
|
||||
public let text: String
|
||||
|
||||
@@ -550,16 +570,61 @@ public enum ChatControllerSubject: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public enum Kind: Equatable {
|
||||
case forward
|
||||
case reply(initialQuote: ReplyQuote?)
|
||||
public struct SelectionState: Equatable {
|
||||
public var quote: Quote?
|
||||
|
||||
public init(quote: Quote?) {
|
||||
self.quote = quote
|
||||
}
|
||||
}
|
||||
|
||||
public let kind: Kind
|
||||
|
||||
public init(kind: Kind) {
|
||||
self.kind = kind
|
||||
public struct Reply: Equatable {
|
||||
public var quote: Quote?
|
||||
public var selectionState: Promise<SelectionState>
|
||||
|
||||
public init(quote: Quote?, selectionState: Promise<SelectionState>) {
|
||||
self.quote = quote
|
||||
self.selectionState = selectionState
|
||||
}
|
||||
|
||||
public static func ==(lhs: Reply, rhs: Reply) -> Bool {
|
||||
if lhs.quote != rhs.quote {
|
||||
return false
|
||||
}
|
||||
if lhs.selectionState !== rhs.selectionState {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public struct Forward: Equatable {
|
||||
public var options: Signal<ForwardOptions, NoError>
|
||||
|
||||
public init(options: Signal<ForwardOptions, NoError>) {
|
||||
self.options = options
|
||||
}
|
||||
|
||||
public static func ==(lhs: Forward, rhs: Forward) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public struct Link: Equatable {
|
||||
public var options: Signal<LinkOptions, NoError>
|
||||
|
||||
public init(options: Signal<LinkOptions, NoError>) {
|
||||
self.options = options
|
||||
}
|
||||
|
||||
public static func ==(lhs: Link, rhs: Link) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
case reply(Reply)
|
||||
case forward(Forward)
|
||||
case link(Link)
|
||||
}
|
||||
|
||||
public struct MessageHighlight: Equatable {
|
||||
@@ -573,7 +638,7 @@ public enum ChatControllerSubject: Equatable {
|
||||
case message(id: MessageSubject, highlight: MessageHighlight?, timecode: Double?)
|
||||
case scheduledMessages
|
||||
case pinnedMessages(id: EngineMessage.Id?)
|
||||
case messageOptions(peerIds: [EnginePeer.Id], ids: [EngineMessage.Id], info: MessageOptionsInfo, options: Signal<ForwardOptions, NoError>)
|
||||
case messageOptions(peerIds: [EnginePeer.Id], ids: [EngineMessage.Id], info: MessageOptionsInfo)
|
||||
|
||||
public static func ==(lhs: ChatControllerSubject, rhs: ChatControllerSubject) -> Bool {
|
||||
switch lhs {
|
||||
@@ -595,8 +660,8 @@ public enum ChatControllerSubject: Equatable {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .messageOptions(lhsPeerIds, lhsIds, lhsInfo, _):
|
||||
if case let .messageOptions(rhsPeerIds, rhsIds, rhsInfo, _) = rhs, lhsPeerIds == rhsPeerIds, lhsIds == rhsIds, lhsInfo == rhsInfo {
|
||||
case let .messageOptions(lhsPeerIds, lhsIds, lhsInfo):
|
||||
if case let .messageOptions(rhsPeerIds, rhsIds, rhsInfo) = rhs, lhsPeerIds == rhsPeerIds, lhsIds == rhsIds, lhsInfo == rhsInfo {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user