mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Make the RoomInfo isPrivate field optional and handle it accordingly.
This commit is contained in:
committed by
Stefan Ceriu
parent
11c7d07e76
commit
bfd97cd560
@@ -79,12 +79,18 @@ extension BaseRoomInfoProxyProtocol {
|
||||
|
||||
extension RoomInfoProxyProtocol {
|
||||
/// A room might be non public but also not private given the fact that the join rule might be missing or unsupported.
|
||||
var isPrivate: Bool {
|
||||
switch joinRule {
|
||||
case .invite, .knock, .restricted, .knockRestricted:
|
||||
var isPrivate: Bool? {
|
||||
guard let joinRule else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return switch joinRule {
|
||||
case .invite, .knock, .restricted, .knockRestricted, .private:
|
||||
true
|
||||
default:
|
||||
case .public:
|
||||
false
|
||||
case .custom: // We don't know how to handle this
|
||||
nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ struct RoomPowerLevelsProxy: RoomPowerLevelsProxyProtocol {
|
||||
}
|
||||
|
||||
func suggestedRole(forUser userID: String) -> RoomMemberRole {
|
||||
let powerLevel = powerLevels.userPowerLevels()[userID] ?? 0
|
||||
let powerLevel = powerLevels.userPowerLevels()[userID] ?? values.usersDefault
|
||||
return suggestedRoleForPowerLevel(powerLevel: powerLevel)
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ extension JoinedRoomProxyProtocol {
|
||||
avatar: infoPublisher.value.avatar,
|
||||
canonicalAlias: infoPublisher.value.canonicalAlias,
|
||||
isEncrypted: infoPublisher.value.isEncrypted,
|
||||
isPublic: !infoPublisher.value.isPrivate,
|
||||
isPublic: !(infoPublisher.value.isPrivate ?? false),
|
||||
isDirect: infoPublisher.value.isDirect)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user