mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
implemented a way to update the desired setting after pressing done, and added tests
This commit is contained in:
+11
-4
@@ -252,12 +252,19 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType,
|
||||
private func displayManageAuthorizedSpacesScreen() {
|
||||
let joinedParentSpaces = state.joinedParentSpaces
|
||||
let unknownSpaceIDs = state.currentSettings.accessType.spaceIDs.filter { id in
|
||||
!joinedParentSpaces.contains(where: { $0.id == id })
|
||||
!joinedParentSpaces.contains { $0.id == id }
|
||||
}
|
||||
let selectedIDs = Set(state.bindings.desiredSettings.accessType.spaceIDs)
|
||||
actionsSubject.send(.displayManageAuthorizedSpacesScreen(.init(joinedParentSpaces: joinedParentSpaces,
|
||||
unknownSpacesIDs: unknownSpaceIDs,
|
||||
selectedIDs: selectedIDs)))
|
||||
let authorizedSpacesSelection = AuthorizedSpacesSelection(joinedParentSpaces: joinedParentSpaces,
|
||||
unknownSpacesIDs: unknownSpaceIDs,
|
||||
currentSelectedIDs: selectedIDs)
|
||||
authorizedSpacesSelection.desiredSelectIDs
|
||||
.sink { [weak self] desiredSelectedIDs in
|
||||
self?.state.bindings.desiredSettings.accessType = .spaceUsers(spaceIDs: desiredSelectedIDs.sorted())
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
actionsSubject.send(.displayManageAuthorizedSpacesScreen(authorizedSpacesSelection))
|
||||
}
|
||||
|
||||
private static let loadingIndicatorIdentifier = "\(EditRoomAddressScreenViewModel.self)-Loading"
|
||||
|
||||
Reference in New Issue
Block a user