Create space flow (#4957)
* create space flow implementation # Conflicts: # ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift * create space flow fully implemented and working * updated tests and updated the create room camera button UI * updated the avatar button in the create room screen, and added power level overrides for spaces * update power level content overrides to behave just as EW, and removed ask to join when creating a space regardless of the FF * updated UI tests snapshots * invite for a public space should always be forced to 50 * pr suggestions + PL override fix * fix a missed code change
This commit is contained in:
@@ -67,7 +67,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
ban: nil,
|
||||
kick: nil,
|
||||
redact: nil,
|
||||
invite: nil,
|
||||
invite: Int32(0),
|
||||
notifications: nil,
|
||||
users: [:],
|
||||
events: [
|
||||
@@ -91,6 +91,32 @@ class ClientProxy: ClientProxyProtocol {
|
||||
"org.matrix.msc3401.call.member": Int32(0)
|
||||
])
|
||||
}
|
||||
|
||||
private static var standardSpaceCreationPowerLevelOverrides: PowerLevels {
|
||||
.init(usersDefault: nil,
|
||||
eventsDefault: Int32(100),
|
||||
stateDefault: nil,
|
||||
ban: nil,
|
||||
kick: nil,
|
||||
redact: nil,
|
||||
invite: Int32(50),
|
||||
notifications: nil,
|
||||
users: [:],
|
||||
events: [:])
|
||||
}
|
||||
|
||||
private static var publicSpaceCreationPowerLevelOverrides: PowerLevels {
|
||||
.init(usersDefault: nil,
|
||||
eventsDefault: Int32(100),
|
||||
stateDefault: nil,
|
||||
ban: nil,
|
||||
kick: nil,
|
||||
redact: nil,
|
||||
invite: Int32(0),
|
||||
notifications: nil,
|
||||
users: [:],
|
||||
events: [:])
|
||||
}
|
||||
|
||||
private var loadCachedAvatarURLTask: Task<Void, Never>?
|
||||
private let userAvatarURLSubject = CurrentValueSubject<URL?, Never>(nil)
|
||||
@@ -480,6 +506,20 @@ class ClientProxy: ClientProxyProtocol {
|
||||
avatarURL: URL?,
|
||||
aliasLocalPart: String?) async -> Result<String, ClientProxyError> {
|
||||
do {
|
||||
let powerLevelContentOverride = if isSpace {
|
||||
if accessType == .public {
|
||||
Self.publicSpaceCreationPowerLevelOverrides
|
||||
} else {
|
||||
Self.standardSpaceCreationPowerLevelOverrides
|
||||
}
|
||||
} else {
|
||||
if accessType == .askToJoin {
|
||||
Self.knockingRoomCreationPowerLevelOverrides
|
||||
} else {
|
||||
Self.roomCreationPowerLevelOverrides
|
||||
}
|
||||
}
|
||||
|
||||
let parameters = CreateRoomParameters(name: name,
|
||||
topic: topic,
|
||||
isEncrypted: accessType.isEncrypted,
|
||||
@@ -488,7 +528,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
preset: accessType.preset,
|
||||
invite: userIDs,
|
||||
avatar: avatarURL?.absoluteString,
|
||||
powerLevelContentOverride: accessType == .askToJoin ? Self.knockingRoomCreationPowerLevelOverrides : Self.roomCreationPowerLevelOverrides,
|
||||
powerLevelContentOverride: powerLevelContentOverride,
|
||||
joinRuleOverride: accessType.joinRuleOverride,
|
||||
historyVisibilityOverride: accessType.historyVisibilityOverride,
|
||||
// This is an FFI naming mistake, what is required is the `aliasLocalPart` not the whole alias
|
||||
|
||||
Reference in New Issue
Block a user