fix issues with restoring old settings

This commit is contained in:
Helium314 2025-02-16 20:32:32 +01:00
parent 0fa8f58750
commit 56c7748dff
3 changed files with 7 additions and 3 deletions

View file

@ -252,6 +252,7 @@ fun checkVersionUpgrade(context: Context) {
if (oldVersion <= 2303) {
File(DeviceProtectedUtils.getFilesDir(context), "layouts").listFiles()?.forEach { file ->
val folder = DeviceProtectedUtils.getFilesDir(context)
if (file.isDirectory) return@forEach
when (file.name) {
"custom.symbols." -> {
val dir = File(folder, LayoutType.SYMBOLS.folder)

View file

@ -134,8 +134,11 @@ fun BackupRestorePreference(setting: Setting) {
ctx.getActivity()?.contentResolver?.openInputStream(uri)?.use { inputStream ->
ZipInputStream(inputStream).use { zip ->
var entry: ZipEntry? = zip.nextEntry
val filesDir = ctx.filesDir?.path ?: return@execute
val deviceProtectedFilesDir = DeviceProtectedUtils.getFilesDir(ctx).path
val filesDir = ctx.filesDir ?: return@execute
val deviceProtectedFilesDir = DeviceProtectedUtils.getFilesDir(ctx)
filesDir.deleteRecursively()
deviceProtectedFilesDir.deleteRecursively()
LayoutUtilsCustom.onLayoutFileChanged()
Settings.getInstance().stopListener()
while (entry != null) {
if (entry.name.startsWith("unprotected${File.separator}")) {

View file

@ -25,7 +25,7 @@ import helium314.keyboard.settings.dialogs.LayoutPickerDialog
import helium314.keyboard.settings.preferences.Preference
@Composable
fun LayoutScreen(
fun SecondaryLayoutScreen(
onClickBack: () -> Unit,
) {
// todo: enable main layouts