Add Patreon link in new Support section

This commit is contained in:
Davide De Rosa 2019-04-07 00:45:32 +02:00
parent 8d6e54e4cf
commit 561307568e
4 changed files with 35 additions and 4 deletions

View File

@ -48,6 +48,7 @@ class OrganizerViewController: UITableViewController, TableModelHost {
if #available(iOS 12, *) {
model.add(.siri)
}
model.add(.support)
model.add(.about)
model.add(.destruction)
model.setHeader(L10n.Organizer.Sections.Providers.header, for: .providers)
@ -59,6 +60,8 @@ class OrganizerViewController: UITableViewController, TableModelHost {
model.setFooter(L10n.Organizer.Sections.Siri.footer, for: .siri)
model.set([.siriShortcuts], in: .siri)
}
model.setHeader(L10n.Organizer.Sections.Support.header, for: .support)
model.set([.patreon], in: .support)
model.set([.openAbout], in: .about)
model.set([.uninstall], in: .destruction)
if AppConstants.Flags.isBeta {
@ -155,10 +158,6 @@ class OrganizerViewController: UITableViewController, TableModelHost {
// MARK: Actions
@IBAction private func about() {
perform(segue: StoryboardSegue.Organizer.aboutSegueIdentifier, sender: nil)
}
private func addNewProvider() {
var names = Set(InfrastructureFactory.shared.allNames)
var createdNames: [Infrastructure.Name] = []
@ -192,6 +191,14 @@ class OrganizerViewController: UITableViewController, TableModelHost {
perform(segue: StoryboardSegue.Organizer.siriShortcutsSegueIdentifier)
}
private func visitPatreon() {
UIApplication.shared.open(AppConstants.URLs.patreon, options: [:], completionHandler: nil)
}
private func about() {
perform(segue: StoryboardSegue.Organizer.aboutSegueIdentifier, sender: nil)
}
private func removeProfile(at indexPath: IndexPath) {
let sectionObject = model.section(for: indexPath.section)
let rowProfile = profileKey(at: indexPath)
@ -283,6 +290,8 @@ extension OrganizerViewController {
case siri
case support
case about
case destruction
@ -299,6 +308,8 @@ extension OrganizerViewController {
case siriShortcuts
case patreon
case openAbout
case uninstall
@ -374,6 +385,11 @@ extension OrganizerViewController {
cell.leftText = L10n.Organizer.Cells.SiriShortcuts.caption
return cell
case .patreon:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Organizer.Cells.Patreon.caption
return cell
case .openAbout:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Organizer.Cells.About.caption(GroupConstants.App.name)
@ -412,6 +428,9 @@ extension OrganizerViewController {
case .siriShortcuts:
addShortcuts()
case .patreon:
visitPatreon()
case .openAbout:
about()

View File

@ -42,11 +42,13 @@
"organizer.sections.hosts.footer" = "Import hosts from raw .ovpn configuration files.";
"organizer.sections.siri.header" = "Siri";
"organizer.sections.siri.footer" = "Get help from Siri to speed up your most common interactions with the app.";
"organizer.sections.support.header" = "Support";
"organizer.cells.profile.value.current" = "In use";
"organizer.cells.add_provider.caption" = "Add new provider";
"organizer.cells.add_host.caption" = "Add new host";
"organizer.cells.siri_shortcuts.caption" = "Manage shortcuts";
"organizer.cells.about.caption" = "About %@";
"organizer.cells.patreon.caption" = "Support me on Patreon";
"organizer.cells.uninstall.caption" = "Remove VPN configuration";
"organizer.alerts.exhausted_providers.message" = "You have created profiles for any available provider.";
"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.";

View File

@ -144,6 +144,8 @@ public class AppConstants {
public static let subreddit = URL(string: "https://www.reddit.com/r/passepartout")!
public static let patreon = URL(string: "https://www.patreon.com/keeshux")!
private static let twitterHashtags = ["OpenVPN", "iOS", "macOS"]
public static var twitterIntent: URL {

View File

@ -408,6 +408,10 @@ public enum L10n {
/// Add new provider
public static let caption = L10n.tr("Localizable", "organizer.cells.add_provider.caption")
}
public enum Patreon {
/// Support me on Patreon
public static let caption = L10n.tr("Localizable", "organizer.cells.patreon.caption")
}
public enum Profile {
public enum Value {
/// In use
@ -442,6 +446,10 @@ public enum L10n {
/// Siri
public static let header = L10n.tr("Localizable", "organizer.sections.siri.header")
}
public enum Support {
/// Support
public static let header = L10n.tr("Localizable", "organizer.sections.support.header")
}
}
}