mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
+2
-2
@@ -26,10 +26,10 @@ class MatrixItemChooserRoomAncestorsDataSource: MatrixItemChooserDataSource {
|
||||
}
|
||||
|
||||
func sections(with session: MXSession, completion: @escaping (Result<[MatrixListItemSectionData], Error>) -> Void) {
|
||||
let ancestorsId = session.spaceService.ancestorsPerRoomId[roomId] ?? []
|
||||
let ancestorsIds = session.spaceService.ancestorsPerRoomId[roomId] ?? []
|
||||
completion(Result(catching: {
|
||||
return [
|
||||
MatrixListItemSectionData(title: VectorL10n.roomAccessSpaceChooserKnownSpacesSection(session.room(withRoomId: roomId)?.displayName ?? ""), infoText: nil, items: ancestorsId.compactMap { spaceId in
|
||||
MatrixListItemSectionData(title: VectorL10n.roomAccessSpaceChooserKnownSpacesSection(session.room(withRoomId: roomId)?.displayName ?? ""), infoText: nil, items: ancestorsIds.compactMap { spaceId in
|
||||
guard let space = session.spaceService.getSpace(withId: spaceId) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ class MatrixItemChooserRoomDirectParentsDataSource: MatrixItemChooserDataSource
|
||||
}
|
||||
|
||||
func sections(with session: MXSession, completion: @escaping (Result<[MatrixListItemSectionData], Error>) -> Void) {
|
||||
let ancestorsId = session.spaceService.directParentIds(ofRoomWithId: roomId)
|
||||
let ancestorsIds = session.spaceService.directParentIds(ofRoomWithId: roomId)
|
||||
|
||||
switch preselectionMode {
|
||||
case .none:
|
||||
@@ -45,7 +45,7 @@ class MatrixItemChooserRoomDirectParentsDataSource: MatrixItemChooserDataSource
|
||||
|
||||
completion(Result(catching: {
|
||||
return [
|
||||
MatrixListItemSectionData(title: VectorL10n.roomAccessSpaceChooserKnownSpacesSection(session.room(withRoomId: roomId)?.displayName ?? ""), infoText: nil, items: ancestorsId.compactMap { spaceId in
|
||||
MatrixListItemSectionData(title: VectorL10n.roomAccessSpaceChooserKnownSpacesSection(session.room(withRoomId: roomId)?.displayName ?? ""), infoText: nil, items: ancestorsIds.compactMap { spaceId in
|
||||
guard let space = session.spaceService.getSpace(withId: spaceId) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ class MatrixItemChooserRoomRestrictedAllowedParentsDataSource: MatrixItemChooser
|
||||
guard let self = self else { return }
|
||||
|
||||
let joinRuleEvent = state?.stateEvents(with: .roomJoinRules)?.last
|
||||
let allowContent: [[String:String]] = joinRuleEvent?.wireContent["allow"] as? [[String:String]] ?? []
|
||||
let allowContent: [[String: String]] = joinRuleEvent?.wireContent["allow"] as? [[String: String]] ?? []
|
||||
self.allowedParentIds = allowContent.compactMap { allowDictionnary in
|
||||
guard let type = allowDictionnary["type"], type == "m.room_membership" else {
|
||||
return nil
|
||||
|
||||
+6
-6
@@ -23,13 +23,13 @@ extension MatrixListItemData {
|
||||
}
|
||||
|
||||
init(mxRoom: MXRoom, spaceService: MXSpaceService) {
|
||||
let parentSapceIds = mxRoom.summary.parentSpaceIds ?? Set()
|
||||
let parentSpaceIds = mxRoom.summary.parentSpaceIds ?? Set()
|
||||
let detailText: String?
|
||||
if parentSapceIds.isEmpty {
|
||||
if parentSpaceIds.isEmpty {
|
||||
detailText = nil
|
||||
} else {
|
||||
if let spaceName = spaceService.getSpace(withId: parentSapceIds.first ?? "")?.summary?.displayname {
|
||||
let count = parentSapceIds.count - 1
|
||||
if let spaceName = spaceService.getSpace(withId: parentSpaceIds.first ?? "")?.summary?.displayname {
|
||||
let count = parentSpaceIds.count - 1
|
||||
switch count {
|
||||
case 0:
|
||||
detailText = VectorL10n.spacesCreationInSpacename(spaceName)
|
||||
@@ -39,8 +39,8 @@ extension MatrixListItemData {
|
||||
detailText = VectorL10n.spacesCreationInSpacenamePlusMany(spaceName, "\(count)")
|
||||
}
|
||||
} else {
|
||||
if parentSapceIds.count > 1 {
|
||||
detailText = VectorL10n.spacesCreationInManySpaces("\(parentSapceIds.count)")
|
||||
if parentSpaceIds.count > 1 {
|
||||
detailText = VectorL10n.spacesCreationInManySpaces("\(parentSpaceIds.count)")
|
||||
} else {
|
||||
detailText = VectorL10n.spacesCreationInOneSpace
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user