mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Space Settings: Leave Room (#4700)
* Implementation for all navigations inside the space settings aside the left space action # Conflicts: # ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift * refactored the leave space view to use its own view model # Conflicts: # ElementX.xcodeproj/project.pbxproj * implemented the leave space view model also in the settings screen, and corrected some tests * reusing the details coordinator for the space settings screen * leave space from settings implemented * fix project * minor pr fixes * code improvements
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
class LeaveSpaceHandleProxy: Identifiable {
|
||||
final class LeaveSpaceHandleProxy {
|
||||
let id: String
|
||||
var rooms: [LeaveSpaceRoomDetails]
|
||||
|
||||
@@ -51,6 +51,25 @@ class LeaveSpaceHandleProxy: Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
func deselectAll() {
|
||||
for room in rooms {
|
||||
room.isSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
func selectAll() {
|
||||
for room in rooms where !room.isLastAdmin {
|
||||
room.isSelected = true
|
||||
}
|
||||
}
|
||||
|
||||
func toggleRoom(roomID: String) {
|
||||
guard let room = rooms.first(where: { $0.spaceRoomProxy.id == roomID }) else {
|
||||
return
|
||||
}
|
||||
room.isSelected.toggle()
|
||||
}
|
||||
|
||||
func leave() async -> Result<Void, SpaceServiceProxyError> {
|
||||
let selectedRoomIDs = rooms.filter(\.isSelected).map(\.spaceRoomProxy.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user