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,
|
||||
key = { tunnel -> tunnel.id },
|
||||
) { tunnel ->
|
||||
val isActive = uiState.tunnels.any {
|
||||
it.id == uiState.vpnState.tunnelConfig?.id &&
|
||||
uiState.vpnState.status.isUp()
|
||||
}
|
||||
val expanded = uiState.generalState.isTunnelStatsExpanded
|
||||
TunnelRowItem(
|
||||
isActive,
|
||||
tunnel.id == uiState.vpnState.tunnelConfig?.id &&
|
||||
uiState.vpnState.status.isUp(),
|
||||
expanded,
|
||||
selectedTunnel?.id == tunnel.id,
|
||||
tunnel,
|
||||
|
|
|
@ -252,13 +252,7 @@ constructor(
|
|||
|
||||
fun onCopyTunnel(tunnel: TunnelConfig) = viewModelScope.launch {
|
||||
saveTunnel(
|
||||
tunnel.copy(
|
||||
id = 0,
|
||||
isPrimaryTunnel = false,
|
||||
isMobileDataTunnel = false,
|
||||
isActive = false,
|
||||
name = makeTunnelNameUnique(tunnel.name),
|
||||
),
|
||||
TunnelConfig(name = makeTunnelNameUnique(tunnel.name), wgQuick = tunnel.wgQuick, amQuick = tunnel.amQuick)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue