Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Disable accent characters for menus that it's not needed on #372 #375

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Keyboards/KeyboardsBase/InterfaceVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ let languagesAbbrDict = [
"Swedish": "sv",
]


/// Returns the abbreviation of the language for use in commands.
func getControllerLanguageAbbr() -> String {
guard let abbreviation = languagesAbbrDict[controllerLanguage] else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ extension ParentTableViewCell: UITableViewDelegate {
case .appLang: break
case .specificLang:
if let viewController = parentViewController?.storyboard?.instantiateViewController(identifier: "TableViewTemplateViewController") as? TableViewTemplateViewController {
let accentKeyLanguages: [String] = ["Swedish", "German", "Spanish"]; //Languages where we can disable accent keys
if (accentKeyLanguages.firstIndex(of: section.sectionTitle) == nil)
{
SettingsTableData.languageSettingsData[0].section.remove(at: 1) //If there are no accent keys we remove the option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really great, @henrikth93! Could we add one line right before this that checks what the the index is for Disable accent characters and then we can drop that index specifically? As of now if something else goes in at index 1 this will break its functionality :)

Aside from this, 100% what we're looking for! 😊

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! That is a good idea! I will change that asap! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @henrikth93! Will merge it in soon after 🤠

}
viewController.configureTable(for: SettingsTableData.languageSettingsData, parentSection: section)

parentViewController?.navigationController?.pushViewController(viewController, animated: true)
Expand Down
2 changes: 1 addition & 1 deletion Scribe/Components/TableViewTemplateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit
class TableViewTemplateViewController: UIViewController {
@IBOutlet var mainTable: UITableView!

var screenTitle: String = ""
var screenTitle: String = ""
var tableData: [ParentTableCellModel] = []
var parentSection: Section?

Expand Down
10 changes: 6 additions & 4 deletions Scribe/SettingsTab/SettingsTableData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct SettingsTableData {
hasDynamicData: .installedKeyboards
),
]

static var languageSettingsData: [ParentTableCellModel] = [
ParentTableCellModel(
headingTitle: "Layout",
Expand All @@ -32,12 +32,12 @@ struct SettingsTableData {
hasToggle: true,
sectionState: .none(.toggleCommaAndPeriod)
),
Section(
Section(
sectionTitle: "Disable accent characters",
imageString: "info.circle",
hasToggle: true,
sectionState: .none(.toggleAccentCharacters)
),
)
],
hasDynamicData: nil
),
Expand All @@ -54,7 +54,7 @@ struct SettingsTableData {
hasDynamicData: nil
)
]

static func getInstalledKeyboardsSections() -> [Section] {
var installedKeyboards = [String]()

Expand Down Expand Up @@ -86,3 +86,5 @@ struct SettingsTableData {
return sections
}
}