From ba8afd9ad71e025bfa632a12fa76e77b5ab8ea64 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 26 Apr 2019 18:20:37 +0200 Subject: [PATCH 1/2] Move changelog/credits to About main screen --- Passepartout-iOS/Base.lproj/About.storyboard | 35 ++------ Passepartout-iOS/Global/SwiftGen+Assets.swift | 1 + Passepartout-iOS/Global/SwiftGen+Segues.swift | 1 + .../Scenes/About/AboutViewController.swift | 83 ++++++++++--------- .../Scenes/About/VersionViewController.swift | 12 --- 5 files changed, 50 insertions(+), 82 deletions(-) diff --git a/Passepartout-iOS/Base.lproj/About.storyboard b/Passepartout-iOS/Base.lproj/About.storyboard index f2241cf7..6e04d622 100644 --- a/Passepartout-iOS/Base.lproj/About.storyboard +++ b/Passepartout-iOS/Base.lproj/About.storyboard @@ -22,10 +22,10 @@ - + - + @@ -48,42 +48,20 @@ - - - - - - - - - + @@ -115,8 +93,6 @@ - - @@ -172,7 +148,7 @@ - + @@ -238,6 +214,7 @@ + @@ -316,7 +293,7 @@ - + diff --git a/Passepartout-iOS/Global/SwiftGen+Assets.swift b/Passepartout-iOS/Global/SwiftGen+Assets.swift index 2c3150b7..dc5ead11 100644 --- a/Passepartout-iOS/Global/SwiftGen+Assets.swift +++ b/Passepartout-iOS/Global/SwiftGen+Assets.swift @@ -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") } } diff --git a/Passepartout-iOS/Global/SwiftGen+Segues.swift b/Passepartout-iOS/Global/SwiftGen+Segues.swift index 2a978941..a7163d8a 100644 --- a/Passepartout-iOS/Global/SwiftGen+Segues.swift +++ b/Passepartout-iOS/Global/SwiftGen+Segues.swift @@ -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 { diff --git a/Passepartout-iOS/Scenes/About/AboutViewController.swift b/Passepartout-iOS/Scenes/About/AboutViewController.swift index 501fa818..6e2d1540 100644 --- a/Passepartout-iOS/Scenes/About/AboutViewController.swift +++ b/Passepartout-iOS/Scenes/About/AboutViewController.swift @@ -33,11 +33,14 @@ class AboutViewController: UITableViewController, TableModelHost { let model: TableModel = { let model: TableModel = 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.Version.Buttons.changelog + + case .seeCredits: + cell.leftText = L10n.Version.Buttons.credits + 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)) } diff --git a/Passepartout-iOS/Scenes/About/VersionViewController.swift b/Passepartout-iOS/Scenes/About/VersionViewController.swift index 06692ed5..44383def 100644 --- a/Passepartout-iOS/Scenes/About/VersionViewController.swift +++ b/Passepartout-iOS/Scenes/About/VersionViewController.swift @@ -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) } } From b1cde747982a44d456657090741517491aa375dd Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 26 Apr 2019 18:28:01 +0200 Subject: [PATCH 2/2] Refactor renamed strings --- .../Scenes/About/AboutViewController.swift | 4 ++-- .../Resources/de.lproj/Localizable.strings | 4 ++-- .../Resources/en.lproj/Localizable.strings | 4 ++-- .../Resources/it.lproj/Localizable.strings | 4 ++-- .../Resources/pt-br.lproj/Localizable.strings | 4 ++-- .../Resources/ru.lproj/Localizable.strings | 4 ++-- Passepartout/Sources/SwiftGen+Strings.swift | 14 ++++++++------ 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Passepartout-iOS/Scenes/About/AboutViewController.swift b/Passepartout-iOS/Scenes/About/AboutViewController.swift index 6e2d1540..900109eb 100644 --- a/Passepartout-iOS/Scenes/About/AboutViewController.swift +++ b/Passepartout-iOS/Scenes/About/AboutViewController.swift @@ -154,10 +154,10 @@ extension AboutViewController { cell.rightText = Utils.versionString() case .seeChangelog: - cell.leftText = L10n.Version.Buttons.changelog + cell.leftText = L10n.About.Cells.Changelog.caption case .seeCredits: - cell.leftText = L10n.Version.Buttons.credits + cell.leftText = L10n.About.Cells.Credits.caption case .website: cell.leftText = L10n.About.Cells.Website.caption diff --git a/Passepartout/Resources/de.lproj/Localizable.strings b/Passepartout/Resources/de.lproj/Localizable.strings index 082a7d40..4cfa6882 100644 --- a/Passepartout/Resources/de.lproj/Localizable.strings +++ b/Passepartout/Resources/de.lproj/Localizable.strings @@ -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"; diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index cd38b50f..b054710a 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -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"; diff --git a/Passepartout/Resources/it.lproj/Localizable.strings b/Passepartout/Resources/it.lproj/Localizable.strings index 1e446075..36b95d4e 100644 --- a/Passepartout/Resources/it.lproj/Localizable.strings +++ b/Passepartout/Resources/it.lproj/Localizable.strings @@ -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"; diff --git a/Passepartout/Resources/pt-br.lproj/Localizable.strings b/Passepartout/Resources/pt-br.lproj/Localizable.strings index 39f969fe..7562b9d3 100644 --- a/Passepartout/Resources/pt-br.lproj/Localizable.strings +++ b/Passepartout/Resources/pt-br.lproj/Localizable.strings @@ -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"; diff --git a/Passepartout/Resources/ru.lproj/Localizable.strings b/Passepartout/Resources/ru.lproj/Localizable.strings index aba68f9e..1efa5406 100644 --- a/Passepartout/Resources/ru.lproj/Localizable.strings +++ b/Passepartout/Resources/ru.lproj/Localizable.strings @@ -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" = "Лицензии"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index eb35575e..d5320245 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -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")