From fe85677e68dc84f9fe285d7b053ab403db3577d2 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 29 Oct 2018 20:59:05 +0100 Subject: [PATCH] Add privacy policy --- .../Scenes/Organizer/AboutViewController.swift | 16 +++++++++++++++- .../Resources/en.lproj/Localizable.strings | 1 + Passepartout/Sources/AppConstants.swift | 2 ++ Passepartout/Sources/SwiftGen+Strings.swift | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift b/Passepartout-iOS/Scenes/Organizer/AboutViewController.swift index 1189f39f..f8944407 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], in: .info) + model.set([.version, .disclaimer, .website, .privacyPolicy], in: .info) model.set([.sourcePassepartout, .sourceTunnelKit], in: .source) model.set([.shareTwitter, .shareGeneric], in: .share) model.set([.joinCommunity, .writeReview], in: .feedback) @@ -77,6 +77,10 @@ class AboutViewController: UITableViewController, TableModelHost { UIApplication.shared.open(AppConstants.URLs.website, options: [:], completionHandler: nil) } + private func visitPrivacyPolicy() { + UIApplication.shared.open(AppConstants.URLs.privacyPolicy, options: [:], completionHandler: nil) + } + private func visitRepository(_ url: URL) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } @@ -143,6 +147,8 @@ extension AboutViewController { case website + case privacyPolicy + case sourcePassepartout case sourceTunnelKit @@ -190,6 +196,11 @@ extension AboutViewController { cell.leftText = L10n.About.Cells.Website.caption return cell + case .privacyPolicy: + let cell = Cells.setting.dequeue(from: tableView, for: indexPath) + cell.leftText = L10n.About.Cells.PrivacyPolicy.caption + return cell + case .sourcePassepartout: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = GroupConstants.App.name @@ -233,6 +244,9 @@ extension AboutViewController { case .website: visitWebsite() + case .privacyPolicy: + visitPrivacyPolicy() + case .sourcePassepartout: visitRepository(AppConstants.Repos.passepartout) diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index 90fb5ac4..d514bdf0 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.privacy_policy.caption" = "Privacy policy"; "about.cells.share_twitter.caption" = "Tweet about it!"; "about.cells.share_generic.caption" = "Invite a friend"; "about.cells.join_community.caption" = "Join community"; diff --git a/Passepartout/Sources/AppConstants.swift b/Passepartout/Sources/AppConstants.swift index f856014b..3170abc8 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 privacyPolicy = website.appendingPathComponent("privacy") + static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md") static let subreddit = URL(string: "https://www.reddit.com/r/passepartout")! diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 725be71a..2cf0ccfa 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -20,6 +20,10 @@ internal enum L10n { /// Join community internal static let caption = L10n.tr("Localizable", "about.cells.join_community.caption") } + internal enum PrivacyPolicy { + /// Privacy policy + internal static let caption = L10n.tr("Localizable", "about.cells.privacy_policy.caption") + } internal enum ShareGeneric { /// Invite a friend internal static let caption = L10n.tr("Localizable", "about.cells.share_generic.caption")