From 2564f2446dafbc98609bf58b358ce1a78c08c073 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 29 Oct 2018 21:22:08 +0100 Subject: [PATCH] Show disclaimer from website --- Passepartout-iOS/Global/SwiftGen+Segues.swift | 1 - .../Organizer/AboutViewController.swift | 47 ++++++------------- .../en.lproj/Organizer.storyboard | 2 - .../Resources/en.lproj/Localizable.strings | 4 +- Passepartout/Sources/AppConstants.swift | 2 + Passepartout/Sources/SwiftGen+Strings.swift | 13 ++--- 6 files changed, 22 insertions(+), 47 deletions(-) diff --git a/Passepartout-iOS/Global/SwiftGen+Segues.swift b/Passepartout-iOS/Global/SwiftGen+Segues.swift index 1173fde8..a5f0bc66 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 disclaimerSegueIdentifier = "DisclaimerSegueIdentifier" case importHostSegueIdentifier = "ImportHostSegueIdentifier" case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier" case showImportedHostsSegueIdentifier = "ShowImportedHostsSegueIdentifier" diff --git a/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift b/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift index f8944407..156c828e 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, .disclaimer, .website, .privacyPolicy], in: .info) + model.set([.version, .website, .disclaimer, .privacyPolicy], in: .info) model.set([.sourcePassepartout, .sourceTunnelKit], in: .source) model.set([.shareTwitter, .shareGeneric], in: .share) model.set([.joinCommunity, .writeReview], in: .feedback) @@ -69,14 +69,14 @@ class AboutViewController: UITableViewController, TableModelHost { perform(segue: StoryboardSegue.Organizer.versionSegueIdentifier) } - private func showDisclaimer() { - perform(segue: StoryboardSegue.Organizer.disclaimerSegueIdentifier) - } - private func visitWebsite() { UIApplication.shared.open(AppConstants.URLs.website, 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) } @@ -108,23 +108,6 @@ class AboutViewController: UITableViewController, TableModelHost { @IBAction private func dismiss() { dismiss(animated: true, completion: nil) } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - guard let sid = segue.identifier, let segueType = StoryboardSegue.Organizer(rawValue: sid) else { - return - } - guard let vc = segue.destination as? LabelViewController else { - return - } - - switch segueType { - case .disclaimerSegueIdentifier: - vc.text = L10n.Disclaimer.Labels.text - - default: - break - } - } } // MARK: - @@ -143,10 +126,10 @@ extension AboutViewController { enum RowType: Int { case version - case disclaimer - case website + case disclaimer + case privacyPolicy case sourcePassepartout @@ -186,16 +169,16 @@ extension AboutViewController { cell.rightText = Utils.versionString() return cell - case .disclaimer: - let cell = Cells.setting.dequeue(from: tableView, for: indexPath) - cell.leftText = L10n.Disclaimer.title - return cell - case .website: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = L10n.About.Cells.Website.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 @@ -238,12 +221,12 @@ extension AboutViewController { case .version: showVersion() - case .disclaimer: - showDisclaimer() - case .website: visitWebsite() + case .disclaimer: + visitDisclaimer() + case .privacyPolicy: visitPrivacyPolicy() diff --git a/Passepartout-iOS/en.lproj/Organizer.storyboard b/Passepartout-iOS/en.lproj/Organizer.storyboard index 231aeab9..a2ef1afc 100644 --- a/Passepartout-iOS/en.lproj/Organizer.storyboard +++ b/Passepartout-iOS/en.lproj/Organizer.storyboard @@ -497,7 +497,6 @@ - @@ -577,7 +576,6 @@ - diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index d514bdf0..962358d5 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -190,6 +190,7 @@ "about.sections.share.header" = "Share"; "about.sections.feedback.header" = "Feedback"; "about.cells.website.caption" = "Visit website"; +"about.cells.disclaimer.caption" = "Disclaimer"; "about.cells.privacy_policy.caption" = "Privacy policy"; "about.cells.share_twitter.caption" = "Tweet about it!"; "about.cells.share_generic.caption" = "Invite a friend"; @@ -205,6 +206,3 @@ "credits.title" = "Credits"; "credits.labels.third_parties" = "The logo is taken from the awesome Circle Icons set by Nick Roach."; - -"disclaimer.title" = "Disclaimer"; -"disclaimer.labels.text" = "Passepartout is a VPN client based on independent work. As such, the developer -while making his best efforts to avoid it- takes no responsibility about any damage caused by the use of this software.\n\nAdditionally, the developer takes no responsibility about data usage, monitoring, logging etc. by the servers you connect to. Passepartout is not even involved in the above choices, as they're part of server-side policies.\n\nFor more information about data usage by third parties, please review the privacy policy of your VPN provider."; diff --git a/Passepartout/Sources/AppConstants.swift b/Passepartout/Sources/AppConstants.swift index 3170abc8..19b700f7 100644 --- a/Passepartout/Sources/AppConstants.swift +++ b/Passepartout/Sources/AppConstants.swift @@ -122,6 +122,8 @@ class AppConstants { class URLs { static let website = URL(string: "https://\(Domain.name)")! + static let disclaimer = website.appendingPathComponent("disclaimer") + static let privacyPolicy = website.appendingPathComponent("privacy") static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md") diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 2cf0ccfa..4f39f5ee 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -16,6 +16,10 @@ internal enum L10n { /// About internal static let title = L10n.tr("Localizable", "about.title") internal enum Cells { + internal enum Disclaimer { + /// Disclaimer + internal static let caption = L10n.tr("Localizable", "about.cells.disclaimer.caption") + } internal enum JoinCommunity { /// Join community internal static let caption = L10n.tr("Localizable", "about.cells.join_community.caption") @@ -213,15 +217,6 @@ internal enum L10n { } } - internal enum Disclaimer { - /// Disclaimer - internal static let title = L10n.tr("Localizable", "disclaimer.title") - internal enum Labels { - /// Passepartout is a VPN client based on independent work. As such, the developer -while making his best efforts to avoid it- takes no responsibility about any damage caused by the use of this software.\n\nAdditionally, the developer takes no responsibility about data usage, monitoring, logging etc. by the servers you connect to. Passepartout is not even involved in the above choices, as they're part of server-side policies.\n\nFor more information about data usage by third parties, please review the privacy policy of your VPN provider. - internal static let text = L10n.tr("Localizable", "disclaimer.labels.text") - } - } - internal enum Endpoint { internal enum Cells { internal enum AnyAddress {