Reuse Credits VC to add a Disclaimer

This commit is contained in:
Davide De Rosa 2018-10-18 10:17:41 +02:00
parent 3b8ad31ba6
commit b93000819b
7 changed files with 70 additions and 28 deletions

View File

@ -89,6 +89,7 @@ internal enum StoryboardSegue {
case aboutSegueIdentifier = "AboutSegueIdentifier" case aboutSegueIdentifier = "AboutSegueIdentifier"
case addProviderSegueIdentifier = "AddProviderSegueIdentifier" case addProviderSegueIdentifier = "AddProviderSegueIdentifier"
case creditsSegueIdentifier = "CreditsSegueIdentifier" case creditsSegueIdentifier = "CreditsSegueIdentifier"
case disclaimerSegueIdentifier = "DisclaimerSegueIdentifier"
case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier" case selectProfileSegueIdentifier = "SelectProfileSegueIdentifier"
case versionSegueIdentifier = "VersionSegueIdentifier" case versionSegueIdentifier = "VersionSegueIdentifier"
} }

View File

@ -37,7 +37,7 @@ class AboutViewController: UITableViewController, TableModelHost {
model.setHeader(L10n.About.Sections.Info.header, for: .info) model.setHeader(L10n.About.Sections.Info.header, for: .info)
model.setHeader(L10n.About.Sections.Source.header, for: .source) model.setHeader(L10n.About.Sections.Source.header, for: .source)
model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback)
model.set([.version, .credits, .website], in: .info) model.set([.version, .credits, .disclaimer, .website], in: .info)
model.set([.sourcePassepartout, .sourceTunnelKit], in: .source) model.set([.sourcePassepartout, .sourceTunnelKit], in: .source)
model.set([.discussReddit, .reportIssue, .writeReview], in: .feedback) model.set([.discussReddit, .reportIssue, .writeReview], in: .feedback)
return model return model
@ -70,6 +70,10 @@ class AboutViewController: UITableViewController, TableModelHost {
perform(segue: StoryboardSegue.Organizer.creditsSegueIdentifier) perform(segue: StoryboardSegue.Organizer.creditsSegueIdentifier)
} }
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)
} }
@ -94,6 +98,28 @@ 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 .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
default:
break
}
}
} }
// MARK: - // MARK: -
@ -112,6 +138,8 @@ extension AboutViewController {
case credits case credits
case disclaimer
case website case website
case sourcePassepartout case sourcePassepartout
@ -154,6 +182,11 @@ extension AboutViewController {
cell.leftText = L10n.Credits.title cell.leftText = L10n.Credits.title
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
@ -194,6 +227,9 @@ extension AboutViewController {
case .credits: case .credits:
showCredits() showCredits()
case .disclaimer:
showDisclaimer()
case .website: case .website:
visitWebsite() visitWebsite()

View File

@ -1,5 +1,5 @@
// //
// CreditsViewController.swift // LabelViewController.swift
// Passepartout-iOS // Passepartout-iOS
// //
// Created by Davide De Rosa on 9/26/18. // Created by Davide De Rosa on 9/26/18.
@ -25,18 +25,12 @@
import UIKit import UIKit
class CreditsViewController: UIViewController { class LabelViewController: UIViewController {
@IBOutlet private weak var scrollView: UIScrollView? @IBOutlet private weak var scrollView: UIScrollView?
// @IBOutlet private weak var labelTitle: UILabel? @IBOutlet private weak var label: UILabel?
//
// @IBOutlet private weak var labelIntro: UILabel? var text: String?
//
// @IBOutlet private weak var buttonPassepartout: UIButton?
//
// @IBOutlet private weak var buttonTunnelKit: UIButton?
@IBOutlet private weak var labelThirdParties: UILabel?
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
@ -48,15 +42,9 @@ class CreditsViewController: UIViewController {
super.viewDidLoad() super.viewDidLoad()
title = L10n.Credits.title title = L10n.Credits.title
// labelIntro?.text = L10n.Credits.Labels.intro label?.text = text
// buttonPassepartout?.setTitle(L10n.Credits.Buttons.passepartout, for: .normal)
// buttonTunnelKit?.setTitle(L10n.Credits.Buttons.tunnelkit, for: .normal)
var notices = AppConstants.Notices.all
notices.insert(L10n.Credits.Labels.thirdParties, at: 0)
labelThirdParties?.text = notices.joined(separator: "\n\n")
scrollView?.applyPrimaryBackground(Theme.current) scrollView?.applyPrimaryBackground(Theme.current)
labelThirdParties?.applyLight(Theme.current) label?.applyLight(Theme.current)
} }
} }

View File

@ -415,16 +415,17 @@
<connections> <connections>
<segue destination="2d7-Ad-AZr" kind="show" identifier="CreditsSegueIdentifier" id="tGv-dr-20P"/> <segue destination="2d7-Ad-AZr" kind="show" identifier="CreditsSegueIdentifier" id="tGv-dr-20P"/>
<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"/>
</objects> </objects>
<point key="canvasLocation" x="-3558" y="-1784"/> <point key="canvasLocation" x="-3558" y="-1784"/>
</scene> </scene>
<!--Credits View Controller--> <!--Label View Controller-->
<scene sceneID="1v7-O6-Ddh"> <scene sceneID="1v7-O6-Ddh">
<objects> <objects>
<viewController id="2d7-Ad-AZr" customClass="CreditsViewController" customModule="Passepartout_iOS" customModuleProvider="target" sceneMemberID="viewController"> <viewController id="2d7-Ad-AZr" customClass="LabelViewController" customModule="Passepartout_iOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="e1G-CS-7AH"> <view key="view" contentMode="scaleToFill" id="e1G-CS-7AH">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -438,7 +439,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UkA-Yl-a47"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UkA-Yl-a47">
<rect key="frame" x="23" y="30" width="329" height="18"/> <rect key="frame" x="23" y="30" width="329" height="18"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="&lt;third_parties&gt;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KWp-cG-SuG"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="&lt;label&gt;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KWp-cG-SuG">
<rect key="frame" x="0.0" y="0.0" width="329" height="18"/> <rect key="frame" x="0.0" y="0.0" width="329" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/> <fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/> <nil key="textColor"/>
@ -481,7 +482,7 @@
<viewLayoutGuide key="safeArea" id="skL-cM-vUB"/> <viewLayoutGuide key="safeArea" id="skL-cM-vUB"/>
</view> </view>
<connections> <connections>
<outlet property="labelThirdParties" destination="KWp-cG-SuG" id="Q8g-Wp-C1j"/> <outlet property="label" destination="KWp-cG-SuG" id="us3-ss-xAX"/>
<outlet property="scrollView" destination="6iI-GI-SMq" id="uWc-do-1WG"/> <outlet property="scrollView" destination="6iI-GI-SMq" id="uWc-do-1WG"/>
</connections> </connections>
</viewController> </viewController>
@ -493,4 +494,7 @@
<resources> <resources>
<image name="logo" width="200" height="200"/> <image name="logo" width="200" height="200"/>
</resources> </resources>
<inferredMetricsTieBreakers>
<segue reference="HW6-RJ-VFY"/>
</inferredMetricsTieBreakers>
</document> </document>

View File

@ -83,7 +83,7 @@
0EF5CF252141CE58004FF1BD /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5CF242141CE58004FF1BD /* HUD.swift */; }; 0EF5CF252141CE58004FF1BD /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5CF242141CE58004FF1BD /* HUD.swift */; };
0EF5CF292141F31F004FF1BD /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4FD7ED20D539A0002221FF /* Utils.swift */; }; 0EF5CF292141F31F004FF1BD /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4FD7ED20D539A0002221FF /* Utils.swift */; };
0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943D215BE10800529B64 /* IssueReporter.swift */; }; 0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943D215BE10800529B64 /* IssueReporter.swift */; };
0EFD9440215BED8E00529B64 /* CreditsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943F215BED8E00529B64 /* CreditsViewController.swift */; }; 0EFD9440215BED8E00529B64 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943F215BED8E00529B64 /* LabelViewController.swift */; };
390EEC911382C4814FB97475 /* Pods_Passepartout_iOS_Tunnel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D0C619B826C7140001C0F32 /* Pods_Passepartout_iOS_Tunnel.framework */; }; 390EEC911382C4814FB97475 /* Pods_Passepartout_iOS_Tunnel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D0C619B826C7140001C0F32 /* Pods_Passepartout_iOS_Tunnel.framework */; };
61E05ED5CCEEA859AD1752F3 /* Pods_Passepartout_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9FBA5419C4B758FB5D68E96 /* Pods_Passepartout_iOS.framework */; }; 61E05ED5CCEEA859AD1752F3 /* Pods_Passepartout_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9FBA5419C4B758FB5D68E96 /* Pods_Passepartout_iOS.framework */; };
CB086D724184B22B368E5BEF /* Pods_PassepartoutTests_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E80C2390BBF547A62D4D277 /* Pods_PassepartoutTests_iOS.framework */; }; CB086D724184B22B368E5BEF /* Pods_PassepartoutTests_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E80C2390BBF547A62D4D277 /* Pods_PassepartoutTests_iOS.framework */; };
@ -204,7 +204,7 @@
0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; }; 0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
0EF5CF242141CE58004FF1BD /* HUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; }; 0EF5CF242141CE58004FF1BD /* HUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
0EFD943D215BE10800529B64 /* IssueReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueReporter.swift; sourceTree = "<group>"; }; 0EFD943D215BE10800529B64 /* IssueReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueReporter.swift; sourceTree = "<group>"; };
0EFD943F215BED8E00529B64 /* CreditsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditsViewController.swift; sourceTree = "<group>"; }; 0EFD943F215BED8E00529B64 /* LabelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelViewController.swift; sourceTree = "<group>"; };
28B2E6590DE79C3B403348DC /* Pods-Passepartout-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Passepartout-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Passepartout-iOS/Pods-Passepartout-iOS.debug.xcconfig"; sourceTree = "<group>"; }; 28B2E6590DE79C3B403348DC /* Pods-Passepartout-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Passepartout-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Passepartout-iOS/Pods-Passepartout-iOS.debug.xcconfig"; sourceTree = "<group>"; };
2F14CE1B8BBCB7B187610A9E /* Pods-PassepartoutTests-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutTests-iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PassepartoutTests-iOS/Pods-PassepartoutTests-iOS.debug.xcconfig"; sourceTree = "<group>"; }; 2F14CE1B8BBCB7B187610A9E /* Pods-PassepartoutTests-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutTests-iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PassepartoutTests-iOS/Pods-PassepartoutTests-iOS.debug.xcconfig"; sourceTree = "<group>"; };
3E7BC601C2DEB273955334A5 /* Pods-PassepartoutTests-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutTests-iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-PassepartoutTests-iOS/Pods-PassepartoutTests-iOS.release.xcconfig"; sourceTree = "<group>"; }; 3E7BC601C2DEB273955334A5 /* Pods-PassepartoutTests-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutTests-iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-PassepartoutTests-iOS/Pods-PassepartoutTests-iOS.release.xcconfig"; sourceTree = "<group>"; };
@ -334,7 +334,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */, 0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */,
0EFD943F215BED8E00529B64 /* CreditsViewController.swift */, 0EFD943F215BED8E00529B64 /* LabelViewController.swift */,
0EBE3A78213C4E5400BFA2F5 /* OrganizerViewController.swift */, 0EBE3A78213C4E5400BFA2F5 /* OrganizerViewController.swift */,
0E3DA370215CB5BF00B40FC9 /* VersionViewController.swift */, 0E3DA370215CB5BF00B40FC9 /* VersionViewController.swift */,
0ED38AD8213F33150004D387 /* WizardHostViewController.swift */, 0ED38AD8213F33150004D387 /* WizardHostViewController.swift */,
@ -818,7 +818,7 @@
0E2B494220FD16540094784C /* TransientStore.swift in Sources */, 0E2B494220FD16540094784C /* TransientStore.swift in Sources */,
0E89DFC5213DF7AE00741BA1 /* Preferences.swift in Sources */, 0E89DFC5213DF7AE00741BA1 /* Preferences.swift in Sources */,
0E6BE13A20CFB76800A6DD36 /* ApplicationError.swift in Sources */, 0E6BE13A20CFB76800A6DD36 /* ApplicationError.swift in Sources */,
0EFD9440215BED8E00529B64 /* CreditsViewController.swift in Sources */, 0EFD9440215BED8E00529B64 /* LabelViewController.swift in Sources */,
0ED31C2C20CF2D6F0027975F /* ProviderPoolViewController.swift in Sources */, 0ED31C2C20CF2D6F0027975F /* ProviderPoolViewController.swift in Sources */,
0E2B494020FCFF990094784C /* Theme+Titles.swift in Sources */, 0E2B494020FCFF990094784C /* Theme+Titles.swift in Sources */,
0E05C5D520D1645F006EE732 /* SettingTableViewCell.swift in Sources */, 0E05C5D520D1645F006EE732 /* SettingTableViewCell.swift in Sources */,

View File

@ -182,3 +182,6 @@
"credits.title" = "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."; "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.";
"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

@ -239,6 +239,16 @@ 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 {