diff --git a/Keyboards/KeyboardsBase/InterfaceVariables.swift b/Keyboards/KeyboardsBase/InterfaceVariables.swift index 1e8447e4..e74a071f 100644 --- a/Keyboards/KeyboardsBase/InterfaceVariables.swift +++ b/Keyboards/KeyboardsBase/InterfaceVariables.swift @@ -103,6 +103,12 @@ let keyboardLayoutDict: [String: () -> Void] = [ "Swedish": setSVKeyboardLayout ] +/// Sets the keyboard layout and its alternate keys. +func setKeyboard() { + setKeyboardLayout() + setKeyboardAlternateKeys() +} + /// Sets the keyboard layouts given the chosen keyboard and device type. func setKeyboardLayout() { if switchInput { @@ -115,6 +121,8 @@ func setKeyboardLayout() { allPrompts = [translatePromptAndCursor, conjugatePromptAndCursor, pluralPromptAndCursor] } +// MARK: Alternate Key Variables + /// Sets the alternates for certain keys given the chosen keyboard. func setKeyboardAlternateKeys() { if DeviceType.isPhone { @@ -155,13 +163,6 @@ func setKeyboardAlternateKeys() { ] } -/// Sets the keyboard layout and its alternate keys. -func setKeyboard() { - setKeyboardLayout() - setKeyboardAlternateKeys() -} - -// MARK: Alternate Key Variables var alternatesKeyView: UIView! var keyCancelled = false var keyPopChar = UILabel() @@ -218,6 +219,24 @@ var cAlternateKeys = [String]() var nAlternateKeys = [String]() var ьAlternateKeys = [String]() +// MARK: Callout Variables + +// Variables that define which keys are positioned on the very left, right or in the center of the keyboard. +// The purpose of these is to define which key pop up functions should be ran. +var centralKeyChars: [String] = [String]() +var leftKeyChars: [String] = [String]() +var rightKeyChars: [String] = [String]() + +// Variables for call out positioning. +var horizStart = CGFloat(0) +var vertStart = CGFloat(0) +var widthMultiplier = CGFloat(0) +var maxHeightMultiplier = CGFloat(0) +var maxHeight = CGFloat(0) +var heightBeforeTopCurves = CGFloat(0) +var maxHeightCurveControl = CGFloat(0) +var minHeightCurveControl = CGFloat(0) + // MARK: English Interface Variables // Note: here only until there is an English keyboard. @@ -292,7 +311,7 @@ func getENKeys() { leftKeyChars = ["q", "1", "-", "[", "_"] rightKeyChars = ["p", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = EnglishKeyboardConstants.letterKeysPad numberKeys = EnglishKeyboardConstants.numberKeysPad @@ -301,7 +320,7 @@ func getENKeys() { leftKeyChars = ["q", "1"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = EnglishKeyboardConstants.keysWithAlternates diff --git a/Keyboards/KeyboardsBase/KeyAnimation.swift b/Keyboards/KeyboardsBase/KeyAnimation.swift index 2d17f6aa..252b4abc 100644 --- a/Keyboards/KeyboardsBase/KeyAnimation.swift +++ b/Keyboards/KeyboardsBase/KeyAnimation.swift @@ -2,15 +2,53 @@ // KeyAnimation.swift // // Functions to pop up key characters and present alternate keys. -// +// import UIKit -// Variables that define which keys are positioned on the very left, right or in the center of the keyboard. -// The purpose of these is to define which key pop up functions should be ran. -var centralKeyChars: [String] = [String]() -var leftKeyChars: [String] = [String]() -var rightKeyChars: [String] = [String]() +/// Creates the shape that allows left most buttons to pop up after being pressed. +/// +/// - Parameters +/// - startX: the x-axis starting point. +/// - startY: the y-axis starting point. +/// - keyWidth: the width of the key. +/// - keyHeight: the height of the key. +/// - char: the character of the key. +/// - position: the position of the key. +func setPopPathState( + startX: CGFloat, + startY: CGFloat, + keyHeight: CGFloat, + char: String, + position: String +) { + // Starting positions need to be updated. + horizStart = startX + vertStart = startY + keyHeight + if DeviceType.isPad { + widthMultiplier = 0.2 + maxHeightMultiplier = 2.05 + } else if DeviceType.isPhone && [".", ",", "?", "!", "'"].contains(char) { + widthMultiplier = 0.2 + maxHeightMultiplier = 2.125 + } else { + widthMultiplier = 0.4 + maxHeightMultiplier = 2.125 + } + // Non central characters have a call out that's twice the width in one direction. + if position != "center" { + widthMultiplier *= 2 + } + maxHeight = vertStart - ( keyHeight * maxHeightMultiplier ) + maxHeightCurveControl = vertStart - ( keyHeight * ( maxHeightMultiplier - 0.125 )) + minHeightCurveControl = vertStart - ( keyHeight * 0.005 ) + + if DeviceType.isPhone { + heightBeforeTopCurves = vertStart - ( keyHeight * 1.8 ) + } else if DeviceType.isPad { + heightBeforeTopCurves = vertStart - ( keyHeight * 1.6 ) + } +} /// Creates the shape that allows left most buttons to pop up after being pressed. /// @@ -27,19 +65,40 @@ func leftKeyPopPath( keyHeight: CGFloat, char: String ) -> UIBezierPath { - // Starting positions need to be updated. - let horizStart = startX - let vertStart = startY + keyHeight + setPopPathState( + startX: startX, startY: startY, keyHeight: keyHeight, char: char, position: "left" + ) // Path is clockwise from bottom left. let path = UIBezierPath() - path.move(to: CGPoint(x: horizStart, y: vertStart)) + path.move(to: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: vertStart)) // Curve up past bottom left, path up, and curve right past the top left. + path.addCurve(to: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.075 )), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart, y: minHeightCurveControl)) + path.addLine(to: CGPoint(x: horizStart, y: heightBeforeTopCurves)) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * 0.35 ), y: maxHeight), + controlPoint1: CGPoint(x: horizStart, y: maxHeightCurveControl), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * 0.2 ), y: maxHeight)) // Path right, curve down past the top right, and path down. + path.addLine(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier * 0.35 )), y: maxHeight)) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: heightBeforeTopCurves * 1.15), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier * 0.75 )), y: maxHeight), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: maxHeightCurveControl)) + path.addLine(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: vertStart - ( keyHeight * 1.3 ))) // Curve in to the left, go down, and curve down past bottom left. + path.addCurve(to: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.5 )), + controlPoint1: CGPoint( + x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), + y: vertStart - ( keyHeight * 1.05 )), + controlPoint2: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.9 ))) + path.addLine(to: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.075 ))) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: vertStart), + controlPoint1: CGPoint(x: horizStart + keyWidth, y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: minHeightCurveControl)) path.close() return path @@ -60,21 +119,42 @@ func rightKeyPopPath( keyHeight: CGFloat, char: String ) -> UIBezierPath { - // Starting positions need to be updated. - let horizStart = startX - let vertStart = startY + keyHeight + setPopPathState( + startX: startX, startY: startY, keyHeight: keyHeight, char: char, position: "right" + ) // Path is clockwise from bottom left. let path = UIBezierPath() - path.move(to: CGPoint(x: horizStart, y: vertStart)) + path.move(to: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: vertStart)) // Curve up past bottom left, path up, and curve out to the left. + path.addCurve(to: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.075 )), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart, y: minHeightCurveControl)) + path.addLine(to: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.5 ))) + path.addCurve(to: CGPoint( + x: horizStart - ( keyWidth * widthMultiplier ), + y: vertStart - ( keyHeight * 1.3 )), + controlPoint1: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.9 )), + controlPoint2: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: vertStart - ( keyHeight * 1.05 ))) // Path up and curve right past the top left. + path.addLine(to: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: heightBeforeTopCurves)) + path.addCurve(to: CGPoint(x: horizStart - ( keyWidth * widthMultiplier * 0.35 ), y: maxHeight), + controlPoint1: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: maxHeightCurveControl), + controlPoint2: CGPoint(x: horizStart - ( keyWidth * widthMultiplier * 0.75 ), y: maxHeight)) // Path right, curve down past the top right, and path down. + path.addLine(to: CGPoint(x: horizStart + ( keyWidth * 0.5 ), y: maxHeight)) + path.addCurve(to: CGPoint(x: horizStart + keyWidth, y: heightBeforeTopCurves), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * 0.95 ), y: maxHeight), + controlPoint2: CGPoint(x: horizStart + keyWidth, y: maxHeightCurveControl)) + path.addLine(to: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.075 ))) // Curve down past bottom left. + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: vertStart), + controlPoint1: CGPoint(x: horizStart + keyWidth, y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: minHeightCurveControl)) path.close() return path @@ -95,77 +175,106 @@ func centerKeyPopPath( keyHeight: CGFloat, char: String ) -> UIBezierPath { - // Starting positions need to be updated. - let horizStart = startX - let vertStart = startY + keyHeight - var widthMultiplier = 0.0 - var maxHeightMultiplier = 0.0 - if DeviceType.isPad { - widthMultiplier = 0.2 - maxHeightMultiplier = 2.05 - } else if DeviceType.isPhone && [".", ",", "?", "!", "'"].contains(char) { - widthMultiplier = 0.2 - maxHeightMultiplier = 2.125 - } else { - widthMultiplier = 0.4 - maxHeightMultiplier = 2.125 - } + setPopPathState( + startX: startX, startY: startY, keyHeight: keyHeight, char: char, position: "center" + ) // Path is clockwise from bottom left. let path = UIBezierPath() path.move(to: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: vertStart)) // Curve up past bottom left, path up, and curve out to the left. - path.addCurve(to: CGPoint( - x: horizStart, - y: vertStart - ( keyHeight * 0.075 )), - controlPoint1: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: vertStart - ( keyHeight * 0.005 )), - controlPoint2: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.005 ))) + path.addCurve(to: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.075 )), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart, y: minHeightCurveControl)) path.addLine(to: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.85 ))) - path.addCurve(to: CGPoint( - x: horizStart - ( keyWidth * widthMultiplier ), - y: vertStart - ( keyHeight * 1.2 )), - controlPoint1: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.9 )), - controlPoint2: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: vertStart - ( keyHeight * 1.05 ))) + path.addCurve(to: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: vertStart - ( keyHeight * 1.2 )), + controlPoint1: CGPoint(x: horizStart, y: vertStart - ( keyHeight * 0.9 )), + controlPoint2: CGPoint( + x: horizStart - ( keyWidth * widthMultiplier ), + y: vertStart - ( keyHeight * 1.05 ))) // Path up and curve right past the top left. - path.addLine(to: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: vertStart - ( keyHeight * 1.8 ))) - path.addCurve(to: CGPoint( - x: horizStart + ( keyWidth * 0.075 ), - y: vertStart - ( keyHeight * maxHeightMultiplier )), - controlPoint1: CGPoint( - x: horizStart - ( keyWidth * widthMultiplier ), - y: vertStart - ( keyHeight * (maxHeightMultiplier - 0.125) )), - controlPoint2: CGPoint(x: horizStart - ( keyWidth * 0.25 ), y: vertStart - ( keyHeight * maxHeightMultiplier ))) + path.addLine(to: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: heightBeforeTopCurves)) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * 0.075 ), y: maxHeight), + controlPoint1: CGPoint(x: horizStart - ( keyWidth * widthMultiplier ), y: maxHeightCurveControl), + controlPoint2: CGPoint(x: horizStart - ( keyWidth * 0.25 ), y: maxHeight)) // Path right, curve down past the top right, and path down. - path.addLine(to: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: vertStart - ( keyHeight * maxHeightMultiplier ))) - path.addCurve(to: CGPoint( - x: horizStart + ( keyWidth * ( 1 + widthMultiplier ) ), - y: vertStart - ( keyHeight * 1.8 )), - controlPoint1: CGPoint(x: horizStart + ( keyWidth * 1.25 ), y: vertStart - ( keyHeight * maxHeightMultiplier )), - controlPoint2: CGPoint( - x: horizStart + ( keyWidth * ( 1 + widthMultiplier ) ), - y: vertStart - ( keyHeight * (maxHeightMultiplier - 0.125) ))) - path.addLine(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier ) ), y: vertStart - ( keyHeight * 1.2 ))) + path.addLine(to: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: maxHeight)) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: heightBeforeTopCurves), + controlPoint1: CGPoint(x: horizStart + ( keyWidth * 1.25 ), y: maxHeight), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: maxHeightCurveControl)) + path.addLine(to: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), y: vertStart - ( keyHeight * 1.2 ))) // Curve in to the left, go down, and curve down past bottom left. - path.addCurve(to: CGPoint( - x: horizStart + keyWidth, - y: vertStart - ( keyHeight * 0.85 )), - controlPoint1: CGPoint(x: horizStart + ( keyWidth * ( 1 + widthMultiplier ) ), y: vertStart - ( keyHeight * 1.05 )), - controlPoint2: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.9 ))) + path.addCurve(to: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.85 )), + controlPoint1: CGPoint( + x: horizStart + ( keyWidth * ( 1 + widthMultiplier )), + y: vertStart - ( keyHeight * 1.05 )), + controlPoint2: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.9 ))) path.addLine(to: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.075 ))) - path.addCurve(to: CGPoint( - x: horizStart + ( keyWidth * 0.925 ), - y: vertStart), - controlPoint1: CGPoint(x: horizStart + keyWidth, y: vertStart - ( keyHeight * 0.005 )), - controlPoint2: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: vertStart - ( keyHeight * 0.005 ))) + path.addCurve(to: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: vertStart), + controlPoint1: CGPoint(x: horizStart + keyWidth, y: minHeightCurveControl), + controlPoint2: CGPoint(x: horizStart + ( keyWidth * 0.925 ), y: minHeightCurveControl)) path.close() return path } +/// Creates and styles the pop up animation of a key. +/// +/// - Parameters +/// - key: the key pressed. +/// - layer: the layer to be set. +/// - char: the character of the key. +/// - displayChar: the character to display on the pop up. +func getKeyPopPath(key: UIButton, layer: CAShapeLayer, char: String, displayChar: String) { + // Get the frame in respect to the superview. + let frame: CGRect = (key.superview?.convert(key.frame, to: nil))! + var labelVertPosition = frame.origin.y - key.frame.height / 1.75 + if displayChar == char && DeviceType.isPhone { // non-capital characters should be highter + labelVertPosition = frame.origin.y - key.frame.height / 1.6 + } + + if centralKeyChars.contains(char) { + layer.path = centerKeyPopPath( + startX: frame.origin.x, + startY: frame.origin.y, + keyWidth: key.frame.width, + keyHeight: key.frame.height, + char: char).cgPath + keyPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.5, y: labelVertPosition) + keyHoldPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.5, y: labelVertPosition) + } else if leftKeyChars.contains(char) { + layer.path = leftKeyPopPath( + startX: frame.origin.x, + startY: frame.origin.y, + keyWidth: key.frame.width, + keyHeight: key.frame.height, + char: char).cgPath + keyPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.85, y: labelVertPosition) + keyHoldPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.85, y: labelVertPosition) + if DeviceType.isPad { + keyPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.65, y: labelVertPosition) + keyHoldPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.65, y: labelVertPosition) + } + } else if rightKeyChars.contains(char) { + layer.path = rightKeyPopPath( + startX: frame.origin.x, + startY: frame.origin.y, + keyWidth: key.frame.width, + keyHeight: key.frame.height, + char: char).cgPath + keyPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.15, y: labelVertPosition) + keyHoldPopChar.center = CGPoint(x: frame.origin.x + key.frame.width * 0.15, y: labelVertPosition) + } + + layer.strokeColor = keyShadowColor + layer.fillColor = keyColor.cgColor + layer.lineWidth = 1.0 +} + /// Sizes the character displayed on a key pop for iPhones. /// /// - Parameters @@ -176,8 +285,8 @@ func setPhoneKeyPopCharSize(char: String) { keyPopChar.font = .systemFont(ofSize: letterKeyWidth / 2.25) keyHoldPopChar.font = .systemFont(ofSize: letterKeyWidth / 2.25) } else { - keyPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.25) - keyHoldPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.25) + keyPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.15) + keyHoldPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.15) } } else if shiftButtonState == .shift || shiftButtonState == .caps { if isLandscapeView == true { @@ -261,39 +370,5 @@ func genKeyPop(key: UIButton, layer: CAShapeLayer, char: String, displayChar: St lbl.sizeToFit() } - // Get the frame in respect to the superview. - let frame: CGRect = (key.superview?.convert(key.frame, to: nil))! - - if centralKeyChars.contains(char) { - layer.path = centerKeyPopPath( - startX: frame.origin.x, - startY: frame.origin.y, - keyWidth: key.frame.width, - keyHeight: key.frame.height, - char: char).cgPath - keyPopChar.center = CGPoint( - x: frame.origin.x + key.frame.width / 2, - y: frame.origin.y - key.frame.height / 1.75) - keyHoldPopChar.center = CGPoint( - x: frame.origin.x + key.frame.width / 2, - y: frame.origin.y - key.frame.height / 1.75) - } else if leftKeyChars.contains(char) { - layer.path = leftKeyPopPath( - startX: frame.origin.x, - startY: frame.origin.y, - keyWidth: key.frame.width, - keyHeight: key.frame.height, - char: char).cgPath - } else if rightKeyChars.contains(char) { - layer.path = rightKeyPopPath( - startX: frame.origin.x, - startY: frame.origin.y, - keyWidth: key.frame.width, - keyHeight: key.frame.height, - char: char).cgPath - } - - layer.strokeColor = keyShadowColor - layer.fillColor = keyColor.cgColor - layer.lineWidth = 1.0 + getKeyPopPath(key: key, layer: layer, char: char, displayChar: displayChar) } diff --git a/Keyboards/LanguageKeyboards/French/FRInterfaceVariables.swift b/Keyboards/LanguageKeyboards/French/FRInterfaceVariables.swift index 6c5da453..e58a0fa8 100644 --- a/Keyboards/LanguageKeyboards/French/FRInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/French/FRInterfaceVariables.swift @@ -74,7 +74,7 @@ func getFRKeys() { leftKeyChars = ["a", "q", "1", "-", "[", "_"] rightKeyChars = ["p", "m", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = FrenchKeyboardConstants.letterKeysPad numberKeys = FrenchKeyboardConstants.numberKeysPad @@ -83,7 +83,7 @@ func getFRKeys() { leftKeyChars = ["q", "a", "1", "@", "~"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = FrenchKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift b/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift index 37eb2283..82c488d4 100644 --- a/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift @@ -77,7 +77,7 @@ func getDEKeys() { leftKeyChars = ["q", "a", "1", "-", "[", "_"] rightKeyChars = ["ü", "ä", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = GermanKeyboardConstants.letterKeysPad numberKeys = GermanKeyboardConstants.numberKeysPad @@ -86,7 +86,7 @@ func getDEKeys() { leftKeyChars = ["q", "a", "1", "\"", "$"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = GermanKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift index aa5c47e4..c7e8a641 100644 --- a/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift @@ -74,7 +74,7 @@ func getITKeys() { leftKeyChars = ["q", "1", "-", "[", "_"] rightKeyChars = ["p", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = ItalianKeyboardConstants.letterKeysPad numberKeys = ItalianKeyboardConstants.numberKeysPad @@ -83,7 +83,7 @@ func getITKeys() { leftKeyChars = ["q", "1"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = ItalianKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift index de2fe28e..71ee1631 100644 --- a/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift @@ -73,7 +73,7 @@ func getPTKeys() { leftKeyChars = ["q", "1", "-", "[", "_"] rightKeyChars = ["p", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = PortugueseKeyboardConstants.letterKeysPad numberKeys = PortugueseKeyboardConstants.numberKeysPad @@ -82,7 +82,7 @@ func getPTKeys() { leftKeyChars = ["q", "1"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = PortugueseKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift index 6e4c8503..918cef47 100644 --- a/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift @@ -68,7 +68,7 @@ func getRUKeys() { leftKeyChars = ["й", "ф", "1", "-", "[", "_"] rightKeyChars = ["х", "э", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = RussianKeyboardConstants.letterKeysPad numberKeys = RussianKeyboardConstants.numberKeysPad @@ -77,7 +77,7 @@ func getRUKeys() { leftKeyChars = ["й", "ф", "1", "@", "$"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = RussianKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift index 22babcc1..a3f70ee0 100644 --- a/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift @@ -75,7 +75,7 @@ func getESKeys() { leftKeyChars = ["q", "a", "1", "-", "[", "_"] rightKeyChars = ["p", "ñ", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = SpanishKeyboardConstants.letterKeysPad numberKeys = SpanishKeyboardConstants.numberKeysPad @@ -84,7 +84,7 @@ func getESKeys() { leftKeyChars = ["q", "a", "1", "@", "€"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = SpanishKeyboardConstants.keysWithAlternates diff --git a/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift index 9532a5b0..5ae88994 100644 --- a/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift @@ -76,7 +76,7 @@ func getSVKeys() { leftKeyChars = ["q", "a", "1", "-", "[", "_"] rightKeyChars = ["å", "ä", "0", "\"", "=", "·"] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { letterKeys = SwedishKeyboardConstants.letterKeysPad numberKeys = SwedishKeyboardConstants.numberKeysPad @@ -85,7 +85,7 @@ func getSVKeys() { leftKeyChars = ["q", "a", "1", "@", "€"] rightKeyChars = [] - centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) || !rightKeyChars.contains($0) } + centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } keysWithAlternates = SwedishKeyboardConstants.keysWithAlternates