summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Containers/Root/RootConfiguration.swift
blob: 1158b4f34ad479222fb64a5cff4c08d716eb83c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
//  RootConfiguration.swift
//  MullvadVPN
//
//  Created by Jon Petersson on 2023-04-19.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import MullvadSettings

struct RootDeviceInfoViewModel {
    let configuration: RootConfiguration
    init(isPresentingAccountExpiryBanner: Bool, deviceState: DeviceState) {
        configuration = RootConfiguration(
            deviceName: deviceState.deviceData?.capitalizedName,
            expiry: (isPresentingAccountExpiryBanner || (deviceState.accountData?.isExpired ?? true))
                ? nil
                : deviceState.accountData?.expiry,
            showsAccountButton: deviceState.isLoggedIn
        )
    }
}

struct RootConfiguration {
    var deviceName: String?
    var expiry: Date?
    var showsAccountButton: Bool
}