Add provider referrals
This commit is contained in:
parent
3ddfa87b58
commit
0b7bd41636
|
@ -48,12 +48,25 @@ class AccountViewController: UIViewController, TableModelHost {
|
|||
model.removeFooter(for: .credentials)
|
||||
return
|
||||
}
|
||||
let V = L10n.Account.SuggestionFooter.Infrastructure.self
|
||||
|
||||
let V = L10n.Account.SuggestionFooter.self
|
||||
|
||||
var guidance: String?
|
||||
switch name {
|
||||
case .pia:
|
||||
model.setFooter(V.pia, for: .credentials)
|
||||
guidance = V.Infrastructure.pia
|
||||
}
|
||||
|
||||
if guidance != nil {
|
||||
let footer: String
|
||||
if let _ = referralURL {
|
||||
footer = "\(guidance!)\n\n\(V.referral)"
|
||||
} else {
|
||||
footer = guidance!
|
||||
}
|
||||
model.setFooter(footer, for: .credentials)
|
||||
tableView?.reloadData()
|
||||
}
|
||||
tableView?.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +75,13 @@ class AccountViewController: UIViewController, TableModelHost {
|
|||
let password = cellPassword?.field.text ?? ""
|
||||
return Credentials(username, password).trimmed()
|
||||
}
|
||||
|
||||
private var referralURL: String? {
|
||||
guard let name = infrastructureName else {
|
||||
return nil
|
||||
}
|
||||
return AppConstants.URLs.referrals[name]
|
||||
}
|
||||
|
||||
weak var delegate: AccountViewControllerDelegate?
|
||||
|
||||
|
@ -116,6 +136,10 @@ class AccountViewController: UIViewController, TableModelHost {
|
|||
}
|
||||
|
||||
@objc private func footerTapped() {
|
||||
guard let url = referralURL else {
|
||||
return
|
||||
}
|
||||
UIApplication.shared.open(URL(string: url)!, options: [:], completionHandler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
"organizer.alerts.add_host.message" = "Open an URL to an .ovpn configuration file from Safari, Mail or another app to set up a host profile.\n\nYou can also import an .ovpn with iTunes File Sharing.";
|
||||
"organizer.alerts.delete_vpn_profile.message" = "Do you really want to erase the VPN configuration from your device settings? This may fix some broken VPN states and will not affect your network and host profiles.";
|
||||
|
||||
"account.suggestion_footer.infrastructure.pia" = "Use your website credentials. Your username is usually numeric with a \"p\" prefix.";
|
||||
|
||||
"wizards.host.cells.title_input.caption" = "Title";
|
||||
"wizards.host.sections.existing.header" = "Existing profiles";
|
||||
"wizards.host.alerts.existing.message" = "A host profile with the same title already exists. Replace it?";
|
||||
|
@ -124,6 +122,8 @@
|
|||
"account.cells.password.placeholder" = "secret";
|
||||
//"account.cells.password_confirm.caption" = "Confirm";
|
||||
//"account.cells.password_confirm.mismatch" = "Passwords don't match!";
|
||||
"account.suggestion_footer.infrastructure.pia" = "Use your website credentials. Your username is usually numeric with a \"p\" prefix.";
|
||||
"account.suggestion_footer.referral" = "Don't have an account? Tap here to get one.";
|
||||
|
||||
"endpoint.sections.location_addresses.header" = "Addresses";
|
||||
"endpoint.sections.location_protocols.header" = "Protocols";
|
||||
|
|
|
@ -151,6 +151,10 @@ class AppConstants {
|
|||
static func review(withId id: String) -> URL {
|
||||
return URL(string: "https://itunes.apple.com/app/id\(id)?action=write-review")!
|
||||
}
|
||||
|
||||
static let referrals: [Infrastructure.Name: String] = [
|
||||
.pia: "https://www.privateinternetaccess.com/pages/buy-vpn/"
|
||||
]
|
||||
}
|
||||
|
||||
class Repos {
|
||||
|
|
|
@ -81,6 +81,8 @@ internal enum L10n {
|
|||
}
|
||||
}
|
||||
internal enum SuggestionFooter {
|
||||
/// Don't have an account? Tap here to get one.
|
||||
internal static let referral = L10n.tr("Localizable", "account.suggestion_footer.referral")
|
||||
internal enum Infrastructure {
|
||||
/// Use your website credentials. Your username is usually numeric with a "p" prefix.
|
||||
internal static let pia = L10n.tr("Localizable", "account.suggestion_footer.infrastructure.pia")
|
||||
|
|
Loading…
Reference in New Issue