mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-17 22:19:08 +00:00
Infer profile id uniqueness by context
Drop "(provider|host)." prefix, reuse as title.
This commit is contained in:
parent
8f29f79168
commit
8e1b67d151
@ -313,7 +313,7 @@ extension OrganizerViewController {
|
|||||||
case .profile:
|
case .profile:
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
let rowProfile = profile(at: indexPath)
|
let rowProfile = profile(at: indexPath)
|
||||||
cell.leftText = rowProfile.title
|
cell.leftText = rowProfile.id
|
||||||
cell.rightText = service.isActiveProfile(rowProfile) ? L10n.Organizer.Cells.Profile.Value.current : nil
|
cell.rightText = service.isActiveProfile(rowProfile) ? L10n.Organizer.Cells.Profile.Value.current : nil
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class ServiceViewController: UIViewController, TableModelHost {
|
|||||||
|
|
||||||
var profile: ConnectionProfile? {
|
var profile: ConnectionProfile? {
|
||||||
didSet {
|
didSet {
|
||||||
title = profile?.title
|
title = profile?.id
|
||||||
reloadModel()
|
reloadModel()
|
||||||
updateViewsIfNeeded()
|
updateViewsIfNeeded()
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ class ServiceViewController: UIViewController, TableModelHost {
|
|||||||
lastInfrastructureUpdate = InfrastructureFactory.shared.modificationDate(for: providerProfile.name)
|
lastInfrastructureUpdate = InfrastructureFactory.shared.modificationDate(for: providerProfile.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
title = profile?.title
|
title = profile?.id
|
||||||
navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
|
navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
|
||||||
navigationItem.leftItemsSupplementBackButton = true
|
navigationItem.leftItemsSupplementBackButton = true
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ import NetworkExtension
|
|||||||
|
|
||||||
protocol ConnectionProfile: class, EndpointDataSource {
|
protocol ConnectionProfile: class, EndpointDataSource {
|
||||||
var id: String { get }
|
var id: String { get }
|
||||||
|
|
||||||
var title: String { get }
|
|
||||||
|
|
||||||
var username: String? { get set }
|
var username: String? { get set }
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ import Foundation
|
|||||||
import TunnelKit
|
import TunnelKit
|
||||||
|
|
||||||
class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
|
class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
|
var title: String
|
||||||
|
|
||||||
let hostname: String
|
let hostname: String
|
||||||
|
|
||||||
var parameters: TunnelKitProvider.Configuration
|
var parameters: TunnelKitProvider.Configuration
|
||||||
@ -41,10 +43,8 @@ class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||||||
// MARK: ConnectionProfile
|
// MARK: ConnectionProfile
|
||||||
|
|
||||||
var id: String {
|
var id: String {
|
||||||
return "host.\(title)"
|
return title
|
||||||
}
|
}
|
||||||
|
|
||||||
var title: String
|
|
||||||
|
|
||||||
var username: String?
|
var username: String?
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||||||
poolId = ""
|
poolId = ""
|
||||||
presetId = ""
|
presetId = ""
|
||||||
|
|
||||||
id = "provider.\(name.rawValue)"
|
|
||||||
username = nil
|
username = nil
|
||||||
|
|
||||||
poolId = infrastructure.defaults.pool
|
poolId = infrastructure.defaults.pool
|
||||||
@ -93,9 +92,7 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||||||
|
|
||||||
// MARK: ConnectionProfile
|
// MARK: ConnectionProfile
|
||||||
|
|
||||||
let id: String
|
var id: String {
|
||||||
|
|
||||||
var title: String {
|
|
||||||
return name.rawValue
|
return name.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user