mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Add space management to the flows. (#4978)
* Add the menu entries to add/remove rooms to/from a space. * Add a user indicator to SpaceAddRoomsScreen. * Reset the SpaceRoomListProxy after adding/removing any children. * Calm the animations down a bit when entering EditMode on the SpaceScreen.
This commit is contained in:
+29
-1
@@ -128,15 +128,43 @@ class SpaceAddRoomsScreenViewModel: SpaceAddRoomsScreenViewModelType, SpaceAddRo
|
||||
}
|
||||
|
||||
private func save() async {
|
||||
showSavingIndicator()
|
||||
defer { hideSavingIndicator() }
|
||||
|
||||
for room in state.selectedRooms {
|
||||
if case .failure(let error) = await spaceServiceProxy.addChild(room.id, to: spaceRoomListProxy.id) {
|
||||
MXLog.error("Failed adding room to space: \(error)")
|
||||
userIndicatorController.submitIndicator(UserIndicator(title: L10n.errorUnknown))
|
||||
showErrorIndicator()
|
||||
updateRooms() // Hide any rooms that were already added.
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
await spaceRoomListProxy.resetAndWaitForFullReload(timeout: .seconds(10))
|
||||
|
||||
actionsSubject.send(.dismiss)
|
||||
}
|
||||
|
||||
// MARK: User Indicators
|
||||
|
||||
private var savingIndicatorID: String { "\(Self.self)-Saving" }
|
||||
private var failureIndicatorID: String { "\(Self.self)-Failure" }
|
||||
|
||||
private func showSavingIndicator() {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: savingIndicatorID,
|
||||
type: .modal(progress: .indeterminate, interactiveDismissDisabled: true, allowsInteraction: false),
|
||||
title: L10n.commonSaving,
|
||||
persistent: true))
|
||||
}
|
||||
|
||||
private func hideSavingIndicator() {
|
||||
userIndicatorController.retractIndicatorWithId(savingIndicatorID)
|
||||
}
|
||||
|
||||
private func showErrorIndicator() {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: failureIndicatorID,
|
||||
type: .toast,
|
||||
title: L10n.errorUnknown,
|
||||
iconName: "xmark"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user