mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-18 21:32:04 +00:00
fix additional subtypes being removed when upgrading from 2.2 beta or older
This commit is contained in:
parent
453683a925
commit
fc12877795
2 changed files with 3 additions and 5 deletions
|
@ -111,19 +111,17 @@ fun checkVersionUpgrade(context: Context) {
|
||||||
if (additionalSubtypeString.contains(".")) { // means there are custom layouts
|
if (additionalSubtypeString.contains(".")) { // means there are custom layouts
|
||||||
val subtypeStrings = additionalSubtypeString.split(";")
|
val subtypeStrings = additionalSubtypeString.split(";")
|
||||||
val newSubtypeStrings = subtypeStrings.mapNotNull {
|
val newSubtypeStrings = subtypeStrings.mapNotNull {
|
||||||
|
if ("." !in it) // not a custom subtype, nothing to do
|
||||||
|
return@mapNotNull it
|
||||||
val split = it.split(":").toMutableList()
|
val split = it.split(":").toMutableList()
|
||||||
Log.i("test", "0: $it")
|
|
||||||
if (split.size < 2) return@mapNotNull null // should never happen
|
if (split.size < 2) return@mapNotNull null // should never happen
|
||||||
val oldName = split[1]
|
val oldName = split[1]
|
||||||
val newName = oldName.substringBeforeLast(".") + "."
|
val newName = oldName.substringBeforeLast(".") + "."
|
||||||
if (oldName == newName) return@mapNotNull split.joinToString(":") // should never happen
|
if (oldName == newName) return@mapNotNull split.joinToString(":") // should never happen
|
||||||
val oldFile = getCustomLayoutFile(oldName, context)
|
val oldFile = getCustomLayoutFile(oldName, context)
|
||||||
val newFile = getCustomLayoutFile(newName, context)
|
val newFile = getCustomLayoutFile(newName, context)
|
||||||
Log.i("test", "1")
|
|
||||||
if (!oldFile.exists()) return@mapNotNull null // should never happen
|
if (!oldFile.exists()) return@mapNotNull null // should never happen
|
||||||
Log.i("test", "2")
|
|
||||||
if (newFile.exists()) newFile.delete() // should never happen
|
if (newFile.exists()) newFile.delete() // should never happen
|
||||||
Log.i("test", "3")
|
|
||||||
oldFile.renameTo(newFile)
|
oldFile.renameTo(newFile)
|
||||||
val enabledSubtypes = prefs.getString(Settings.PREF_ENABLED_SUBTYPES, "")!!
|
val enabledSubtypes = prefs.getString(Settings.PREF_ENABLED_SUBTYPES, "")!!
|
||||||
if (enabledSubtypes.contains(oldName))
|
if (enabledSubtypes.contains(oldName))
|
||||||
|
|
|
@ -37,7 +37,7 @@ If the layout has exactly 2 keys in the bottom row, these keys will replace comm
|
||||||
* `shift_state_selector`: keys for `unshifted`, `shifted`, `shiftedManual`, `shiftedAutomatic`, `capsLock`, `manualOrLocked`, `default` (all optional)
|
* `shift_state_selector`: keys for `unshifted`, `shifted`, `shiftedManual`, `shiftedAutomatic`, `capsLock`, `manualOrLocked`, `default` (all optional)
|
||||||
* `variation_selector`: keys for input types `datetime`, `time`, `date`, `password`, `normal`, `uri`, `email`, `default` (all optional)
|
* `variation_selector`: keys for input types `datetime`, `time`, `date`, `password`, `normal`, `uri`, `email`, `default` (all optional)
|
||||||
* `keyboard_state_selector`: keys for `emojiKeyEnabled`, `languageKeyEnabled`, `symbols`, `moreSymbols`, `alphabet`, `default` (all optional)
|
* `keyboard_state_selector`: keys for `emojiKeyEnabled`, `languageKeyEnabled`, `symbols`, `moreSymbols`, `alphabet`, `default` (all optional)
|
||||||
* the `keyEnabled` keys will be used if the corresponding setting is enabled, `symbols`, `moreSymbols`, `alphabet` will be used when the said keyboard view is active
|
* the `<emoji/language>KeyEnabled` keys will be used if the corresponding setting is enabled, `symbols`, `moreSymbols`, `alphabet` will be used when the said keyboard view is active
|
||||||
* `layout_direction_selector`: keys for `ltr` and `rtl` (both mandatory)
|
* `layout_direction_selector`: keys for `ltr` and `rtl` (both mandatory)
|
||||||
### Properties
|
### Properties
|
||||||
* A (non-selector) key can have the following properties:
|
* A (non-selector) key can have the following properties:
|
||||||
|
|
Loading…
Add table
Reference in a new issue