Add donation cell in organizer

This commit is contained in:
Davide De Rosa 2019-04-06 23:11:07 +02:00
parent 895c19328e
commit 6f57d3503a
3 changed files with 22 additions and 3 deletions

View File

@ -61,7 +61,7 @@ class OrganizerViewController: UITableViewController, TableModelHost {
model.set([.siriShortcuts], in: .siri)
}
model.setHeader(L10n.Organizer.Sections.Support.header, for: .support)
model.set([.patreon], in: .support)
model.set([.donate, .patreon], in: .support)
model.set([.openAbout], in: .about)
model.set([.uninstall], in: .destruction)
if AppConstants.Flags.isBeta {
@ -191,6 +191,10 @@ class OrganizerViewController: UITableViewController, TableModelHost {
perform(segue: StoryboardSegue.Organizer.siriShortcutsSegueIdentifier)
}
private func donateToDeveloper() {
// TODO
}
private func visitPatreon() {
UIApplication.shared.open(AppConstants.URLs.patreon, options: [:], completionHandler: nil)
}
@ -308,6 +312,8 @@ extension OrganizerViewController {
case siriShortcuts
case donate
case patreon
case openAbout
@ -385,6 +391,11 @@ extension OrganizerViewController {
cell.leftText = L10n.Organizer.Cells.SiriShortcuts.caption
return cell
case .donate:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Organizer.Cells.Donate.caption
return cell
case .patreon:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Organizer.Cells.Patreon.caption
@ -428,6 +439,9 @@ extension OrganizerViewController {
case .siriShortcuts:
addShortcuts()
case .donate:
donateToDeveloper()
case .patreon:
visitPatreon()

View File

@ -48,6 +48,7 @@
"organizer.cells.add_host.caption" = "Add new host";
"organizer.cells.siri_shortcuts.caption" = "Manage shortcuts";
"organizer.cells.about.caption" = "About %@";
"organizer.cells.donate.caption" = "Make a donation";
"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.";

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 Donate {
/// Make a donation
public static let caption = L10n.tr("Localizable", "organizer.cells.donate.caption")
}
public enum Patreon {
/// Support me on Patreon
public static let caption = L10n.tr("Localizable", "organizer.cells.patreon.caption")