fix: copy tunnel bug
This commit is contained in:
parent
921e33cb70
commit
57676bf4bb
|
@ -248,13 +248,10 @@ fun MainScreen(viewModel: MainViewModel = hiltViewModel(), uiState: AppUiState)
|
||||||
uiState.tunnels,
|
uiState.tunnels,
|
||||||
key = { tunnel -> tunnel.id },
|
key = { tunnel -> tunnel.id },
|
||||||
) { tunnel ->
|
) { tunnel ->
|
||||||
val isActive = uiState.tunnels.any {
|
|
||||||
it.id == uiState.vpnState.tunnelConfig?.id &&
|
|
||||||
uiState.vpnState.status.isUp()
|
|
||||||
}
|
|
||||||
val expanded = uiState.generalState.isTunnelStatsExpanded
|
val expanded = uiState.generalState.isTunnelStatsExpanded
|
||||||
TunnelRowItem(
|
TunnelRowItem(
|
||||||
isActive,
|
tunnel.id == uiState.vpnState.tunnelConfig?.id &&
|
||||||
|
uiState.vpnState.status.isUp(),
|
||||||
expanded,
|
expanded,
|
||||||
selectedTunnel?.id == tunnel.id,
|
selectedTunnel?.id == tunnel.id,
|
||||||
tunnel,
|
tunnel,
|
||||||
|
|
|
@ -252,13 +252,7 @@ constructor(
|
||||||
|
|
||||||
fun onCopyTunnel(tunnel: TunnelConfig) = viewModelScope.launch {
|
fun onCopyTunnel(tunnel: TunnelConfig) = viewModelScope.launch {
|
||||||
saveTunnel(
|
saveTunnel(
|
||||||
tunnel.copy(
|
TunnelConfig(name = makeTunnelNameUnique(tunnel.name), wgQuick = tunnel.wgQuick, amQuick = tunnel.amQuick)
|
||||||
id = 0,
|
|
||||||
isPrimaryTunnel = false,
|
|
||||||
isMobileDataTunnel = false,
|
|
||||||
isActive = false,
|
|
||||||
name = makeTunnelNameUnique(tunnel.name),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue