58 lines
1.3 KiB
Swift
58 lines
1.3 KiB
Swift
//
|
|
// MenuItem.swift
|
|
// PrivadoVPN
|
|
//
|
|
// Created by Juraldinio on 7/1/21.
|
|
// Copyright © 2021 Privado LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
enum MenuItem: CaseIterable {
|
|
|
|
case preferences
|
|
case undock
|
|
case contactUs
|
|
case logout
|
|
|
|
var image: String? {
|
|
switch self {
|
|
case .preferences: return nil
|
|
case .undock: return "application.pin"
|
|
case .contactUs: return nil
|
|
case .logout: return nil
|
|
}
|
|
}
|
|
|
|
var title: String {
|
|
let identity: String
|
|
switch self {
|
|
case .preferences: identity = "header.menu.preferences"
|
|
case .undock: identity = UserSettings.shared.isDocked ? "header.menu.undock" : "header.menu.dock"
|
|
case .contactUs: identity = "header.menu.contactus"
|
|
case .logout: identity = "header.menu.logout"
|
|
}
|
|
return NSLocalizedString(identity, comment: "")
|
|
}
|
|
|
|
var tag: Int {
|
|
switch self {
|
|
case .preferences: return 0
|
|
case .undock: return 1
|
|
case .contactUs: return 2
|
|
case .logout: return 3
|
|
|
|
}
|
|
}
|
|
|
|
static func item(by tag: Int) -> MenuItem? {
|
|
switch tag {
|
|
case 0: return .preferences
|
|
case 1: return .undock
|
|
case 2: return .contactUs
|
|
case 3: return .logout
|
|
default: return nil
|
|
}
|
|
}
|
|
}
|