mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Merge branch 'gil/SP1_space_creation' into gil/5231_SP3-1_Update_room_settings_for_Spaces
# Conflicts: # Podfile.lock
This commit is contained in:
@@ -70,8 +70,8 @@ class ThreadViewController: RoomViewController {
|
||||
super.onButtonPressed(sender)
|
||||
}
|
||||
|
||||
override func handleTypingNotification(_ typing: Bool) {
|
||||
// no-op
|
||||
override func sendTypingNotification(_ typing: Bool, timeout notificationTimeoutMS: UInt) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
private func showThreadActions() {
|
||||
|
||||
@@ -65,11 +65,11 @@ extension ThreadListCoordinator: ThreadListViewModelCoordinatorDelegate {
|
||||
self.delegate?.threadListCoordinatorDidLoadThreads(self)
|
||||
}
|
||||
|
||||
func threadListViewModelDidSelectThread(_ viewModel: ThreadListViewModelProtocol, thread: MXThread) {
|
||||
func threadListViewModelDidSelectThread(_ viewModel: ThreadListViewModelProtocol, thread: MXThreadProtocol) {
|
||||
self.delegate?.threadListCoordinatorDidSelectThread(self, thread: thread)
|
||||
}
|
||||
|
||||
func threadListViewModelDidSelectThreadViewInRoom(_ viewModel: ThreadListViewModelProtocol, thread: MXThread) {
|
||||
func threadListViewModelDidSelectThreadViewInRoom(_ viewModel: ThreadListViewModelProtocol, thread: MXThreadProtocol) {
|
||||
self.delegate?.threadListCoordinatorDidSelectRoom(self, roomId: thread.roomId, eventId: thread.id)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import Foundation
|
||||
|
||||
protocol ThreadListCoordinatorDelegate: AnyObject {
|
||||
func threadListCoordinatorDidLoadThreads(_ coordinator: ThreadListCoordinatorProtocol)
|
||||
func threadListCoordinatorDidSelectThread(_ coordinator: ThreadListCoordinatorProtocol, thread: MXThread)
|
||||
func threadListCoordinatorDidSelectThread(_ coordinator: ThreadListCoordinatorProtocol, thread: MXThreadProtocol)
|
||||
func threadListCoordinatorDidSelectRoom(_ coordinator: ThreadListCoordinatorProtocol, roomId: String, eventId: String)
|
||||
func threadListCoordinatorDidCancel(_ coordinator: ThreadListCoordinatorProtocol)
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
|
||||
private let session: MXSession
|
||||
private let roomId: String
|
||||
private var threads: [MXThread] = []
|
||||
private var threads: [MXThreadProtocol] = []
|
||||
private var eventFormatter: MXKEventFormatter?
|
||||
private var roomState: MXRoomState?
|
||||
|
||||
private var currentOperation: MXHTTPOperation?
|
||||
private var longPressedThread: MXThread?
|
||||
private var longPressedThread: MXThreadProtocol?
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -144,7 +144,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func model(forThread thread: MXThread) -> ThreadModel {
|
||||
private func model(forThread thread: MXThreadProtocol) -> ThreadModel {
|
||||
let rootAvatarViewData: AvatarViewData?
|
||||
let rootMessageSender: MXUser?
|
||||
let lastAvatarViewData: AvatarViewData?
|
||||
@@ -199,7 +199,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
notificationStatus: notificationStatus)
|
||||
}
|
||||
|
||||
private func rootMessageText(forThread thread: MXThread) -> NSAttributedString? {
|
||||
private func rootMessageText(forThread thread: MXThreadProtocol) -> NSAttributedString? {
|
||||
guard let eventFormatter = eventFormatter else {
|
||||
return nil
|
||||
}
|
||||
@@ -229,7 +229,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
error: formatterError)
|
||||
}
|
||||
|
||||
private func lastMessageTextAndTime(forThread thread: MXThread) -> (NSAttributedString?, String?) {
|
||||
private func lastMessageTextAndTime(forThread thread: MXThreadProtocol) -> (NSAttributedString?, String?) {
|
||||
guard let eventFormatter = eventFormatter else {
|
||||
return (nil, nil)
|
||||
}
|
||||
@@ -250,23 +250,36 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
if showLoading {
|
||||
viewState = .loading
|
||||
}
|
||||
|
||||
let onlyParticipated: Bool
|
||||
|
||||
switch selectedFilterType {
|
||||
case .all:
|
||||
threads = session.threadingService.threads(inRoom: roomId)
|
||||
onlyParticipated = false
|
||||
case .myThreads:
|
||||
threads = session.threadingService.participatedThreads(inRoom: roomId)
|
||||
onlyParticipated = true
|
||||
}
|
||||
|
||||
session.threadingService.allThreads(inRoom: roomId,
|
||||
onlyParticipated: onlyParticipated) { [weak self] response in
|
||||
guard let self = self else { return }
|
||||
switch response {
|
||||
case .success(let threads):
|
||||
self.threads = threads
|
||||
self.threadsLoaded()
|
||||
case .failure(let error):
|
||||
MXLog.error("[ThreadListViewModel] loadData: error: \(error)")
|
||||
self.viewState = .error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func threadsLoaded() {
|
||||
if threads.isEmpty {
|
||||
viewState = .empty(emptyViewModel)
|
||||
return
|
||||
}
|
||||
|
||||
threadsLoaded()
|
||||
}
|
||||
|
||||
private func threadsLoaded() {
|
||||
|
||||
guard let eventFormatter = session.roomSummaryUpdateDelegate as? MXKEventFormatter,
|
||||
let room = session.room(withRoomId: roomId) else {
|
||||
// go into loaded state
|
||||
@@ -323,7 +336,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
|
||||
|
||||
private func actionShare() {
|
||||
guard let thread = longPressedThread,
|
||||
let index = threads.firstIndex(of: thread) else {
|
||||
let index = threads.firstIndex(where: { thread.id == $0.id }) else {
|
||||
return
|
||||
}
|
||||
if let permalink = MXTools.permalink(toEvent: thread.id, inRoom: thread.roomId),
|
||||
|
||||
@@ -24,8 +24,8 @@ protocol ThreadListViewModelViewDelegate: AnyObject {
|
||||
|
||||
protocol ThreadListViewModelCoordinatorDelegate: AnyObject {
|
||||
func threadListViewModelDidLoadThreads(_ viewModel: ThreadListViewModelProtocol)
|
||||
func threadListViewModelDidSelectThread(_ viewModel: ThreadListViewModelProtocol, thread: MXThread)
|
||||
func threadListViewModelDidSelectThreadViewInRoom(_ viewModel: ThreadListViewModelProtocol, thread: MXThread)
|
||||
func threadListViewModelDidSelectThread(_ viewModel: ThreadListViewModelProtocol, thread: MXThreadProtocol)
|
||||
func threadListViewModelDidSelectThreadViewInRoom(_ viewModel: ThreadListViewModelProtocol, thread: MXThreadProtocol)
|
||||
func threadListViewModelDidCancel(_ viewModel: ThreadListViewModelProtocol)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ enum ThreadNotificationStatus {
|
||||
case notified
|
||||
case highlighted
|
||||
|
||||
init(withThread thread: MXThread) {
|
||||
init(withThread thread: MXThreadProtocol) {
|
||||
if thread.highlightCount > 0 {
|
||||
self = .highlighted
|
||||
} else if thread.isParticipated && thread.notificationCount > 0 {
|
||||
|
||||
@@ -155,7 +155,7 @@ extension ThreadsCoordinator: ThreadListCoordinatorDelegate {
|
||||
|
||||
}
|
||||
|
||||
func threadListCoordinatorDidSelectThread(_ coordinator: ThreadListCoordinatorProtocol, thread: MXThread) {
|
||||
func threadListCoordinatorDidSelectThread(_ coordinator: ThreadListCoordinatorProtocol, thread: MXThreadProtocol) {
|
||||
let roomCoordinator = createThreadCoordinator(forThreadId: thread.id)
|
||||
selectedThreadCoordinator = roomCoordinator
|
||||
roomCoordinator.start()
|
||||
|
||||
@@ -28,7 +28,8 @@ import Foundation
|
||||
|
||||
/// ThreadsCoordinatorBridgePresenter enables to start ThreadsCoordinator from a view controller.
|
||||
/// This bridge is used while waiting for global usage of coordinator pattern.
|
||||
/// **WARNING**: This class breaks the Coordinator abstraction and it has been introduced for **Objective-C compatibility only** (mainly for integration in legacy view controllers). Each bridge should be removed once the underlying Coordinator has been integrated by another Coordinator.
|
||||
/// **WARNING**: This class breaks the Coordinator abstraction and it has been introduced for **Objective-C compatibility only** (mainly for integration in legacy view controllers). Each bridge should be removed
|
||||
/// once the underlying Coordinator has been integrated by another Coordinator.
|
||||
@objcMembers
|
||||
final class ThreadsCoordinatorBridgePresenter: NSObject {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user