diff --git a/Scribe.xcodeproj/project.pbxproj b/Scribe.xcodeproj/project.pbxproj index 2d8c5197..c50be3ac 100644 --- a/Scribe.xcodeproj/project.pbxproj +++ b/Scribe.xcodeproj/project.pbxproj @@ -724,6 +724,8 @@ D1CDEDDC2A85AE9D00098546 /* NBInterfaceVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CDED802A85A12400098546 /* NBInterfaceVariables.swift */; }; D1F0367227AAE12200CD7921 /* InterfaceVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = D190B2492741B31F00705659 /* InterfaceVariables.swift */; }; D1F0367327AAE1B400CD7921 /* CommandVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = D190B2462741B24F00705659 /* CommandVariables.swift */; }; + ED2486F32B0B4E8C0038AE6A /* AboutTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED2486F12B0B4E8C0038AE6A /* AboutTableViewCell.swift */; }; + ED2486F42B0B4E8C0038AE6A /* AboutTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ED2486F22B0B4E8C0038AE6A /* AboutTableViewCell.xib */; }; EDB4601B2AF9FD8200BEA967 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = EDB4601A2AF9FD8200BEA967 /* Localizable.xcstrings */; }; EDB460212B03B3E400BEA967 /* BaseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDB460202B03B3E400BEA967 /* BaseTableViewController.swift */; }; EDC364692AE408F20001E456 /* InterfaceConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC364682AE408F20001E456 /* InterfaceConstants.swift */; }; @@ -969,6 +971,8 @@ D1D8B23B2AE4089C0070B817 /* Italian.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Italian.entitlements; sourceTree = ""; }; D1D8B23C2AE408AC0070B817 /* German.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = German.entitlements; sourceTree = ""; }; D1D8B23D2AE408C50070B817 /* French.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = French.entitlements; sourceTree = ""; }; + ED2486F12B0B4E8C0038AE6A /* AboutTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTableViewCell.swift; sourceTree = ""; }; + ED2486F22B0B4E8C0038AE6A /* AboutTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutTableViewCell.xib; sourceTree = ""; }; EDB4601A2AF9FD8200BEA967 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; EDB4601C2AF9FDD600BEA967 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/AppScreen.strings; sourceTree = ""; }; EDB4601D2AF9FDD600BEA967 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = ""; }; @@ -1092,6 +1096,7 @@ 1406B7832A2DFCA2001DF45B /* Components */ = { isa = PBXGroup; children = ( + ED2486F02B0B4E610038AE6A /* UITableViewCells */, 1406B7852A2DFCBE001DF45B /* InfoChildTableViewCell */, 140158A12A4EDB2200D14E52 /* TableViewTemplateViewController.swift */, ); @@ -1468,6 +1473,15 @@ path = Keyboards; sourceTree = ""; }; + ED2486F02B0B4E610038AE6A /* UITableViewCells */ = { + isa = PBXGroup; + children = ( + ED2486F12B0B4E8C0038AE6A /* AboutTableViewCell.swift */, + ED2486F22B0B4E8C0038AE6A /* AboutTableViewCell.xib */, + ); + path = UITableViewCells; + sourceTree = ""; + }; EDB4601F2B03B3B400BEA967 /* Views */ = { isa = PBXGroup; children = ( @@ -1834,6 +1848,7 @@ 38BD214122D5908100C6795D /* LaunchScreen.storyboard in Resources */, 147797B12A2CD3370044A53E /* InfoChildTableViewCell.xib in Resources */, EDB4601B2AF9FD8200BEA967 /* Localizable.xcstrings in Resources */, + ED2486F42B0B4E8C0038AE6A /* AboutTableViewCell.xib in Resources */, 38BD213922D5907F00C6795D /* AppScreen.storyboard in Resources */, 38BD213E22D5908100C6795D /* Assets.xcassets in Resources */, ); @@ -2030,6 +2045,7 @@ D171942027AECD170038660B /* SVCommandVariables.swift in Sources */, 30453967293B9D31003AE55B /* ViewThemeable.swift in Sources */, D1362A39274C106A00C00E48 /* ColorVariables.swift in Sources */, + ED2486F32B0B4E8C0038AE6A /* AboutTableViewCell.swift in Sources */, D1A2DCB127AD37BD0057A10D /* ENAppText.swift in Sources */, D1CDED832A85A12C00098546 /* NBCommandVariables.swift in Sources */, D171944927AEF7290038660B /* KeyboardKeys.swift in Sources */, diff --git a/Scribe/AboutTab/AboutViewController.swift b/Scribe/AboutTab/AboutViewController.swift index d432e177..0ad0d464 100644 --- a/Scribe/AboutTab/AboutViewController.swift +++ b/Scribe/AboutTab/AboutViewController.swift @@ -29,6 +29,8 @@ final class AboutViewController: BaseTableViewController { super.viewDidLoad() title = "About" + + tableView.register(UINib(nibName: "AboutTableViewCell", bundle: nil), forCellReuseIdentifier: AboutTableViewCell.reuseIdentifier) } } @@ -37,7 +39,7 @@ final class AboutViewController: BaseTableViewController { extension AboutViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: InfoChildTableViewCell.reuseIdentifier, for: indexPath) as! InfoChildTableViewCell + let cell = tableView.dequeueReusableCell(withIdentifier: AboutTableViewCell.reuseIdentifier, for: indexPath) as! AboutTableViewCell cell.configureCell(for: dataSet[indexPath.section].section[indexPath.row]) diff --git a/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.swift b/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.swift index 0b71db67..9c474b2a 100644 --- a/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.swift +++ b/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.swift @@ -15,8 +15,6 @@ final class InfoChildTableViewCell: UITableViewCell { @IBOutlet var containerView: UIView! @IBOutlet var titleLabel: UILabel! @IBOutlet var descriptionLabel: UILabel! - @IBOutlet var iconImageView: UIImageView! - @IBOutlet var chevronImgView: UIImageView! @IBOutlet var toggleSwitch: UISwitch! var section: Section? @@ -47,17 +45,6 @@ final class InfoChildTableViewCell: UITableViewCell { titleLabel.text = section.sectionTitle - if let icon = section.imageString { - iconImageView.image = UIImage.availableIconImage(with: icon) - - containerView.addSubview(iconImageView) - - } else { - iconImageView.image = nil - - iconImageView.removeFromSuperview() - } - if let shortDescription = section.shortDescription { descriptionLabel.text = shortDescription @@ -72,7 +59,7 @@ final class InfoChildTableViewCell: UITableViewCell { toggleSwitch.isHidden = true } else { accessoryType = .none -// chevronImgView.isHidden = true + toggleSwitch.isHidden = false } fetchSwitchStateForCell() diff --git a/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.xib b/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.xib index 37516840..76a2cac2 100644 --- a/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.xib +++ b/Scribe/Components/InfoChildTableViewCell/InfoChildTableViewCell.xib @@ -22,16 +22,8 @@ - - - - - - - - - + @@ -63,13 +55,9 @@ - - - - - + @@ -89,7 +77,6 @@ - @@ -101,7 +88,7 @@ - + diff --git a/Scribe/Components/UITableViewCells/AboutTableViewCell.swift b/Scribe/Components/UITableViewCells/AboutTableViewCell.swift new file mode 100644 index 00000000..8c952741 --- /dev/null +++ b/Scribe/Components/UITableViewCells/AboutTableViewCell.swift @@ -0,0 +1,49 @@ +// +// 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 + +final class AboutTableViewCell: UITableViewCell { + + // MARK: - Constants + + static let reuseIdentifier = String(describing: InfoChildTableViewCell.self) + + // MARK: - Properties + + @IBOutlet var titleLabel: UILabel! + @IBOutlet var iconImageView: UIImageView! + + var section: Section? + var parentSection: Section? + + // MARK: - Functions + + func configureCell(for section: Section) { + selectionStyle = .none + + titleLabel.text = section.sectionTitle + + if let icon = section.imageString { + iconImageView.image = UIImage.availableIconImage(with: icon) + iconImageView.constraints.forEach { $0.isActive = true } + } else { + iconImageView.image = nil + iconImageView.constraints.forEach { $0.isActive = false } + } + } +} diff --git a/Scribe/Components/UITableViewCells/AboutTableViewCell.xib b/Scribe/Components/UITableViewCells/AboutTableViewCell.xib new file mode 100644 index 00000000..011920ea --- /dev/null +++ b/Scribe/Components/UITableViewCells/AboutTableViewCell.xib @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Scribe/SettingsTab/SettingsTableData.swift b/Scribe/SettingsTab/SettingsTableData.swift index 294d99f5..3d0cc020 100644 --- a/Scribe/SettingsTab/SettingsTableData.swift +++ b/Scribe/SettingsTab/SettingsTableData.swift @@ -77,7 +77,6 @@ struct SettingsTableData { for language in installedKeyboards { let newSection = Section( sectionTitle: language, - imageString: "globe", hasToggle: false, sectionState: .specificLang(languagesAbbrDict[language]!) )