Merge branch 'rearrange-about'

This commit is contained in:
Davide De Rosa 2019-04-26 18:28:48 +02:00
commit 23eaf78e35
11 changed files with 68 additions and 98 deletions

View File

@ -22,10 +22,10 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Kan-Ro-DbI">
<rect key="frame" x="0.0" y="0.0" width="414" height="491"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="395"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RP1-au-v0h">
<rect key="frame" x="28" y="40" width="358" height="411"/>
<rect key="frame" x="28" y="40" width="358" height="315"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="eRj-AM-Edq">
<rect key="frame" x="79" y="0.0" width="200" height="200"/>
@ -48,42 +48,20 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wV2-Nx-RuF">
<rect key="frame" x="0.0" y="335" width="358" height="33"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<state key="normal" title="&lt;CL&gt;"/>
<connections>
<action selector="visitChangelog" destination="PMT-gj-ARE" eventType="touchUpInside" id="hSv-6o-eXI"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rtK-wa-fgh">
<rect key="frame" x="0.0" y="378" width="358" height="33"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<state key="normal" title="&lt;CRD&gt;"/>
<connections>
<segue destination="duu-Yq-oor" kind="show" id="w0a-1I-6Nc"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="wV2-Nx-RuF" secondAttribute="trailing" id="1jj-cq-2Ja"/>
<constraint firstItem="eRj-AM-Edq" firstAttribute="centerX" secondItem="RP1-au-v0h" secondAttribute="centerX" id="39V-6k-m1r"/>
<constraint firstAttribute="trailing" secondItem="F6g-5X-yGY" secondAttribute="trailing" id="4NF-Ha-rCB"/>
<constraint firstItem="Zek-qD-saW" firstAttribute="leading" secondItem="RP1-au-v0h" secondAttribute="leading" id="4r5-es-LKj"/>
<constraint firstItem="tOJ-Gb-6TL" firstAttribute="top" secondItem="Zek-qD-saW" secondAttribute="bottom" constant="5" id="5EV-6h-af6"/>
<constraint firstItem="F6g-5X-yGY" firstAttribute="leading" secondItem="RP1-au-v0h" secondAttribute="leading" id="Bbh-jl-eyk"/>
<constraint firstItem="rtK-wa-fgh" firstAttribute="top" secondItem="wV2-Nx-RuF" secondAttribute="bottom" constant="10" id="ChX-qg-yan"/>
<constraint firstItem="Zek-qD-saW" firstAttribute="top" secondItem="eRj-AM-Edq" secondAttribute="bottom" constant="20" id="E5v-Gd-4FH"/>
<constraint firstItem="wV2-Nx-RuF" firstAttribute="leading" secondItem="RP1-au-v0h" secondAttribute="leading" id="Iop-zX-3fL"/>
<constraint firstItem="F6g-5X-yGY" firstAttribute="top" secondItem="tOJ-Gb-6TL" secondAttribute="bottom" constant="20" id="Vla-uy-lL8"/>
<constraint firstAttribute="trailing" secondItem="Zek-qD-saW" secondAttribute="trailing" id="WL1-SB-5gf"/>
<constraint firstAttribute="bottom" secondItem="rtK-wa-fgh" secondAttribute="bottom" id="XDo-fJ-IOo"/>
<constraint firstAttribute="trailing" secondItem="tOJ-Gb-6TL" secondAttribute="trailing" id="a5o-c7-BD5"/>
<constraint firstAttribute="trailing" secondItem="rtK-wa-fgh" secondAttribute="trailing" id="dBQ-XF-2mE"/>
<constraint firstItem="tOJ-Gb-6TL" firstAttribute="leading" secondItem="RP1-au-v0h" secondAttribute="leading" id="grT-YM-rGi"/>
<constraint firstItem="eRj-AM-Edq" firstAttribute="top" secondItem="RP1-au-v0h" secondAttribute="top" id="q35-KT-uTl"/>
<constraint firstItem="rtK-wa-fgh" firstAttribute="leading" secondItem="RP1-au-v0h" secondAttribute="leading" id="weH-qk-nTh"/>
<constraint firstItem="wV2-Nx-RuF" firstAttribute="top" secondItem="F6g-5X-yGY" secondAttribute="bottom" constant="20" id="y5I-Du-MiY"/>
<constraint firstAttribute="bottom" secondItem="F6g-5X-yGY" secondAttribute="bottom" id="tqI-4a-Mbr"/>
</constraints>
</view>
</subviews>
@ -115,8 +93,6 @@
<viewLayoutGuide key="safeArea" id="1um-xX-wxp"/>
</view>
<connections>
<outlet property="buttonChangelog" destination="wV2-Nx-RuF" id="E0X-ek-Ii2"/>
<outlet property="buttonCredits" destination="rtK-wa-fgh" id="56A-mE-YHa"/>
<outlet property="labelIntro" destination="F6g-5X-yGY" id="QSg-VO-Wf4"/>
<outlet property="labelTitle" destination="Zek-qD-saW" id="TL8-Vb-B58"/>
<outlet property="labelVersion" destination="tOJ-Gb-6TL" id="O7w-Ne-L0R"/>
@ -172,7 +148,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="A5e-dW-BFv" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1786" y="-2247"/>
<point key="canvasLocation" x="-2552" y="-1544"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="bMd-7b-j9C">
@ -238,6 +214,7 @@
</navigationItem>
<connections>
<segue destination="PMT-gj-ARE" kind="show" identifier="VersionSegueIdentifier" id="uYt-4N-PPL"/>
<segue destination="duu-Yq-oor" kind="show" identifier="CreditsSegueIdentifier" id="8oK-Gy-3Vg"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AnH-Vt-JJn" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -316,7 +293,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Urb-bq-a19" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1012" y="-2248"/>
<point key="canvasLocation" x="-1542" y="-1544"/>
</scene>
</scenes>
<resources>

View File

@ -286,6 +286,7 @@ internal enum Asset {
internal static let pia = ImageAsset(name: "pia")
internal static let protonvpn = ImageAsset(name: "protonvpn")
internal static let tunnelbear = ImageAsset(name: "tunnelbear")
internal static let vyprvpn = ImageAsset(name: "vyprvpn")
internal static let windscribe = ImageAsset(name: "windscribe")
}
}

View File

@ -13,6 +13,7 @@ import UIKit
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
internal enum StoryboardSegue {
internal enum About: String, SegueType {
case creditsSegueIdentifier = "CreditsSegueIdentifier"
case versionSegueIdentifier = "VersionSegueIdentifier"
}
internal enum Main: String, SegueType {

View File

@ -33,11 +33,14 @@ class AboutViewController: UITableViewController, TableModelHost {
let model: TableModel<SectionType, RowType> = {
let model: TableModel<SectionType, RowType> = TableModel()
model.add(.info)
model.add(.moreInfo)
model.add(.web)
model.add(.share)
model.setHeader("", for: .info)
model.setHeader(L10n.About.Sections.Web.header, for: .web)
model.setHeader(L10n.About.Sections.Share.header, for: .share)
model.set([.version], in: .info)
model.set([.seeChangelog, .seeCredits], in: .moreInfo)
model.set([.website, .faq, .disclaimer, .privacyPolicy], in: .web)
model.set([.shareTwitter, .shareGeneric], in: .share)
return model
@ -66,30 +69,14 @@ class AboutViewController: UITableViewController, TableModelHost {
perform(segue: StoryboardSegue.About.versionSegueIdentifier)
}
private func visitWebsite() {
UIApplication.shared.open(AppConstants.URLs.website, options: [:], completionHandler: nil)
private func openCredits() {
perform(segue: StoryboardSegue.About.creditsSegueIdentifier)
}
private func visitFAQ() {
UIApplication.shared.open(AppConstants.URLs.faq, options: [:], completionHandler: nil)
}
private func visitDisclaimer() {
UIApplication.shared.open(AppConstants.URLs.disclaimer, options: [:], completionHandler: nil)
}
private func visitPrivacyPolicy() {
UIApplication.shared.open(AppConstants.URLs.privacyPolicy, options: [:], completionHandler: nil)
}
private func visitRepository(_ url: URL) {
private func visit(_ url: URL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
private func tweetAboutApp() {
UIApplication.shared.open(AppConstants.URLs.twitterIntent, options: [:], completionHandler: nil)
}
private func inviteFriend(sender: UITableViewCell?) {
let message = "\(L10n.Share.message) \(AppConstants.URLs.website)"
let vc = UIActivityViewController(activityItems: [message], applicationActivities: nil)
@ -108,6 +95,8 @@ extension AboutViewController {
enum SectionType: Int {
case info
case moreInfo
case web
case share
@ -116,6 +105,10 @@ extension AboutViewController {
enum RowType: Int {
case version
case seeChangelog
case seeCredits
case website
case faq
@ -141,48 +134,50 @@ extension AboutViewController {
return model.footer(for: section)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return model.headerHeight(for: section)
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return model.footerHeight(for: section)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return model.count(for: section)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
switch model.row(at: indexPath) {
case .version:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Version.title
cell.rightText = Utils.versionString()
return cell
case .seeChangelog:
cell.leftText = L10n.About.Cells.Changelog.caption
case .seeCredits:
cell.leftText = L10n.About.Cells.Credits.caption
case .website:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.Website.caption
return cell
case .faq:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.Faq.caption
return cell
case .disclaimer:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.Disclaimer.caption
return cell
case .privacyPolicy:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.PrivacyPolicy.caption
return cell
case .shareTwitter:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.ShareTwitter.caption
return cell
case .shareGeneric:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.ShareGeneric.caption
return cell
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@ -190,21 +185,27 @@ extension AboutViewController {
case .version:
showVersion()
case .seeChangelog:
visit(AppConstants.URLs.changelog)
case .seeCredits:
openCredits()
case .website:
visitWebsite()
visit(AppConstants.URLs.website)
case .faq:
visitFAQ()
visit(AppConstants.URLs.faq)
case .disclaimer:
visitDisclaimer()
visit(AppConstants.URLs.disclaimer)
case .privacyPolicy:
visitPrivacyPolicy()
visit(AppConstants.URLs.privacyPolicy)
case .shareTwitter:
tweetAboutApp()
visit(AppConstants.URLs.twitterIntent)
case .shareGeneric:
inviteFriend(sender: tableView.cellForRow(at: indexPath))
}

View File

@ -35,10 +35,6 @@ class VersionViewController: UIViewController {
@IBOutlet private weak var labelIntro: UILabel?
@IBOutlet private weak var buttonChangelog: UIButton?
@IBOutlet private weak var buttonCredits: UIButton?
override func awakeFromNib() {
super.awakeFromNib()
@ -52,18 +48,10 @@ class VersionViewController: UIViewController {
labelTitle?.text = GroupConstants.App.name
labelVersion?.text = Utils.versionString()
labelIntro?.text = L10n.Version.Labels.intro
buttonChangelog?.setTitle(L10n.Version.Buttons.changelog, for: .normal)
buttonCredits?.setTitle(L10n.Version.Buttons.credits, for: .normal)
scrollView?.applyPrimaryBackground(Theme.current)
for label in [labelTitle, labelVersion, labelIntro] {
label?.applyLight(Theme.current)
}
buttonChangelog?.apply(Theme.current)
buttonCredits?.apply(Theme.current)
}
@IBAction private func visitChangelog() {
UIApplication.shared.open(AppConstants.URLs.changelog, options: [:], completionHandler: nil)
}
}

View File

@ -246,6 +246,8 @@
"about.title" = "Über";
"about.sections.web.header" = "Web";
"about.sections.share.header" = "Teilen";
"about.cells.changelog.caption" = "Changelog";
"about.cells.credits.caption" = "Credits";
"about.cells.website.caption" = "Homepage";
"about.cells.faq.caption" = "FAQ";
"about.cells.disclaimer.caption" = "Haftungsausschluss";
@ -266,8 +268,6 @@
"version.title" = "Version";
"version.labels.intro" = "Passepartout und TunnelKit sind geschrieben und gewartet von by Davide De Rosa (keeshux).\n\nQuellcode für Passepartout und TunnelKit ist öffentlich auf GitHub unter GPLv3 verfügbar, du findest die Links auf der Homepage.\n\nPassepartout ist ein inoffizieller client und auf keine Art und Weise mit OpenVPN Inc. verbunden.";
"version.buttons.changelog" = "CHANGELOG";
"version.buttons.credits" = "CREDITS";
"credits.title" = "Credits";
"credits.sections.licenses.header" = "Lizenzen";

View File

@ -244,6 +244,8 @@
"about.title" = "About";
"about.sections.web.header" = "Web";
"about.sections.share.header" = "Share";
"about.cells.changelog.caption" = "Changelog";
"about.cells.credits.caption" = "Credits";
"about.cells.website.caption" = "Home page";
"about.cells.faq.caption" = "FAQ";
"about.cells.disclaimer.caption" = "Disclaimer";
@ -264,8 +266,6 @@
"version.title" = "Version";
"version.labels.intro" = "Passepartout and TunnelKit are written and maintained by Davide De Rosa (keeshux).\n\nSource code for Passepartout and TunnelKit is publicly available on GitHub under the GPLv3, you can find links in the home page.\n\nPassepartout is a non-official client and is in no way affiliated with OpenVPN Inc.";
"version.buttons.changelog" = "CHANGELOG";
"version.buttons.credits" = "CREDITS";
"credits.title" = "Credits";
"credits.sections.licenses.header" = "Licenses";

View File

@ -246,6 +246,8 @@
"about.title" = "Informazioni su";
"about.sections.web.header" = "Web";
"about.sections.share.header" = "Condividi";
"about.cells.changelog.caption" = "Changelog";
"about.cells.credits.caption" = "Credits";
"about.cells.website.caption" = "Home page";
"about.cells.faq.caption" = "FAQ";
"about.cells.disclaimer.caption" = "Disclaimer";
@ -266,8 +268,6 @@
"version.title" = "Versione";
"version.labels.intro" = "Passepartout e TunnelKit sono scritti e mantenuti da Davide De Rosa (keeshux).\n\nIl codice sorgente di Passepartout e TunnelKit è pubblicamente disponibile su GitHub in accordo con la GPLv3, puoi trovare i link nella home page.\n\nPassepartout è un client non ufficiale e non è affiliato ad OpenVPN Inc. in alcuna maniera.";
"version.buttons.changelog" = "CHANGELOG";
"version.buttons.credits" = "CREDITS";
"credits.title" = "Credits";
"credits.sections.licenses.header" = "Licenze";

View File

@ -250,6 +250,8 @@
"about.title" = "Sobre";
"about.sections.web.header" = "Web";
"about.sections.share.header" = "Compartilhar";
"about.cells.changelog.caption" = "Changelog";
"about.cells.credits.caption" = "Créditos";
"about.cells.website.caption" = "Home page";
"about.cells.faq.caption" = "FAQ";
"about.cells.disclaimer.caption" = "Disclaimer";
@ -270,8 +272,6 @@
"version.title" = "Versão";
"version.labels.intro" = "Passepartout e TunnelKit são desenvolvidos e mantidos por Davide De Rosa (keeshux).\n\nO código de fonte está disponível no GitHub sobre a licença GPLv3, você pode encontrar links na home page.\n\nPassepartout não é um cliente oficial e não possui nenhuma ligação com a OpenVPN Inc.";
"version.buttons.changelog" = "CHANGELOG";
"version.buttons.credits" = "CRÉDITOS";
"credits.title" = "Créditos";
"credits.sections.licenses.header" = "Licenças";

View File

@ -246,6 +246,8 @@
"about.title" = "О нас";
"about.sections.web.header" = "Веб";
"about.sections.share.header" = "Поделиться";
"about.cells.changelog.caption" = "Журнал изменений";
"about.cells.credits.caption" = "Благодарности";
"about.cells.website.caption" = "Домашняя страница";
"about.cells.faq.caption" = "FAQ";
"about.cells.disclaimer.caption" = "Предупреждение";
@ -266,8 +268,6 @@
"version.title" = "Версия";
"version.labels.intro" = "Passepartout и TunnelKit написаны и установлены Davide De Rosa (keeshux).\n\nИсходные коды для Passepartout и TunnelKit публично доступны на GitHub под GPLv3, вы можете найти ссылки на домашней странице.\n\nPassepartout является неофициальным клиентом, и никаким образом не связан с OpenVPN Inc.";
"version.buttons.changelog" = "ЖУРНАЛ ИЗМЕНЕНИЙ";
"version.buttons.credits" = "БЛАГОДАРНОСТИ";
"credits.title" = "Благодарность";
"credits.sections.licenses.header" = "Лицензии";

View File

@ -16,6 +16,14 @@ public enum L10n {
/// About
public static let title = L10n.tr("Localizable", "about.title")
public enum Cells {
public enum Changelog {
/// Changelog
public static let caption = L10n.tr("Localizable", "about.cells.changelog.caption")
}
public enum Credits {
/// Credits
public static let caption = L10n.tr("Localizable", "about.cells.credits.caption")
}
public enum Disclaimer {
/// Disclaimer
public static let caption = L10n.tr("Localizable", "about.cells.disclaimer.caption")
@ -892,12 +900,6 @@ public enum L10n {
public enum Version {
/// Version
public static let title = L10n.tr("Localizable", "version.title")
public enum Buttons {
/// CHANGELOG
public static let changelog = L10n.tr("Localizable", "version.buttons.changelog")
/// CREDITS
public static let credits = L10n.tr("Localizable", "version.buttons.credits")
}
public enum Labels {
/// Passepartout and TunnelKit are written and maintained by Davide De Rosa (keeshux).\n\nSource code for Passepartout and TunnelKit is publicly available on GitHub under the GPLv3, you can find links in the home page.\n\nPassepartout is a non-official client and is in no way affiliated with OpenVPN Inc.
public static let intro = L10n.tr("Localizable", "version.labels.intro")