Merge branch 'develop' into alfogrillo/learn_more_sheet

# Conflicts:
#	RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift
#	RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Coordinator/UserOtherSessionsCoordinator.swift
#	RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/UI/UserOtherSessionsUITests.swift
#	RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsModels.swift
#	RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsViewModel.swift
#	RiotSwiftUI/Modules/UserSessions/UserOtherSessions/View/UserOtherSessions.swift
#	RiotSwiftUI/Modules/UserSessions/UserSessionOverview/Test/UI/UserSessionOverviewUITests.swift
This commit is contained in:
Alfonso Grillo
2022-11-03 09:20:58 +01:00
95 changed files with 858 additions and 363 deletions
@@ -36,7 +36,8 @@ class UserOtherSessionsViewModel: UserOtherSessionsViewModelType, UserOtherSessi
sessionItems: sessionItems,
header: filter.userOtherSessionsViewHeader,
emptyItemsTitle: filter.userOtherSessionsViewEmptyResultsTitle,
allItemsSelected: false))
allItemsSelected: false,
enableSignOutButton: false))
}
// MARK: - Public
@@ -61,6 +62,14 @@ class UserOtherSessionsViewModel: UserOtherSessionsViewModelType, UserOtherSessi
case .toggleAllSelection:
toggleAllSelection()
updateViewState()
case .logoutAllUserSessions:
let filteredSessions = state.bindings.filter.filterSessionsInfos(sessionInfos)
completion?(.logoutFromUserSessions(sessionInfos: filteredSessions))
case .logoutSelectedUserSessions:
let selectedSessionInfos = sessionInfos.filter { sessionInfo in
selectedSessions.contains(sessionInfo.id)
}
completion?(.logoutFromUserSessions(sessionInfos: selectedSessionInfos))
case .viewSessionInfo:
completion?(.showSessionStateInfo(filter: state.bindings.filter))
}
@@ -99,6 +108,8 @@ class UserOtherSessionsViewModel: UserOtherSessionsViewModelType, UserOtherSessi
state.emptyItemsTitle = currentFilter.userOtherSessionsViewEmptyResultsTitle
state.allItemsSelected = sessionInfos.count == selectedSessions.count
state.enableSignOutButton = selectedSessions.count > 0
}
private func toggleAllSelection() {
@@ -164,7 +175,6 @@ private extension UserOtherSessionsFilter {
filterSessionsInfos(sessionInfos)
.map {
UserSessionListItemViewDataFactory().create(from: $0,
highlightSessionDetails: self == .unverified && $0.isCurrent,
isSelected: selectedSessions.contains($0.id))
}
}