Skip to content

Commit d2e4c67

Browse files
committed
#372 code and comment formatting
1 parent f450a0a commit d2e4c67

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

Keyboards/KeyboardsBase/InterfaceVariables.swift

-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ let languagesAbbrDict = [
132132
"Swedish": "sv",
133133
]
134134

135-
136135
/// Returns the abbreviation of the language for use in commands.
137136
func getControllerLanguageAbbr() -> String {
138137
guard let abbreviation = languagesAbbrDict[controllerLanguage] else {

Scribe/Components/ParentTableViewCell/ParentTableViewCell.swift

+17-13
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,24 @@ extension ParentTableViewCell: UITableViewDelegate {
144144

145145
case .specificLang:
146146
if let viewController = parentViewController?.storyboard?.instantiateViewController(identifier: "TableViewTemplateViewController") as? TableViewTemplateViewController {
147-
let accentKeyLanguages: [String] = ["Swedish", "German", "Spanish"]; //Languages where we can disable accent keys
148-
let accentKeyOptionIndex = SettingsTableData.languageSettingsData[0].section.firstIndex(where: {s in s.sectionTitle.elementsEqual("Disable accent characters")}) ?? -1
149-
if (accentKeyLanguages.firstIndex(of: section.sectionTitle) == nil && accentKeyOptionIndex != -1)
150-
{
151-
let accentKeySettings = SettingsTableData.languageSettingsData[0].section.remove(at: accentKeyOptionIndex )//since there are no accent keys we can remove the option.
152-
print(accentKeySettings)
153-
}
154-
else if (accentKeyLanguages.firstIndex(of: section.sectionTitle) != nil && accentKeyOptionIndex == -1)
147+
// Languages where we can disable accent keys.
148+
let accentKeyLanguages: [String] = ["Swedish", "German", "Spanish"]
149+
let accentKeyOptionIndex = SettingsTableData.languageSettingsData[0].section.firstIndex(where: {
150+
s in s.sectionTitle.elementsEqual("Disable accent characters")
151+
}) ?? -1
152+
if accentKeyLanguages.firstIndex(of: section.sectionTitle) == nil && accentKeyOptionIndex != -1
155153
{
156-
SettingsTableData.languageSettingsData[0].section.insert(Section(
157-
sectionTitle: "Disable accent characters",
158-
imageString: "info.circle",
159-
hasToggle: true,
160-
sectionState: .none(.toggleAccentCharacters)), at: 1)
154+
// As there are no accent keys we can remove the `Disable accent characters` option.
155+
let accentKeySettings = SettingsTableData.languageSettingsData[0].section.remove(at: accentKeyOptionIndex)
156+
print(accentKeySettings)
157+
} else if accentKeyLanguages.firstIndex(of: section.sectionTitle) != nil && accentKeyOptionIndex == -1
158+
{
159+
SettingsTableData.languageSettingsData[0].section.insert(Section(
160+
sectionTitle: "Disable accent characters",
161+
imageString: "info.circle",
162+
hasToggle: true,
163+
sectionState: .none(.toggleAccentCharacters)
164+
), at: 1)
161165
}
162166
viewController.configureTable(for: SettingsTableData.languageSettingsData, parentSection: section)
163167

Scribe/Components/TableViewTemplateViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import UIKit
77
class TableViewTemplateViewController: UIViewController {
88
@IBOutlet var mainTable: UITableView!
99

10-
var screenTitle: String = ""
10+
var screenTitle: String = ""
1111
var tableData: [ParentTableCellModel] = []
1212
var parentSection: Section?
1313

Scribe/SettingsTab/SettingsTableData.swift

+6-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct SettingsTableData {
2121
hasDynamicData: .installedKeyboards
2222
),
2323
]
24-
24+
2525
static var languageSettingsData: [ParentTableCellModel] = [
2626
ParentTableCellModel(
2727
headingTitle: "Layout",
@@ -32,12 +32,12 @@ struct SettingsTableData {
3232
hasToggle: true,
3333
sectionState: .none(.toggleCommaAndPeriod)
3434
),
35-
Section(
35+
Section(
3636
sectionTitle: "Disable accent characters",
3737
imageString: "info.circle",
3838
hasToggle: true,
3939
sectionState: .none(.toggleAccentCharacters)
40-
)
40+
),
4141
],
4242
hasDynamicData: nil
4343
),
@@ -49,12 +49,12 @@ struct SettingsTableData {
4949
imageString: "info.circle",
5050
hasToggle: true,
5151
sectionState: .none(.autosuggestEmojis)
52-
)
52+
),
5353
],
5454
hasDynamicData: nil
55-
)
55+
),
5656
]
57-
57+
5858
static func getInstalledKeyboardsSections() -> [Section] {
5959
var installedKeyboards = [String]()
6060

@@ -86,5 +86,3 @@ struct SettingsTableData {
8686
return sections
8787
}
8888
}
89-
90-

0 commit comments

Comments
 (0)