Show disclaimer from website

This commit is contained in:
Davide De Rosa 2018-10-29 21:22:08 +01:00
parent fe85677e68
commit 2564f2446d
6 changed files with 22 additions and 47 deletions

View File

@ -23,7 +23,6 @@ internal enum StoryboardSegue {
internal enum Organizer: String, SegueType { internal enum Organizer: String, SegueType {
case aboutSegueIdentifier = "AboutSegueIdentifier" case aboutSegueIdentifier = "AboutSegueIdentifier"
case addProviderSegueIdentifier = "AddProviderSegueIdentifier" case addProviderSegueIdentifier = "AddProviderSegueIdentifier"
case disclaimerSegueIdentifier = "DisclaimerSegueIdentifier"
case importHostSegueIdentifier = "ImportHostSegueIdentifier" case importHostSegueIdentifier = "ImportHostSegueIdentifier"
case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier" case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier"
case showImportedHostsSegueIdentifier = "ShowImportedHostsSegueIdentifier" case showImportedHostsSegueIdentifier = "ShowImportedHostsSegueIdentifier"

View File

@ -39,7 +39,7 @@ class AboutViewController: UITableViewController, TableModelHost {
model.setHeader(L10n.About.Sections.Source.header, for: .source) model.setHeader(L10n.About.Sections.Source.header, for: .source)
model.setHeader(L10n.About.Sections.Share.header, for: .share) model.setHeader(L10n.About.Sections.Share.header, for: .share)
model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) 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([.sourcePassepartout, .sourceTunnelKit], in: .source)
model.set([.shareTwitter, .shareGeneric], in: .share) model.set([.shareTwitter, .shareGeneric], in: .share)
model.set([.joinCommunity, .writeReview], in: .feedback) model.set([.joinCommunity, .writeReview], in: .feedback)
@ -69,14 +69,14 @@ class AboutViewController: UITableViewController, TableModelHost {
perform(segue: StoryboardSegue.Organizer.versionSegueIdentifier) perform(segue: StoryboardSegue.Organizer.versionSegueIdentifier)
} }
private func showDisclaimer() {
perform(segue: StoryboardSegue.Organizer.disclaimerSegueIdentifier)
}
private func visitWebsite() { private func visitWebsite() {
UIApplication.shared.open(AppConstants.URLs.website, options: [:], completionHandler: nil) UIApplication.shared.open(AppConstants.URLs.website, options: [:], completionHandler: nil)
} }
private func visitDisclaimer() {
UIApplication.shared.open(AppConstants.URLs.disclaimer, options: [:], completionHandler: nil)
}
private func visitPrivacyPolicy() { private func visitPrivacyPolicy() {
UIApplication.shared.open(AppConstants.URLs.privacyPolicy, options: [:], completionHandler: nil) UIApplication.shared.open(AppConstants.URLs.privacyPolicy, options: [:], completionHandler: nil)
} }
@ -108,23 +108,6 @@ class AboutViewController: UITableViewController, TableModelHost {
@IBAction private func dismiss() { @IBAction private func dismiss() {
dismiss(animated: true, completion: nil) 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: - // MARK: -
@ -143,10 +126,10 @@ extension AboutViewController {
enum RowType: Int { enum RowType: Int {
case version case version
case disclaimer
case website case website
case disclaimer
case privacyPolicy case privacyPolicy
case sourcePassepartout case sourcePassepartout
@ -186,16 +169,16 @@ extension AboutViewController {
cell.rightText = Utils.versionString() cell.rightText = Utils.versionString()
return cell return cell
case .disclaimer:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Disclaimer.title
return cell
case .website: case .website:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath) let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.Website.caption cell.leftText = L10n.About.Cells.Website.caption
return cell return cell
case .disclaimer:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.Disclaimer.caption
return cell
case .privacyPolicy: case .privacyPolicy:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath) let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.PrivacyPolicy.caption cell.leftText = L10n.About.Cells.PrivacyPolicy.caption
@ -238,12 +221,12 @@ extension AboutViewController {
case .version: case .version:
showVersion() showVersion()
case .disclaimer:
showDisclaimer()
case .website: case .website:
visitWebsite() visitWebsite()
case .disclaimer:
visitDisclaimer()
case .privacyPolicy: case .privacyPolicy:
visitPrivacyPolicy() visitPrivacyPolicy()

View File

@ -497,7 +497,6 @@
</navigationItem> </navigationItem>
<connections> <connections>
<segue destination="PMT-gj-ARE" kind="show" identifier="VersionSegueIdentifier" id="uYt-4N-PPL"/> <segue destination="PMT-gj-ARE" kind="show" identifier="VersionSegueIdentifier" id="uYt-4N-PPL"/>
<segue destination="2d7-Ad-AZr" kind="show" identifier="DisclaimerSegueIdentifier" id="HW6-RJ-VFY"/>
</connections> </connections>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AnH-Vt-JJn" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="AnH-Vt-JJn" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -577,7 +576,6 @@
<image name="logo" width="200" height="200"/> <image name="logo" width="200" height="200"/>
</resources> </resources>
<inferredMetricsTieBreakers> <inferredMetricsTieBreakers>
<segue reference="SQ0-O9-E5E"/>
<segue reference="kwN-PZ-Zg5"/> <segue reference="kwN-PZ-Zg5"/>
</inferredMetricsTieBreakers> </inferredMetricsTieBreakers>
</document> </document>

View File

@ -190,6 +190,7 @@
"about.sections.share.header" = "Share"; "about.sections.share.header" = "Share";
"about.sections.feedback.header" = "Feedback"; "about.sections.feedback.header" = "Feedback";
"about.cells.website.caption" = "Visit website"; "about.cells.website.caption" = "Visit website";
"about.cells.disclaimer.caption" = "Disclaimer";
"about.cells.privacy_policy.caption" = "Privacy policy"; "about.cells.privacy_policy.caption" = "Privacy policy";
"about.cells.share_twitter.caption" = "Tweet about it!"; "about.cells.share_twitter.caption" = "Tweet about it!";
"about.cells.share_generic.caption" = "Invite a friend"; "about.cells.share_generic.caption" = "Invite a friend";
@ -205,6 +206,3 @@
"credits.title" = "Credits"; "credits.title" = "Credits";
"credits.labels.third_parties" = "The logo is taken from the awesome Circle Icons set by Nick Roach."; "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.";

View File

@ -122,6 +122,8 @@ class AppConstants {
class URLs { class URLs {
static let website = URL(string: "https://\(Domain.name)")! static let website = URL(string: "https://\(Domain.name)")!
static let disclaimer = website.appendingPathComponent("disclaimer")
static let privacyPolicy = website.appendingPathComponent("privacy") static let privacyPolicy = website.appendingPathComponent("privacy")
static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md") static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md")

View File

@ -16,6 +16,10 @@ internal enum L10n {
/// About /// About
internal static let title = L10n.tr("Localizable", "about.title") internal static let title = L10n.tr("Localizable", "about.title")
internal enum Cells { internal enum Cells {
internal enum Disclaimer {
/// Disclaimer
internal static let caption = L10n.tr("Localizable", "about.cells.disclaimer.caption")
}
internal enum JoinCommunity { internal enum JoinCommunity {
/// Join community /// Join community
internal static let caption = L10n.tr("Localizable", "about.cells.join_community.caption") 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 Endpoint {
internal enum Cells { internal enum Cells {
internal enum AnyAddress { internal enum AnyAddress {