Skip to content

Commit

Permalink
Merge pull request #443 from mostazomarc/426-fix-opening-brace
Browse files Browse the repository at this point in the history
Removed opening_brace from disabled rules in .swiftlint.yml
  • Loading branch information
andrewtavis authored May 18, 2024
2 parents f87e9ab + 45211be commit f5ecbd9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 61 deletions.
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ disabled_rules:
# WARNINGS IN PROJECT CURRENTLY
- todo
- orphaned_doc_comment
- opening_brace
- blanket_disable_command
- for_where
- empty_enum_arguments
Expand Down
6 changes: 2 additions & 4 deletions Keyboards/KeyboardsBase/KeyAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,10 @@ func getKeyPopPath(key: UIButton, layer: CAShapeLayer, char: String, displayChar
var labelVertPosition = frame.origin.y - key.frame.height / 1.75
// non-capital characters should be higher for portrait phone views.
if displayChar == char, DeviceType.isPhone, !isLandscapeView,
!["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"].contains(char)
{
!["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"].contains(char) {
labelVertPosition = frame.origin.y - key.frame.height / 1.6
} else if DeviceType.isPad,
isLandscapeView
{
isLandscapeView {
labelVertPosition = frame.origin.y - key.frame.height / 2
}

Expand Down
39 changes: 13 additions & 26 deletions Keyboards/KeyboardsBase/KeyboardKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class KeyboardKey: UIButton {
&& key != spaceBar
&& key != languageTextForSpaceBar
&& key != "ABC"
&& key != "АБВ"
{
&& key != "АБВ" {
capsKey = keyboard[row][idx].capitalized
} else {
capsKey = key
Expand Down Expand Up @@ -102,8 +101,7 @@ class KeyboardKey: UIButton {
if key == "#+="
|| key == "ABC"
|| key == "АБВ"
|| key == "123"
{
|| key == "123" {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 3.5)
} else if key == spaceBar || key == languageTextForSpaceBar {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 4)
Expand All @@ -114,8 +112,7 @@ class KeyboardKey: UIButton {
if key == "#+="
|| key == "ABC"
|| key == "АБВ"
|| key == "123"
{
|| key == "123" {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 1.75)
} else if key == spaceBar || key == languageTextForSpaceBar {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 2)
Expand All @@ -132,8 +129,7 @@ class KeyboardKey: UIButton {
if keyboardState == .letters
&& !isSpecial
&& !["123", "´", spaceBar, languageTextForSpaceBar].contains(key)
&& shiftButtonState == .normal
{
&& shiftButtonState == .normal {
titleEdgeInsets = UIEdgeInsets(top: -4.0, left: 0.0, bottom: 0.0, right: 0.0)

if isLandscapeView {
Expand All @@ -158,8 +154,7 @@ class KeyboardKey: UIButton {
if key == "#+="
|| key == "ABC"
|| key == "АБВ"
|| key == "hideKeyboard"
{
|| key == "hideKeyboard" {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 3.75)
} else if key == spaceBar || key == languageTextForSpaceBar {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 4.25)
Expand All @@ -172,8 +167,7 @@ class KeyboardKey: UIButton {
if key == "#+="
|| key == "ABC"
|| key == "АБВ"
|| key == "hideKeyboard"
{
|| key == "hideKeyboard" {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 3.25)
} else if key == spaceBar || key == languageTextForSpaceBar {
titleLabel?.font = .systemFont(ofSize: letterKeyWidth / 3.5)
Expand All @@ -192,8 +186,7 @@ class KeyboardKey: UIButton {
if keyboardState == .letters
&& !isSpecial
&& ![".?123", spaceBar, languageTextForSpaceBar, "ß", "´", ",", ".", "'", "-"].contains(key)
&& shiftButtonState == .normal
{
&& shiftButtonState == .normal {
titleEdgeInsets = UIEdgeInsets(top: -4.0, left: 0.0, bottom: 0.0, right: 0.0)

if isLandscapeView {
Expand Down Expand Up @@ -229,13 +222,11 @@ class KeyboardKey: UIButton {
} else if key == "delete"
|| key == "#+="
|| key == "shift"
|| key == "selectKeyboard"
{
|| key == "selectKeyboard" {
// Cancel Russian keyboard key resizing if translating as the keyboard is English.
if controllerLanguage == "Russian"
&& keyboardState == .letters
&& commandState != .translate
{
&& commandState != .translate {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
} else {
Expand All @@ -245,8 +236,7 @@ class KeyboardKey: UIButton {
} else if key == "123"
|| key == ".?123"
|| key == "return"
|| key == "hideKeyboard"
{
|| key == "hideKeyboard" {
if row == 2 {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
Expand All @@ -255,8 +245,7 @@ class KeyboardKey: UIButton {
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 2).isActive = true
}
} else if (keyboardState == .numbers || keyboardState == .symbols)
&& row == 2
{
&& row == 2 {
// Make second row number and symbol keys wider for iPhones.
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.4).isActive = true
} else if key != spaceBar && key != languageTextForSpaceBar {
Expand Down Expand Up @@ -301,8 +290,7 @@ class KeyboardKey: UIButton {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
{
&& DeviceType.isPad {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarReturnKeyWidth).isActive = true
} else {
Expand All @@ -323,8 +311,7 @@ class KeyboardKey: UIButton {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
{
&& DeviceType.isPad {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
} else {
Expand Down
36 changes: 12 additions & 24 deletions Keyboards/KeyboardsBase/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,7 @@ class KeyboardViewController: UIInputViewController {
currentPrefix = inString.replacingOccurrences(of: pastStringInTextProxy, with: "")

if currentPrefix.hasPrefix("(") || currentPrefix.hasPrefix("#") ||
currentPrefix.hasPrefix("/") || currentPrefix.hasPrefix("\"")
{
currentPrefix.hasPrefix("/") || currentPrefix.hasPrefix("\"") {
currentPrefix = currentPrefix.replacingOccurrences(of: #"[\"(#\/]"#, with: "", options: .regularExpression)
}

Expand Down Expand Up @@ -872,8 +871,7 @@ class KeyboardViewController: UIInputViewController {
conditionallyDisplayAnnotation()
if (keyPressed == phoneEmojiKey0 || keyPressed == phoneEmojiKey1)
|| (keyPressed == padEmojiKey0 || keyPressed == padEmojiKey1 || keyPressed == padEmojiKey2)
|| (keyPressed == pluralKey && emojisToShow == .one)
{
|| (keyPressed == pluralKey && emojisToShow == .one) {
emojiAutoActionRepeatPossible = true
}
}
Expand Down Expand Up @@ -1357,8 +1355,7 @@ class KeyboardViewController: UIInputViewController {
}

if controllerLanguage == "German"
&& [.accusativeIndefinite, .dativeIndefinite, .genitiveIndefinite].contains(deCaseDeclensionState)
{
&& [.accusativeIndefinite, .dativeIndefinite, .genitiveIndefinite].contains(deCaseDeclensionState) {
formKeyBR.isUserInteractionEnabled = false
}

Expand Down Expand Up @@ -1636,17 +1633,15 @@ class KeyboardViewController: UIInputViewController {
if DeviceType.isPhone
&& key == "y"
&& ["German", "Swedish"].contains(controllerLanguage)
&& commandState != .translate
{
&& commandState != .translate {
leftPadding = keyWidth / 3
addPadding(to: stackView2, width: leftPadding, key: "y")
}
if DeviceType.isPhone
&& key == "a"
&& (controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate)
{
|| commandState == .translate) {
leftPadding = keyWidth / 4
addPadding(to: stackView1, width: leftPadding, key: "a")
}
Expand All @@ -1655,8 +1650,7 @@ class KeyboardViewController: UIInputViewController {
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate)
{
|| commandState == .translate) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "a")
}
Expand All @@ -1665,17 +1659,15 @@ class KeyboardViewController: UIInputViewController {
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate)
{
|| commandState == .translate) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "@")
}
if DeviceType.isPad
&& key == ""
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
|| commandState == .translate)
{
|| commandState == .translate) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "")
}
Expand Down Expand Up @@ -1763,17 +1755,15 @@ class KeyboardViewController: UIInputViewController {
if DeviceType.isPhone
&& key == "m"
&& ["German", "Swedish"].contains(controllerLanguage)
&& commandState != .translate
{
&& commandState != .translate {
rightPadding = keyWidth / 3
addPadding(to: stackView2, width: rightPadding, key: "m")
}
if DeviceType.isPhone
&& key == "l"
&& (controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate)
{
|| commandState == .translate) {
rightPadding = keyWidth / 4
addPadding(to: stackView1, width: rightPadding, key: "l")
}
Expand Down Expand Up @@ -2187,8 +2177,7 @@ class KeyboardViewController: UIInputViewController {
.conjugate,
.selectVerbConjugation,
.selectCaseDeclension,
.plural].contains(commandState)
{ // escape
.plural].contains(commandState) { // escape
commandState = .idle
deCaseVariantDeclensionState = .disabled
} else if [.idle, .alreadyPlural, .invalid].contains(commandState) { // ScribeKey
Expand Down Expand Up @@ -2727,8 +2716,7 @@ class KeyboardViewController: UIInputViewController {
if touch.tapCount == 2
&& (originalKey == spaceBar || originalKey == languageTextForSpaceBar)
&& proxy.documentContextBeforeInput?.count != 1
&& doubleSpacePeriodPossible
{
&& doubleSpacePeriodPossible {
// The fist condition prevents a period if the prior characters are spaces as the user wants a series of spaces.
if proxy.documentContextBeforeInput?.suffix(2) != " " && ![.translate, .conjugate, .plural].contains(commandState) {
proxy.deleteBackward()
Expand Down
3 changes: 1 addition & 2 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ func returnDeclension(keyPressed: UIButton) {
func triggerVerbConjugation(commandBar: UILabel) -> Bool {
// Cancel via a return press.
if let commandBarText = commandBar.text,
commandBarText == conjugatePromptAndCursor || commandBarText == conjugatePromptAndCursor
{
commandBarText == conjugatePromptAndCursor || commandBarText == conjugatePromptAndCursor {
return false
}

Expand Down
3 changes: 1 addition & 2 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Plural.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import UIKit
func queryPlural(commandBar: UILabel) {
// Cancel via a return press.
if let commandBarText = commandBar.text,
commandBarText == pluralPromptAndCursor || commandBarText == pluralPromptAndCursor
{
commandBarText == pluralPromptAndCursor || commandBarText == pluralPromptAndCursor {
return
}

Expand Down
3 changes: 1 addition & 2 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Translate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import UIKit
func queryTranslation(commandBar: UILabel) {
// Cancel via a return press.
if let commandBarText = commandBar.text,
commandBarText == translatePromptAndCursor || commandBarText == translatePromptAndPlaceholder
{
commandBarText == translatePromptAndCursor || commandBarText == translatePromptAndPlaceholder {
return
}

Expand Down

0 comments on commit f5ecbd9

Please sign in to comment.