fix: create config not saving

Fixes bug where creating a config from scratch was failing to save

Closes #93
Closes #96
Closes #89
This commit is contained in:
Zane Schepke
2024-01-19 20:52:11 -05:00
parent d6ee36edc0
commit d9f3a21cc3
6 changed files with 14 additions and 14 deletions
@@ -206,11 +206,13 @@ constructor(
val peerList = buildPeerListFromProxyPeers()
val wgInterface = buildInterfaceListFromProxyInterface()
val config = Config.Builder().addPeers(peerList).setInterface(wgInterface).build()
val tunnelConfig =
_uiState.value.tunnel?.copy(
val tunnelConfig = when(uiState.value.tunnel) {
null -> TunnelConfig(name = _uiState.value.tunnelName, wgQuick = config.toWgQuickString())
else -> uiState.value.tunnel!!.copy(
name = _uiState.value.tunnelName,
wgQuick = config.toWgQuickString(),
)
}
updateTunnelConfig(tunnelConfig)
Result.Success(Event.Message.ConfigSaved)
} catch (e: Exception) {
@@ -69,11 +69,6 @@ fun WireguardAutoTunnelTheme(
window.navigationBarColor = Color.Transparent.toArgb()
WindowCompat.getInsetsController(window, window.decorView).isAppearanceLightStatusBars =
!darkTheme
WindowCompat.getInsetsController(
window,
window.decorView,
)
.isAppearanceLightNavigationBars = !darkTheme
}
}