feat(server): перенести вход сопряжения на вкладку сервера
- убрать SSH-статус и кнопку сопряжения с главного экрана - авто-сопряжение при открытии вкладки сервера из сохранённого конфига - карточка состояния SSH (приглашение/прогресс/ошибка) вместо задизейбленных контролов - дебаунс показа карточки, чтобы не мигала при загрузке конфига - cleanup неиспользуемых строк
This commit is contained in:
1 parent
1dc67a44df
commit
ed7d369064
4 files changed
+174
-73
No files matched your search
@@ -232,12 +232,8 @@ private fun AppNavHost(
|
|||||||
SshSetupScreen(
|
SshSetupScreen(
|
||||||
serverViewModel = serverViewModel,
|
serverViewModel = serverViewModel,
|
||||||
settingsViewModel = settingsViewModel,
|
settingsViewModel = settingsViewModel,
|
||||||
onConnected = {
|
// Форма открыта поверх экрана сервера — после успеха возвращаемся на него.
|
||||||
navController.navigate(Routes.SERVER_MANAGEMENT) {
|
onConnected = { navController.popBackStack() },
|
||||||
popUpTo(Routes.SSH_SETUP) { inclusive = true }
|
|
||||||
launchSingleTop = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onBack = { navController.popBackStack() }
|
onBack = { navController.popBackStack() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -246,6 +242,7 @@ private fun AppNavHost(
|
|||||||
ServerManagementScreen(
|
ServerManagementScreen(
|
||||||
serverViewModel = serverViewModel,
|
serverViewModel = serverViewModel,
|
||||||
settingsViewModel = settingsViewModel,
|
settingsViewModel = settingsViewModel,
|
||||||
|
onEditConnection = { navController.navigate(Routes.SSH_SETUP) },
|
||||||
onContinue = {
|
onContinue = {
|
||||||
navController.navigate(Routes.CLIENT_SETUP) {
|
navController.navigate(Routes.CLIENT_SETUP) {
|
||||||
// Убираем SERVER_MANAGEMENT из back stack,
|
// Убираем SERVER_MANAGEMENT из back stack,
|
||||||
@@ -268,9 +265,7 @@ private fun AppNavHost(
|
|||||||
composable(Routes.HOME) {
|
composable(Routes.HOME) {
|
||||||
HomeScreen(
|
HomeScreen(
|
||||||
settingsViewModel = settingsViewModel,
|
settingsViewModel = settingsViewModel,
|
||||||
proxyViewModel = proxyViewModel,
|
proxyViewModel = proxyViewModel
|
||||||
serverViewModel = serverViewModel,
|
|
||||||
onNavigateToSshSetup = { navController.navigate(Routes.SSH_SETUP) }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import androidx.compose.animation.core.Spring
|
|||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.animation.core.spring
|
import androidx.compose.animation.core.spring
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -24,7 +23,6 @@ import androidx.compose.foundation.layout.height
|
|||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
@@ -94,11 +92,9 @@ import com.freeturn.app.data.SplitTunnelMode
|
|||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
import com.freeturn.app.ui.theme.extendedColorScheme
|
import com.freeturn.app.ui.theme.extendedColorScheme
|
||||||
import com.freeturn.app.viewmodel.ProxyState
|
import com.freeturn.app.viewmodel.ProxyState
|
||||||
import com.freeturn.app.viewmodel.SshConnectionState
|
|
||||||
import com.freeturn.app.viewmodel.UpdateState
|
import com.freeturn.app.viewmodel.UpdateState
|
||||||
import com.freeturn.app.viewmodel.SettingsViewModel
|
import com.freeturn.app.viewmodel.SettingsViewModel
|
||||||
import com.freeturn.app.viewmodel.ProxyViewModel
|
import com.freeturn.app.viewmodel.ProxyViewModel
|
||||||
import com.freeturn.app.viewmodel.ServerViewModel
|
|
||||||
|
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
|
||||||
@@ -106,18 +102,13 @@ import androidx.core.net.toUri
|
|||||||
@Composable
|
@Composable
|
||||||
fun HomeScreen(
|
fun HomeScreen(
|
||||||
settingsViewModel: SettingsViewModel,
|
settingsViewModel: SettingsViewModel,
|
||||||
proxyViewModel: ProxyViewModel,
|
proxyViewModel: ProxyViewModel
|
||||||
serverViewModel: ServerViewModel,
|
|
||||||
onNavigateToSshSetup: () -> Unit
|
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val proxyState by proxyViewModel.proxyState.collectAsStateWithLifecycle()
|
val proxyState by proxyViewModel.proxyState.collectAsStateWithLifecycle()
|
||||||
val connectedSince by proxyViewModel.connectedSince.collectAsStateWithLifecycle()
|
val connectedSince by proxyViewModel.connectedSince.collectAsStateWithLifecycle()
|
||||||
val uptimeText = rememberProxyUptime(connectedSince)
|
val uptimeText = rememberProxyUptime(connectedSince)
|
||||||
val sshState by serverViewModel.sshState.collectAsStateWithLifecycle()
|
|
||||||
val sshConfig by serverViewModel.sshConfig.collectAsStateWithLifecycle()
|
|
||||||
val clientConfig by settingsViewModel.clientConfig.collectAsStateWithLifecycle()
|
val clientConfig by settingsViewModel.clientConfig.collectAsStateWithLifecycle()
|
||||||
val isConfigured = sshConfig.ip.isNotBlank()
|
|
||||||
|
|
||||||
// Запрос разрешений при первом открытии главного экрана
|
// Запрос разрешений при первом открытии главного экрана
|
||||||
val batteryOptLauncher = rememberLauncherForActivityResult(
|
val batteryOptLauncher = rememberLauncherForActivityResult(
|
||||||
@@ -217,12 +208,6 @@ fun HomeScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(stringResource(R.string.turn_proxy_title)) },
|
title = { Text(stringResource(R.string.turn_proxy_title)) },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = {
|
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
|
||||||
onNavigateToSshSetup()
|
|
||||||
}) {
|
|
||||||
Icon(painterResource(R.drawable.host_24px), contentDescription = stringResource(R.string.connection))
|
|
||||||
}
|
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
showBottomSheet.value = true
|
showBottomSheet.value = true
|
||||||
@@ -296,51 +281,6 @@ fun HomeScreen(
|
|||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isConfigured) {
|
|
||||||
Spacer(Modifier.height(32.dp))
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 24.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.size(8.dp)
|
|
||||||
.background(
|
|
||||||
if (sshState is SshConnectionState.Connected)
|
|
||||||
MaterialTheme.extendedColorScheme.info
|
|
||||||
else MaterialTheme.colorScheme.outline,
|
|
||||||
CircleShape
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Spacer(Modifier.width(8.dp))
|
|
||||||
Text(
|
|
||||||
when (sshState) {
|
|
||||||
is SshConnectionState.Connected -> "SSH: ${(sshState as SshConnectionState.Connected).ip.redact(privacyMode)}"
|
|
||||||
is SshConnectionState.Connecting -> stringResource(R.string.ssh_connecting)
|
|
||||||
is SshConnectionState.Error -> stringResource(R.string.ssh_error)
|
|
||||||
else -> stringResource(R.string.ssh_disconnected)
|
|
||||||
},
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
if (sshState !is SshConnectionState.Connected) {
|
|
||||||
Spacer(Modifier.width(8.dp))
|
|
||||||
TextButton(
|
|
||||||
onClick = {
|
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
|
||||||
serverViewModel.reconnectSsh()
|
|
||||||
},
|
|
||||||
enabled = sshState !is SshConnectionState.Connecting
|
|
||||||
) {
|
|
||||||
Text(stringResource(R.string.reconnect), style = MaterialTheme.typography.labelSmall)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(Modifier.height(32.dp))
|
Spacer(Modifier.height(32.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
package com.freeturn.app.ui.screens
|
package com.freeturn.app.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.expandVertically
|
import androidx.compose.animation.expandVertically
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
@@ -39,6 +40,7 @@ import androidx.compose.material3.CardDefaults
|
|||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FilledTonalButton
|
import androidx.compose.material3.FilledTonalButton
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.LinearWavyProgressIndicator
|
import androidx.compose.material3.LinearWavyProgressIndicator
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
@@ -61,7 +63,10 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.semantics.semantics
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -78,8 +83,14 @@ import com.freeturn.app.viewmodel.SettingsViewModel
|
|||||||
fun ServerManagementScreen(
|
fun ServerManagementScreen(
|
||||||
serverViewModel: ServerViewModel,
|
serverViewModel: ServerViewModel,
|
||||||
settingsViewModel: SettingsViewModel,
|
settingsViewModel: SettingsViewModel,
|
||||||
onContinue: () -> Unit
|
onContinue: () -> Unit,
|
||||||
|
// null — поток онбординга (SERVER_MANAGEMENT_OB): сюда приходят уже сопряжёнными,
|
||||||
|
// SSH-логика не активна, экран рендерится как раньше. Не-null — основная вкладка:
|
||||||
|
// включает авто-сопряжение при открытии, кнопку смены сервера и состояния
|
||||||
|
// «не сопряжено / подключаюсь / ошибка».
|
||||||
|
onEditConnection: (() -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
|
val mainFlow = onEditConnection != null
|
||||||
val sshState by serverViewModel.sshState.collectAsStateWithLifecycle()
|
val sshState by serverViewModel.sshState.collectAsStateWithLifecycle()
|
||||||
val serverState by serverViewModel.serverState.collectAsStateWithLifecycle()
|
val serverState by serverViewModel.serverState.collectAsStateWithLifecycle()
|
||||||
val sshConfig by serverViewModel.sshConfig.collectAsStateWithLifecycle()
|
val sshConfig by serverViewModel.sshConfig.collectAsStateWithLifecycle()
|
||||||
@@ -106,9 +117,32 @@ fun ServerManagementScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Авто-сопряжение при открытии основной вкладки: есть сохранённый конфиг, но
|
||||||
|
// соединение не установлено → пробуем переподключиться. Триггер только из
|
||||||
|
// Disconnected (после неудачи состояние Error — без бесконечного цикла). Ключ по
|
||||||
|
// ip корректно отрабатывает асинхронную загрузку конфига из DataStore.
|
||||||
|
LaunchedEffect(sshConfig.ip, mainFlow) {
|
||||||
|
if (mainFlow && sshConfig.ip.isNotBlank() && sshState is SshConnectionState.Disconnected) {
|
||||||
|
serverViewModel.reconnectSsh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
val isConnected = sshState is SshConnectionState.Connected
|
val isConnected = sshState is SshConnectionState.Connected
|
||||||
|
// Дебаунс карточки сопряжения: при открытии config грузится из DataStore async,
|
||||||
|
// а sshState стартует Disconnected — без задержки карточка мигает на доли секунды
|
||||||
|
// до прихода Connected. Ошибку показываем сразу (уже устаканившееся состояние).
|
||||||
|
var pairingPromptVisible by remember { mutableStateOf(false) }
|
||||||
|
LaunchedEffect(isConnected) {
|
||||||
|
if (isConnected) {
|
||||||
|
pairingPromptVisible = false
|
||||||
|
} else {
|
||||||
|
delay(400)
|
||||||
|
pairingPromptVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val showPairing = sshState is SshConnectionState.Error || pairingPromptVisible
|
||||||
val isWorking = serverState is ServerState.Working || serverState is ServerState.Checking
|
val isWorking = serverState is ServerState.Working || serverState is ServerState.Checking
|
||||||
val serverKnown = serverState as? ServerState.Known
|
val serverKnown = serverState as? ServerState.Known
|
||||||
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
|
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
|
||||||
@@ -121,6 +155,18 @@ fun ServerManagementScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
actions = {
|
actions = {
|
||||||
SshStatusBadge(sshState = sshState, ip = sshConfig.ip.redact(privacyMode))
|
SshStatusBadge(sshState = sshState, ip = sshConfig.ip.redact(privacyMode))
|
||||||
|
// Вход в форму сопряжения / смены сервера (перенесён с главного экрана).
|
||||||
|
if (onEditConnection != null) {
|
||||||
|
IconButton(onClick = {
|
||||||
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
|
onEditConnection()
|
||||||
|
}) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.host_24px),
|
||||||
|
contentDescription = stringResource(R.string.connection)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -144,6 +190,24 @@ fun ServerManagementScreen(
|
|||||||
) {
|
) {
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
|
|
||||||
|
// Основная вкладка без активного сопряжения → приглашение/прогресс/ошибка
|
||||||
|
// вместо бесполезных задизейбленных контролов. В онбординге (mainFlow=false)
|
||||||
|
// сюда приходят уже Connected, поэтому ветка management как раньше.
|
||||||
|
if (mainFlow && !isConnected) {
|
||||||
|
// showPairing дебаунсит первичный показ — пустой экран до 400мс
|
||||||
|
// вместо мигающей карточки при загрузке config / авто-сопряжении.
|
||||||
|
if (showPairing) {
|
||||||
|
SshPairingPrompt(
|
||||||
|
state = sshState,
|
||||||
|
configBlank = sshConfig.ip.isBlank(),
|
||||||
|
onConnect = { onEditConnection?.invoke() },
|
||||||
|
onRetry = { serverViewModel.reconnectSsh() }
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(24.dp))
|
||||||
|
}
|
||||||
|
return@Column
|
||||||
|
}
|
||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = !clientCfg.syncServerSwitches,
|
visible = !clientCfg.syncServerSwitches,
|
||||||
enter = fadeIn() + expandVertically(),
|
enter = fadeIn() + expandVertically(),
|
||||||
@@ -461,6 +525,109 @@ fun ServerManagementScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Состояние сопряжения для основной вкладки сервера, когда соединение ещё не
|
||||||
|
* установлено: приглашение подключиться (нет конфига), прогресс (идёт авто-/ручное
|
||||||
|
* сопряжение) или ошибка с повтором.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun SshPairingPrompt(
|
||||||
|
state: SshConnectionState,
|
||||||
|
configBlank: Boolean,
|
||||||
|
onConnect: () -> Unit,
|
||||||
|
onRetry: () -> Unit
|
||||||
|
) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
// Disconnected с сохранённым конфигом — транзитное: авто-сопряжение вот-вот
|
||||||
|
// сработает, показываем прогресс, а не кнопку «Подключиться» (без мигания).
|
||||||
|
val connecting = state is SshConnectionState.Connecting ||
|
||||||
|
(state is SshConnectionState.Disconnected && !configBlank)
|
||||||
|
// Ключ для AnimatedContent: морфим только при смене фазы, а не при каждом
|
||||||
|
// обновлении state.message внутри Error.
|
||||||
|
val phase = when {
|
||||||
|
state is SshConnectionState.Error -> "error"
|
||||||
|
connecting -> "connecting"
|
||||||
|
else -> "prompt"
|
||||||
|
}
|
||||||
|
|
||||||
|
Card(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
AnimatedContent(
|
||||||
|
targetState = phase,
|
||||||
|
label = "ssh-pairing",
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) { target ->
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.padding(24.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
|
) {
|
||||||
|
when (target) {
|
||||||
|
"error" -> {
|
||||||
|
val message = (state as? SshConnectionState.Error)?.message.orEmpty()
|
||||||
|
// Иконка + текст — единый узел для TalkBack: озвучивается как ошибка.
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
modifier = Modifier.semantics(mergeDescendants = true) {}
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.error_24px),
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.error
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
message,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
|
onRetry()
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
shape = MaterialTheme.shapes.large
|
||||||
|
) { Text(stringResource(R.string.reconnect)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
"connecting" -> {
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.ssh_connecting),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
LinearWavyProgressIndicator(modifier = Modifier.fillMaxWidth())
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.host_24px),
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.server_not_paired_prompt),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
|
onConnect()
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
shape = MaterialTheme.shapes.large
|
||||||
|
) { Text(stringResource(R.string.connect_btn)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
||||||
val connected = sshState is SshConnectionState.Connected
|
val connected = sshState is SshConnectionState.Connected
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
<string name="tcp">TCP</string>
|
<string name="tcp">TCP</string>
|
||||||
<string name="udp">UDP</string>
|
<string name="udp">UDP</string>
|
||||||
<string name="ssh_connecting">SSH: сопряжение…</string>
|
<string name="ssh_connecting">SSH: сопряжение…</string>
|
||||||
<string name="ssh_error">SSH: ошибка</string>
|
|
||||||
<string name="ssh_disconnected">SSH: не сопряжено</string>
|
|
||||||
<string name="reconnect">Повторить сопряжение</string>
|
<string name="reconnect">Повторить сопряжение</string>
|
||||||
|
<string name="server_not_paired_prompt">Сервер не сопряжён. Подключитесь, чтобы управлять им.</string>
|
||||||
<string name="proxy_active_stop">Прокси активен - нажмите для остановки</string>
|
<string name="proxy_active_stop">Прокси активен - нажмите для остановки</string>
|
||||||
<string name="proxy_error_restart">Ошибка - нажмите для повторного запуска</string>
|
<string name="proxy_error_restart">Ошибка - нажмите для повторного запуска</string>
|
||||||
<string name="start_proxy">Запустить прокси</string>
|
<string name="start_proxy">Запустить прокси</string>
|
||||||
|
|||||||
Reference in new issue
Block a user