Исправление импорта ссылок WDTT в v14

This commit is contained in:
Ivan4537 committed 2026-08-03 10:28:08 +03:00
1 parent 10c6939b2a
commit 3d2c277b06
4 files changed
+18 -16

No files matched your search

@@ -2431,8 +2431,9 @@ class SettingsStore(context: Context) {
this[getProfileKey(PROFILE_NAME, profile)] = importedProfileName
}
this[getProfileKey(WDTT_LINK_MODE, profile)] = plan.storeAsLink
this[getProfileKey(CONNECTION_INPUT_METHOD, profile)] =
if (plan.storeAsLink) "link" else "manual"
// A parsed wdtt:// import is still a link-originated connection even when its
// sensitive fields are materialized separately instead of keeping the raw link.
this[getProfileKey(CONNECTION_INPUT_METHOD, profile)] = "link"
if (plan.storeAsLink) {
this[getProfileKey(WDTT_LINK, profile)] = plan.link
clearManualTunnelFields(profile)
@@ -3278,9 +3279,7 @@ class SettingsStore(context: Context) {
}
val methodKey = getProfileKey(CONNECTION_INPUT_METHOD, profile)
if (!linkMode && hasManualConnection && prefs[methodKey] == "link") {
prefs[methodKey] = "manual"
} else if (prefs[methodKey] != "link" && prefs[methodKey] != "manual") {
if (prefs[methodKey] != "link" && prefs[methodKey] != "manual") {
when {
linkMode && hasStoredLink -> prefs[methodKey] = "link"
hasManualConnection -> prefs[methodKey] = "manual"
@@ -159,12 +159,7 @@ internal fun resolveConnectionInputMethod(
hasManualConnection: Boolean,
userInterface: Boolean,
): String = when (savedMethod) {
"link" -> when {
hasStoredLink -> "link"
hasManualConnection -> "manual"
userInterface -> "link"
else -> "manual"
}
"link" -> "link"
"manual" -> "manual"
else -> when {
hasStoredLink -> "link"
@@ -236,8 +231,14 @@ internal fun isSelectedCompactConnectionReady(
linkValid: Boolean,
manualValid: Boolean,
): Boolean = when (selectedMethod) {
"link" -> storedLinkMode && linkPresent && linkValid
"manual" -> !storedLinkMode && manualValid
"link" -> when {
storedLinkMode && linkPresent -> linkValid
savedMethod == "link" -> manualValid
else -> false
}
"manual" -> !storedLinkMode &&
(savedMethod == "manual" || savedMethod.isBlank()) &&
manualValid
else -> false
}
@@ -800,6 +801,7 @@ fun SettingsTabContent(
if (result == null) {
Toast.makeText(context, "Ссылка WDTT не распознана.", Toast.LENGTH_LONG).show()
} else {
userConnectionMethod = "link"
userLinkInput = ""
userConnectionEditor = ""
Toast.makeText(context, "Подключение сохранено", Toast.LENGTH_SHORT).show()