Flescio/create room action (#925)

* fix invites users screen

* add create room action

* add a task runner with timeout, add fetch room summary after creation

* rename Runner, add Unit Test, separate UserProfile form client proxy

* change to all room summary publisher
This commit is contained in:
Flescio
2023-05-22 17:27:39 +02:00
committed by GitHub
parent 16728ca438
commit beb61d109f
25 changed files with 324 additions and 68 deletions
@@ -107,6 +107,7 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
private func openCreateRoomScreen() {
let createParameters = CreateRoomCoordinatorParameters(userSession: parameters.userSession,
userIndicatorController: parameters.userIndicatorController,
createRoomParameters: createRoomParametersPublisher,
selectedUsers: selectedUsersPublisher)
let coordinator = CreateRoomCoordinator(parameters: createParameters)
@@ -116,8 +117,8 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
self?.toggleUser(user)
case .updateDetails(let details):
self?.createRoomParameters.send(details)
case .createRoom:
break
case .openRoom(let identifier):
self?.actionsSubject.send(.openRoom(withIdentifier: identifier))
}
}
.store(in: &cancellables)
@@ -127,10 +127,11 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
}
private func createDirectRoom(with user: UserProfile) async {
defer {
hideLoadingIndicator()
}
showLoadingIndicator()
let result = await clientProxy.createDirectRoom(with: user.userID)
hideLoadingIndicator()
switch result {
switch await clientProxy.createDirectRoom(with: user.userID, expectedRoomName: user.displayName) {
case .success(let roomId):
actionsSubject.send(.openRoom(withIdentifier: roomId))
case .failure(let failure):