2022-09-27 07:17:22 +00:00
|
|
|
//
|
2022-09-05 08:41:35 +00:00
|
|
|
// Copyright 2022 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
|
|
|
|
|
|
|
|
/// Represents a user session information
|
|
|
|
struct UserSessionInfo: Identifiable {
|
|
|
|
/// The session identifier
|
2022-09-27 13:51:13 +00:00
|
|
|
let id: String
|
2022-09-05 08:41:35 +00:00
|
|
|
|
|
|
|
/// The session display name
|
2022-09-27 13:51:13 +00:00
|
|
|
let name: String?
|
2022-09-05 08:41:35 +00:00
|
|
|
|
|
|
|
/// The device type used by the session
|
|
|
|
let deviceType: DeviceType
|
|
|
|
|
|
|
|
/// True to indicate that the session is verified
|
|
|
|
let isVerified: Bool
|
|
|
|
|
|
|
|
/// The IP address where this device was last seen.
|
|
|
|
let lastSeenIP: String?
|
|
|
|
|
|
|
|
/// Last time the session was active
|
|
|
|
let lastSeenTimestamp: TimeInterval?
|
2022-09-29 12:07:10 +00:00
|
|
|
|
|
|
|
// MARK: - Application Properties
|
|
|
|
|
|
|
|
/// Application name used by the session
|
|
|
|
let applicationName: String?
|
|
|
|
|
|
|
|
/// Application version used by the session
|
|
|
|
let applicationVersion: String?
|
|
|
|
|
|
|
|
/// Application URL used by the session. Only applicable for web sessions.
|
|
|
|
let applicationURL: String?
|
|
|
|
|
|
|
|
// MARK: - Device Properties
|
|
|
|
|
|
|
|
/// Device model
|
|
|
|
let deviceModel: String?
|
|
|
|
|
|
|
|
/// Device OS
|
|
|
|
let deviceOS: String?
|
|
|
|
|
|
|
|
/// Last seen IP location
|
|
|
|
let lastSeenIPLocation: String?
|
|
|
|
|
|
|
|
/// Device name
|
|
|
|
let deviceName: String?
|
|
|
|
|
2022-09-05 08:41:35 +00:00
|
|
|
/// True to indicate that session has been used under `inactiveSessionDurationTreshold` value
|
2022-09-27 13:51:13 +00:00
|
|
|
let isActive: Bool
|
2022-09-29 12:07:10 +00:00
|
|
|
|
2022-09-27 12:36:44 +00:00
|
|
|
/// True to indicate that this is current user session
|
2022-09-27 13:51:13 +00:00
|
|
|
let isCurrent: Bool
|
2022-09-05 08:41:35 +00:00
|
|
|
}
|
2022-09-27 11:51:15 +00:00
|
|
|
|
|
|
|
extension UserSessionInfo: Equatable {
|
|
|
|
static func == (lhs: UserSessionInfo, rhs: UserSessionInfo) -> Bool {
|
2022-09-29 12:07:10 +00:00
|
|
|
lhs.id == rhs.id
|
2022-09-27 11:51:15 +00:00
|
|
|
}
|
|
|
|
}
|