From 1b54e9cfc9052008a80c1ae17ee977a9cd57f3fe Mon Sep 17 00:00:00 2001 From: samosvalishe Date: Mon, 1 Jun 2026 15:04:35 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=D0=BE=D1=87=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20AppPreferences=20=D0=BE=D1=82=20legacy-=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/freeturn/app/data/AppPreferences.kt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/freeturn/app/data/AppPreferences.kt b/app/src/main/java/com/freeturn/app/data/AppPreferences.kt index 7827961..a387ef2 100644 --- a/app/src/main/java/com/freeturn/app/data/AppPreferences.kt +++ b/app/src/main/java/com/freeturn/app/data/AppPreferences.kt @@ -1,4 +1,4 @@ -@file:Suppress("DEPRECATION") + package com.freeturn.app.data @@ -122,10 +122,6 @@ class AppPreferences(context: Context) { val TG_SUBSCRIBE_SHOWN = booleanPreferencesKey("tg_subscribe_shown") val PROFILES_JSON = stringPreferencesKey("profiles_json") val ACTIVE_PROFILE_ID = stringPreferencesKey("active_profile_id") - - // Устаревшие ключи — используются только для миграции - private val SSH_PASS_LEGACY = stringPreferencesKey("ssh_pass") - private val SSH_KEY_LEGACY = stringPreferencesKey("ssh_key") } // Шифрованное хранилище для SSH-пароля и ключа (Android Keystore + AES-256) @@ -151,12 +147,10 @@ class AppPreferences(context: Context) { ip = prefs[SSH_IP] ?: "", port = prefs[SSH_PORT] ?: 22, username = prefs[SSH_USER] ?: "root", - // Читаем из зашифрованного хранилища; если пусто — берём из DataStore (миграция) - password = encryptedPrefs.getString("ssh_pass", null) - ?: prefs[SSH_PASS_LEGACY] ?: "", + // Читаем из зашифрованного хранилища + password = encryptedPrefs.getString("ssh_pass", null) ?: "", authType = prefs[SSH_AUTH_TYPE] ?: "PASSWORD", - sshKey = encryptedPrefs.getString("ssh_key", null) - ?: prefs[SSH_KEY_LEGACY] ?: "", + sshKey = encryptedPrefs.getString("ssh_key", null) ?: "", hostFingerprint = prefs[SSH_HOST_FP] ?: "" ) } @@ -280,8 +274,6 @@ class AppPreferences(context: Context) { prefs[SSH_USER] = config.username prefs[SSH_AUTH_TYPE] = config.authType prefs[SSH_HOST_FP] = config.hostFingerprint - prefs.remove(SSH_PASS_LEGACY) - prefs.remove(SSH_KEY_LEGACY) } } @@ -349,8 +341,6 @@ class AppPreferences(context: Context) { context.dataStore.edit { it.clear() } withContext(Dispatchers.IO) { encryptedPrefs.edit { clear() } - // Чистим следы старого кастомного ядра, если оставались. - File(context.filesDir, "custom_vkturn").delete() } } }