diff --git a/Scribe/AppTexts/AppTextStyling.swift b/Scribe/AppTexts/AppTextStyling.swift index 66831e74..30bfc398 100644 --- a/Scribe/AppTexts/AppTextStyling.swift +++ b/Scribe/AppTexts/AppTextStyling.swift @@ -81,3 +81,38 @@ func getGlobeIcon(fontSize: CGFloat) -> NSAttributedString { return NSAttributedString(attachment: globeAttachment) } + +/// 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.5)] + ) + + let wikidataDataLicensing: String = "https://www.wikidata.org/wiki/Wikidata:Licensing" + let wikipediaDataLicensing: String = "https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_content" + let huggingFaceLicensing: String = "https://github.com/huggingface/transformers/blob/master/LICENSE" + let scribeGitHub: String = "https://github.com/scribe-org" + let scribeEmail: String = "scribe.langauge@gmail.com" + let gitHubLogoLicensing: String = "https://github.com/logos" + let wikidataLogoLicensing: String = "https://foundation.wikimedia.org/wiki/Policy:Trademark_policy" + let customKeyboardLicense: String = "https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE" + + let privacyPolicyTextWithLinks = addHyperLinks( + originalText: text, + links: [ + wikidataDataLicensing: wikidataDataLicensing, + wikipediaDataLicensing: wikipediaDataLicensing, + huggingFaceLicensing: huggingFaceLicensing, + scribeGitHub: scribeGitHub, + scribeEmail: "mailto:" + scribeEmail, + gitHubLogoLicensing: gitHubLogoLicensing, + wikidataLogoLicensing: wikidataLogoLicensing, + customKeyboardLicense: customKeyboardLicense], + fontSize: fontSize + ) + + return concatAttributedStrings( + left: privacyTextTitle, + right: privacyPolicyTextWithLinks + ) +} diff --git a/Scribe/AppTexts/English/ENPrivacyPolicy.swift b/Scribe/AppTexts/English/ENPrivacyPolicy.swift index bab95bfb..49fc24c4 100644 --- a/Scribe/AppTexts/English/ENPrivacyPolicy.swift +++ b/Scribe/AppTexts/English/ENPrivacyPolicy.swift @@ -6,47 +6,12 @@ // PRIVACY.txt is formatted for GitHub, and this is formatted for modular sizing. // -import UIKit - -/// Formats and returns the text of the Scribe privacy policy. -func setENPrivacyPolicy(fontSize: CGFloat) -> NSMutableAttributedString { - let privacyTextTitle = NSMutableAttributedString(string: """ - Privacy Policy - """, attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: fontSize * 1.5)]) - - let wikidataDataLicensing: String = "https://www.wikidata.org/wiki/Wikidata:Licensing" - let wikipediaDataLicensing: String = "https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_content" - let huggingFaceLicensing: String = "https://github.com/huggingface/transformers/blob/master/LICENSE" - let scribeGitHub: String = "https://github.com/scribe-org" - let scribeEmail: String = "scribe.langauge@gmail.com" - let gitHubLogoLicensing: String = "https://github.com/logos" - let wikidataLogoLicensing: String = "https://foundation.wikimedia.org/wiki/Policy:Trademark_policy" - let customKeyboardLicense: String = "https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE" - - let privacyPolicyTextWithLinks = addHyperLinks( - originalText: privacyPolicyText, - links: [ - wikidataDataLicensing: wikidataDataLicensing, - wikipediaDataLicensing: wikipediaDataLicensing, - huggingFaceLicensing: huggingFaceLicensing, - scribeGitHub: scribeGitHub, - scribeEmail: "mailto:" + scribeEmail, - gitHubLogoLicensing: gitHubLogoLicensing, - wikidataLogoLicensing: wikidataLogoLicensing, - customKeyboardLicense: customKeyboardLicense], - fontSize: fontSize - ) - - return concatAttributedStrings( - left: privacyTextTitle, - right: privacyPolicyTextWithLinks - ) -} +let enPrivacyPolicyTitle: String = "Privacy Policy" // swiftlint:disable all // Includes a new line so that there is space between it and the page title. -let privacyPolicyText = """ +let enPrivacyPolicyText: String = """ \n 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. diff --git a/Scribe/ViewController.swift b/Scribe/ViewController.swift index 76ad76bb..7326c0a6 100644 --- a/Scribe/ViewController.swift +++ b/Scribe/ViewController.swift @@ -261,7 +261,9 @@ class ViewController: UIViewController { privacyScroll.isHidden = false - privacyTextView.attributedText = setENPrivacyPolicy(fontSize: fontSize) + privacyTextView.attributedText = setPrivacyPolicy( + fontSize: fontSize, title: enPrivacyPolicyTitle, text: enPrivacyPolicyText + ) privacyTextView.textColor = .init(.keyChar).light }