mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
reused the room details view model for the space settings screen
This commit is contained in:
@@ -169,6 +169,11 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
// MARK: - Private
|
||||
|
||||
private func processTapToLeave() {
|
||||
guard !roomProxy.infoPublisher.value.isSpace else {
|
||||
Task { await processLeaveSpace() }
|
||||
return
|
||||
}
|
||||
|
||||
guard state.joinedMembersCount > 1 else {
|
||||
state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomID: roomProxy.id,
|
||||
isDM: roomProxy.isDirectOneToOneRoom,
|
||||
@@ -202,6 +207,16 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
state: roomProxy.infoPublisher.value.isPrivate ?? true ? .private : .public)
|
||||
}
|
||||
|
||||
private func processLeaveSpace() async {
|
||||
switch await userSession.clientProxy.spaceService.leaveSpace(spaceID: roomProxy.id) {
|
||||
case .success:
|
||||
// TODO: Handle leave space
|
||||
break
|
||||
case .failure(let failure):
|
||||
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
||||
}
|
||||
}
|
||||
|
||||
private func setupRoomSubscription() {
|
||||
roomProxy.infoPublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
||||
Reference in New Issue
Block a user