mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4180d39925 |
+2
-2
@@ -86,13 +86,13 @@ constructor(
|
|||||||
|
|
||||||
fun NotificationChannels.asBuilder(): NotificationCompat.Builder {
|
fun NotificationChannels.asBuilder(): NotificationCompat.Builder {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
NotificationChannels.AUTO_TUNNEL -> {
|
NotificationChannels.VPN -> {
|
||||||
NotificationCompat.Builder(
|
NotificationCompat.Builder(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.auto_tunnel_channel_id),
|
context.getString(R.string.auto_tunnel_channel_id),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
NotificationChannels.VPN -> {
|
NotificationChannels.AUTO_TUNNEL -> {
|
||||||
NotificationCompat.Builder(
|
NotificationCompat.Builder(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.vpn_channel_id),
|
context.getString(R.string.vpn_channel_id),
|
||||||
|
|||||||
-2
@@ -85,7 +85,6 @@ constructor(
|
|||||||
|
|
||||||
private suspend fun setState(tunnelConfig: TunnelConfig, tunnelState: TunnelState): Result<TunnelState> {
|
private suspend fun setState(tunnelConfig: TunnelConfig, tunnelState: TunnelState): Result<TunnelState> {
|
||||||
return runCatching {
|
return runCatching {
|
||||||
updateTunnelConfig(tunnelConfig) //need so kernel can get tunnel name or it breaks kernel
|
|
||||||
when (val backend = backend()) {
|
when (val backend = backend()) {
|
||||||
is Backend -> backend.setState(this, tunnelState.toWgState(), TunnelConfig.configFromWgQuick(tunnelConfig.wgQuick)).let { TunnelState.from(it) }
|
is Backend -> backend.setState(this, tunnelState.toWgState(), TunnelConfig.configFromWgQuick(tunnelConfig.wgQuick)).let { TunnelState.from(it) }
|
||||||
is org.amnezia.awg.backend.Backend -> {
|
is org.amnezia.awg.backend.Backend -> {
|
||||||
@@ -103,7 +102,6 @@ constructor(
|
|||||||
else -> throw NotImplementedError()
|
else -> throw NotImplementedError()
|
||||||
}
|
}
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
//TODO add better error message and comms to user
|
|
||||||
Timber.e(it)
|
Timber.e(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ constructor(
|
|||||||
if (!isKernelEnabled) {
|
if (!isKernelEnabled) {
|
||||||
requestRoot().onSuccess {
|
requestRoot().onSuccess {
|
||||||
if (!isKernelSupported()) return@onSuccess SnackbarController.showMessage(StringValue.StringResource(R.string.kernel_not_supported))
|
if (!isKernelSupported()) return@onSuccess SnackbarController.showMessage(StringValue.StringResource(R.string.kernel_not_supported))
|
||||||
tunnelService.get().setBackendState(BackendState.INACTIVE, emptyList())
|
|
||||||
appDataRepository.settings.save(
|
appDataRepository.settings.save(
|
||||||
copy(
|
copy(
|
||||||
isKernelEnabled = true,
|
isKernelEnabled = true,
|
||||||
|
|||||||
+41
-42
@@ -151,51 +151,50 @@ fun SettingsScreen(viewModel: SettingsViewModel = hiltViewModel(), appViewModel:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
if (!isRunningOnTv) {
|
if (!isRunningOnTv) {
|
||||||
add(
|
addAll(
|
||||||
SelectionItem(
|
listOf(
|
||||||
Icons.Outlined.VpnLock,
|
SelectionItem(
|
||||||
{
|
Icons.Outlined.VpnLock,
|
||||||
ScaledSwitch(
|
{
|
||||||
enabled = !(
|
ScaledSwitch(
|
||||||
(
|
enabled = !(
|
||||||
uiState.settings.isTunnelOnWifiEnabled ||
|
(
|
||||||
uiState.settings.isTunnelOnEthernetEnabled ||
|
uiState.settings.isTunnelOnWifiEnabled ||
|
||||||
uiState.settings.isTunnelOnMobileDataEnabled
|
uiState.settings.isTunnelOnEthernetEnabled ||
|
||||||
) &&
|
uiState.settings.isTunnelOnMobileDataEnabled
|
||||||
uiState.settings.isAutoTunnelEnabled
|
) &&
|
||||||
),
|
uiState.settings.isAutoTunnelEnabled
|
||||||
onClick = { appViewModel.onToggleAlwaysOnVPN() },
|
),
|
||||||
checked = uiState.settings.isAlwaysOnVpnEnabled,
|
onClick = { appViewModel.onToggleAlwaysOnVPN() },
|
||||||
)
|
checked = uiState.settings.isAlwaysOnVpnEnabled,
|
||||||
},
|
)
|
||||||
title = {
|
},
|
||||||
Text(
|
title = {
|
||||||
stringResource(R.string.always_on_vpn_support),
|
Text(
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
stringResource(R.string.always_on_vpn_support),
|
||||||
)
|
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
||||||
},
|
)
|
||||||
onClick = { appViewModel.onToggleAlwaysOnVPN() },
|
},
|
||||||
|
onClick = { appViewModel.onToggleAlwaysOnVPN() },
|
||||||
|
),
|
||||||
|
SelectionItem(
|
||||||
|
Icons.Outlined.VpnKeyOff,
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.kill_switch_options),
|
||||||
|
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
navController.navigate(Route.KillSwitch)
|
||||||
|
},
|
||||||
|
trailing = {
|
||||||
|
ForwardButton { navController.navigate(Route.KillSwitch) }
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
add(
|
|
||||||
SelectionItem(
|
|
||||||
Icons.Outlined.VpnKeyOff,
|
|
||||||
title = {
|
|
||||||
Text(
|
|
||||||
stringResource(R.string.kill_switch_options),
|
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = {
|
|
||||||
navController.navigate(Route.KillSwitch)
|
|
||||||
},
|
|
||||||
trailing = {
|
|
||||||
ForwardButton { navController.navigate(Route.KillSwitch) }
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
add(
|
add(
|
||||||
SelectionItem(
|
SelectionItem(
|
||||||
Icons.Outlined.Restore,
|
Icons.Outlined.Restore,
|
||||||
|
|||||||
+16
-23
@@ -25,10 +25,7 @@ import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SelectionIte
|
|||||||
import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SurfaceSelectionGroupButton
|
import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SurfaceSelectionGroupButton
|
||||||
import com.zaneschepke.wireguardautotunnel.ui.common.navigation.TopNavBar
|
import com.zaneschepke.wireguardautotunnel.ui.common.navigation.TopNavBar
|
||||||
import com.zaneschepke.wireguardautotunnel.ui.common.permission.vpn.withVpnPermission
|
import com.zaneschepke.wireguardautotunnel.ui.common.permission.vpn.withVpnPermission
|
||||||
import com.zaneschepke.wireguardautotunnel.ui.common.snackbar.SnackbarController
|
|
||||||
import com.zaneschepke.wireguardautotunnel.ui.screens.settings.components.ForwardButton
|
import com.zaneschepke.wireguardautotunnel.ui.screens.settings.components.ForwardButton
|
||||||
import com.zaneschepke.wireguardautotunnel.util.StringValue
|
|
||||||
import com.zaneschepke.wireguardautotunnel.util.extensions.isRunningOnTv
|
|
||||||
import com.zaneschepke.wireguardautotunnel.util.extensions.launchVpnSettings
|
import com.zaneschepke.wireguardautotunnel.util.extensions.launchVpnSettings
|
||||||
import com.zaneschepke.wireguardautotunnel.util.extensions.scaledHeight
|
import com.zaneschepke.wireguardautotunnel.util.extensions.scaledHeight
|
||||||
import com.zaneschepke.wireguardautotunnel.util.extensions.scaledWidth
|
import com.zaneschepke.wireguardautotunnel.util.extensions.scaledWidth
|
||||||
@@ -41,8 +38,6 @@ fun KillSwitchScreen(uiState: AppUiState, appViewModel: AppViewModel) {
|
|||||||
|
|
||||||
fun toggleVpnKillSwitch() {
|
fun toggleVpnKillSwitch() {
|
||||||
with(uiState.settings) {
|
with(uiState.settings) {
|
||||||
//TODO improve this error message
|
|
||||||
if(isKernelEnabled) return SnackbarController.showMessage(StringValue.StringResource(R.string.kernel_not_supported))
|
|
||||||
if (isVpnKillSwitchEnabled) {
|
if (isVpnKillSwitchEnabled) {
|
||||||
appViewModel.onToggleVpnKillSwitch(false)
|
appViewModel.onToggleVpnKillSwitch(false)
|
||||||
} else {
|
} else {
|
||||||
@@ -71,25 +66,23 @@ fun KillSwitchScreen(uiState: AppUiState, appViewModel: AppViewModel) {
|
|||||||
.padding(top = 24.dp.scaledHeight())
|
.padding(top = 24.dp.scaledHeight())
|
||||||
.padding(horizontal = 24.dp.scaledWidth()),
|
.padding(horizontal = 24.dp.scaledWidth()),
|
||||||
) {
|
) {
|
||||||
if (!context.isRunningOnTv()) {
|
SurfaceSelectionGroupButton(
|
||||||
SurfaceSelectionGroupButton(
|
listOf(
|
||||||
listOf(
|
SelectionItem(
|
||||||
SelectionItem(
|
Icons.Outlined.AdminPanelSettings,
|
||||||
Icons.Outlined.AdminPanelSettings,
|
title = {
|
||||||
title = {
|
Text(
|
||||||
Text(
|
stringResource(R.string.native_kill_switch),
|
||||||
stringResource(R.string.native_kill_switch),
|
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
|
)
|
||||||
)
|
},
|
||||||
},
|
onClick = { context.launchVpnSettings() },
|
||||||
onClick = { context.launchVpnSettings() },
|
trailing = {
|
||||||
trailing = {
|
ForwardButton { context.launchVpnSettings() }
|
||||||
ForwardButton { context.launchVpnSettings() }
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
}
|
)
|
||||||
SurfaceSelectionGroupButton(
|
SurfaceSelectionGroupButton(
|
||||||
buildList {
|
buildList {
|
||||||
add(
|
add(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
object Constants {
|
object Constants {
|
||||||
const val VERSION_NAME = "3.6.4"
|
const val VERSION_NAME = "3.6.3"
|
||||||
const val JVM_TARGET = "17"
|
const val JVM_TARGET = "17"
|
||||||
const val VERSION_CODE = 36400
|
const val VERSION_CODE = 36300
|
||||||
const val TARGET_SDK = 35
|
const val TARGET_SDK = 35
|
||||||
const val MIN_SDK = 26
|
const val MIN_SDK = 26
|
||||||
const val APP_ID = "com.zaneschepke.wireguardautotunnel"
|
const val APP_ID = "com.zaneschepke.wireguardautotunnel"
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
What's new:
|
|
||||||
- Fixed kernel mode toggle bug
|
|
||||||
- Fixed notification crash bug
|
|
||||||
@@ -10,7 +10,7 @@ coreKtx = "1.15.0"
|
|||||||
datastorePreferences = "1.1.1"
|
datastorePreferences = "1.1.1"
|
||||||
desugar_jdk_libs = "2.1.3"
|
desugar_jdk_libs = "2.1.3"
|
||||||
espressoCore = "3.6.1"
|
espressoCore = "3.6.1"
|
||||||
hiltAndroid = "2.53"
|
hiltAndroid = "2.53.1"
|
||||||
hiltNavigationCompose = "1.2.0"
|
hiltNavigationCompose = "1.2.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
kotlinx-serialization-json = "1.7.3"
|
kotlinx-serialization-json = "1.7.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user