mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14a7278747 | |||
| 8fd2d8f62f | |||
| 7be051a664 | |||
| 88fff0b31c | |||
| 99a3fba97f |
@@ -15,7 +15,7 @@ A clear and concise description of what the bug is.
|
||||
- Device: [e.g. Pixel 4a]
|
||||
- Android Version: [e.g. Android 13]
|
||||
- App Version [e.g. 3.3.3]
|
||||
- Backend: [e.g. Kernel, Userspace]
|
||||
- App mode: [e.g. Kernel, VPN, Proxy, Lockdown]
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
package com.zaneschepke.wireguardautotunnel.ui.common.textbox
|
||||
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Save
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun SubmitConfigurationTextBox(
|
||||
value: String?,
|
||||
label: String,
|
||||
hint: String,
|
||||
modifier: Modifier = Modifier,
|
||||
isErrorValue: (value: String?) -> Boolean,
|
||||
onSubmit: (value: String) -> Unit,
|
||||
supportingText: @Composable (() -> Unit)? = null,
|
||||
keyboardOptions: KeyboardOptions =
|
||||
KeyboardOptions(capitalization = KeyboardCapitalization.None, imeAction = ImeAction.Done),
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
val isFocused by interactionSource.collectIsFocusedAsState()
|
||||
val keyboardController = LocalSoftwareKeyboardController.current
|
||||
|
||||
var stateValue by remember { mutableStateOf(value ?: "") }
|
||||
|
||||
CustomTextField(
|
||||
isError = isErrorValue(stateValue),
|
||||
textStyle =
|
||||
MaterialTheme.typography.bodySmall.copy(color = MaterialTheme.colorScheme.onSurface),
|
||||
value = stateValue,
|
||||
onValueChange = { stateValue = it },
|
||||
interactionSource = interactionSource,
|
||||
supportingText = supportingText,
|
||||
label = {
|
||||
Text(
|
||||
label,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
placeholder = {
|
||||
Text(
|
||||
hint,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.outline,
|
||||
)
|
||||
},
|
||||
modifier = modifier.fillMaxWidth().height(48.dp),
|
||||
singleLine = true,
|
||||
keyboardOptions = keyboardOptions,
|
||||
keyboardActions =
|
||||
KeyboardActions(
|
||||
onDone = {
|
||||
onSubmit(stateValue)
|
||||
keyboardController?.hide()
|
||||
}
|
||||
),
|
||||
trailing = {
|
||||
if (!isErrorValue(stateValue) && isFocused) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
onSubmit(stateValue)
|
||||
keyboardController?.hide()
|
||||
focusManager.clearFocus()
|
||||
}
|
||||
) {
|
||||
val icon = Icons.Outlined.Save
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = icon.name,
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
+85
-10
@@ -1,16 +1,36 @@
|
||||
package com.zaneschepke.wireguardautotunnel.ui.screens.tunnels.tunneloptions.components
|
||||
|
||||
import android.util.Patterns
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Save
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.zaneschepke.wireguardautotunnel.R
|
||||
import com.zaneschepke.wireguardautotunnel.domain.model.TunnelConf
|
||||
import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SelectionItem
|
||||
import com.zaneschepke.wireguardautotunnel.ui.common.textbox.SubmitConfigurationTextBox
|
||||
import com.zaneschepke.wireguardautotunnel.ui.common.textbox.CustomTextField
|
||||
import com.zaneschepke.wireguardautotunnel.util.extensions.isValidIpv4orIpv6Address
|
||||
|
||||
@Composable
|
||||
@@ -18,18 +38,73 @@ fun pingConfigItem(tunnelConf: TunnelConf, onSubmit: (ip: String) -> Unit): Sele
|
||||
return SelectionItem(
|
||||
title = {},
|
||||
description = {
|
||||
val focusManager = LocalFocusManager.current
|
||||
val keyboardController = LocalSoftwareKeyboardController.current
|
||||
|
||||
var stateValue by remember { mutableStateOf(tunnelConf.pingTarget ?: "") }
|
||||
val isError by
|
||||
remember(stateValue) {
|
||||
derivedStateOf {
|
||||
stateValue.isNotBlank() &&
|
||||
!stateValue.isValidIpv4orIpv6Address() &&
|
||||
!Patterns.DOMAIN_NAME.matcher(stateValue).matches()
|
||||
}
|
||||
}
|
||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
SubmitConfigurationTextBox(
|
||||
value = tunnelConf.pingTarget,
|
||||
label = stringResource(R.string.set_custom_ping_target),
|
||||
hint = stringResource(R.string.ip_or_hostname),
|
||||
isErrorValue = {
|
||||
it?.isNotBlank() == true &&
|
||||
!it.isValidIpv4orIpv6Address() &&
|
||||
!Patterns.DOMAIN_NAME.matcher(it).matches()
|
||||
CustomTextField(
|
||||
isError = isError,
|
||||
textStyle =
|
||||
MaterialTheme.typography.bodySmall.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
),
|
||||
value = stateValue,
|
||||
onValueChange = { stateValue = it },
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
label = {
|
||||
Text(
|
||||
stringResource(R.string.set_custom_ping_target),
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
stringResource(R.string.ip_or_hostname),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.outline,
|
||||
)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
supportingText = { Text(stringResource(R.string.ping_target_description)) },
|
||||
onSubmit = onSubmit,
|
||||
modifier =
|
||||
Modifier.padding(top = 5.dp, bottom = 10.dp)
|
||||
.fillMaxWidth()
|
||||
.padding(end = 16.dp),
|
||||
singleLine = true,
|
||||
keyboardOptions =
|
||||
KeyboardOptions(
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
imeAction = ImeAction.Done,
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { onSubmit(stateValue) }),
|
||||
trailing = {
|
||||
if (!isError) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
onSubmit(stateValue)
|
||||
keyboardController?.hide()
|
||||
focusManager.clearFocus()
|
||||
}
|
||||
) {
|
||||
val icon = Icons.Outlined.Save
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = icon.name,
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<files-path name="files" path="." />
|
||||
<external-path name="external_files" path="." />
|
||||
<external-files-path name="apks" path="/" />
|
||||
</paths>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<files-path name="files" path="." />
|
||||
<external-path name="external_files" path="." />
|
||||
<external-files-path name="apks" path="/" />
|
||||
<cache-path name="cache_files" path="external_files/" />
|
||||
</paths>
|
||||
@@ -1,6 +1,6 @@
|
||||
object Constants {
|
||||
const val VERSION_NAME = "4.0.0"
|
||||
const val VERSION_CODE = 40000
|
||||
const val VERSION_NAME = "4.0.1"
|
||||
const val VERSION_CODE = 40001
|
||||
const val TARGET_SDK = 36
|
||||
const val MIN_SDK = 26
|
||||
const val APP_ID = "com.zaneschepke.wireguardautotunnel"
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
What's new:
|
||||
- Search domain tunnels fail to start bugfix
|
||||
- DNS fallback to IPv4 on IPv4 only networks bugfix
|
||||
- Ping target not editable bugfix
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
accompanist = "0.37.3"
|
||||
activityCompose = "1.11.0"
|
||||
amneziawgAndroid = "2.1.8"
|
||||
amneziawgAndroid = "2.1.9"
|
||||
androidx-junit = "1.3.0"
|
||||
icmp4a = "1.0.0"
|
||||
orbitCompose = "10.0.0"
|
||||
|
||||
Reference in New Issue
Block a user