Infer profile id uniqueness by context

Drop "(provider|host)." prefix, reuse as title.
This commit is contained in:
Davide De Rosa 2018-10-25 23:08:43 +02:00
parent 8f29f79168
commit 8e1b67d151
5 changed files with 7 additions and 12 deletions

View File

@ -313,7 +313,7 @@ extension OrganizerViewController {
case .profile:
let cell = Cells.setting.dequeue(from: tableView, for: 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
return cell

View File

@ -37,7 +37,7 @@ class ServiceViewController: UIViewController, TableModelHost {
var profile: ConnectionProfile? {
didSet {
title = profile?.title
title = profile?.id
reloadModel()
updateViewsIfNeeded()
}
@ -78,7 +78,7 @@ class ServiceViewController: UIViewController, TableModelHost {
lastInfrastructureUpdate = InfrastructureFactory.shared.modificationDate(for: providerProfile.name)
}
title = profile?.title
title = profile?.id
navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
navigationItem.leftItemsSupplementBackButton = true

View File

@ -29,8 +29,6 @@ import NetworkExtension
protocol ConnectionProfile: class, EndpointDataSource {
var id: String { get }
var title: String { get }
var username: String? { get set }

View File

@ -27,6 +27,8 @@ import Foundation
import TunnelKit
class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
var title: String
let hostname: String
var parameters: TunnelKitProvider.Configuration
@ -41,10 +43,8 @@ class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
// MARK: ConnectionProfile
var id: String {
return "host.\(title)"
return title
}
var title: String
var username: String?

View File

@ -66,7 +66,6 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
poolId = ""
presetId = ""
id = "provider.\(name.rawValue)"
username = nil
poolId = infrastructure.defaults.pool
@ -93,9 +92,7 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
// MARK: ConnectionProfile
let id: String
var title: String {
var id: String {
return name.rawValue
}