Use wrappers for profile metadata
Contextually fix provider appearance in Siri shortcuts. Was using name (lowercase) rather than description (fancy).
This commit is contained in:
parent
7a0b3b8e52
commit
c7b2ff56b5
|
@ -208,7 +208,7 @@ class ProductManager: NSObject {
|
|||
|
||||
log.debug("Checking 'Unlimited hosts'")
|
||||
if !isEligible(forFeature: .unlimitedHosts) {
|
||||
let ids = service.ids(forContext: .host)
|
||||
let ids = service.currentHostNames()
|
||||
if ids.count > AppConstants.InApp.limitedNumberOfHosts {
|
||||
for id in ids {
|
||||
service.removeProfile(ProfileKey(.host, id))
|
||||
|
@ -246,7 +246,7 @@ class ProductManager: NSObject {
|
|||
|
||||
extension ConnectionService {
|
||||
var hasReachedMaximumNumberOfHosts: Bool {
|
||||
let numberOfHosts = ids(forContext: .host).count
|
||||
let numberOfHosts = currentHostNames().count
|
||||
return numberOfHosts >= AppConstants.InApp.limitedNumberOfHosts
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
|
||||
//
|
||||
|
||||
providers = service.ids(forContext: .provider).sorted()
|
||||
hosts = service.ids(forContext: .host).sortedCaseInsensitive()
|
||||
providers = service.currentProviderNames().sorted()
|
||||
hosts = service.currentHostNames().sortedCaseInsensitive()
|
||||
|
||||
var providerRows = [RowType](repeating: .profile, count: providers.count)
|
||||
var hostRows = [RowType](repeating: .profile, count: hosts.count)
|
||||
|
|
|
@ -35,7 +35,7 @@ class WizardHostViewController: UITableViewController, StrongTableHost {
|
|||
@IBOutlet private weak var itemNext: UIBarButtonItem!
|
||||
|
||||
private let existingHosts: [String] = {
|
||||
return TransientStore.shared.service.ids(forContext: .host).sortedCaseInsensitive()
|
||||
return TransientStore.shared.service.currentHostNames().sortedCaseInsensitive()
|
||||
}()
|
||||
|
||||
var parsingResult: OpenVPN.ConfigurationParser.Result? {
|
||||
|
|
|
@ -33,7 +33,7 @@ import Convenience
|
|||
class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewControllerDelegate, StrongTableHost {
|
||||
private let service = TransientStore.shared.service
|
||||
|
||||
private var providers: [String] = []
|
||||
private var providers: [Infrastructure.Metadata] = []
|
||||
|
||||
private var hosts: [String] = []
|
||||
|
||||
|
@ -51,8 +51,8 @@ class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewC
|
|||
}()
|
||||
|
||||
func reloadModel() {
|
||||
providers = service.ids(forContext: .provider).sorted()
|
||||
hosts = service.ids(forContext: .host).sortedCaseInsensitive()
|
||||
providers = service.currentProviderMetadata().sorted()
|
||||
hosts = service.currentHostNames().sortedCaseInsensitive()
|
||||
|
||||
if !providers.isEmpty {
|
||||
model.add(.providers)
|
||||
|
@ -124,7 +124,7 @@ class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewC
|
|||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
switch model.row(at: indexPath) {
|
||||
case .providerShortcut:
|
||||
cell.leftText = providers[indexPath.row]
|
||||
cell.leftText = providers[indexPath.row].description
|
||||
|
||||
case .hostShortcut:
|
||||
cell.leftText = hosts[indexPath.row]
|
||||
|
@ -135,7 +135,7 @@ class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewC
|
|||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
switch model.row(at: indexPath) {
|
||||
case .providerShortcut:
|
||||
selectedProfile = service.profile(withContext: .provider, id: providers[indexPath.row])
|
||||
selectedProfile = service.profile(withContext: .provider, id: providers[indexPath.row].name)
|
||||
pickProviderLocation()
|
||||
|
||||
case .hostShortcut:
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bec079519b8095222644e9ba795e9b4d3bed7149
|
||||
Subproject commit 149e95d9727e504c96b3e6ec0d822c195782299a
|
Loading…
Reference in New Issue