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

Emoji autosuggest menu #345

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,28 @@ class InfoChildTableViewCell: UITableViewCell {

fetchSwitchStateForCell()

toggleSwitch.onTintColor = .init(.commandKey).withAlphaComponent(0.4)
toggleSwitch.thumbTintColor = toggleSwitch.isOn ? .init(.commandKey) : .lightGray
toggleSwitch.onTintColor = .init(.scribeCTA).withAlphaComponent(0.4)
toggleSwitch.thumbTintColor = toggleSwitch.isOn ? .init(.scribeCTA) : .lightGray
}

@IBAction func switchDidChange(_: UISwitch) {
switch togglePurpose {
case .toggleCommaAndPeriod:
let dictionaryKey = languageCode + "CommaAndPeriod"
userDefaults.setValue(toggleSwitch.isOn, forKey: dictionaryKey)
case .autosuggestEmojis: break
case .none: break
}

toggleSwitch.thumbTintColor = toggleSwitch.isOn ? .init(.commandKey) : .lightGray
toggleSwitch.thumbTintColor = toggleSwitch.isOn ? .init(.scribeCTA) : .lightGray
}

func fetchSwitchStateForCell() {
switch togglePurpose {
case .toggleCommaAndPeriod:
let dictionaryKey = languageCode + "CommaAndPeriod"
toggleSwitch.isOn = userDefaults.bool(forKey: dictionaryKey)
case .autosuggestEmojis: break
case .none: break
}
}
Expand Down
1 change: 1 addition & 0 deletions Scribe/ParentTableCellModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum SectionState: Equatable {

enum UserInteractiveState {
case toggleCommaAndPeriod
case autosuggestEmojis
case none
}

Expand Down
19 changes: 18 additions & 1 deletion Scribe/SettingsTab/SettingsTableData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,27 @@ struct SettingsTableData {
ParentTableCellModel(
headingTitle: "Layout",
section: [
Section(sectionTitle: "Period and comma on ABC", imageString: "info.circle", hasToggle: true, sectionState: .none(.toggleCommaAndPeriod)),
Section(
sectionTitle: "Period and comma on ABC",
imageString: "info.circle",
hasToggle: true,
sectionState: .none(.toggleCommaAndPeriod)
),
],
hasDynamicData: nil
),
ParentTableCellModel(
headingTitle: "Functionality",
section: [
Section(
sectionTitle: "Autosuggest emojis",
imageString: "info.circle",
hasToggle: true,
sectionState: .none(.autosuggestEmojis)
)
],
hasDynamicData: nil
)
]

static func getInstalledKeyboardsSections() -> [Section] {
Expand Down