fix: minor ui changes
This commit is contained in:
parent
1af474c449
commit
528a1f84e4
|
@ -56,9 +56,12 @@ constructor(
|
||||||
return runCatching {
|
return runCatching {
|
||||||
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 -> backend.setState(this, tunnelState.toAmState(), TunnelConfig.configFromAmQuick(tunnelConfig.amQuick)).let {
|
is org.amnezia.awg.backend.Backend -> {
|
||||||
|
val config = if(tunnelConfig.amQuick.isBlank()) TunnelConfig.configFromAmQuick(tunnelConfig.wgQuick) else TunnelConfig.configFromAmQuick(tunnelConfig.amQuick)
|
||||||
|
backend.setState(this, tunnelState.toAmState(), config).let {
|
||||||
TunnelState.from(it)
|
TunnelState.from(it)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else -> throw NotImplementedError()
|
else -> throw NotImplementedError()
|
||||||
}
|
}
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import androidx.compose.material3.SnackbarDuration
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.material3.SnackbarResult
|
import androidx.compose.material3.SnackbarResult
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.surfaceColorAtElevation
|
import androidx.compose.material3.surfaceColorAtElevation
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
@ -127,6 +128,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
containerColor = MaterialTheme.colorScheme.background,
|
||||||
// TODO refactor
|
// TODO refactor
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
@ -148,6 +150,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
Surface {
|
||||||
NavHost(
|
NavHost(
|
||||||
navController,
|
navController,
|
||||||
startDestination = (if (isPinLockEnabled == true) Screen.Lock.route else Screen.Main.route),
|
startDestination = (if (isPinLockEnabled == true) Screen.Lock.route else Screen.Main.route),
|
||||||
|
@ -237,3 +240,4 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import androidx.compose.material3.NavigationBar
|
||||||
import androidx.compose.material3.NavigationBarItem
|
import androidx.compose.material3.NavigationBarItem
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
|
|
|
@ -296,7 +296,7 @@ constructor(
|
||||||
val wgQuick = buildConfig().toWgQuickString(true)
|
val wgQuick = buildConfig().toWgQuickString(true)
|
||||||
val amQuick =
|
val amQuick =
|
||||||
if (configType == ConfigType.AMNEZIA) {
|
if (configType == ConfigType.AMNEZIA) {
|
||||||
buildAmConfig().toAwgQuickString()
|
buildAmConfig().toAwgQuickString(true)
|
||||||
} else {
|
} else {
|
||||||
TunnelConfig.AM_QUICK_DEFAULT
|
TunnelConfig.AM_QUICK_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,6 @@ import android.annotation.SuppressLint
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AppCompatActivity.RESULT_OK
|
import androidx.appcompat.app.AppCompatActivity.RESULT_OK
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.focusable
|
import androidx.compose.foundation.focusable
|
||||||
import androidx.compose.foundation.gestures.ScrollableDefaults
|
import androidx.compose.foundation.gestures.ScrollableDefaults
|
||||||
|
@ -265,12 +262,8 @@ fun MainScreen(
|
||||||
reverseLayout = false,
|
reverseLayout = false,
|
||||||
flingBehavior = ScrollableDefaults.flingBehavior(),
|
flingBehavior = ScrollableDefaults.flingBehavior(),
|
||||||
) {
|
) {
|
||||||
|
if(uiState.tunnels.isEmpty()) {
|
||||||
item {
|
item {
|
||||||
AnimatedVisibility(
|
|
||||||
uiState.tunnels.isEmpty(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
enter = fadeIn(),
|
|
||||||
) {
|
|
||||||
GettingStartedLabel(onClick = { context.openWebUrl(it) })
|
GettingStartedLabel(onClick = { context.openWebUrl(it) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ constructor(
|
||||||
when (type) {
|
when (type) {
|
||||||
ConfigType.AMNEZIA -> {
|
ConfigType.AMNEZIA -> {
|
||||||
val config = org.amnezia.awg.config.Config.parse(it)
|
val config = org.amnezia.awg.config.Config.parse(it)
|
||||||
amQuick = config.toAwgQuickString()
|
amQuick = config.toAwgQuickString(true)
|
||||||
config.toWgQuickString()
|
config.toWgQuickString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ constructor(
|
||||||
org.amnezia.awg.config.Config.parse(
|
org.amnezia.awg.config.Config.parse(
|
||||||
zip,
|
zip,
|
||||||
)
|
)
|
||||||
amQuick = config.toAwgQuickString()
|
amQuick = config.toAwgQuickString(true)
|
||||||
config.toWgQuickString()
|
config.toWgQuickString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ fun SettingsScreen(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth(fillMaxWidth)
|
.fillMaxWidth(fillMaxWidth)
|
||||||
.padding(vertical = 10.dp)
|
.padding(vertical = 10.dp)
|
||||||
.padding(bottom = 140.dp),
|
.padding(bottom = 10.dp),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.Start,
|
horizontalAlignment = Alignment.Start,
|
||||||
|
|
|
@ -29,7 +29,7 @@ fun TunnelStatistics.PeerStats.handshakeStatus(): HandshakeStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Config.toWgQuickString(): String {
|
fun Config.toWgQuickString(): String {
|
||||||
val amQuick = toAwgQuickString()
|
val amQuick = toAwgQuickString(true)
|
||||||
val lines = amQuick.lines().toMutableList()
|
val lines = amQuick.lines().toMutableList()
|
||||||
val linesIterator = lines.iterator()
|
val linesIterator = lines.iterator()
|
||||||
while (linesIterator.hasNext()) {
|
while (linesIterator.hasNext()) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[versions]
|
[versions]
|
||||||
accompanist = "0.34.0"
|
accompanist = "0.34.0"
|
||||||
activityCompose = "1.9.1"
|
activityCompose = "1.9.1"
|
||||||
amneziawgAndroid = "1.2.1"
|
amneziawgAndroid = "1.2.2"
|
||||||
androidx-junit = "1.2.1"
|
androidx-junit = "1.2.1"
|
||||||
appcompat = "1.7.0"
|
appcompat = "1.7.0"
|
||||||
biometricKtx = "1.2.0-alpha05"
|
biometricKtx = "1.2.0-alpha05"
|
||||||
|
@ -16,7 +16,7 @@ junit = "4.13.2"
|
||||||
kotlinx-serialization-json = "1.7.1"
|
kotlinx-serialization-json = "1.7.1"
|
||||||
lifecycle-runtime-compose = "2.8.4"
|
lifecycle-runtime-compose = "2.8.4"
|
||||||
material3 = "1.2.1"
|
material3 = "1.2.1"
|
||||||
multifabVersion = "1.1.0"
|
multifabVersion = "1.1.1"
|
||||||
navigationCompose = "2.7.7"
|
navigationCompose = "2.7.7"
|
||||||
pinLockCompose = "1.0.3"
|
pinLockCompose = "1.0.3"
|
||||||
roomVersion = "2.6.1"
|
roomVersion = "2.6.1"
|
||||||
|
|
Loading…
Reference in New Issue