From f9c37240ae81b48697d31dc97050b59b287b251f Mon Sep 17 00:00:00 2001 From: Saurabh Jamadagni Date: Wed, 14 Jun 2023 18:01:26 +0530 Subject: [PATCH 1/7] intermediate commit to save scrollview changes --- Scribe/Base.lproj/AppScreen.storyboard | 74 +++++++++++++----- .../ParentTableViewCell.swift | 3 + Scribe/ParentTableCellModel.swift | 29 +++---- .../ViewControllers/InformationScreenVC.swift | 77 ++++++++++++++++++- 4 files changed, 145 insertions(+), 38 deletions(-) diff --git a/Scribe/Base.lproj/AppScreen.storyboard b/Scribe/Base.lproj/AppScreen.storyboard index e4eedc08..93fbd88a 100644 --- a/Scribe/Base.lproj/AppScreen.storyboard +++ b/Scribe/Base.lproj/AppScreen.storyboard @@ -50,38 +50,72 @@ - - - - - + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + - - + + + - + diff --git a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift index 41e5d8e3..4797c9d6 100644 --- a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift +++ b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift @@ -97,6 +97,9 @@ extension ParentTableViewCell: UITableViewDelegate { case .privacyPolicy: // Push a new screen print("Scribe privacy policy page") + if let viewController = parentViewController?.storyboard?.instantiateViewController(identifier: "InformationScreenVC") as? InformationScreenVC { + parentViewController?.navigationController?.pushViewController(viewController, animated: true) + } case .licenses: // Push a new screen print("Licenses page") diff --git a/Scribe/ParentTableCellModel.swift b/Scribe/ParentTableCellModel.swift index d44a4e63..d271ada3 100644 --- a/Scribe/ParentTableCellModel.swift +++ b/Scribe/ParentTableCellModel.swift @@ -11,23 +11,24 @@ struct ParentTableCellModel { } struct Section { - enum SectionState { - case github - case matrix - case wikimedia - case shareScribe - case rateScribe - case bugReport - case email -// case appHints - case privacyPolicy - case licenses - case appLang - case specificLang - } let sectionTitle: String let imageString: String let hasToggle: Bool let sectionState: SectionState } + +enum SectionState { + case github + case matrix + case wikimedia + case shareScribe + case rateScribe + case bugReport + case email +// case appHints + case privacyPolicy + case licenses + case appLang + case specificLang +} diff --git a/Scribe/ViewControllers/InformationScreenVC.swift b/Scribe/ViewControllers/InformationScreenVC.swift index 168aaf80..907549aa 100644 --- a/Scribe/ViewControllers/InformationScreenVC.swift +++ b/Scribe/ViewControllers/InformationScreenVC.swift @@ -6,16 +6,85 @@ import UIKit class InformationScreenVC: UIViewController { @IBOutlet var headingLabel: UILabel! - @IBOutlet var spacer: UIView! + @IBOutlet var textView: UITextView! + @IBOutlet var containerView: UIView! var text: String = "" var screenTitle: String = "" + var section: SectionState = .privacyPolicy + + let tempContent = """ +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. + +This privacy policy (POLICY) is used to inform the reader of the policies for the access, tracking, collection, retention, use, and disclosure of personal information (USER INFORMATION) and usage data (USER DATA) for all individuals who make use of this SERVICE (USERS). + +USER INFORMATION is specifically defined as any information related to the USERS themselves or the devices they use to access the SERVICE. + +USER DATA is specifically defined as any text that is typed or actions that are done by the USERS while using the SERVICE. + +1. Policy Statement + +This SERVICE does not access, track, collect, retain, use, or disclose any USER INFORMATION or USER DATA. + +2. Do Not Track + +USERS contacting SCRIBE to ask that their USER INFORMATION and USER DATA not be tracked will be provided with a copy of this POLICY as well as a link to all source codes as proof that they are not being tracked. + +3. Third-Party Data + +This SERVICE makes use of third-party data. All data used in the creation of this SERVICE comes from sources that allow its full use in the manner done so by the SERVICE. Specifically, the data for this SERVICE comes from Wikidata and Wikipedia. Wikidata states that, "All structured data in the main, property and lexeme namespaces is made available under the Creative Commons CC0 License; text in other namespaces is made available under the Creative Commons Attribution-Share Alike License." The policy detailing Wikidata data usage can be found at https://www.wikidata.org/wiki/Wikidata:Licensing. Wikipedia states that text data, the type of data used by the SERVICE, "... can be used under the terms of the Creative Commons Attribution Share-Alike license". The policy detailing Wikipedia data usage can be found at https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_content. + +4. Third-Party Source Code + +This SERVICE was based on third party code. All source code used in the creation of this SERVICE comes from sources that allow its full use in the manner done so by the SERVICE. Specifically, the basis of this project was the project CustomKeyboard by Ethan Sarif-Kattan. CustomKeyboard was released under an MIT license, with this license being available at https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE. + +5. Third-Party Services + +This SERVICE makes use of third-party services to manipulate some of the third-party data. Specifically, data has been translated using models from Hugging Face transformers. This service is covered by a Apache License 2.0, which states that it is available for commercial use, modification, distribution, patent use, and private use. The license for the aforementioned service can be found at https://github.com/huggingface/transformers/blob/master/LICENSE. + +6. Third-Party Links + +This SERVICE contains links to external websites. If USERS click on a third-party link, they will be directed to a website. Note that these external websites are not operated by this SERVICE. Therefore, USERS are strongly advised to review the privacy policy of these websites. This SERVICE has no control over and assumes no responsibility for the content, privacy policies, or practices of any third-party sites or services. + +7. Third-Party Images + +This SERVICE contains images that are copyrighted by third-parties. Specifically this app includes a copy of the logos of GitHub, Inc and Wikidata, trademarked by Wikimedia Foundation, Inc. The terms by which the GitHub logo can be used are found on https://github.com/logos, and the terms for the Wikidata logo are found on the following Wikimedia page: https://foundation.wikimedia.org/wiki/Policy:Trademark_policy. This SERVICE uses the copyrighted images in a way that matches these criteria, with the only deviation being a rotation of the GitHub logo that is common in the open-source community to indicate that there is a link to the GitHub website. + +8. Content Notice + +This SERVICE allows USERS to access linguistic content (CONTENT). Some of this CONTENT could be deemed inappropriate for children and legal minors. Accessing CONTENT using the SERVICE is done in a way that the information is unavailable unless explicitly known. Specifically, USERS "can" translate words, conjugate verbs, and access other grammatical features of CONTENT that may be sexual, violent, or otherwise inappropriate in nature. USERS "cannot" translate words, conjugate verbs, and access other grammatical features of CONTENT that may be sexual, violent, or otherwise inappropriate in nature if they do not already know about the nature of this CONTENT. SCRIBE takes no responsibility for the access of such CONTENT. + +9. Changes + +This POLICY is subject to change. Updates to this POLICY will replace all prior instances, and if deemed material will further be clearly stated in the next applicable update to the SERVICE. SCRIBE encourages the USERS to familiarize themselves with any changes to this POLICY. + +10. Contact + +If you have any questions, concerns, or suggestions about this POLICY, do not hesitate to visit https://github.com/scribe-org or contact SCRIBE at scribe.langauge@gmail.com. The person responsible for such inquiries is Andrew Tavis McAllister. + +11. Effective Date + +This POLICY is effective as of the 24th of May, 2022. +""" override func viewDidLoad() { super.viewDidLoad() - navigationItem.title = screenTitle - headingLabel.text = text - spacer.backgroundColor = .clear + navigationItem.title = "Privacy test" + headingLabel.text = "Test heading" + + textView.text = tempContent + + setupInformationPage() + } + + func setupInformationPage() { + containerView.backgroundColor = .clear + + + textView.backgroundColor = UIColor(named: "commandBar") + applyCornerRadius(elem: textView, radius: 16) + applyShadowEffects(elem: textView) } } From 0edce67b0ae063b0d795ed94382c5b496efa9b9a Mon Sep 17 00:00:00 2001 From: Saurabh Jamadagni Date: Thu, 15 Jun 2023 19:45:05 +0530 Subject: [PATCH 2/7] fix: adding the complete privacy policy page --- Scribe/AppExtensions.swift | 6 + Scribe/AppTexts/AppTextStyling.swift | 11 +- Scribe/AppTexts/English/ENPrivacyPolicy.swift | 2 +- Scribe/AppTexts/German/DEPrivacyPolicy.swift | 1 + Scribe/Base.lproj/AppScreen.storyboard | 71 ++++++++--- .../ParentTableViewCell.swift | 3 +- Scribe/InstallationTab/InstallationVC.swift | 18 ++- .../ViewControllers/InformationScreenVC.swift | 115 ++++++++---------- 8 files changed, 120 insertions(+), 107 deletions(-) diff --git a/Scribe/AppExtensions.swift b/Scribe/AppExtensions.swift index c76156f1..8ad8b7ef 100644 --- a/Scribe/AppExtensions.swift +++ b/Scribe/AppExtensions.swift @@ -26,3 +26,9 @@ extension UIView { return nil } } + +extension Locale { + static var userSystemLanguage: String { + return String(Locale.preferredLanguages[0].prefix(2)).uppercased() + } +} diff --git a/Scribe/AppTexts/AppTextStyling.swift b/Scribe/AppTexts/AppTextStyling.swift index d0fb1103..1864794c 100644 --- a/Scribe/AppTexts/AppTextStyling.swift +++ b/Scribe/AppTexts/AppTextStyling.swift @@ -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" @@ -106,8 +102,5 @@ func setPrivacyPolicy(fontSize: CGFloat, title: String, text: String) -> NSMutab fontSize: fontSize ) - return concatAttributedStrings( - left: privacyTextTitle, - right: privacyPolicyTextWithLinks - ) + return privacyPolicyTextWithLinks } diff --git a/Scribe/AppTexts/English/ENPrivacyPolicy.swift b/Scribe/AppTexts/English/ENPrivacyPolicy.swift index 700c6228..b27f035e 100644 --- a/Scribe/AppTexts/English/ENPrivacyPolicy.swift +++ b/Scribe/AppTexts/English/ENPrivacyPolicy.swift @@ -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. diff --git a/Scribe/AppTexts/German/DEPrivacyPolicy.swift b/Scribe/AppTexts/German/DEPrivacyPolicy.swift index 430f3375..c3b590c8 100644 --- a/Scribe/AppTexts/German/DEPrivacyPolicy.swift +++ b/Scribe/AppTexts/German/DEPrivacyPolicy.swift @@ -7,6 +7,7 @@ // let dePrivacyPolicyTitle = "Datenschutzrichtlinie" +let dePrivacyPolicyPageCaption = "Wir sorgen für Ihre Sicherheit" // swiftlint:disable all diff --git a/Scribe/Base.lproj/AppScreen.storyboard b/Scribe/Base.lproj/AppScreen.storyboard index 93fbd88a..40be795f 100644 --- a/Scribe/Base.lproj/AppScreen.storyboard +++ b/Scribe/Base.lproj/AppScreen.storyboard @@ -54,35 +54,65 @@ - + - + - - + + - - - + + @@ -108,9 +138,12 @@ - + + - + + + diff --git a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift index 4797c9d6..8c3bc219 100644 --- a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift +++ b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift @@ -95,10 +95,9 @@ extension ParentTableViewCell: UITableViewDelegate { // // reset functionality // print("Resets app hints") case .privacyPolicy: - // Push a new screen - print("Scribe privacy policy page") if let viewController = parentViewController?.storyboard?.instantiateViewController(identifier: "InformationScreenVC") as? InformationScreenVC { parentViewController?.navigationController?.pushViewController(viewController, animated: true) + viewController.section = .privacyPolicy } case .licenses: // Push a new screen diff --git a/Scribe/InstallationTab/InstallationVC.swift b/Scribe/InstallationTab/InstallationVC.swift index ac08f3e8..ecfb6139 100644 --- a/Scribe/InstallationTab/InstallationVC.swift +++ b/Scribe/InstallationTab/InstallationVC.swift @@ -37,8 +37,6 @@ class InstallationVC: UIViewController { @IBOutlet var svSpace: UIView! @IBOutlet var bottomSpace: UIView! - let userSystemLanguage = String(Locale.preferredLanguages[0].prefix(2)).uppercased() - /// Includes a call to checkDarkModeSetColors to set brand colors and a call to set the UI for the app screen. override func viewDidLoad() { super.viewDidLoad() @@ -97,9 +95,9 @@ class InstallationVC: UIViewController { /// Sets the functionality of the button that switches between installation instructions and the privacy policy. func setSwitchViewBtn() { if !displayPrivacyPolicy { - switchView.setTitle(userSystemLanguage == "DE" ? "Datenschutzrichtlinie ansehen" : "View privacy policy", for: .normal) + switchView.setTitle(Locale.userSystemLanguage == "DE" ? "Datenschutzrichtlinie ansehen" : "View privacy policy", for: .normal) } else if displayPrivacyPolicy { - switchView.setTitle(userSystemLanguage == "DE" ? "Installation ansehen" : "View installation", for: .normal) + switchView.setTitle(Locale.userSystemLanguage == "DE" ? "Installation ansehen" : "View installation", for: .normal) } switchView.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.center switchView.setTitleColor(.init(.keyChar), for: .normal) @@ -236,7 +234,7 @@ class InstallationVC: UIViewController { privacyScroll.isHidden = true // Set the texts for the fields. - switch userSystemLanguage { + switch Locale.userSystemLanguage { case "EN": appTextView.attributedText = setENInstallation(fontSize: fontSize) GHTextView.attributedText = setENGitHubText(fontSize: fontSize) @@ -278,20 +276,20 @@ class InstallationVC: UIViewController { privacyScroll.isHidden = false - switch userSystemLanguage { + switch Locale.userSystemLanguage { case "EN": privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, title: enPrivacyPolicyTitle, text: enPrivacyPolicyText + fontSize: fontSize, text: enPrivacyPolicyText ) case "DE": privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, title: dePrivacyPolicyTitle, text: dePrivacyPolicyText + fontSize: fontSize, text: dePrivacyPolicyText ) default: privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, title: enPrivacyPolicyTitle, text: enPrivacyPolicyText + fontSize: fontSize, text: enPrivacyPolicyText ) } privacyTextView.textColor = .init(.keyChar) @@ -301,7 +299,7 @@ class InstallationVC: UIViewController { func setCurrentUI() { // Sets the font size for the text in the app screen and corresponding UIImage icons. if DeviceType.isPhone { - if userSystemLanguage == "DE" { + if Locale.userSystemLanguage == "DE" { fontSize = UIScreen.main.bounds.height / 61 } else { fontSize = UIScreen.main.bounds.height / 59 diff --git a/Scribe/ViewControllers/InformationScreenVC.swift b/Scribe/ViewControllers/InformationScreenVC.swift index 907549aa..40f6adc1 100644 --- a/Scribe/ViewControllers/InformationScreenVC.swift +++ b/Scribe/ViewControllers/InformationScreenVC.swift @@ -7,84 +7,67 @@ import UIKit class InformationScreenVC: UIViewController { @IBOutlet var headingLabel: UILabel! @IBOutlet var textView: UITextView! - @IBOutlet var containerView: UIView! + @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 - - let tempContent = """ -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. - -This privacy policy (POLICY) is used to inform the reader of the policies for the access, tracking, collection, retention, use, and disclosure of personal information (USER INFORMATION) and usage data (USER DATA) for all individuals who make use of this SERVICE (USERS). - -USER INFORMATION is specifically defined as any information related to the USERS themselves or the devices they use to access the SERVICE. - -USER DATA is specifically defined as any text that is typed or actions that are done by the USERS while using the SERVICE. - -1. Policy Statement - -This SERVICE does not access, track, collect, retain, use, or disclose any USER INFORMATION or USER DATA. - -2. Do Not Track - -USERS contacting SCRIBE to ask that their USER INFORMATION and USER DATA not be tracked will be provided with a copy of this POLICY as well as a link to all source codes as proof that they are not being tracked. - -3. Third-Party Data - -This SERVICE makes use of third-party data. All data used in the creation of this SERVICE comes from sources that allow its full use in the manner done so by the SERVICE. Specifically, the data for this SERVICE comes from Wikidata and Wikipedia. Wikidata states that, "All structured data in the main, property and lexeme namespaces is made available under the Creative Commons CC0 License; text in other namespaces is made available under the Creative Commons Attribution-Share Alike License." The policy detailing Wikidata data usage can be found at https://www.wikidata.org/wiki/Wikidata:Licensing. Wikipedia states that text data, the type of data used by the SERVICE, "... can be used under the terms of the Creative Commons Attribution Share-Alike license". The policy detailing Wikipedia data usage can be found at https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_content. - -4. Third-Party Source Code - -This SERVICE was based on third party code. All source code used in the creation of this SERVICE comes from sources that allow its full use in the manner done so by the SERVICE. Specifically, the basis of this project was the project CustomKeyboard by Ethan Sarif-Kattan. CustomKeyboard was released under an MIT license, with this license being available at https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE. - -5. Third-Party Services - -This SERVICE makes use of third-party services to manipulate some of the third-party data. Specifically, data has been translated using models from Hugging Face transformers. This service is covered by a Apache License 2.0, which states that it is available for commercial use, modification, distribution, patent use, and private use. The license for the aforementioned service can be found at https://github.com/huggingface/transformers/blob/master/LICENSE. - -6. Third-Party Links - -This SERVICE contains links to external websites. If USERS click on a third-party link, they will be directed to a website. Note that these external websites are not operated by this SERVICE. Therefore, USERS are strongly advised to review the privacy policy of these websites. This SERVICE has no control over and assumes no responsibility for the content, privacy policies, or practices of any third-party sites or services. - -7. Third-Party Images - -This SERVICE contains images that are copyrighted by third-parties. Specifically this app includes a copy of the logos of GitHub, Inc and Wikidata, trademarked by Wikimedia Foundation, Inc. The terms by which the GitHub logo can be used are found on https://github.com/logos, and the terms for the Wikidata logo are found on the following Wikimedia page: https://foundation.wikimedia.org/wiki/Policy:Trademark_policy. This SERVICE uses the copyrighted images in a way that matches these criteria, with the only deviation being a rotation of the GitHub logo that is common in the open-source community to indicate that there is a link to the GitHub website. - -8. Content Notice - -This SERVICE allows USERS to access linguistic content (CONTENT). Some of this CONTENT could be deemed inappropriate for children and legal minors. Accessing CONTENT using the SERVICE is done in a way that the information is unavailable unless explicitly known. Specifically, USERS "can" translate words, conjugate verbs, and access other grammatical features of CONTENT that may be sexual, violent, or otherwise inappropriate in nature. USERS "cannot" translate words, conjugate verbs, and access other grammatical features of CONTENT that may be sexual, violent, or otherwise inappropriate in nature if they do not already know about the nature of this CONTENT. SCRIBE takes no responsibility for the access of such CONTENT. - -9. Changes - -This POLICY is subject to change. Updates to this POLICY will replace all prior instances, and if deemed material will further be clearly stated in the next applicable update to the SERVICE. SCRIBE encourages the USERS to familiarize themselves with any changes to this POLICY. - -10. Contact - -If you have any questions, concerns, or suggestions about this POLICY, do not hesitate to visit https://github.com/scribe-org or contact SCRIBE at scribe.langauge@gmail.com. The person responsible for such inquiries is Andrew Tavis McAllister. - -11. Effective Date - -This POLICY is effective as of the 24th of May, 2022. -""" override func viewDidLoad() { super.viewDidLoad() - - navigationItem.title = "Privacy test" - headingLabel.text = "Test heading" - textView.text = tempContent + setupInformationPageUI() - setupInformationPage() + if section == .privacyPolicy { + setupPrivacyPolicyPage() + } } - func setupInformationPage() { - containerView.backgroundColor = .clear + func setupInformationPageUI() { + scrollContainerView.backgroundColor = .clear + + textView.backgroundColor = UIColor(named: "commandBar") + contentContainerView.backgroundColor = UIColor(named: "commandBar") + applyCornerRadius(elem: contentContainerView, radius: 16) + applyShadowEffects(elem: contentContainerView) + cornerImageView.clipsToBounds = true + contentContainerView.clipsToBounds = true - textView.backgroundColor = UIColor(named: "commandBar") - applyCornerRadius(elem: textView, radius: 16) - applyShadowEffects(elem: textView) + 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 } } From 1ff9191f914a1104b977f7995b50e0e16058e486 Mon Sep 17 00:00:00 2001 From: Saurabh Jamadagni Date: Thu, 15 Jun 2023 19:45:48 +0530 Subject: [PATCH 3/7] fix: file reorganising --- Scribe.xcodeproj/project.pbxproj | 10 +--------- .../InformationScreenVC.swift | 0 2 files changed, 1 insertion(+), 9 deletions(-) rename Scribe/{ViewControllers => AboutTab}/InformationScreenVC.swift (100%) diff --git a/Scribe.xcodeproj/project.pbxproj b/Scribe.xcodeproj/project.pbxproj index 06b98142..bd458cd1 100644 --- a/Scribe.xcodeproj/project.pbxproj +++ b/Scribe.xcodeproj/project.pbxproj @@ -1079,6 +1079,7 @@ children = ( 14AC56832A24AED3006B1DDF /* AboutViewController.swift */, 1406B7862A2DFCDD001DF45B /* AboutTableData.swift */, + 14AC56892A261663006B1DDF /* InformationScreenVC.swift */, ); path = AboutTab; sourceTree = ""; @@ -1092,14 +1093,6 @@ path = SettingsTab; sourceTree = ""; }; - 14AC568D2A262EE5006B1DDF /* ViewControllers */ = { - isa = PBXGroup; - children = ( - 14AC56892A261663006B1DDF /* InformationScreenVC.swift */, - ); - path = ViewControllers; - sourceTree = ""; - }; 30453961293B9D05003AE55B /* ToolTip */ = { isa = PBXGroup; children = ( @@ -1173,7 +1166,6 @@ 147797B62A2CFB560044A53E /* SettingsTab */, 147797A92A2CD2B50044A53E /* AboutTab */, D1A2DCAF27AD378F0057A10D /* AppTexts */, - 14AC568D2A262EE5006B1DDF /* ViewControllers */, 1406B7832A2DFCA2001DF45B /* Components */, 147797B22A2CD5AB0044A53E /* ParentTableCellModel.swift */, 38BD213322D5907F00C6795D /* AppDelegate.swift */, diff --git a/Scribe/ViewControllers/InformationScreenVC.swift b/Scribe/AboutTab/InformationScreenVC.swift similarity index 100% rename from Scribe/ViewControllers/InformationScreenVC.swift rename to Scribe/AboutTab/InformationScreenVC.swift From 389272b084b134d958936b4b7c88bc0b2ba27e41 Mon Sep 17 00:00:00 2001 From: Saurabh Jamadagni Date: Mon, 19 Jun 2023 15:31:49 +0530 Subject: [PATCH 4/7] fix: fixing inconsistencies with UI and making corner radius calculation uniform --- Scribe/AboutTab/InformationScreenVC.swift | 2 +- Scribe/Base.lproj/AppScreen.storyboard | 8 ++++---- .../ParentTableViewCell/ParentTableViewCell.swift | 6 ++---- Scribe/ParentTableCellModel.swift | 1 - Scribe/SettingsTab/SettingsViewController.swift | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Scribe/AboutTab/InformationScreenVC.swift b/Scribe/AboutTab/InformationScreenVC.swift index 40f6adc1..2629deb9 100644 --- a/Scribe/AboutTab/InformationScreenVC.swift +++ b/Scribe/AboutTab/InformationScreenVC.swift @@ -32,7 +32,7 @@ class InformationScreenVC: UIViewController { textView.backgroundColor = UIColor(named: "commandBar") contentContainerView.backgroundColor = UIColor(named: "commandBar") - applyCornerRadius(elem: contentContainerView, radius: 16) + applyCornerRadius(elem: contentContainerView, radius: contentContainerView.frame.width * 0.05) applyShadowEffects(elem: contentContainerView) cornerImageView.clipsToBounds = true diff --git a/Scribe/Base.lproj/AppScreen.storyboard b/Scribe/Base.lproj/AppScreen.storyboard index 40be795f..958700c2 100644 --- a/Scribe/Base.lproj/AppScreen.storyboard +++ b/Scribe/Base.lproj/AppScreen.storyboard @@ -166,10 +166,10 @@ - + - - - - - - - - - - - - - - + + - + @@ -308,14 +276,14 @@ - + @@ -363,49 +331,32 @@ - - - - - - + - - - - - - - - - - - - @@ -414,20 +365,14 @@ - - - - - - @@ -435,7 +380,6 @@ - @@ -446,16 +390,9 @@ - - - - - - - @@ -516,7 +453,6 @@ - @@ -538,14 +474,11 @@ - - + + - - - diff --git a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift index 99b8d73f..a06bdd86 100644 --- a/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift +++ b/Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift @@ -70,8 +70,6 @@ extension ParentTableViewCell: UITableViewDataSource { /// Function implementation conforming to the UITableViewDelegate protocol. extension ParentTableViewCell: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - print(data?.section[indexPath.row].sectionTitle ?? "") - if let section = data?.section[indexPath.row] { switch section.sectionState { case .github: diff --git a/Scribe/InstallationTab/InstallationVC.swift b/Scribe/InstallationTab/InstallationVC.swift index ecfb6139..eb0dcca4 100644 --- a/Scribe/InstallationTab/InstallationVC.swift +++ b/Scribe/InstallationTab/InstallationVC.swift @@ -23,19 +23,9 @@ class InstallationVC: UIViewController { @IBOutlet var GHBtn: UIButton! @IBOutlet var GHCorner: UIImageView! - @IBOutlet var privacyTextBackground: UIView! - @IBOutlet var privacyTextView: UITextView! - @IBOutlet var privacyScroll: UIImageView! - - @IBOutlet var switchView: UIButton! - @IBOutlet var switchViewBackground: UIView! - var displayPrivacyPolicy = false - // Spacing views to size app screen proportionally. @IBOutlet var topSpace: UIView! @IBOutlet var logoSpace: UIView! - @IBOutlet var svSpace: UIView! - @IBOutlet var bottomSpace: UIView! /// Includes a call to checkDarkModeSetColors to set brand colors and a call to set the UI for the app screen. override func viewDidLoad() { @@ -90,33 +80,6 @@ class InstallationVC: UIViewController { } } - let switchViewColor = UIColor(named: "scribeCTA") - - /// Sets the functionality of the button that switches between installation instructions and the privacy policy. - func setSwitchViewBtn() { - if !displayPrivacyPolicy { - switchView.setTitle(Locale.userSystemLanguage == "DE" ? "Datenschutzrichtlinie ansehen" : "View privacy policy", for: .normal) - } else if displayPrivacyPolicy { - switchView.setTitle(Locale.userSystemLanguage == "DE" ? "Installation ansehen" : "View installation", for: .normal) - } - switchView.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.center - switchView.setTitleColor(.init(.keyChar), for: .normal) - switchView.titleLabel?.font = .systemFont(ofSize: fontSize * 1.5, weight: .semibold) - - switchView.clipsToBounds = true - switchView.backgroundColor = switchViewColor - applyCornerRadius(elem: switchView, radius: switchView.frame.height * 0.35) - applyShadowEffects(elem: switchView) - - switchView.addTarget(self, action: #selector(switchAppView), for: .touchUpInside) - switchView.addTarget(self, action: #selector(keyTouchDown), for: .touchDown) - - // Add a white background so that the key press doesn't show the blue app screen background. - switchViewBackground.backgroundColor = .white - switchViewBackground.clipsToBounds = true - applyCornerRadius(elem: switchViewBackground, radius: switchView.frame.height * 0.35) - } - /// Sets the functionality of the button over the keyboard installation guide that opens Settings. func setSettingsBtn() { settingsBtn.addTarget(self, action: #selector(openSettingsApp), for: .touchUpInside) @@ -134,10 +97,9 @@ class InstallationVC: UIViewController { // Set the scroll bar so that it appears on a white background regardless of light or dark mode. let scrollbarAppearance = UINavigationBarAppearance() scrollbarAppearance.configureWithOpaqueBackground() - privacyScroll.isUserInteractionEnabled = false // Disable spacing views. - let allSpacingViews: [UIView] = [topSpace, logoSpace, svSpace, bottomSpace] + let allSpacingViews: [UIView] = [topSpace, logoSpace] for view in allSpacingViews { view.isUserInteractionEnabled = false view.backgroundColor = .clear @@ -149,26 +111,21 @@ class InstallationVC: UIViewController { /// Sets properties for the app screen given the current device. func setUIDeviceProperties() { - // Height ratios to set corner radii exactly. - let installTextToSwitchBtnHeightRatio = appTextBackground.frame.height / switchViewBackground.frame.height - let GHTextToSwitchBtnHeightRatio = GHTextBackground.frame.height / switchViewBackground.frame.height - let privacyTextToSwitchBtnHeightRatio = privacyTextBackground.frame.height / switchViewBackground.frame.height - settingsCorner.layer.maskedCorners = .layerMaxXMinYCorner - settingsCorner.layer.cornerRadius = appTextBackground.frame.height * 0.4 / installTextToSwitchBtnHeightRatio + settingsCorner.layer.cornerRadius = appTextBackground.frame.width * 0.05 settingsCorner.alpha = 0.9 GHCorner.layer.maskedCorners = .layerMaxXMinYCorner - GHCorner.layer.cornerRadius = GHTextBackground.frame.height * 0.4 / GHTextToSwitchBtnHeightRatio + GHCorner.layer.cornerRadius = GHTextBackground.frame.width * 0.05 GHCorner.alpha = 0.9 settingsBtn.clipsToBounds = true settingsBtn.layer.masksToBounds = false - settingsBtn.layer.cornerRadius = appTextBackground.frame.height * 0.4 / installTextToSwitchBtnHeightRatio + settingsBtn.layer.cornerRadius = appTextBackground.frame.width * 0.05 GHBtn.clipsToBounds = true GHBtn.layer.masksToBounds = false - GHBtn.layer.cornerRadius = GHTextBackground.frame.height * 0.4 / GHTextToSwitchBtnHeightRatio + GHBtn.layer.cornerRadius = GHTextBackground.frame.width * 0.05 - let allTextViews: [UITextView] = [appTextView, GHTextView, privacyTextView] + let allTextViews: [UITextView] = [appTextView, GHTextView] // Disable text views. for textView in allTextViews { @@ -182,20 +139,14 @@ class InstallationVC: UIViewController { appTextBackground.clipsToBounds = true applyCornerRadius( elem: appTextBackground, - radius: appTextBackground.frame.height * 0.4 / installTextToSwitchBtnHeightRatio + radius: appTextBackground.frame.width * 0.05 ) GHTextBackground.isUserInteractionEnabled = false GHTextBackground.clipsToBounds = true applyCornerRadius( elem: GHTextBackground, - radius: GHTextBackground.frame.height * 0.4 / GHTextToSwitchBtnHeightRatio - ) - - privacyTextView.backgroundColor = .clear - applyCornerRadius( - elem: privacyTextBackground, - radius: privacyTextBackground.frame.height * 0.4 / privacyTextToSwitchBtnHeightRatio + radius: GHTextBackground.frame.width * 0.05 ) // Set link attributes for all textViews. @@ -225,14 +176,6 @@ class InstallationVC: UIViewController { GHTextBackground.backgroundColor = UIColor(named: "commandBar") applyShadowEffects(elem: GHTextBackground) - // Disable the privacy policy elements. - privacyTextView.isUserInteractionEnabled = false - privacyTextView.backgroundColor = .clear - privacyTextView.text = "" - privacyTextBackground.backgroundColor = .clear - - privacyScroll.isHidden = true - // Set the texts for the fields. switch Locale.userSystemLanguage { case "EN": @@ -251,50 +194,6 @@ class InstallationVC: UIViewController { GHTextView.textColor = .init(.keyChar) } - /// Sets the necessary properties for the privacy policy UI including calling the text generation function. - func setPrivacyUI() { - let privacySymbol: UIImage = getPrivacySymbol(fontSize: fontSize * 0.9) - topIconPhone.image = privacySymbol - topIconPad.image = privacySymbol - topIconPhone.tintColor = .init(.keyChar) - topIconPad.tintColor = .init(.keyChar) - - // Disable installation directions and GitHub notice elements. - settingsBtn.isUserInteractionEnabled = false - appTextView.text = "" - appTextBackground.backgroundColor = .clear - - GHBtn.isUserInteractionEnabled = false - GHCorner.isHidden = true - GHTextView.text = "" - GHTextBackground.backgroundColor = .clear - - // Enable the privacy policy elements. - privacyTextView.isUserInteractionEnabled = true - privacyTextBackground.backgroundColor = UIColor(named: "commandBar") - applyShadowEffects(elem: privacyTextBackground) - - privacyScroll.isHidden = false - - switch Locale.userSystemLanguage { - case "EN": - privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, text: enPrivacyPolicyText - ) - - case "DE": - privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, text: dePrivacyPolicyText - ) - - default: - privacyTextView.attributedText = setPrivacyPolicy( - fontSize: fontSize, text: enPrivacyPolicyText - ) - } - privacyTextView.textColor = .init(.keyChar) - } - /// Creates the current app UI by applying constraints and calling child UI functions. func setCurrentUI() { // Sets the font size for the text in the app screen and corresponding UIImage icons. @@ -308,27 +207,11 @@ class InstallationVC: UIViewController { fontSize = UIScreen.main.bounds.height / 53 } setTopIcon() - setSwitchViewBtn() setSettingsBtn() setGHBtn() setUIConstantProperties() setUIDeviceProperties() - - if !displayPrivacyPolicy { - setInstallationUI() - } else { - setPrivacyUI() - } - } - - /// Switches the view of the app based on the current view. - @objc func switchAppView() { - if !displayPrivacyPolicy { - displayPrivacyPolicy = true - } else { - displayPrivacyPolicy = false - } - setCurrentUI() + setInstallationUI() } /// Function to open the settings app that is targeted by settingsBtn. @@ -350,24 +233,13 @@ class InstallationVC: UIViewController { /// - Parameters /// - sender: the button that has been pressed. @objc func keyTouchDown(_ sender: UIButton) { - if sender == switchView { - sender.backgroundColor = .clear - sender.setTitleColor(switchViewColor, for: .normal) + sender.backgroundColor = .black + sender.alpha = 0.2 - // Bring sender's background and text colors back to their original values. - DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { [self] in - sender.backgroundColor = switchViewColor - sender.setTitleColor(.init(.keyChar).light, for: .normal) - } - } else { - sender.backgroundColor = .black - sender.alpha = 0.2 - - // Bring sender's opacity back up to fully opaque and replace the background color. - DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { - sender.backgroundColor = .clear - sender.alpha = 1.0 - } + // Bring sender's opacity back up to fully opaque and replace the background color. + DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { + sender.backgroundColor = .clear + sender.alpha = 1.0 } } } From c2acf442172e75e7f6e02bb3de95d0fc1ddc45ab Mon Sep 17 00:00:00 2001 From: Saurabh Jamadagni Date: Mon, 19 Jun 2023 17:22:18 +0530 Subject: [PATCH 7/7] design: removing redundancy from installation screen. --- Scribe/Base.lproj/AppScreen.storyboard | 186 +++++++------------- Scribe/InstallationTab/InstallationVC.swift | 49 +----- 2 files changed, 71 insertions(+), 164 deletions(-) diff --git a/Scribe/Base.lproj/AppScreen.storyboard b/Scribe/Base.lproj/AppScreen.storyboard index 03346275..871eac93 100644 --- a/Scribe/Base.lproj/AppScreen.storyboard +++ b/Scribe/Base.lproj/AppScreen.storyboard @@ -68,7 +68,7 @@ - + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. @@ -260,147 +260,104 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - - - - - + - - - - - - - - - - + + - - - - + + + + - + @@ -447,7 +404,6 @@ - @@ -474,11 +430,5 @@ - - - - - - diff --git a/Scribe/InstallationTab/InstallationVC.swift b/Scribe/InstallationTab/InstallationVC.swift index eb0dcca4..32c3a76a 100644 --- a/Scribe/InstallationTab/InstallationVC.swift +++ b/Scribe/InstallationTab/InstallationVC.swift @@ -17,12 +17,6 @@ class InstallationVC: UIViewController { @IBOutlet var topIconPad: UIImageView! @IBOutlet var settingsCorner: UIImageView! - @IBOutlet var GHTextView: UITextView! - @IBOutlet var GHTextBackground: UIView! - - @IBOutlet var GHBtn: UIButton! - @IBOutlet var GHCorner: UIImageView! - // Spacing views to size app screen proportionally. @IBOutlet var topSpace: UIView! @IBOutlet var logoSpace: UIView! @@ -86,12 +80,6 @@ class InstallationVC: UIViewController { settingsBtn.addTarget(self, action: #selector(keyTouchDown), for: .touchDown) } - /// Sets the functionality of the button over the keyboard installation guide that links to Scribe's GitHub. - func setGHBtn() { - GHBtn.addTarget(self, action: #selector(openScribeGH), for: .touchUpInside) - GHBtn.addTarget(self, action: #selector(keyTouchDown), for: .touchDown) - } - /// Sets constant properties for the app screen. func setUIConstantProperties() { // Set the scroll bar so that it appears on a white background regardless of light or dark mode. @@ -114,18 +102,13 @@ class InstallationVC: UIViewController { settingsCorner.layer.maskedCorners = .layerMaxXMinYCorner settingsCorner.layer.cornerRadius = appTextBackground.frame.width * 0.05 settingsCorner.alpha = 0.9 - GHCorner.layer.maskedCorners = .layerMaxXMinYCorner - GHCorner.layer.cornerRadius = GHTextBackground.frame.width * 0.05 - GHCorner.alpha = 0.9 + settingsBtn.titleLabel?.text = "" settingsBtn.clipsToBounds = true settingsBtn.layer.masksToBounds = false settingsBtn.layer.cornerRadius = appTextBackground.frame.width * 0.05 - GHBtn.clipsToBounds = true - GHBtn.layer.masksToBounds = false - GHBtn.layer.cornerRadius = GHTextBackground.frame.width * 0.05 - let allTextViews: [UITextView] = [appTextView, GHTextView] + let allTextViews: [UITextView] = [appTextView] // Disable text views. for textView in allTextViews { @@ -135,20 +118,13 @@ class InstallationVC: UIViewController { } // Set backgrounds and corner radii. - appTextBackground.isUserInteractionEnabled = false + appTextBackground.isUserInteractionEnabled = true appTextBackground.clipsToBounds = true applyCornerRadius( elem: appTextBackground, radius: appTextBackground.frame.width * 0.05 ) - GHTextBackground.isUserInteractionEnabled = false - GHTextBackground.clipsToBounds = true - applyCornerRadius( - elem: GHTextBackground, - radius: GHTextBackground.frame.width * 0.05 - ) - // Set link attributes for all textViews. for textView in allTextViews { textView.linkTextAttributes = [ @@ -171,27 +147,18 @@ class InstallationVC: UIViewController { appTextBackground.backgroundColor = UIColor(named: "commandBar") applyShadowEffects(elem: appTextBackground) - GHBtn.isUserInteractionEnabled = true - GHCorner.isHidden = false - GHTextBackground.backgroundColor = UIColor(named: "commandBar") - applyShadowEffects(elem: GHTextBackground) - // Set the texts for the fields. switch Locale.userSystemLanguage { case "EN": appTextView.attributedText = setENInstallation(fontSize: fontSize) - GHTextView.attributedText = setENGitHubText(fontSize: fontSize) case "DE": appTextView.attributedText = setDEInstallation(fontSize: fontSize) - GHTextView.attributedText = setDEGitHubText(fontSize: fontSize) default: appTextView.attributedText = setENInstallation(fontSize: fontSize) - GHTextView.attributedText = setENGitHubText(fontSize: fontSize) } appTextView.textColor = .init(.keyChar) - GHTextView.textColor = .init(.keyChar) } /// Creates the current app UI by applying constraints and calling child UI functions. @@ -208,7 +175,6 @@ class InstallationVC: UIViewController { } setTopIcon() setSettingsBtn() - setGHBtn() setUIConstantProperties() setUIDeviceProperties() setInstallationUI() @@ -219,15 +185,6 @@ class InstallationVC: UIViewController { UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) } - /// Function to open Scribe's GitHub page that is targeted by GHBtn. - @objc func openScribeGH() { - guard let url = URL(string: "https://github.com/scribe-org/Scribe-iOS") else { - return - } - - UIApplication.shared.open(url, options: [:], completionHandler: nil) - } - /// Function to change the key coloration given a touch down. /// /// - Parameters