Skip to content

Commit

Permalink
[#330] Apply PR feedback
Browse files Browse the repository at this point in the history
Added separator insets to tableviews.
Added disclosure indicators in About tabs to cells with nested navigation.
Additional cleanups.
  • Loading branch information
damien-rivet committed Dec 16, 2023
1 parent 040dbd0 commit ac0979f
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 28 deletions.
12 changes: 12 additions & 0 deletions Scribe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -978,6 +979,7 @@
EDB4601D2AF9FDD600BEA967 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
EDB460202B03B3E400BEA967 /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = "<group>"; };
EDC364682AE408F20001E456 /* InterfaceConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceConstants.swift; sourceTree = "<group>"; };
EDEE62242B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsetsExtensions.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -1207,6 +1209,7 @@
38BD213222D5907F00C6795D /* Scribe */ = {
isa = PBXGroup;
children = (
EDEE62232B2DE64A00A0B9C1 /* Extensions */,
147797A92A2CD2B50044A53E /* AboutTab */,
38BD213322D5907F00C6795D /* AppDelegate.swift */,
1406B78B2A3209CF001DF45B /* AppExtensions.swift */,
Expand Down Expand Up @@ -1498,6 +1501,14 @@
path = Resources;
sourceTree = "<group>";
};
EDEE62232B2DE64A00A0B9C1 /* Extensions */ = {
isa = PBXGroup;
children = (
EDEE62242B2DE65A00A0B9C1 /* UIEdgeInsetsExtensions.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -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 */,
Expand Down
20 changes: 10 additions & 10 deletions Scribe/AboutTab/AboutTableData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down
3 changes: 0 additions & 3 deletions Scribe/AboutTab/AboutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ extension AboutViewController {

cell.configureCell(for: dataSet[indexPath.section].section[indexPath.row])

cell.backgroundColor = .clear
cell.selectionStyle = .none

return cell
}
}
Expand Down
2 changes: 2 additions & 0 deletions Scribe/Components/UITableViewCells/AboutTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ final class AboutTableViewCell: UITableViewCell {
} else {
iconImageView.image = nil
}

accessoryType = section.hasNestedNavigation ? .disclosureIndicator : .none
}
}
27 changes: 27 additions & 0 deletions Scribe/Extensions/UIEdgeInsetsExtensions.swift
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
//

import UIKit

extension UIEdgeInsets {

// MARK: - Initialisation

init(vertical: CGFloat, horizontal: CGFloat) {
self.init(top: vertical, left: horizontal, bottom: vertical, right: horizontal)
}
}
4 changes: 3 additions & 1 deletion Scribe/ParentTableCellModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
14 changes: 7 additions & 7 deletions Scribe/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Settings"
"value" : "Scribe Settings"
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions Scribe/SettingsTab/SettingsTableData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down Expand Up @@ -77,7 +77,6 @@ struct SettingsTableData {
for language in installedKeyboards {
let newSection = Section(
sectionTitle: language,
hasToggle: false,
sectionState: .specificLang(languagesAbbrDict[language]!)
)

Expand Down
19 changes: 16 additions & 3 deletions Scribe/SettingsTab/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,34 @@
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()

title = NSLocalizedString("settings.title", comment: "The title for the settings screen")
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()

Expand Down Expand Up @@ -81,6 +90,8 @@ final class SettingsViewController: UIViewController {
}
}

// MARK: - UITableViewDataSource

extension SettingsViewController: UITableViewDataSource {

func numberOfSections(in tableView: UITableView) -> Int {
Expand All @@ -103,6 +114,8 @@ extension SettingsViewController: UITableViewDataSource {
}
}

// MARK: - UITableViewDelegate

extension SettingsViewController: UITableViewDelegate {

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down
2 changes: 2 additions & 0 deletions Scribe/Views/BaseTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class BaseTableViewController: UITableViewController {
// MARK: - Constants

private let sectionHeaderHeight: CGFloat = 32
private let separatorInset = UIEdgeInsets(vertical: 16, horizontal: 16)

// MARK: - Properties

Expand All @@ -36,6 +37,7 @@ class BaseTableViewController: UITableViewController {

tableView.sectionHeaderHeight = sectionHeaderHeight
tableView.register(UINib(nibName: "InfoChildTableViewCell", bundle: nil), forCellReuseIdentifier: "InfoChildTableViewCell")
tableView.separatorInset = separatorInset
}
}

Expand Down

0 comments on commit ac0979f

Please sign in to comment.