Return provider guidance string dynamically
Drop annoying switch/case.
This commit is contained in:
parent
a5cdd136e6
commit
8318821a80
|
@ -185,8 +185,9 @@ extension MFMailComposeViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: load from index JSON
|
|
||||||
extension Infrastructure.Metadata {
|
extension Infrastructure.Metadata {
|
||||||
|
|
||||||
|
// FIXME: load from index JSON
|
||||||
var logo: UIImage? {
|
var logo: UIImage? {
|
||||||
let bundle = Bundle(for: AppDelegate.self)
|
let bundle = Bundle(for: AppDelegate.self)
|
||||||
guard let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil) else {
|
guard let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil) else {
|
||||||
|
@ -194,6 +195,15 @@ extension Infrastructure.Metadata {
|
||||||
}
|
}
|
||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var guidanceString: String? {
|
||||||
|
let key = "account.sections.guidance.footer.infrastructure.\(name)"
|
||||||
|
let format = NSLocalizedString(key, tableName: "Core", bundle: Bundle(for: AppDelegate.self), comment: "")
|
||||||
|
guard !format.isEmpty else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return String(format: format, locale: .current, description)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PoolGroup {
|
extension PoolGroup {
|
||||||
|
|
|
@ -61,33 +61,7 @@ class AccountViewController: UIViewController, StrongTableHost {
|
||||||
guard let name = infrastructureName, let metadata = InfrastructureFactory.shared.metadata(forName: name) else {
|
guard let name = infrastructureName, let metadata = InfrastructureFactory.shared.metadata(forName: name) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// XXX: should make this dynamic
|
return metadata.guidanceString
|
||||||
let V = L10n.Core.Account.Sections.Guidance.Footer.Infrastructure.self
|
|
||||||
switch metadata.name {
|
|
||||||
case .mullvad:
|
|
||||||
return V.mullvad(metadata.description)
|
|
||||||
|
|
||||||
case .nordvpn:
|
|
||||||
return V.nordvpn(metadata.description)
|
|
||||||
|
|
||||||
case .pia:
|
|
||||||
return V.pia(metadata.description)
|
|
||||||
|
|
||||||
case .protonvpn:
|
|
||||||
return V.protonvpn(metadata.description)
|
|
||||||
|
|
||||||
case .tunnelbear:
|
|
||||||
return V.tunnelbear(metadata.description)
|
|
||||||
|
|
||||||
case .vyprvpn:
|
|
||||||
return V.vyprvpn(metadata.description)
|
|
||||||
|
|
||||||
case .windscribe:
|
|
||||||
return V.windscribe(metadata.description)
|
|
||||||
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var guidanceURL: String? {
|
private var guidanceURL: String? {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f3cf90e8276d51860c33b2faef49718ef1e5b269
|
Subproject commit 479132676b5de9c746f369338d53f32e769cf794
|
Loading…
Reference in New Issue