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:
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ import NetworkExtension
|
|||
|
||||
protocol ConnectionProfile: class, EndpointDataSource {
|
||||
var id: String { get }
|
||||
|
||||
var title: String { get }
|
||||
|
||||
var username: String? { get set }
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue