@@ -14,6 +14,13 @@ public enum SwedishKeyboardConstants {
14
14
[ " shift " , " y " , " x " , " c " , " v " , " b " , " n " , " m " , " delete " ] ,
15
15
[ " 123 " , " selectKeyboard " , " space " , " return " ] , // "undo"
16
16
]
17
+
18
+ static let letterKeysPhoneDisableAccents = [
19
+ [ " q " , " w " , " e " , " r " , " t " , " z " , " u " , " i " , " o " , " p " ] ,
20
+ [ " a " , " s " , " d " , " f " , " g " , " h " , " j " , " k " , " l " ] ,
21
+ [ " shift " , " y " , " x " , " c " , " v " , " b " , " n " , " m " , " delete " ] ,
22
+ [ " 123 " , " selectKeyboard " , " space " , " return " ] , // "undo"
23
+ ]
17
24
18
25
static let numberKeysPhone = [
19
26
[ " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , " 0 " ] ,
@@ -37,6 +44,14 @@ public enum SwedishKeyboardConstants {
37
44
[ " shift " , " y " , " x " , " c " , " v " , " b " , " n " , " m " , " , " , " . " , " ? " , " shift " ] ,
38
45
[ " selectKeyboard " , " .?123 " , " space " , " .?123 " , " hideKeyboard " ] , // "undo"
39
46
]
47
+
48
+ static let letterKeysPadDisableAccents = [
49
+ [ " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , " 0 " , " - " , " = " , " + " ] ,
50
+ [ " q " , " w " , " e " , " r " , " t " , " z " , " u " , " i " , " o " , " p " , " delete " ] ,
51
+ [ " a " , " s " , " d " , " f " , " g " , " h " , " j " , " k " , " l " , " return " ] ,
52
+ [ " shift " , " y " , " x " , " c " , " v " , " b " , " n " , " m " , " , " , " . " , " ? " , " shift " ] ,
53
+ [ " selectKeyboard " , " .?123 " , " space " , " .?123 " , " hideKeyboard " ] , // "undo"
54
+ ]
40
55
41
56
static let numberKeysPad = [
42
57
[ " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , " 0 " , " ` " , " delete " ] ,
@@ -60,6 +75,14 @@ public enum SwedishKeyboardConstants {
60
75
[ " shift " , " < " , " z " , " x " , " c " , " v " , " b " , " n " , " m " , " , " , " . " , " - " , " shift " ] ,
61
76
[ " selectKeyboard " , " .?123 " , " space " , " .?123 " , " hideKeyboard " ] , // "microphone", "scribble"
62
77
]
78
+
79
+ static let letterKeysPadExpandedDisableAccents = [
80
+ [ " ` " , " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , " 0 " , " + " , " ' " , " delete " ] ,
81
+ [ " indent " , " q " , " w " , " e " , " r " , " t " , " y " , " u " , " i " , " o " , " p " , " ^ " , " * " ] ,
82
+ [ " uppercase " , " a " , " s " , " d " , " f " , " g " , " h " , " j " , " k " , " l " , " ' " , " return " ] ,
83
+ [ " shift " , " < " , " z " , " x " , " c " , " v " , " b " , " n " , " m " , " , " , " . " , " - " , " shift " ] ,
84
+ [ " selectKeyboard " , " .?123 " , " space " , " .?123 " , " hideKeyboard " ] , // "microphone", "scribble"
85
+ ]
63
86
64
87
static let symbolKeysPadExpanded = [
65
88
[ " § " , " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , " 0 " , " < " , " > " , " delete " ] ,
@@ -71,13 +94,17 @@ public enum SwedishKeyboardConstants {
71
94
72
95
// Alternate key vars.
73
96
static let keysWithAlternates = [ " a " , " e " , " i " , " o " , " u " , " ä " , " ö " , " c " , " n " , " s " ]
97
+ static let keysWithAlernatesDisableAccents = [ " a " , " e " , " i " , " o " , " u " , " c " , " n " , " s " ]
74
98
static let keysWithAlternatesLeft = [ " a " , " e " , " c " , " s " ]
75
99
static let keysWithAlternatesRight = [ " i " , " o " , " u " , " ä " , " ö " , " n " ]
100
+ static let keysWithAlternatesRightDisableAccents = [ " i " , " o " , " u " , " n " ]
76
101
77
102
static let aAlternateKeys = [ " á " , " à " , " â " , " ã " , " ā " ]
103
+ static let aAlternateKeysDisableAccents = [ " á " , " à " , " â " , " ã " , " ā " , " å " ]
78
104
static let eAlternateKeys = [ " é " , " ë " , " è " , " ê " , " ẽ " , " ē " , " ę " ]
79
105
static let iAlternateKeys = [ " ī " , " î " , " í " , " ï " , " ì " , " ĩ " ]
80
106
static let oAlternateKeys = [ " ō " , " õ " , " ô " , " ò " , " ó " , " œ " ]
107
+ static let oAlternateKeysDisableAccents = [ " ō " , " õ " , " ô " , " ò " , " ó " , " œ " , " ö " , " ø " ]
81
108
static let uAlternateKeys = [ " û " , " ú " , " ü " , " ù " , " ũ " , " ū " ]
82
109
static let äAlternateKeys = [ " æ " ]
83
110
static let öAlternateKeys = [ " ø " ]
@@ -88,24 +115,42 @@ public enum SwedishKeyboardConstants {
88
115
89
116
/// Gets the keys for the Swedish keyboard.
90
117
func getSVKeys( ) {
118
+ let userDefaults = UserDefaults ( suiteName: " group.scribe.userDefaultsContainer " ) !
119
+
91
120
if DeviceType . isPhone {
92
- letterKeys = SwedishKeyboardConstants . letterKeysPhone
121
+ if userDefaults. bool ( forKey: " svAccentCharacters " ) {
122
+ letterKeys = SwedishKeyboardConstants . letterKeysPhoneDisableAccents
123
+ } else {
124
+ letterKeys = SwedishKeyboardConstants . letterKeysPhone
125
+ }
93
126
numberKeys = SwedishKeyboardConstants . numberKeysPhone
94
127
symbolKeys = SwedishKeyboardConstants . symbolKeysPhone
95
128
allKeys = Array ( letterKeys. joined ( ) ) + Array( numberKeys. joined ( ) ) + Array( symbolKeys. joined ( ) )
96
129
97
130
leftKeyChars = [ " q " , " a " , " 1 " , " - " , " [ " , " _ " ]
98
- rightKeyChars = [ " å " , " ä " , " 0 " , " \" " , " = " , " · " ]
131
+ if userDefaults. bool ( forKey: " svAccentCharacters " ) {
132
+ rightKeyChars = [ " p " , " l " , " 0 " , " \" " , " = " , " · " ]
133
+ } else {
134
+ rightKeyChars = [ " å " , " ä " , " 0 " , " \" " , " = " , " · " ]
135
+ }
99
136
centralKeyChars = allKeys. filter { !leftKeyChars. contains ( $0) && !rightKeyChars. contains ( $0) }
100
137
} else {
101
138
// Use the expanded keys layout if the iPad is wide enough and has no home button.
102
139
if usingExpandedKeyboard {
103
- letterKeys = SwedishKeyboardConstants . letterKeysPadExpanded
140
+ if userDefaults. bool ( forKey: " svAccentCharacters " ) {
141
+ letterKeys = SwedishKeyboardConstants . letterKeysPadExpandedDisableAccents
142
+ } else {
143
+ letterKeys = SwedishKeyboardConstants . letterKeysPadExpanded
144
+ }
104
145
symbolKeys = SwedishKeyboardConstants . symbolKeysPadExpanded
105
146
106
147
allKeys = Array ( letterKeys. joined ( ) ) + Array( symbolKeys. joined ( ) )
107
148
} else {
108
- letterKeys = SwedishKeyboardConstants . letterKeysPad
149
+ if userDefaults. bool ( forKey: " svAccentCharacters " ) {
150
+ letterKeys = SwedishKeyboardConstants . letterKeysPadDisableAccents
151
+ } else {
152
+ letterKeys = SwedishKeyboardConstants . letterKeysPad
153
+ }
109
154
numberKeys = SwedishKeyboardConstants . numberKeysPad
110
155
symbolKeys = SwedishKeyboardConstants . symbolKeysPad
111
156
@@ -120,16 +165,23 @@ func getSVKeys() {
120
165
centralKeyChars = allKeys. filter { !leftKeyChars. contains ( $0) && !rightKeyChars. contains ( $0) }
121
166
}
122
167
123
- keysWithAlternates = SwedishKeyboardConstants . keysWithAlternates
168
+ if userDefaults. bool ( forKey: " svAccentCharacters " ) {
169
+ keysWithAlternates = SwedishKeyboardConstants . keysWithAlernatesDisableAccents
170
+ keysWithAlternatesRight = SwedishKeyboardConstants . keysWithAlternatesRightDisableAccents
171
+ aAlternateKeys = SwedishKeyboardConstants . aAlternateKeysDisableAccents
172
+ oAlternateKeys = SwedishKeyboardConstants . oAlternateKeysDisableAccents
173
+ } else {
174
+ keysWithAlternates = SwedishKeyboardConstants . keysWithAlternates
175
+ keysWithAlternatesRight = SwedishKeyboardConstants . keysWithAlternatesRight
176
+ aAlternateKeys = SwedishKeyboardConstants . aAlternateKeys
177
+ oAlternateKeys = SwedishKeyboardConstants . oAlternateKeys
178
+ äAlternateKeys = SwedishKeyboardConstants . äAlternateKeys
179
+ öAlternateKeys = SwedishKeyboardConstants . öAlternateKeys
180
+ }
124
181
keysWithAlternatesLeft = SwedishKeyboardConstants . keysWithAlternatesLeft
125
- keysWithAlternatesRight = SwedishKeyboardConstants . keysWithAlternatesRight
126
- aAlternateKeys = SwedishKeyboardConstants . aAlternateKeys
127
182
eAlternateKeys = SwedishKeyboardConstants . eAlternateKeys
128
183
iAlternateKeys = SwedishKeyboardConstants . iAlternateKeys
129
- oAlternateKeys = SwedishKeyboardConstants . oAlternateKeys
130
184
uAlternateKeys = SwedishKeyboardConstants . uAlternateKeys
131
- äAlternateKeys = SwedishKeyboardConstants . äAlternateKeys
132
- öAlternateKeys = SwedishKeyboardConstants . öAlternateKeys
133
185
sAlternateKeys = SwedishKeyboardConstants . sAlternateKeys
134
186
cAlternateKeys = SwedishKeyboardConstants . cAlternateKeys
135
187
nAlternateKeys = SwedishKeyboardConstants . nAlternateKeys
0 commit comments