mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-27 19:56:57 +02:00
Enable user mentions in Rich Text Editor
This commit is contained in:
@@ -18,6 +18,7 @@ import Combine
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
import WysiwygComposer
|
||||
|
||||
protocol UserSuggestionCoordinatorDelegate: AnyObject {
|
||||
func userSuggestionCoordinator(_ coordinator: UserSuggestionCoordinator, didRequestMentionForMember member: MXRoomMember, textTrigger: String?)
|
||||
@@ -92,6 +93,10 @@ final class UserSuggestionCoordinator: Coordinator, Presentable {
|
||||
userSuggestionService.processTextMessage(textMessage)
|
||||
}
|
||||
|
||||
func processSuggestionPattern(_ suggestionPattern: SuggestionPattern?) {
|
||||
userSuggestionService.processSuggestionPattern(suggestionPattern)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() { }
|
||||
|
||||
+4
@@ -44,6 +44,10 @@ final class UserSuggestionCoordinatorBridge: NSObject {
|
||||
func processTextMessage(_ textMessage: String) {
|
||||
userSuggestionCoordinator.processTextMessage(textMessage)
|
||||
}
|
||||
|
||||
func processSuggestionPattern(_ suggestionPatternWrapper: SuggestionPatternWrapper) {
|
||||
userSuggestionCoordinator.processSuggestionPattern(suggestionPatternWrapper.suggestionPattern)
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController? {
|
||||
userSuggestionCoordinator.toPresentable()
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import WysiwygComposer
|
||||
|
||||
struct RoomMembersProviderMember {
|
||||
var userId: String
|
||||
@@ -85,6 +86,16 @@ class UserSuggestionService: UserSuggestionServiceProtocol {
|
||||
|
||||
currentTextTriggerSubject.send(lastComponent)
|
||||
}
|
||||
|
||||
func processSuggestionPattern(_ suggestionPattern: SuggestionPattern?) {
|
||||
guard let suggestionPattern, suggestionPattern.key == .at else {
|
||||
items.send([])
|
||||
currentTextTriggerSubject.send(nil)
|
||||
return
|
||||
}
|
||||
|
||||
currentTextTriggerSubject.send("@" + suggestionPattern.text)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import WysiwygComposer
|
||||
|
||||
protocol UserSuggestionItemProtocol: Avatarable {
|
||||
var userId: String { get }
|
||||
@@ -29,6 +30,7 @@ protocol UserSuggestionServiceProtocol {
|
||||
var currentTextTrigger: String? { get }
|
||||
|
||||
func processTextMessage(_ textMessage: String?)
|
||||
func processSuggestionPattern(_ suggestionPattern: SuggestionPattern?)
|
||||
}
|
||||
|
||||
// MARK: Avatarable
|
||||
|
||||
Reference in New Issue
Block a user