2022-09-30 13:34:41 +00:00
|
|
|
//
|
|
|
|
// Copyright 2021 New Vector Ltd
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
// MARK: - Coordinator
|
2022-10-07 09:58:26 +00:00
|
|
|
|
2022-10-04 06:38:53 +00:00
|
|
|
enum UserOtherSessionsCoordinatorResult {
|
2022-10-14 06:21:17 +00:00
|
|
|
case openSessionOverview(sessionInfo: UserSessionInfo)
|
2022-10-31 12:44:03 +00:00
|
|
|
case logoutFromUserSessions(sessionInfos: [UserSessionInfo])
|
2022-10-04 06:38:53 +00:00
|
|
|
}
|
2022-09-30 13:34:41 +00:00
|
|
|
|
|
|
|
// MARK: View model
|
|
|
|
|
2022-10-04 13:58:08 +00:00
|
|
|
enum UserOtherSessionsViewModelResult: Equatable {
|
2022-10-04 12:14:59 +00:00
|
|
|
case showUserSessionOverview(sessionInfo: UserSessionInfo)
|
2022-10-31 12:44:03 +00:00
|
|
|
case logoutFromUserSessions(sessionInfos: [UserSessionInfo])
|
2022-09-30 13:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: View
|
|
|
|
|
2022-10-04 13:58:08 +00:00
|
|
|
struct UserOtherSessionsViewState: BindableState, Equatable {
|
2022-10-11 05:42:28 +00:00
|
|
|
var bindings: UserOtherSessionsBindings
|
2022-10-20 12:35:46 +00:00
|
|
|
var title: String
|
2022-10-25 06:17:58 +00:00
|
|
|
var sessionItems: [UserSessionListItemViewData]
|
2022-10-20 09:07:55 +00:00
|
|
|
var header: UserOtherSessionsHeaderViewData
|
2022-10-20 12:35:46 +00:00
|
|
|
var emptyItemsTitle: String
|
2022-10-21 08:48:16 +00:00
|
|
|
var allItemsSelected: Bool
|
2022-10-26 13:07:01 +00:00
|
|
|
var enableSignOutButton: Bool
|
2022-11-02 16:59:50 +00:00
|
|
|
var showLocationInfo: Bool = RiotSettings.shared.showIPAddressesInSessionsManager
|
2022-09-30 13:34:41 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 05:42:28 +00:00
|
|
|
struct UserOtherSessionsBindings: Equatable {
|
2022-10-12 06:30:41 +00:00
|
|
|
var filter: UserOtherSessionsFilter
|
2022-10-19 14:02:48 +00:00
|
|
|
var isEditModeEnabled: Bool
|
2022-09-30 13:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum UserOtherSessionsViewAction {
|
2022-10-04 06:38:53 +00:00
|
|
|
case userOtherSessionSelected(sessionId: String)
|
2022-10-12 10:11:43 +00:00
|
|
|
case filterWasChanged
|
2022-10-11 11:54:09 +00:00
|
|
|
case clearFilter
|
2022-10-19 14:02:48 +00:00
|
|
|
case editModeWasToggled
|
2022-10-21 08:48:16 +00:00
|
|
|
case toggleAllSelection
|
2022-10-31 12:36:14 +00:00
|
|
|
case logoutAllUserSessions
|
|
|
|
case logoutSelectedUserSessions
|
2022-11-02 16:59:50 +00:00
|
|
|
case showLocationInfo
|
2022-09-30 13:34:41 +00:00
|
|
|
}
|