diff --git a/Scribe.xcodeproj/project.pbxproj b/Scribe.xcodeproj/project.pbxproj index c50be3ac..dd2feda4 100644 --- a/Scribe.xcodeproj/project.pbxproj +++ b/Scribe.xcodeproj/project.pbxproj @@ -740,6 +740,7 @@ EDC364722AE408FF0001E456 /* InterfaceConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC364682AE408F20001E456 /* InterfaceConstants.swift */; }; EDC364732AE409000001E456 /* InterfaceConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC364682AE408F20001E456 /* InterfaceConstants.swift */; }; EDC364742AE409000001E456 /* InterfaceConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC364682AE408F20001E456 /* InterfaceConstants.swift */; }; + EDEE62252B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDEE62242B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -978,6 +979,7 @@ EDB4601D2AF9FDD600BEA967 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = ""; }; EDB460202B03B3E400BEA967 /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = ""; }; EDC364682AE408F20001E456 /* InterfaceConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceConstants.swift; sourceTree = ""; }; + EDEE62242B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsetsExtensions.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1207,6 +1209,7 @@ 38BD213222D5907F00C6795D /* Scribe */ = { isa = PBXGroup; children = ( + EDEE62232B2DE64A00A0B9C1 /* Extensions */, 147797A92A2CD2B50044A53E /* AboutTab */, 38BD213322D5907F00C6795D /* AppDelegate.swift */, 1406B78B2A3209CF001DF45B /* AppExtensions.swift */, @@ -1498,6 +1501,14 @@ path = Resources; sourceTree = ""; }; + EDEE62232B2DE64A00A0B9C1 /* Extensions */ = { + isa = PBXGroup; + children = ( + EDEE62242B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift */, + ); + path = Extensions; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -2015,6 +2026,7 @@ 147797B02A2CD3370044A53E /* InfoChildTableViewCell.swift in Sources */, D1A2DCB427AD3EB50057A10D /* AppUISymbols.swift in Sources */, D171945427AF04E50038660B /* KeyboardViewController.swift in Sources */, + EDEE62252B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift in Sources */, D1CDED772A859E4800098546 /* DACommandVariables.swift in Sources */, D171943827AEF0560038660B /* KeyboardStyling.swift in Sources */, D111E9BA27AFE7B200746F92 /* Annotate.swift in Sources */, diff --git a/Scribe/AboutTab/AboutTableData.swift b/Scribe/AboutTab/AboutTableData.swift index a395f598..fa2dd593 100644 --- a/Scribe/AboutTab/AboutTableData.swift +++ b/Scribe/AboutTab/AboutTableData.swift @@ -9,28 +9,28 @@ struct AboutTableData { ParentTableCellModel( headingTitle: "Community", section: [ - Section(sectionTitle: "See the code on GitHub", imageString: "github", hasToggle: false, sectionState: .github), - Section(sectionTitle: "Chat with the team on Matrix", imageString: "matrix", hasToggle: false, sectionState: .matrix), - Section(sectionTitle: "Wikimedia and Scribe", imageString: "wikimedia", hasToggle: false, sectionState: .wikimedia), - Section(sectionTitle: "Share Scribe", imageString: "square.and.arrow.up", hasToggle: false, sectionState: .shareScribe), + Section(sectionTitle: "See the code on GitHub", imageString: "github", sectionState: .github), + Section(sectionTitle: "Chat with the team on Matrix", imageString: "matrix", sectionState: .matrix), + Section(sectionTitle: "Wikimedia and Scribe", imageString: "wikimedia", sectionState: .wikimedia), + Section(sectionTitle: "Share Scribe", imageString: "square.and.arrow.up", sectionState: .shareScribe), ], hasDynamicData: nil ), ParentTableCellModel( headingTitle: "Feedback and support", section: [ - Section(sectionTitle: "Rate Scribe", imageString: "star", hasToggle: false, sectionState: .rateScribe), - Section(sectionTitle: "Report a bug", imageString: "ant", hasToggle: false, sectionState: .bugReport), - Section(sectionTitle: "Send us an email", imageString: "envelope", hasToggle: false, sectionState: .email), -// Section(sectionTitle: "Reset app hints", imageString: "lightbulb", hasToggle: false, sectionState: .appHints) + Section(sectionTitle: "Rate Scribe", imageString: "star", sectionState: .rateScribe), + Section(sectionTitle: "Report a bug", imageString: "ant", sectionState: .bugReport), + Section(sectionTitle: "Send us an email", imageString: "envelope", sectionState: .email), +// Section(sectionTitle: "Reset app hints", imageString: "lightbulb", sectionState: .appHints) ], hasDynamicData: nil ), ParentTableCellModel( headingTitle: "Legal", section: [ - Section(sectionTitle: "Privacy policy", imageString: "lock.shield", hasToggle: false, sectionState: .privacyPolicy), - Section(sectionTitle: "Third-party licenses", imageString: "thirdPartyLicenses", hasToggle: false, sectionState: .licenses), + Section(sectionTitle: "Privacy policy", imageString: "lock.shield", hasNestedNavigation: true, sectionState: .privacyPolicy), + Section(sectionTitle: "Third-party licenses", imageString: "thirdPartyLicenses", hasNestedNavigation: true, sectionState: .licenses), ], hasDynamicData: nil ), diff --git a/Scribe/AboutTab/AboutViewController.swift b/Scribe/AboutTab/AboutViewController.swift index 41e61f47..89326f72 100644 --- a/Scribe/AboutTab/AboutViewController.swift +++ b/Scribe/AboutTab/AboutViewController.swift @@ -43,9 +43,6 @@ extension AboutViewController { cell.configureCell(for: dataSet[indexPath.section].section[indexPath.row]) - cell.backgroundColor = .clear - cell.selectionStyle = .none - return cell } } diff --git a/Scribe/Components/UITableViewCells/AboutTableViewCell.swift b/Scribe/Components/UITableViewCells/AboutTableViewCell.swift index 499abcec..7f84a81f 100644 --- a/Scribe/Components/UITableViewCells/AboutTableViewCell.swift +++ b/Scribe/Components/UITableViewCells/AboutTableViewCell.swift @@ -43,5 +43,7 @@ final class AboutTableViewCell: UITableViewCell { } else { iconImageView.image = nil } + + accessoryType = section.hasNestedNavigation ? .disclosureIndicator : .none } } diff --git a/Scribe/Extensions/UIEdgeInsetsExtensions.swift b/Scribe/Extensions/UIEdgeInsetsExtensions.swift new file mode 100644 index 00000000..f3dc76e3 --- /dev/null +++ b/Scribe/Extensions/UIEdgeInsetsExtensions.swift @@ -0,0 +1,27 @@ +// +// Copyright (C) 2023 Scribe +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +import UIKit + +extension UIEdgeInsets { + + // MARK: - Initialisation + + init(vertical: CGFloat, horizontal: CGFloat) { + self.init(top: vertical, left: horizontal, bottom: vertical, right: horizontal) + } +} diff --git a/Scribe/ParentTableCellModel.swift b/Scribe/ParentTableCellModel.swift index b8505926..036f6c87 100644 --- a/Scribe/ParentTableCellModel.swift +++ b/Scribe/ParentTableCellModel.swift @@ -16,13 +16,15 @@ struct Section { let sectionTitle: String let imageString: String? let hasToggle: Bool + let hasNestedNavigation: Bool let sectionState: SectionState let shortDescription: String? - init(sectionTitle: String, imageString: String? = nil, hasToggle: Bool, sectionState: SectionState, shortDescription: String? = nil) { + init(sectionTitle: String, imageString: String? = nil, hasToggle: Bool = false, hasNestedNavigation: Bool = false, sectionState: SectionState, shortDescription: String? = nil) { self.sectionTitle = sectionTitle self.imageString = imageString self.hasToggle = hasToggle + self.hasNestedNavigation = hasNestedNavigation self.sectionState = sectionState self.shortDescription = shortDescription } diff --git a/Scribe/Resources/Localizable.xcstrings b/Scribe/Resources/Localizable.xcstrings index 19d4a518..bd30f59d 100644 --- a/Scribe/Resources/Localizable.xcstrings +++ b/Scribe/Resources/Localizable.xcstrings @@ -12,24 +12,24 @@ } } }, - "settings.appLanguage" : { - "comment" : "The title of the app language section", + "settings.appSettings" : { + "comment" : "The title of the app settings section", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "App language" + "value" : "App settings" } } } }, - "settings.appLanguage.system" : { - "comment" : "Use the system language", + "settings.appSettings.appLanguage" : { + "comment" : "Change the language of the Scribe App", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "System language" + "value" : "App language" } } } @@ -136,7 +136,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Settings" + "value" : "Scribe Settings" } } } diff --git a/Scribe/SettingsTab/SettingsTableData.swift b/Scribe/SettingsTab/SettingsTableData.swift index 3d0cc020..e702bfeb 100644 --- a/Scribe/SettingsTab/SettingsTableData.swift +++ b/Scribe/SettingsTab/SettingsTableData.swift @@ -8,16 +8,16 @@ struct SettingsTableData { static let settingsTableData: [ParentTableCellModel] = [ ParentTableCellModel( - headingTitle: NSLocalizedString("settings.appLanguage", comment: "The title of the app language section"), + headingTitle: NSLocalizedString("settings.appSettings", comment: "The title of the app settings section"), section: [ - Section(sectionTitle: NSLocalizedString("settings.appLanguage.system", comment: "Use the system language"), imageString: "globe", hasToggle: false, sectionState: .appLang), + Section(sectionTitle: NSLocalizedString("settings.appSettings.appLanguage", comment: "Change the language of the Scribe App"), imageString: "globe", hasToggle: false, sectionState: .appLang), ], hasDynamicData: nil ), ParentTableCellModel( headingTitle: NSLocalizedString("settings.installedKeyboards", comment: "The title of the installed keyboards section"), section: [ - // Section(sectionTitle: "All keyboards", imageString: "globe", hasToggle: false, sectionState: .specificLang("all")), + // Section(sectionTitle: "All keyboards", imageString: "globe", sectionState: .specificLang("all")), ], hasDynamicData: .installedKeyboards ), @@ -77,7 +77,6 @@ struct SettingsTableData { for language in installedKeyboards { let newSection = Section( sectionTitle: language, - hasToggle: false, sectionState: .specificLang(languagesAbbrDict[language]!) ) diff --git a/Scribe/SettingsTab/SettingsViewController.swift b/Scribe/SettingsTab/SettingsViewController.swift index 04ec052f..956e525e 100644 --- a/Scribe/SettingsTab/SettingsViewController.swift +++ b/Scribe/SettingsTab/SettingsViewController.swift @@ -18,13 +18,22 @@ import UIKit final class SettingsViewController: UIViewController { + + // MARK: - Constants + + private let sectionHeaderHeight: CGFloat = 32 + private let separatorInset = UIEdgeInsets(vertical: 16, horizontal: 16) + + // MARK: - Properties + @IBOutlet var footerFrame: UIView! @IBOutlet var footerButton: UIButton! - @IBOutlet var parentTable: UITableView! var tableData = SettingsTableData.settingsTableData + // MARK: - Functions + override func viewDidLoad() { super.viewDidLoad() @@ -32,11 +41,11 @@ final class SettingsViewController: UIViewController { navigationItem.backButtonTitle = NSLocalizedString("settings.title.backButton", comment: "The back button's title for the settings screen") parentTable.register(UINib(nibName: "InfoChildTableViewCell", bundle: nil), forCellReuseIdentifier: InfoChildTableViewCell.reuseIdentifier) - parentTable.dataSource = self parentTable.delegate = self parentTable.backgroundColor = .clear - parentTable.sectionHeaderHeight = 32 + parentTable.sectionHeaderHeight = sectionHeaderHeight + parentTable.separatorInset = separatorInset setFooterButtonView() @@ -81,6 +90,8 @@ final class SettingsViewController: UIViewController { } } +// MARK: - UITableViewDataSource + extension SettingsViewController: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { @@ -103,6 +114,8 @@ extension SettingsViewController: UITableViewDataSource { } } +// MARK: - UITableViewDelegate + extension SettingsViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/Scribe/Views/BaseTableViewController.swift b/Scribe/Views/BaseTableViewController.swift index a5191ca0..f5e28340 100644 --- a/Scribe/Views/BaseTableViewController.swift +++ b/Scribe/Views/BaseTableViewController.swift @@ -22,6 +22,7 @@ class BaseTableViewController: UITableViewController { // MARK: - Constants private let sectionHeaderHeight: CGFloat = 32 + private let separatorInset = UIEdgeInsets(vertical: 16, horizontal: 16) // MARK: - Properties @@ -36,6 +37,7 @@ class BaseTableViewController: UITableViewController { tableView.sectionHeaderHeight = sectionHeaderHeight tableView.register(UINib(nibName: "InfoChildTableViewCell", bundle: nil), forCellReuseIdentifier: "InfoChildTableViewCell") + tableView.separatorInset = separatorInset } }