From ff1c83dd3d3a21ce0c84bbb7cfe348feaa6d2722 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 7 Apr 2019 00:41:00 +0200 Subject: [PATCH] Show headers in donation table --- Passepartout-iOS/Base.lproj/Organizer.storyboard | 6 +++--- .../Scenes/Organizer/DonationViewController.swift | 6 ++++++ Passepartout/Resources/en.lproj/Localizable.strings | 2 ++ Passepartout/Sources/SwiftGen+Strings.swift | 10 ++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Passepartout-iOS/Base.lproj/Organizer.storyboard b/Passepartout-iOS/Base.lproj/Organizer.storyboard index 459eb6b2..0d79b233 100644 --- a/Passepartout-iOS/Base.lproj/Organizer.storyboard +++ b/Passepartout-iOS/Base.lproj/Organizer.storyboard @@ -250,13 +250,13 @@ - + - + - + diff --git a/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift b/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift index f2b2995b..fcc354ea 100644 --- a/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift @@ -55,6 +55,8 @@ class DonationViewController: UITableViewController, TableModelHost { } model.add(.oneTime) // model.add(.recurring) + model.setHeader(L10n.Donation.Sections.OneTime.header, for: .oneTime) +// model.setHeader(L10n.Donation.Sections.Recurring.header, for: .recurring) model.set(list, in: .oneTime) } @@ -83,6 +85,10 @@ class DonationViewController: UITableViewController, TableModelHost { return model.count } + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return model.header(for: section) + } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return model.count(for: section) } diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index b34ecc1c..19ee48ef 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -248,6 +248,8 @@ "about.cells.write_review.caption" = "Write a review"; "donation.title" = "Donate"; +"donation.sections.one_time.header" = "One time"; +"donation.sections.recurring.header" = "Recurring"; "share.message" = "Passepartout is an user-friendly, open source OpenVPN client for iOS and macOS"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index e5840689..236c017b 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -298,6 +298,16 @@ public enum L10n { public enum Donation { /// Donate public static let title = L10n.tr("Localizable", "donation.title") + public enum Sections { + public enum OneTime { + /// One time + public static let header = L10n.tr("Localizable", "donation.sections.one_time.header") + } + public enum Recurring { + /// Recurring + public static let header = L10n.tr("Localizable", "donation.sections.recurring.header") + } + } } public enum Endpoint {