mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Send html in plain text mode (#2246)
This commit is contained in:
+2
-2
@@ -65,14 +65,14 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
func processItemDisappearance(_ itemID: TimelineItemIdentifier) async { }
|
||||
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
inReplyTo itemID: TimelineItemIdentifier?,
|
||||
intentionalMentions: IntentionalMentions) async { }
|
||||
|
||||
func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async { }
|
||||
|
||||
func editMessage(_ newMessage: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
original itemID: TimelineItemIdentifier,
|
||||
intentionalMentions: IntentionalMentions) async { }
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
func processItemDisappearance(_ itemID: TimelineItemIdentifier) { }
|
||||
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
inReplyTo itemID: TimelineItemIdentifier?,
|
||||
intentionalMentions: IntentionalMentions) async {
|
||||
var inReplyTo: String?
|
||||
@@ -148,7 +148,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
|
||||
func editMessage(_ newMessage: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
original itemID: TimelineItemIdentifier,
|
||||
intentionalMentions: IntentionalMentions) async {
|
||||
MXLog.info("Edit message in \(roomID)")
|
||||
|
||||
+3
-3
@@ -50,12 +50,12 @@ protocol RoomTimelineControllerProtocol {
|
||||
func sendReadReceipt(for itemID: TimelineItemIdentifier) async -> Result<Void, RoomTimelineControllerError>
|
||||
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
inReplyTo itemID: TimelineItemIdentifier?,
|
||||
intentionalMentions: IntentionalMentions) async
|
||||
|
||||
func editMessage(_ newMessage: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
original itemID: TimelineItemIdentifier,
|
||||
intentionalMentions: IntentionalMentions) async
|
||||
|
||||
@@ -74,7 +74,7 @@ protocol RoomTimelineControllerProtocol {
|
||||
|
||||
extension RoomTimelineControllerProtocol {
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
intentionalMentions: IntentionalMentions) async {
|
||||
await sendMessage(message,
|
||||
html: html,
|
||||
|
||||
@@ -93,7 +93,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
}
|
||||
|
||||
func editMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
original eventID: String,
|
||||
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError> {
|
||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||
@@ -320,7 +320,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
}
|
||||
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
inReplyTo eventID: String? = nil,
|
||||
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError> {
|
||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||
@@ -454,7 +454,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
// MARK: - Private
|
||||
|
||||
private func buildMessageContentFor(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
intentionalMentions: Mentions) -> RoomMessageEventContentWithoutRelation {
|
||||
let emoteSlashCommand = "/me "
|
||||
let isEmote: Bool = message.starts(with: emoteSlashCommand)
|
||||
@@ -462,18 +462,10 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
let content: RoomMessageEventContentWithoutRelation
|
||||
if isEmote {
|
||||
let emoteMessage = String(message.dropFirst(emoteSlashCommand.count))
|
||||
|
||||
var emoteHtml: String?
|
||||
if let html {
|
||||
emoteHtml = String(html.dropFirst(emoteSlashCommand.count))
|
||||
}
|
||||
let emoteHtml = String(html.dropFirst(emoteSlashCommand.count))
|
||||
content = buildEmoteMessageContentFor(emoteMessage, html: emoteHtml)
|
||||
} else {
|
||||
if let html {
|
||||
content = messageEventContentFromHtml(body: message, htmlBody: html)
|
||||
} else {
|
||||
content = messageEventContentFromMarkdown(md: message)
|
||||
}
|
||||
content = messageEventContentFromHtml(body: message, htmlBody: html)
|
||||
}
|
||||
return content.withMentions(mentions: intentionalMentions)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ protocol TimelineProxyProtocol {
|
||||
func cancelSend(transactionID: String) async
|
||||
|
||||
func editMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
original eventID: String,
|
||||
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
@@ -103,7 +103,7 @@ protocol TimelineProxyProtocol {
|
||||
func sendMessageEventContent(_ messageContent: RoomMessageEventContentWithoutRelation) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
inReplyTo eventID: String?,
|
||||
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
@@ -124,7 +124,7 @@ protocol TimelineProxyProtocol {
|
||||
|
||||
extension TimelineProxyProtocol {
|
||||
func sendMessage(_ message: String,
|
||||
html: String?,
|
||||
html: String,
|
||||
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError> {
|
||||
await sendMessage(message,
|
||||
html: html,
|
||||
|
||||
Reference in New Issue
Block a user