mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
updated existing preview tests and added a test for the single space cases
fixed a bug where was not possible to re-select the space members option with unknown spaces. pr suggestions
This commit is contained in:
+2
-10
@@ -7,7 +7,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
enum SecurityAndPrivacyScreenViewModelAction {
|
||||
case displayEditAddressScreen
|
||||
@@ -39,14 +38,11 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
|
||||
var canEditHistoryVisibility = false
|
||||
var joinedParentSpaces: [SpaceRoomProxyProtocol] = []
|
||||
|
||||
/// The count of the intersection between the set of joined parent spaces and the set of spaces in the current access type
|
||||
var selectableSpacesCount: Int {
|
||||
Set(joinedParentSpaces.map(\.id) + currentSettings.accessType.spaceIDs).count
|
||||
}
|
||||
|
||||
private var desiredJoinedParentSpaces: [SpaceRoomProxyProtocol] {
|
||||
joinedParentSpaces.filter { bindings.desiredSettings.accessType.spaceIDs.contains($0.id) }
|
||||
}
|
||||
|
||||
private var hasChanges: Bool {
|
||||
currentSettings != bindings.desiredSettings
|
||||
}
|
||||
@@ -111,13 +107,9 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
|
||||
var spaceSelection: SpaceSelection {
|
||||
if selectableSpacesCount > 1 {
|
||||
.multiple
|
||||
} else if let desiredJoinedParent = desiredJoinedParentSpaces.first {
|
||||
// The parent space is joined by the user and is also currently selected
|
||||
.singleJoined(desiredJoinedParent)
|
||||
} else if let joinedParent = joinedParentSpaces.first {
|
||||
// The parent space is joined by the user but is not currently selected
|
||||
.singleJoined(joinedParent)
|
||||
} else if let unknownSpaceID = bindings.desiredSettings.accessType.spaceIDs.first {
|
||||
} else if let unknownSpaceID = currentSettings.accessType.spaceIDs.first {
|
||||
// The space is not joined by the user but is currently selected
|
||||
.singleUnknown(id: unknownSpaceID)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user