Show headers in donation table

This commit is contained in:
Davide De Rosa 2019-04-07 00:41:00 +02:00
parent 724a4bc10a
commit ff1c83dd3d
4 changed files with 21 additions and 3 deletions

View File

@ -250,13 +250,13 @@
<scene sceneID="NrW-UF-gN3">
<objects>
<tableViewController id="SoF-ZH-NT1" customClass="DonationViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="2Io-7F-8Ed">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="2Io-7F-8Ed">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingTableViewCell" textLabel="52Q-2q-7xf" detailTextLabel="5ba-c6-s1I" style="IBUITableViewCellStyleValue1" id="Ukv-2T-HRq" customClass="SettingTableViewCell" customModule="Passepartout" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Ukv-2T-HRq" id="9sw-RZ-ki7">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>

View File

@ -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)
}

View File

@ -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";

View File

@ -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 {