mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-17 22:19:08 +00:00
Show AreaID (Area + Num) in pool selector
Rename localizedCountryArea to localizedId.
This commit is contained in:
parent
0cb0874332
commit
8fd5a74dc4
@ -78,7 +78,7 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.imageView?.image = pool.logo
|
||||
cell.leftText = pool.localizedName
|
||||
cell.rightText = pool.area?.uppercased()
|
||||
cell.rightText = pool.areaId?.uppercased()
|
||||
cell.applyChecked(pool.id == currentPoolId, Theme.current)
|
||||
cell.isTappable = true
|
||||
return cell
|
||||
|
@ -673,7 +673,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
||||
case .providerPool:
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.leftText = L10n.Service.Cells.Provider.Pool.caption
|
||||
cell.rightText = uncheckedProviderProfile.pool?.localizedCountryArea
|
||||
cell.rightText = uncheckedProviderProfile.pool?.localizedId
|
||||
return cell
|
||||
|
||||
case .providerPreset:
|
||||
|
@ -57,6 +57,20 @@ public struct Pool: Codable, Comparable, CustomStringConvertible {
|
||||
|
||||
public let num: String?
|
||||
|
||||
public var areaId: String? {
|
||||
let id: String
|
||||
if let area = area, let num = num {
|
||||
id = "\(area) #\(num)"
|
||||
} else if let area = area {
|
||||
id = area
|
||||
} else if let num = num {
|
||||
id = "#\(num)"
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return id.uppercased()
|
||||
}
|
||||
|
||||
public let isFree: Bool?
|
||||
|
||||
// public let location: (Double, Double)
|
||||
@ -82,7 +96,7 @@ public struct Pool: Codable, Comparable, CustomStringConvertible {
|
||||
// MARK: Comparable
|
||||
|
||||
public static func <(lhs: Pool, rhs: Pool) -> Bool {
|
||||
return lhs.localizedCountryArea < rhs.localizedCountryArea
|
||||
return lhs.localizedId < rhs.localizedId
|
||||
}
|
||||
|
||||
// MARK: CustomStringConvertible
|
||||
@ -99,7 +113,7 @@ extension Pool {
|
||||
return Utils.localizedCountry(country)
|
||||
}
|
||||
|
||||
public var localizedCountryArea: String {
|
||||
public var localizedId: String {
|
||||
let countryString = localizedCountry
|
||||
let zone: String
|
||||
if let area = area, let num = num {
|
||||
|
Loading…
Reference in New Issue
Block a user