From 90f2d33d97e08611e58d009a1c8475470bba20a0 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Fri, 16 Apr 2021 20:33:59 -0400 Subject: [PATCH] Fix data migration sniff setting default to true --- .../src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt | 2 +- .../main/kotlin/com/v2ray/ang/viewmodel/SettingsViewModel.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt index 404e1285..d03686b4 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt @@ -69,7 +69,6 @@ object AngConfigManager { settingsStorage?.encode(key, sharedPreferences.getString(key, null)) } listOf(AppConfig.PREF_SPEED_ENABLED, - AppConfig.PREF_SNIFFING_ENABLED, AppConfig.PREF_PROXY_SHARING, AppConfig.PREF_LOCAL_DNS_ENABLED, // AppConfig.PREF_ALLOW_INSECURE, @@ -78,6 +77,7 @@ object AngConfigManager { AppConfig.PREF_BYPASS_APPS,).forEach { key -> settingsStorage?.encode(key, sharedPreferences.getBoolean(key, false)) } + settingsStorage?.encode(AppConfig.PREF_SNIFFING_ENABLED, sharedPreferences.getBoolean(AppConfig.PREF_SNIFFING_ENABLED, true)) settingsStorage?.encode(AppConfig.PREF_PER_APP_PROXY_SET, sharedPreferences.getStringSet(AppConfig.PREF_PER_APP_PROXY_SET, setOf())) } diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/SettingsViewModel.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/SettingsViewModel.kt index d117ef2c..464f3e9a 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/SettingsViewModel.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/SettingsViewModel.kt @@ -37,7 +37,6 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application settingsStorage?.encode(key, sharedPreferences.getString(key, "")) } AppConfig.PREF_SPEED_ENABLED, - AppConfig.PREF_SNIFFING_ENABLED, AppConfig.PREF_PROXY_SHARING, AppConfig.PREF_LOCAL_DNS_ENABLED, AppConfig.PREF_FORWARD_IPV6, @@ -45,6 +44,9 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application AppConfig.PREF_BYPASS_APPS, -> { settingsStorage?.encode(key, sharedPreferences.getBoolean(key, false)) } + AppConfig.PREF_SNIFFING_ENABLED, -> { + settingsStorage?.encode(key, sharedPreferences.getBoolean(key, true)) + } AppConfig.PREF_PER_APP_PROXY_SET -> { settingsStorage?.encode(key, sharedPreferences.getStringSet(key, setOf())) }