Fix invoice text in replies

This commit is contained in:
Ali 2021-04-10 12:38:16 +04:00
parent 251133d3f4
commit aabafc617f

View File

@ -24,6 +24,7 @@ public enum MessageContentKindKey {
case poll case poll
case restricted case restricted
case dice case dice
case invoice
} }
public enum MessageContentKind: Equatable { public enum MessageContentKind: Equatable {
@ -44,6 +45,7 @@ public enum MessageContentKind: Equatable {
case poll(String) case poll(String)
case restricted(String) case restricted(String)
case dice(String) case dice(String)
case invoice(String)
public var key: MessageContentKindKey { public var key: MessageContentKindKey {
switch self { switch self {
@ -81,6 +83,8 @@ public enum MessageContentKind: Equatable {
return .restricted return .restricted
case .dice: case .dice:
return .dice return .dice
case .invoice:
return .invoice
} }
} }
} }
@ -171,6 +175,8 @@ public func mediaContentKind(_ media: Media, message: Message? = nil, strings: P
return .poll(poll.text) return .poll(poll.text)
case let dice as TelegramMediaDice: case let dice as TelegramMediaDice:
return .dice(dice.emoji) return .dice(dice.emoji)
case let invoice as TelegramMediaInvoice:
return .invoice(invoice.title)
default: default:
return nil return nil
} }
@ -220,6 +226,8 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation
return (text, false) return (text, false)
case let .dice(emoji): case let .dice(emoji):
return (emoji, true) return (emoji, true)
case let .invoice(text):
return (text, true)
} }
} }