4850 bring leaving space experience in line with web (#6062)

* Bring leaving space experience in line with Web #4850

- Done
This commit is contained in:
Gil Eluard
2022-04-27 13:31:14 +02:00
committed by GitHub
parent 2b5989bc9b
commit 987eb7d5c0
23 changed files with 537 additions and 60 deletions
@@ -39,6 +39,13 @@ class MockMatrixItemChooserService: MatrixItemChooserServiceProtocol {
var loadingText: String? {
nil
}
var itemCount: Int {
var itemCount = 0
for section in sectionsSubject.value {
itemCount += section.items.count
}
return itemCount
}
init(type: MatrixItemChooserType = .room, sections: [MatrixListItemSectionData] = mockSections, selectedItemIndexPaths: [IndexPath] = []) {
sectionsSubject = CurrentValueSubject(sections)
@@ -79,4 +86,20 @@ class MockMatrixItemChooserService: MatrixItemChooserServiceProtocol {
func refresh() {
}
func selectAllItems() {
var newSelection: Set<String> = Set()
for section in sectionsSubject.value {
for item in section.items {
newSelection.insert(item.id)
}
}
self.selectedItemIds = newSelection
selectedItemIdsSubject.send(selectedItemIds)
}
func deselectAllItems() {
self.selectedItemIds = Set()
selectedItemIdsSubject.send(selectedItemIds)
}
}