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

#229 #96 adds french azerty and reduces JSON sizes #236

Merged
merged 7 commits into from
Oct 18, 2022
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).

# [Unreleased] Scribe-iOS 2.1.0

### ⌨️ New Keyboards

- Adds a QWERTY keyboard option for French.

### ✨ New Features

- The left and right buttons in the conjugation and declination views are disabled now if pressing them will not lead to a change in the view.
Expand All @@ -21,6 +25,12 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
### 🎨 Design Changes

- The labels for conjugations and declinations have been made darker in dark mode to be more readable.
- French keyboards are now named based on their keyboard style.

### 🐞 Bug Fixes

- The accent character on the French letters keyboard is now the correct character.
- Indentation has been removed from all Scribe JSON files to reduce their filesize, speed up the load times and mitigate crashes.

### ♻️ Code Refactoring

Expand Down
7 changes: 5 additions & 2 deletions Keyboards/KeyboardsBase/InterfaceVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ var controllerLanguageAbbr = String()

// Dictionary for accessing language abbreviations.
let languagesAbbrDict: [String: String] = [
"French": "fr",
"French_AZERTY": "fr",
"French_QWERTY": "fr",
"German": "de",
"Italian": "it",
"Portuguese": "pt",
Expand All @@ -127,7 +128,9 @@ func getControllerLanguageAbbr() -> String {

// Dictionary for accessing keyboard abbreviations and layouts.
let keyboardLayoutDict: [String: () -> Void] = [
"French": setFRKeyboardLayout,
// Layouts for French checked within setFRKeyboardLayout.
"French_AZERTY": setFRKeyboardLayout,
"French_QWERTY": setFRKeyboardLayout,
"German": setDEKeyboardLayout,
"Italian": setITKeyboardLayout,
"Portuguese": setPTKeyboardLayout,
Expand Down
10 changes: 7 additions & 3 deletions Keyboards/KeyboardsBase/KeyboardKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class KeyboardKey: UIButton {
self.layer.setValue(true, forKey: "isSpecial")
Copy link
Member

Choose a reason for hiding this comment

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

Just an observation on the changes in this file -

These are interesting, hmm.. 🤔 Makes sense that some keys should be ignored when it comes to upper/lower-casing. Just wondering if there could be a scenario where a key would have upper/lower-casing in one language but not in another. In that case, the logic here would depend on the target language. I'm thinking this would definitely be an edge-case, and I don't even know if it could happen 😆 , but just a thought I had.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thoughts of edge cases are much appreciated! There are all kinds of little things like that in Scribe 😊 Specifically languagesWithCapitalizedNouns, which as of now is ["German"] 😄 We try to handle them as they come up :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh.. the challenges of working with multiple human languages 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

Welcome to Scribe! 🤣😊

}
var capsKey = ""
if self.key != "ß" && self.key != spaceBar {
if self.key != "ß"
&& self.key != "´"
&& self.key != spaceBar
&& self.key != "ABC"
&& self.key != "АБВ" {
capsKey = keyboard[self.row][self.idx].capitalized
} else {
capsKey = self.key
Expand Down Expand Up @@ -97,7 +101,7 @@ class KeyboardKey: UIButton {

if keyboardState == .letters
&& isSpecial == false
&& !["123", spaceBar].contains(self.key)
&& !["123", "´", spaceBar].contains(self.key)
&& shiftButtonState == .normal {
self.titleEdgeInsets = UIEdgeInsets(top: -4.0, left: 0.0, bottom: 0.0, right: 0.0)

Expand Down Expand Up @@ -154,7 +158,7 @@ class KeyboardKey: UIButton {

if keyboardState == .letters
&& isSpecial == false
&& ![".?123", spaceBar, "ß", ",", ".", "'", "-"].contains(self.key)
&& ![".?123", spaceBar, "ß", "´", ",", ".", "'", "-"].contains(self.key)
&& shiftButtonState == .normal {
self.titleEdgeInsets = UIEdgeInsets(top: -4.0, left: 0.0, bottom: 0.0, right: 0.0)

Expand Down
15 changes: 9 additions & 6 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import UIKit

// Dictionary for accessing keyboard conjugation state.
let keyboardConjTitleDict: [String: Any] = [
"French": frGetConjugationTitle,
"French_AZERTY": frGetConjugationTitle,
"French_QWERTY": frGetConjugationTitle,
"German": deGetConjugationTitle,
"Italian": itGetConjugationTitle,
"Portuguese": ptGetConjugationTitle,
Expand All @@ -19,7 +20,8 @@ let keyboardConjTitleDict: [String: Any] = [

// Dictionary for accessing keyboard conjugation state.
let keyboardConjStateDict: [String: Any] = [
"French": frGetConjugationState,
"French_AZERTY": frGetConjugationState,
"French_QWERTY": frGetConjugationState,
"German": deGetConjugationState,
"Italian": itGetConjugationState,
"Portuguese": ptGetConjugationState,
Expand All @@ -30,7 +32,8 @@ let keyboardConjStateDict: [String: Any] = [

// Dictionary for accessing keyboard conjugation state.
let keyboardConjLabelDict: [String: Any] = [
"French": frSetConjugationLabels,
"French_AZERTY": frSetConjugationLabels,
"French_QWERTY": frSetConjugationLabels,
"German": deSetConjugationLabels,
"Italian": itSetConjugationLabels,
"Portuguese": ptSetConjugationLabels,
Expand Down Expand Up @@ -236,7 +239,7 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) {
/// Returns the conjugation state to its initial conjugation based on the keyboard language.
func resetVerbConjugationState() {
conjViewShiftButtonsState = .leftInactive
if controllerLanguage == "French" {
if controllerLanguage.prefix("French".count) == "French" {
frConjugationState = .indicativePresent
} else if controllerLanguage == "German" {
deConjugationState = .indicativePresent
Expand Down Expand Up @@ -289,7 +292,7 @@ func resetCaseDeclensionState() {

/// Runs an action associated with the left view switch button of the conjugation state based on the keyboard language.
func conjugationStateLeft() {
if controllerLanguage == "French" {
if controllerLanguage.prefix("French".count) == "French" {
frConjugationStateLeft()
} else if controllerLanguage == "German" {
deConjugationStateLeft()
Expand All @@ -308,7 +311,7 @@ func conjugationStateLeft() {

/// Runs an action associated with the right view switch button of the conjugation state based on the keyboard language.
func conjugationStateRight() {
if controllerLanguage == "French" {
if controllerLanguage.prefix("French".count) == "French" {
frConjugationStateRight()
} else if controllerLanguage == "German" {
deConjugationStateRight()
Expand Down
Loading