From fec2f02df567885379a0d53b505482506a670ee7 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 29 Oct 2018 20:41:25 +0100 Subject: [PATCH] Move Credits inside Version --- Passepartout-iOS/Global/SwiftGen+Segues.swift | 1 - .../Organizer/AboutViewController.swift | 21 +---------------- .../Organizer/VersionViewController.swift | 21 +++++++++++++---- .../en.lproj/Organizer.storyboard | 23 ++++++++++++++----- .../Resources/en.lproj/Localizable.strings | 1 + Passepartout/Sources/SwiftGen+Strings.swift | 2 ++ 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/Passepartout-iOS/Global/SwiftGen+Segues.swift b/Passepartout-iOS/Global/SwiftGen+Segues.swift index f3493d06..1173fde8 100644 --- a/Passepartout-iOS/Global/SwiftGen+Segues.swift +++ b/Passepartout-iOS/Global/SwiftGen+Segues.swift @@ -23,7 +23,6 @@ internal enum StoryboardSegue { internal enum Organizer: String, SegueType { case aboutSegueIdentifier = "AboutSegueIdentifier" case addProviderSegueIdentifier = "AddProviderSegueIdentifier" - case creditsSegueIdentifier = "CreditsSegueIdentifier" case disclaimerSegueIdentifier = "DisclaimerSegueIdentifier" case importHostSegueIdentifier = "ImportHostSegueIdentifier" case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier" diff --git a/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift b/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift index 88a045d3..7cb08bc0 100644 --- a/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift @@ -39,7 +39,7 @@ class AboutViewController: UITableViewController, TableModelHost { model.setHeader(L10n.About.Sections.Source.header, for: .source) model.setHeader(L10n.About.Sections.Share.header, for: .share) model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) - model.set([.version, .credits, .disclaimer, .website], in: .info) + model.set([.version, .disclaimer, .website], in: .info) model.set([.sourcePassepartout, .sourceTunnelKit], in: .source) model.set([.shareTwitter, .shareGeneric], in: .share) model.set([.joinCommunity, .writeReview], in: .feedback) @@ -69,10 +69,6 @@ class AboutViewController: UITableViewController, TableModelHost { perform(segue: StoryboardSegue.Organizer.versionSegueIdentifier) } - private func showCredits() { - perform(segue: StoryboardSegue.Organizer.creditsSegueIdentifier) - } - private func showDisclaimer() { perform(segue: StoryboardSegue.Organizer.disclaimerSegueIdentifier) } @@ -118,11 +114,6 @@ class AboutViewController: UITableViewController, TableModelHost { } switch segueType { - case .creditsSegueIdentifier: - var notices = AppConstants.Notices.all - notices.insert(L10n.Credits.Labels.thirdParties, at: 0) - vc.text = notices.joined(separator: "\n\n") - case .disclaimerSegueIdentifier: vc.text = L10n.Disclaimer.Labels.text @@ -148,8 +139,6 @@ extension AboutViewController { enum RowType: Int { case version - case credits - case disclaimer case website @@ -191,11 +180,6 @@ extension AboutViewController { cell.rightText = Utils.versionString() return cell - case .credits: - let cell = Cells.setting.dequeue(from: tableView, for: indexPath) - cell.leftText = L10n.Credits.title - return cell - case .disclaimer: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = L10n.Disclaimer.title @@ -243,9 +227,6 @@ extension AboutViewController { case .version: showVersion() - case .credits: - showCredits() - case .disclaimer: showDisclaimer() diff --git a/Passepartout-iOS/Scenes/Organizer/VersionViewController.swift b/Passepartout-iOS/Scenes/Organizer/VersionViewController.swift index 3513abfc..2aa1b5ec 100644 --- a/Passepartout-iOS/Scenes/Organizer/VersionViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/VersionViewController.swift @@ -32,12 +32,12 @@ class VersionViewController: UIViewController { @IBOutlet private weak var labelVersion: UILabel? - @IBOutlet private weak var labelCopyright: UILabel? - @IBOutlet private weak var labelIntro: UILabel? @IBOutlet private weak var buttonChangelog: UIButton? + @IBOutlet private weak var buttonCredits: UIButton? + override func awakeFromNib() { super.awakeFromNib() @@ -49,18 +49,29 @@ class VersionViewController: UIViewController { labelTitle?.text = GroupConstants.App.name labelVersion?.text = Utils.versionString() - labelCopyright?.text = GroupConstants.App.name 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, labelCopyright, labelIntro] { + 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) } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + guard let vc = segue.destination as? LabelViewController else { + return + } + vc.title = L10n.Credits.title + var notices = AppConstants.Notices.all + notices.insert(L10n.Credits.Labels.thirdParties, at: 0) + vc.text = notices.joined(separator: "\n\n") + } } diff --git a/Passepartout-iOS/en.lproj/Organizer.storyboard b/Passepartout-iOS/en.lproj/Organizer.storyboard index c5c6af32..231aeab9 100644 --- a/Passepartout-iOS/en.lproj/Organizer.storyboard +++ b/Passepartout-iOS/en.lproj/Organizer.storyboard @@ -328,10 +328,10 @@ - + - + @@ -362,6 +362,14 @@ + @@ -370,14 +378,17 @@ + + + - + @@ -411,6 +422,7 @@ + @@ -419,7 +431,7 @@ - + @@ -484,7 +496,6 @@ - @@ -566,7 +577,7 @@ - + diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index 04c2c863..dba503e6 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -200,6 +200,7 @@ "version.labels.intro" = "Passepartout and TunnelKit are written and maintained by Davide De Rosa (keeshux).\n\nTunnelKit is a native OpenVPN client originally forked from PIATunnel by Private Internet Access.\n\nSource code for Passepartout and TunnelKit is publicly available on GitHub under the GPLv3."; "version.buttons.changelog" = "CHANGELOG"; +"version.buttons.credits" = "CREDITS"; "credits.title" = "Credits"; "credits.labels.third_parties" = "Passepartout is a non-official client and is in no way affiliated with OpenVPN Inc.\n\nThe logo is taken from the awesome Circle Icons set by Nick Roach."; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index e147cc26..e61c319c 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -614,6 +614,8 @@ internal enum L10n { internal enum Buttons { /// CHANGELOG internal static let changelog = L10n.tr("Localizable", "version.buttons.changelog") + /// CREDITS + internal static let credits = L10n.tr("Localizable", "version.buttons.credits") } internal enum Labels { /// Passepartout and TunnelKit are written and maintained by Davide De Rosa (keeshux).\n\nTunnelKit is a native OpenVPN client originally forked from PIATunnel by Private Internet Access.\n\nSource code for Passepartout and TunnelKit is publicly available on GitHub under the GPLv3.