diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt index bf6b126..e12e6f2 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt @@ -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, diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainViewModel.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainViewModel.kt index 9c821c2..f000325 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainViewModel.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainViewModel.kt @@ -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) ) }