mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
More Moderation tweaks (#2566)
* Show room member role changes in the timeline. * Fix a bug in room flow coordinator. * Tidy up roles and permissions flow. * Refresh the power levels in the room details screen. * Automatically update permissions after saving. * Remove extra button. * Add a short delay to the roles and permissions screen snapshots. The permissions rows are now in a loading state initially.
This commit is contained in:
+3
-3
@@ -27,7 +27,7 @@ struct RoomChangePermissionsScreenCoordinatorParameters {
|
||||
}
|
||||
|
||||
enum RoomChangePermissionsScreenCoordinatorAction {
|
||||
case cancel
|
||||
case complete
|
||||
}
|
||||
|
||||
final class RoomChangePermissionsScreenCoordinator: CoordinatorProtocol {
|
||||
@@ -55,8 +55,8 @@ final class RoomChangePermissionsScreenCoordinator: CoordinatorProtocol {
|
||||
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .cancel:
|
||||
actionsSubject.send(.cancel)
|
||||
case .complete:
|
||||
actionsSubject.send(.complete)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
enum RoomChangePermissionsScreenViewModelAction {
|
||||
case cancel
|
||||
case complete
|
||||
}
|
||||
|
||||
struct RoomChangePermissionsScreenViewState: BindableState {
|
||||
|
||||
+3
-10
@@ -21,8 +21,8 @@ import SwiftUI
|
||||
typealias RoomChangePermissionsScreenViewModelType = StateStoreViewModel<RoomChangePermissionsScreenViewState, RoomChangePermissionsScreenViewAction>
|
||||
|
||||
class RoomChangePermissionsScreenViewModel: RoomChangePermissionsScreenViewModelType, RoomChangePermissionsScreenViewModelProtocol {
|
||||
let roomProxy: RoomProxyProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private var actionsSubject: PassthroughSubject<RoomChangePermissionsScreenViewModelAction, Never> = .init()
|
||||
|
||||
var actionsPublisher: AnyPublisher<RoomChangePermissionsScreenViewModelAction, Never> {
|
||||
@@ -71,14 +71,7 @@ class RoomChangePermissionsScreenViewModel: RoomChangePermissionsScreenViewModel
|
||||
switch await roomProxy.applyPowerLevelChanges(changes) {
|
||||
case .success:
|
||||
MXLog.info("Success")
|
||||
case .failure:
|
||||
context.alertInfo = AlertInfo(id: .generic)
|
||||
return
|
||||
}
|
||||
|
||||
switch await roomProxy.powerLevels() {
|
||||
case .success(let powerLevels):
|
||||
state.currentPermissions = .init(powerLevels: powerLevels)
|
||||
actionsSubject.send(.complete)
|
||||
case .failure:
|
||||
context.alertInfo = AlertInfo(id: .generic)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user