Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new space selector bottom sheet #1541

Merged
merged 18 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e9b8a74
Delight: Edit layout experiment #6079
gileluard May 10, 2022
f697363
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard May 10, 2022
c3dd30a
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard May 19, 2022
173a7c3
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard May 20, 2022
41ad8c7
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard Jul 6, 2022
4a24ed8
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard Jul 12, 2022
db47bdc
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard Jul 25, 2022
aa5baf7
Update All chats screen with latest design #6407
gileluard Jul 25, 2022
ab2a633
Update All chats screen with latest design #6407
gileluard Jul 25, 2022
106e82c
Implement the new Space selector bottom sheet #6410
gileluard Jul 27, 2022
54d4ccb
Merge branch 'develop' into gil/6079-Delight_Edit_layout_experiment
gileluard Jul 27, 2022
febfbd0
Merge branch 'gil/6079-Delight_Edit_layout_experiment' into gil/6410-…
gileluard Jul 27, 2022
9c80cbb
Update All chats screen with latest design #6407
gileluard Aug 1, 2022
4fae95a
Update All chats screen with latest design #6407
gileluard Aug 1, 2022
d0b36c8
Update All chats screen with latest design #6407
gileluard Aug 1, 2022
eb0b598
Merge branch 'gil/6079-Delight_Edit_layout_experiment' into gil/6410-…
gileluard Aug 1, 2022
a35d8dd
Merge branch 'develop' into gil/6410-Implement_new_Space_selector_bot…
gileluard Aug 2, 2022
e9d64cd
Implement the new Space selector bottom sheet #6410
gileluard Aug 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion MatrixSDK/Space/MXSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,22 @@ public class MXSpace: NSObject {
return
}
let userPowerLevel = powerLevels.powerLevelOfUser(withUserID: userId)
let minimumPowerLevel = powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault
let minimumPowerLevel = self.minimumPowerLevelForAddingRoom(with: powerLevels)
let canAddRoom = userPowerLevel >= minimumPowerLevel

completion(canAddRoom)
}
}

/// Returns the mimnimum power level required to add a room to this space
/// - Parameters:
/// - powerLevels: power levels of the room related to the space
///
/// - Returns: the mimnimum power level required to add a room to this space
public func minimumPowerLevelForAddingRoom(with powerLevels: MXRoomPowerLevels) -> Int {
return powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault
}

// MARK: - Private

private func updateChildRooms(from space: MXSpace, with directRoomsPerMember: [String : [String]]) {
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Space/MXSpaceNotificationCounter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class MXSpaceNotificationCounter: NSObject {
room.roomId
}

let spaceIds: [String] = self.session.spaceService.rootSpaceSummaries.compactMap { summary in
let spaceIds: [String] = self.session.spaceService.spaceSummaries.compactMap { summary in
summary.roomId
}

Expand Down
7 changes: 7 additions & 0 deletions MatrixSDK/Space/MXSpaceService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ public class MXSpaceService: NSObject {
/// The instance of `MXSpaceNotificationCounter` that computes the number of unread messages for each space
public let notificationCounter: MXSpaceNotificationCounter

/// List of `MXSpace` instances of the high level spaces.
public var rootSpaces: [MXSpace] {
return self.graph.rootSpaceIds.compactMap { spaceId in
self.getSpace(withId: spaceId)
}
}

/// List of `MXRoomSummary` of the high level spaces.
public var rootSpaceSummaries: [MXRoomSummary] {
return self.graph.rootSpaceIds.compactMap { spaceId in
Expand Down
1 change: 1 addition & 0 deletions changelog.d/6410.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
App Layout: added MXSpace.minimumPowerLevelForAddingRoom() and MXSpaceService.rootSpaces