Skip to content

Commit 8cbe769

Browse files
committed
Convert keyboard app About tab to SwiftUI (#608)
1 parent 83caeea commit 8cbe769

12 files changed

Lines changed: 798 additions & 696 deletions

Scribe.xcodeproj/project.pbxproj

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
075257CC2F7D481E00E57E2A /* AboutTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257C92F7D481D00E57E2A /* AboutTab.swift */; };
11+
075257CD2F7D481E00E57E2A /* AboutRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257C72F7D481D00E57E2A /* AboutRowView.swift */; };
12+
075257CE2F7D481E00E57E2A /* AboutInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257C62F7D481D00E57E2A /* AboutInfoView.swift */; };
13+
075257CF2F7D481E00E57E2A /* AboutSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257C82F7D481D00E57E2A /* AboutSectionView.swift */; };
14+
075257D02F7D481E00E57E2A /* AboutTipCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257CA2F7D481D00E57E2A /* AboutTipCardView.swift */; };
15+
075257D12F7D481E00E57E2A /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075257CB2F7D481D00E57E2A /* ShareSheet.swift */; };
1016
140158992A430DD000D14E52 /* ThirdPartyLicense.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140158982A430DD000D14E52 /* ThirdPartyLicense.swift */; };
1117
1401589B2A45A07200D14E52 /* WikimediaAndScribe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1401589A2A45A07200D14E52 /* WikimediaAndScribe.swift */; };
1218
140158A22A4EDB2200D14E52 /* TableViewTemplateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140158A12A4EDB2200D14E52 /* TableViewTemplateViewController.swift */; };
13-
1406B7872A2DFCDD001DF45B /* AboutTableData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1406B7862A2DFCDD001DF45B /* AboutTableData.swift */; };
1419
1406B78C2A3209CF001DF45B /* AppExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1406B78B2A3209CF001DF45B /* AppExtensions.swift */; };
1520
146B70BD2A853A3800710BD4 /* SwipeableTabBarController in Frameworks */ = {isa = PBXBuildFile; productRef = 146B70BC2A853A3800710BD4 /* SwipeableTabBarController */; };
1621
147797B02A2CD3370044A53E /* InfoChildTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 147797AE2A2CD3370044A53E /* InfoChildTableViewCell.swift */; };
@@ -1018,7 +1023,12 @@
10181023
140158982A430DD000D14E52 /* ThirdPartyLicense.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartyLicense.swift; sourceTree = "<group>"; };
10191024
1401589A2A45A07200D14E52 /* WikimediaAndScribe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WikimediaAndScribe.swift; sourceTree = "<group>"; };
10201025
140158A12A4EDB2200D14E52 /* TableViewTemplateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewTemplateViewController.swift; sourceTree = "<group>"; };
1021-
1406B7862A2DFCDD001DF45B /* AboutTableData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTableData.swift; sourceTree = "<group>"; };
1026+
075257C62F7D481D00E57E2A /* AboutInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutInfoView.swift; sourceTree = "<group>"; };
1027+
075257C72F7D481D00E57E2A /* AboutRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutRowView.swift; sourceTree = "<group>"; };
1028+
075257C82F7D481D00E57E2A /* AboutSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutSectionView.swift; sourceTree = "<group>"; };
1029+
075257C92F7D481D00E57E2A /* AboutTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTab.swift; sourceTree = "<group>"; };
1030+
075257CA2F7D481D00E57E2A /* AboutTipCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTipCardView.swift; sourceTree = "<group>"; };
1031+
075257CB2F7D481D00E57E2A /* ShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSheet.swift; sourceTree = "<group>"; };
10221032
1406B78B2A3209CF001DF45B /* AppExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppExtensions.swift; sourceTree = "<group>"; };
10231033
144B56F22A568AC200C2F447 /* Scribe.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Scribe.entitlements; sourceTree = "<group>"; };
10241034
147797AE2A2CD3370044A53E /* InfoChildTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoChildTableViewCell.swift; sourceTree = "<group>"; };
@@ -1554,7 +1564,12 @@
15541564
147797A92A2CD2B50044A53E /* AboutTab */ = {
15551565
isa = PBXGroup;
15561566
children = (
1557-
1406B7862A2DFCDD001DF45B /* AboutTableData.swift */,
1567+
075257C62F7D481D00E57E2A /* AboutInfoView.swift */,
1568+
075257C72F7D481D00E57E2A /* AboutRowView.swift */,
1569+
075257C82F7D481D00E57E2A /* AboutSectionView.swift */,
1570+
075257C92F7D481D00E57E2A /* AboutTab.swift */,
1571+
075257CA2F7D481D00E57E2A /* AboutTipCardView.swift */,
1572+
075257CB2F7D481D00E57E2A /* ShareSheet.swift */,
15581573
14AC56832A24AED3006B1DDF /* AboutViewController.swift */,
15591574
14AC56892A261663006B1DDF /* InformationScreenVC.swift */,
15601575
);
@@ -2887,7 +2902,6 @@
28872902
CE1378C428F5D7AC00E1CBC2 /* ScribeColor.swift in Sources */,
28882903
D171946527AF31770038660B /* Conjugate.swift in Sources */,
28892904
147797B52A2CFB490044A53E /* SettingsViewController.swift in Sources */,
2890-
1406B7872A2DFCDD001DF45B /* AboutTableData.swift in Sources */,
28912905
E9202DF02F0FAA0C001590FC /* DownloadStateManager.swift in Sources */,
28922906
E996498A2E98AC6000200F53 /* IDInterfaceVariables.swift in Sources */,
28932907
3045396D293B9DDC003AE55B /* ToolTipViewDatasource.swift in Sources */,
@@ -2897,6 +2911,12 @@
28972911
D180EC0328FDFABF0018E29B /* FR-AZERTYInterfaceVariables.swift in Sources */,
28982912
D1CDED7B2A859FBF00098546 /* ENInterfaceVariables.swift in Sources */,
28992913
38BD213622D5907F00C6795D /* InstallationVC.swift in Sources */,
2914+
075257CC2F7D481E00E57E2A /* AboutTab.swift in Sources */,
2915+
075257CD2F7D481E00E57E2A /* AboutRowView.swift in Sources */,
2916+
075257CE2F7D481E00E57E2A /* AboutInfoView.swift in Sources */,
2917+
075257CF2F7D481E00E57E2A /* AboutSectionView.swift in Sources */,
2918+
075257D02F7D481E00E57E2A /* AboutTipCardView.swift in Sources */,
2919+
075257D12F7D481E00E57E2A /* ShareSheet.swift in Sources */,
29002920
D171942D27AECEB80038660B /* DEInterfaceVariables.swift in Sources */,
29012921
147797C02A2D0CDF0044A53E /* SettingsTableData.swift in Sources */,
29022922
E9F7273F2F45A6E60060B92D /* APIClient.swift in Sources */,
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
/**
4+
* Detail information screens navigated to from the About tab.
5+
*/
6+
7+
import SwiftUI
8+
9+
enum AboutInfoSection {
10+
case wikimedia
11+
case privacyPolicy
12+
case licenses
13+
}
14+
15+
struct AboutInfoView: View {
16+
let section: AboutInfoSection
17+
18+
private var title: String {
19+
switch section {
20+
case .wikimedia:
21+
return NSLocalizedString(
22+
"i18n.app.about.community.wikimedia", value: "Wikimedia and Scribe", comment: "")
23+
case .privacyPolicy:
24+
return NSLocalizedString(
25+
"i18n._global.privacy_policy", value: "Privacy policy", comment: "")
26+
case .licenses:
27+
return NSLocalizedString(
28+
"i18n.app.about.legal.third_party", value: "Third-party licenses", comment: "")
29+
}
30+
}
31+
32+
private var caption: String {
33+
switch section {
34+
case .wikimedia:
35+
return NSLocalizedString(
36+
"i18n.app.about.community.wikimedia.caption", value: "How we work together",
37+
comment: "")
38+
case .privacyPolicy:
39+
return NSLocalizedString(
40+
"i18n.app.about.legal.privacy_policy.caption", value: "Keeping you safe",
41+
comment: "")
42+
case .licenses:
43+
return NSLocalizedString(
44+
"i18n.app.about.legal.third_party.caption", value: "Whose code we used",
45+
comment: "")
46+
}
47+
}
48+
49+
private var bodyText: String {
50+
switch section {
51+
case .wikimedia: return wikimediaBodyText
52+
case .privacyPolicy: return privacyPolicyBodyText
53+
case .licenses: return thirdPartyLicensesBodyText
54+
}
55+
}
56+
57+
var body: some View {
58+
ScrollView {
59+
VStack(alignment: .leading, spacing: 0) {
60+
VStack(alignment: .leading, spacing: 16) {
61+
Text(caption)
62+
.font(.title2)
63+
.fontWeight(.bold)
64+
.foregroundColor(.primary)
65+
66+
Text(bodyText)
67+
.font(.body)
68+
.foregroundColor(.primary)
69+
.tint(Color("linkBlue"))
70+
}
71+
.padding(20)
72+
.background(Color("lightWhiteDarkBlack"))
73+
.cornerRadius(12)
74+
.padding(.horizontal, 20)
75+
.padding(.top, 16)
76+
}
77+
.padding(.bottom, 32)
78+
}
79+
.background(Color("scribeAppBackground").ignoresSafeArea())
80+
.navigationTitle(title)
81+
.navigationBarTitleDisplayMode(.large)
82+
}
83+
}
84+
85+
// MARK: - Body text
86+
87+
private let wikimediaBodyText: String = {
88+
let t1 = NSLocalizedString(
89+
"i18n.app.about.community.wikimedia.text_1",
90+
value: "Scribe would not be possible without countless contributions by Wikimedia contributors to the many projects that they support. Specifically Scribe makes use of data from the Wikidata Lexicographical data community, as well as data from Wikipedia for each language that Scribe supports.",
91+
comment: "")
92+
let t2 = NSLocalizedString(
93+
"i18n.app.about.community.wikimedia.text_2",
94+
value: "Wikidata is a collaboratively edited multilingual knowledge graph hosted by the Wikimedia Foundation. It provides freely available data that anyone can use under a Creative Commons Public Domain license (CC0). Scribe uses language data from Wikidata to provide users with verb conjugations, noun-form annotations, noun plurals, and many other features.",
95+
comment: "")
96+
let t3 = NSLocalizedString(
97+
"i18n.app.about.community.wikimedia.text_3",
98+
value: "Wikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers through open collaboration and a wiki-based editing system. Scribe uses data from Wikipedia to produce autosuggestions by deriving the most common words in a language as well as the most common words that follow them.",
99+
comment: "")
100+
return [t1, t2, t3].joined(separator: "\n\n")
101+
}()
102+
103+
private let privacyPolicyBodyText: String = NSLocalizedString(
104+
"i18n.app.about.legal.privacy_policy.text",
105+
value: """
106+
Please note that the English version of this policy takes precedence over all other versions.
107+
108+
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.
109+
110+
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).
111+
112+
USER INFORMATION is specifically defined as any information related to the USERS themselves or the devices they use to access the SERVICE.
113+
114+
USER DATA is specifically defined as any text that is typed or actions that are done by the USERS while using the SERVICE.
115+
116+
1. Policy Statement
117+
118+
This SERVICE does not access, track, collect, retain, use, or disclose any USER INFORMATION or USER DATA.
119+
120+
2. Do Not Track
121+
122+
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.
123+
124+
3. Third-Party Data
125+
126+
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, Wikipedia and Unicode. 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. Unicode provides permission, "… free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the "Data Files") or Unicode software and any associated documentation (the "Software") to deal in the Data Files or Software without restriction…" The policy detailing Unicode data usage can be found at https://www.unicode.org/license.txt.
127+
128+
4. Third-Party Source Code
129+
130+
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 Custom Keyboard by Ethan Sarif-Kattan. Custom Keyboard was released under an MIT license, with this license being available at https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE.
131+
132+
5. Third-Party Services
133+
134+
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 an 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.
135+
136+
6. Third-Party Links
137+
138+
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.
139+
140+
7. Third-Party Images
141+
142+
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.
143+
144+
8. Content Notice
145+
146+
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.
147+
148+
9. Changes
149+
150+
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 USERS to periodically review this POLICY for the latest information on our privacy practices and to familiarize themselves with any changes.
151+
152+
10. Contact
153+
154+
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.
155+
156+
11. Effective Date
157+
158+
This POLICY is effective as of the 24th of May, 2022.
159+
""",
160+
comment: ""
161+
)
162+
163+
private let thirdPartyLicensesBodyText: String = {
164+
let intro = NSLocalizedString(
165+
"i18n.app.about.legal.third_party.text",
166+
value: "The Scribe developers (SCRIBE) built the iOS application \"Scribe - Language Keyboards\" (SERVICE) using 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. This section lists the source code on which the SERVICE was based as well as the coinciding licenses of each.\n\nThe following is a list of all used source code, the main author or authors of the code, the license under which it was released at time of usage, and a link to the license.",
167+
comment: "")
168+
let entry1 = NSLocalizedString(
169+
"i18n.app.about.legal.third_party.entry_custom_keyboard",
170+
value: "Custom Keyboard\n• Author: EthanSK\n• License: MIT\n• Link: https://github.com/EthanSK/CustomKeyboard/blob/master/LICENSE",
171+
comment: "")
172+
let entry2 = NSLocalizedString(
173+
"i18n.app.about.legal.third_party.entry_simple_keyboard",
174+
value: "Simple Keyboard\n• Author: Simple Mobile Tools\n• License: GPL-3.0\n• Link: https://github.com/SimpleMobileTools/Simple-Keyboard/blob/main/LICENSE",
175+
comment: "")
176+
return "\(intro)\n\n1. \(entry1)\n\n2. \(entry2)"
177+
}()

0 commit comments

Comments
 (0)