Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Privacy policy text in About section #331

Merged
merged 8 commits into from
Jun 20, 2023
10 changes: 1 addition & 9 deletions Scribe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@
children = (
14AC56832A24AED3006B1DDF /* AboutViewController.swift */,
1406B7862A2DFCDD001DF45B /* AboutTableData.swift */,
14AC56892A261663006B1DDF /* InformationScreenVC.swift */,
);
path = AboutTab;
sourceTree = "<group>";
Expand All @@ -1008,14 +1009,6 @@
path = SettingsTab;
sourceTree = "<group>";
};
14AC568D2A262EE5006B1DDF /* ViewControllers */ = {
isa = PBXGroup;
children = (
14AC56892A261663006B1DDF /* InformationScreenVC.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
};
30453961293B9D05003AE55B /* ToolTip */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1088,7 +1081,6 @@
147797B62A2CFB560044A53E /* SettingsTab */,
147797A92A2CD2B50044A53E /* AboutTab */,
D1A2DCAF27AD378F0057A10D /* AppTexts */,
14AC568D2A262EE5006B1DDF /* ViewControllers */,
1406B7832A2DFCA2001DF45B /* Components */,
147797B22A2CD5AB0044A53E /* ParentTableCellModel.swift */,
38BD213322D5907F00C6795D /* AppDelegate.swift */,
Expand Down
73 changes: 73 additions & 0 deletions Scribe/AboutTab/InformationScreenVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// InformationScreenVC.swift
//

import UIKit

class InformationScreenVC: UIViewController {
@IBOutlet var headingLabel: UILabel!
@IBOutlet var textView: UITextView!
@IBOutlet var scrollContainerView: UIView!
@IBOutlet var contentContainerView: UIView!

@IBOutlet var cornerImageView: UIImageView!
@IBOutlet var iconImageView: UIImageView!

var text: String = ""
var screenTitle: String = ""
var section: SectionState = .privacyPolicy

override func viewDidLoad() {
super.viewDidLoad()

setupInformationPageUI()

if section == .privacyPolicy {
setupPrivacyPolicyPage()
}
}

func setupInformationPageUI() {
scrollContainerView.backgroundColor = .clear

textView.backgroundColor = UIColor(named: "commandBar")
contentContainerView.backgroundColor = UIColor(named: "commandBar")
applyCornerRadius(elem: contentContainerView, radius: contentContainerView.frame.width * 0.05)
applyShadowEffects(elem: contentContainerView)

cornerImageView.clipsToBounds = true
contentContainerView.clipsToBounds = true

textView.isEditable = false
}

func setupPrivacyPolicyPage() {
switch Locale.userSystemLanguage {
case "EN":
navigationItem.title = enPrivacyPolicyTitle
headingLabel.attributedText = NSMutableAttributedString(
string: enPrivacyPolicyPageCaption,
attributes: [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: fontSize * 1.2)]
)
textView.attributedText = setPrivacyPolicy(fontSize: fontSize, text: enPrivacyPolicyText)
case "DE":
navigationItem.title = dePrivacyPolicyTitle
headingLabel.attributedText = NSMutableAttributedString(
string: dePrivacyPolicyPageCaption,
attributes: [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: fontSize * 1.2)]
)
textView.attributedText = setPrivacyPolicy(fontSize: fontSize, text: dePrivacyPolicyText)

default:
navigationItem.title = enPrivacyPolicyTitle
headingLabel.attributedText = NSMutableAttributedString(
string: enPrivacyPolicyPageCaption,
attributes: [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: fontSize * 1.2)]
)
textView.attributedText = setPrivacyPolicy(fontSize: fontSize, text: enPrivacyPolicyText)
}
textView.textColor = keyCharColor
iconImageView.image = UIImage(systemName: "lock.shield")
iconImageView.tintColor = keyCharColor
}
}
6 changes: 6 additions & 0 deletions Scribe/AppExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ extension UIView {
return nil
}
}

extension Locale {
static var userSystemLanguage: String {
return String(Locale.preferredLanguages[0].prefix(2)).uppercased()
}
}
11 changes: 2 additions & 9 deletions Scribe/AppTexts/AppTextStyling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ func getGlobeIcon(fontSize: CGFloat) -> NSAttributedString {
}

/// Formats and returns the text of the Scribe privacy policy with links activated.
func setPrivacyPolicy(fontSize: CGFloat, title: String, text: String) -> NSMutableAttributedString {
let privacyTextTitle = NSMutableAttributedString(
string: title, attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: fontSize * 1.2)]
)

func setPrivacyPolicy(fontSize: CGFloat, text: String) -> NSMutableAttributedString {
let wikidataDataLicensing = "https://www.wikidata.org/wiki/Wikidata:Licensing"
let wikipediaDataLicensing = "https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_content"
let unicodeDataLicense = "https://www.unicode.org/license.txt"
Expand All @@ -106,8 +102,5 @@ func setPrivacyPolicy(fontSize: CGFloat, title: String, text: String) -> NSMutab
fontSize: fontSize
)

return concatAttributedStrings(
left: privacyTextTitle,
right: privacyPolicyTextWithLinks
)
return privacyPolicyTextWithLinks
}
2 changes: 1 addition & 1 deletion Scribe/AppTexts/English/ENPrivacyPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
//

let enPrivacyPolicyTitle = "Privacy Policy"
let enPrivacyPolicyPageCaption = "Keeping you safe"

// swiftlint:disable all

// Includes a new line so that there is space between it and the page title.
let enPrivacyPolicyText = """
\n
Please note that the English version of this policy takes precedence over all other versions.

The Scribe developers (SCRIBE) built the iOS application "Scribe - Language Keyboards" (SERVICE) as an open-source application. This SERVICE is provided by SCRIBE at no cost and is intended for use as is.
Expand Down
1 change: 1 addition & 0 deletions Scribe/AppTexts/German/DEPrivacyPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

let dePrivacyPolicyTitle = "Datenschutzrichtlinie"
let dePrivacyPolicyPageCaption = "Wir sorgen für Ihre Sicherheit"


// swiftlint:disable all
Expand Down