Skip to content

Commit

Permalink
Merge pull request #412 from Taufi/swipe-conjugation
Browse files Browse the repository at this point in the history
Allow for swiping between conjugation and declension views #361
  • Loading branch information
andrewtavis authored Apr 13, 2024
2 parents 8c7be15 + b339781 commit 40b0680
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
- German indefinite pronouns are now selectable from the case-declension display ([#303](https://github.com/scribe-org/Scribe-iOS/issues/303)).
- German imperfect verb conjugations now insert both the auxiliary verb and the past participle with the cursor between them.
- Tab and caps lock keys and their functionalities have been added to expanded iPad layouts ([#371](https://github.com/scribe-org/Scribe-iOS/issues/371)).
- Users can now swipe between the conjugation and declension views ([#361](https://github.com/scribe-org/Scribe-iOS/issues/361)).

### 🎨 Design Changes

Expand Down
39 changes: 27 additions & 12 deletions Keyboards/KeyboardsBase/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,13 @@ class KeyboardViewController: UIInputViewController {

/// Sets up all buttons and labels for the conjugation view given constraints to determine the dimensions.
func setConjugationBtns() {
// Add swipe functionality to the conjugation and declension views.
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(shiftLeft))
keyboardView.addGestureRecognizer(swipeRight)
let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(shiftRight))
swipeLeft.direction = .left
keyboardView.addGestureRecognizer(swipeLeft)

// Set the conjugation view to 2x2 for Swedish and Russian past tense.
if controllerLanguage == "Swedish" {
formsDisplayDimensions = .view2x2
Expand Down Expand Up @@ -1573,6 +1580,24 @@ class KeyboardViewController: UIInputViewController {
}
}

@objc func shiftLeft() {
if commandState == .displayInformation {
tipView?.updatePrevious()
} else {
conjugationStateLeft()
loadKeys()
}
}

@objc func shiftRight() {
if commandState == .displayInformation {
tipView?.updateNext()
} else {
conjugationStateRight()
loadKeys()
}
}

func setKeywidth() {
// keyWidth determined per keyboard by the top row.
if isLandscapeView {
Expand Down Expand Up @@ -2256,20 +2281,10 @@ class KeyboardViewController: UIInputViewController {
commandBar.attributedText = pluralPromptAndColorPlaceholder

case "shiftFormsDisplayLeft":
if commandState == .displayInformation {
tipView?.updatePrevious()
} else {
conjugationStateLeft()
loadKeys()
}
shiftLeft()

case "shiftFormsDisplayRight":
if commandState == .displayInformation {
tipView?.updateNext()
} else {
conjugationStateRight()
loadKeys()
}
shiftRight()

case "firstPersonSingular":
returnConjugation(keyPressed: sender, requestedForm: formFPS)
Expand Down

0 comments on commit 40b0680

Please sign in to comment.