feat: рефакторинг строковых ресурсов
This commit is contained in:
1 parent
abe549d994
commit
a60668c9c4
7 files changed
+224
-104
No files matched your search
@@ -42,7 +42,9 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.freeturn.app.R
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.freeturn.app.data.ClientConfig
|
import com.freeturn.app.data.ClientConfig
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
@@ -105,7 +107,7 @@ fun ClientSetupScreen(
|
|||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(title = { Text("Клиент") })
|
TopAppBar(title = { Text(stringResource(R.string.client_title)) })
|
||||||
},
|
},
|
||||||
contentWindowInsets = WindowInsets(0, 0, 0, 0)
|
contentWindowInsets = WindowInsets(0, 0, 0, 0)
|
||||||
) { padding ->
|
) { padding ->
|
||||||
@@ -121,45 +123,45 @@ fun ClientSetupScreen(
|
|||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
|
|
||||||
// ── Подключение ───────────────────────────────────────────────
|
// ── Подключение ───────────────────────────────────────────────
|
||||||
Text("Подключение", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.connection_title), style = MaterialTheme.typography.titleMedium)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = serverAddress,
|
value = serverAddress,
|
||||||
onValueChange = { serverAddress = it },
|
onValueChange = { serverAddress = it },
|
||||||
label = { Text("Адрес vk-turn-proxy сервера") },
|
label = { Text(stringResource(R.string.server_address_label)) },
|
||||||
placeholder = { Text("1.2.3.4:56000") },
|
placeholder = { Text(stringResource(R.string.server_address_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
supportingText = { Text("IP и порт vk-turn-proxy на вашем VPS") }
|
supportingText = { Text(stringResource(R.string.server_address_support)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = vkLink,
|
value = vkLink,
|
||||||
onValueChange = { vkLink = it },
|
onValueChange = { vkLink = it },
|
||||||
label = { Text("Ссылка VK-звонок / Yandex Telemost") },
|
label = { Text(stringResource(R.string.vk_link_label)) },
|
||||||
placeholder = { Text("https://vk.com/call/...") },
|
placeholder = { Text(stringResource(R.string.vk_link_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
minLines = 2,
|
minLines = 2,
|
||||||
maxLines = 4,
|
maxLines = 4,
|
||||||
supportingText = { Text("VK: Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить»)") }
|
supportingText = { Text(stringResource(R.string.vk_link_support)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = localPort,
|
value = localPort,
|
||||||
onValueChange = { localPort = it },
|
onValueChange = { localPort = it },
|
||||||
label = { Text("Локальный адрес прослушивания") },
|
label = { Text(stringResource(R.string.local_listen_address)) },
|
||||||
placeholder = { Text("127.0.0.1:9000") },
|
placeholder = { Text(stringResource(R.string.local_listen_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
supportingText = {
|
supportingText = {
|
||||||
Text("Адрес, на котором клиент принимает трафик от WireGuard/Hysteria")
|
Text(stringResource(R.string.local_listen_support))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color)
|
HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color)
|
||||||
|
|
||||||
// ── Параметры ─────────────────────────────────────────────────
|
// ── Параметры ─────────────────────────────────────────────────
|
||||||
Text("Параметры", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.parameters_title), style = MaterialTheme.typography.titleMedium)
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Row(
|
Row(
|
||||||
@@ -167,9 +169,9 @@ fun ClientSetupScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text("Потоки: ${threads.toInt()}", style = MaterialTheme.typography.bodyMedium)
|
Text(stringResource(R.string.threads_format, threads.toInt()), style = MaterialTheme.typography.bodyMedium)
|
||||||
Text(
|
Text(
|
||||||
"Рекомендуется 4–8",
|
stringResource(R.string.threads_recommendation),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
||||||
)
|
)
|
||||||
@@ -192,8 +194,8 @@ fun ClientSetupScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SwitchRow(
|
SwitchRow(
|
||||||
label = "UDP-режим",
|
label = stringResource(R.string.udp_mode),
|
||||||
description = "Снижает задержки и повышает стабильность",
|
description = stringResource(R.string.udp_mode_desc),
|
||||||
checked = useUdp,
|
checked = useUdp,
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
|
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
|
||||||
@@ -202,8 +204,8 @@ fun ClientSetupScreen(
|
|||||||
)
|
)
|
||||||
|
|
||||||
SwitchRow(
|
SwitchRow(
|
||||||
label = "Без DTLS-шифрования",
|
label = stringResource(R.string.no_dtls),
|
||||||
description = "Может ускорить соединение, повышает риск блокировки",
|
description = stringResource(R.string.no_dtls_desc),
|
||||||
checked = noDtls,
|
checked = noDtls,
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
|
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
|
||||||
@@ -214,7 +216,7 @@ fun ClientSetupScreen(
|
|||||||
HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color)
|
HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color)
|
||||||
|
|
||||||
// ── Ядро ──────────────────────────────────────────────────────
|
// ── Ядро ──────────────────────────────────────────────────────
|
||||||
Text("Ядро", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.core_title), style = MaterialTheme.typography.titleMedium)
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
@@ -234,12 +236,12 @@ fun ClientSetupScreen(
|
|||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(
|
Text(
|
||||||
if (customKernelExists) "Кастомное ядро" else "Встроенное ядро",
|
if (customKernelExists) stringResource(R.string.custom_core) else stringResource(R.string.builtin_core),
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
if (customKernelExists) "Загружено из памяти устройства"
|
if (customKernelExists) stringResource(R.string.loaded_from_memory)
|
||||||
else "Из APK (libvkturn.so)",
|
else stringResource(R.string.from_apk),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f)
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f)
|
||||||
)
|
)
|
||||||
@@ -254,13 +256,13 @@ fun ClientSetupScreen(
|
|||||||
colors = ButtonDefaults.outlinedButtonColors(
|
colors = ButtonDefaults.outlinedButtonColors(
|
||||||
contentColor = MaterialTheme.colorScheme.error
|
contentColor = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
) { Text("Сбросить") }
|
) { Text(stringResource(R.string.reset)) }
|
||||||
}
|
}
|
||||||
Button(onClick = {
|
Button(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
kernelPickerLauncher.launch(arrayOf("*/*"))
|
kernelPickerLauncher.launch(arrayOf("*/*"))
|
||||||
}) {
|
}) {
|
||||||
Text("Загрузить")
|
Text(stringResource(R.string.btn_load))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,7 +279,7 @@ fun ClientSetupScreen(
|
|||||||
enabled = serverAddress.isNotBlank() && vkLink.isNotBlank(),
|
enabled = serverAddress.isNotBlank() && vkLink.isNotBlank(),
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Text("Завершить настройку", style = MaterialTheme.typography.labelLarge)
|
Text(stringResource(R.string.finish_setup), style = MaterialTheme.typography.labelLarge)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import androidx.compose.foundation.rememberScrollState
|
|||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.ButtonDefaults
|
import androidx.compose.material3.ButtonDefaults
|
||||||
@@ -148,13 +149,13 @@ fun HomeScreen(
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Turn Proxy") },
|
title = { Text(stringResource(R.string.turn_proxy_title)) },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
showBottomSheet.value = true
|
showBottomSheet.value = true
|
||||||
}) {
|
}) {
|
||||||
Icon(painterResource(R.drawable.info_24px), contentDescription = "Информация")
|
Icon(painterResource(R.drawable.info_24px), contentDescription = stringResource(R.string.info_desc))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -191,10 +192,10 @@ fun HomeScreen(
|
|||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = when (proxyState) {
|
text = when (proxyState) {
|
||||||
is ProxyState.Running -> "Прокси активен"
|
is ProxyState.Running -> stringResource(R.string.proxy_active)
|
||||||
is ProxyState.Starting -> "Подключение..."
|
is ProxyState.Starting -> stringResource(R.string.proxy_connecting)
|
||||||
is ProxyState.Error -> (proxyState as ProxyState.Error).message
|
is ProxyState.Error -> (proxyState as ProxyState.Error).message
|
||||||
else -> "Нажмите для запуска"
|
else -> stringResource(R.string.proxy_press_to_start)
|
||||||
},
|
},
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = when (proxyState) {
|
color = when (proxyState) {
|
||||||
@@ -215,12 +216,12 @@ fun HomeScreen(
|
|||||||
elevation = CardDefaults.cardElevation(2.dp)
|
elevation = CardDefaults.cardElevation(2.dp)
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(20.dp)) {
|
Column(modifier = Modifier.padding(20.dp)) {
|
||||||
Text("Текущие настройки", style = MaterialTheme.typography.titleSmall)
|
Text(stringResource(R.string.current_settings), style = MaterialTheme.typography.titleSmall)
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
ConfigRow("Сервер", clientConfig.serverAddress)
|
ConfigRow(stringResource(R.string.server), clientConfig.serverAddress)
|
||||||
ConfigRow("Потоки", "${clientConfig.threads}")
|
ConfigRow(stringResource(R.string.threads), "${clientConfig.threads}")
|
||||||
ConfigRow("UDP", if (clientConfig.useUdp) "Вкл" else "Выкл")
|
ConfigRow(stringResource(R.string.udp), if (clientConfig.useUdp) stringResource(R.string.on) else stringResource(R.string.off))
|
||||||
ConfigRow("Локальный порт", clientConfig.localPort)
|
ConfigRow(stringResource(R.string.local_port), clientConfig.localPort)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,9 +246,9 @@ fun HomeScreen(
|
|||||||
Text(
|
Text(
|
||||||
when (sshState) {
|
when (sshState) {
|
||||||
is SshConnectionState.Connected -> "SSH: ${(sshState as SshConnectionState.Connected).ip}"
|
is SshConnectionState.Connected -> "SSH: ${(sshState as SshConnectionState.Connected).ip}"
|
||||||
is SshConnectionState.Connecting -> "SSH: подключение..."
|
is SshConnectionState.Connecting -> stringResource(R.string.ssh_connecting)
|
||||||
is SshConnectionState.Error -> "SSH: ошибка"
|
is SshConnectionState.Error -> stringResource(R.string.ssh_error)
|
||||||
else -> "SSH: не подключено"
|
else -> stringResource(R.string.ssh_disconnected)
|
||||||
},
|
},
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f)
|
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f)
|
||||||
@@ -261,7 +262,7 @@ fun HomeScreen(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.height(28.dp)
|
modifier = Modifier.height(28.dp)
|
||||||
) {
|
) {
|
||||||
Text("Переподключить", style = MaterialTheme.typography.labelSmall)
|
Text(stringResource(R.string.reconnect), style = MaterialTheme.typography.labelSmall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,15 +337,15 @@ private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) {
|
|||||||
when (state) {
|
when (state) {
|
||||||
is ProxyState.Starting -> CircularWavyProgressIndicator(color = contentColor)
|
is ProxyState.Starting -> CircularWavyProgressIndicator(color = contentColor)
|
||||||
is ProxyState.Running -> Icon(
|
is ProxyState.Running -> Icon(
|
||||||
painterResource(R.drawable.check_circle_24px), "Прокси активен — нажмите для остановки",
|
painterResource(R.drawable.check_circle_24px), stringResource(R.string.proxy_active_stop),
|
||||||
Modifier.size(52.dp), tint = contentColor
|
Modifier.size(52.dp), tint = contentColor
|
||||||
)
|
)
|
||||||
is ProxyState.Error -> Icon(
|
is ProxyState.Error -> Icon(
|
||||||
painterResource(R.drawable.error_24px), "Ошибка — нажмите для повторного запуска",
|
painterResource(R.drawable.error_24px), stringResource(R.string.proxy_error_restart),
|
||||||
Modifier.size(52.dp), tint = contentColor
|
Modifier.size(52.dp), tint = contentColor
|
||||||
)
|
)
|
||||||
else -> Icon(
|
else -> Icon(
|
||||||
painterResource(R.drawable.play_arrow_24px), "Запустить прокси",
|
painterResource(R.drawable.play_arrow_24px), stringResource(R.string.start_proxy),
|
||||||
Modifier.size(52.dp), tint = contentColor
|
Modifier.size(52.dp), tint = contentColor
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -379,7 +380,7 @@ private fun InfoBottomSheet(
|
|||||||
// ── Соединение ────────────────────────────────────────────────────
|
// ── Соединение ────────────────────────────────────────────────────
|
||||||
item {
|
item {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text("Соединение", style = MaterialTheme.typography.titleSmall) },
|
headlineContent = { Text(stringResource(R.string.connection), style = MaterialTheme.typography.titleSmall) },
|
||||||
colors = listColors,
|
colors = listColors,
|
||||||
supportingContent = {
|
supportingContent = {
|
||||||
Text(
|
Text(
|
||||||
@@ -390,7 +391,7 @@ private fun InfoBottomSheet(
|
|||||||
(sshState as SshConnectionState.Connecting).step
|
(sshState as SshConnectionState.Connecting).step
|
||||||
is SshConnectionState.Error ->
|
is SshConnectionState.Error ->
|
||||||
"Ошибка: ${(sshState as SshConnectionState.Error).message}"
|
"Ошибка: ${(sshState as SshConnectionState.Error).message}"
|
||||||
else -> "Не подключено"
|
else -> stringResource(R.string.not_connected)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -399,12 +400,12 @@ private fun InfoBottomSheet(
|
|||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
onNavigateToSshSetup()
|
onNavigateToSshSetup()
|
||||||
}) { Text("Изменить") }
|
}) { Text(stringResource(R.string.change)) }
|
||||||
} else {
|
} else {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
onNavigateToSshSetup()
|
onNavigateToSshSetup()
|
||||||
}) { Text("Настроить") }
|
}) { Text(stringResource(R.string.configure)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -415,9 +416,9 @@ private fun InfoBottomSheet(
|
|||||||
// ── Ссылки ────────────────────────────────────────────────────────
|
// ── Ссылки ────────────────────────────────────────────────────────
|
||||||
item {
|
item {
|
||||||
RepoLinkItem(
|
RepoLinkItem(
|
||||||
title = "Android-клиент",
|
title = stringResource(R.string.android_client),
|
||||||
subtitle = "antongospod/turn-proxy",
|
subtitle = "antongospod/turn-proxy-android",
|
||||||
url = "https://github.com/antongospod/turn-proxy",
|
url = "https://github.com/antongospod/turn-proxy-android",
|
||||||
containerColor = containerColor,
|
containerColor = containerColor,
|
||||||
onHaptic = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) },
|
onHaptic = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) },
|
||||||
onOpen = { uriHandler.openUri(it) }
|
onOpen = { uriHandler.openUri(it) }
|
||||||
@@ -426,7 +427,7 @@ private fun InfoBottomSheet(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
RepoLinkItem(
|
RepoLinkItem(
|
||||||
title = "Прокси-ядро",
|
title = stringResource(R.string.proxy_core),
|
||||||
subtitle = "cacggghp/vk-turn-proxy",
|
subtitle = "cacggghp/vk-turn-proxy",
|
||||||
url = "https://github.com/cacggghp/vk-turn-proxy",
|
url = "https://github.com/cacggghp/vk-turn-proxy",
|
||||||
containerColor = containerColor,
|
containerColor = containerColor,
|
||||||
@@ -442,7 +443,7 @@ private fun InfoBottomSheet(
|
|||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
"Сбросить настройки",
|
stringResource(R.string.reset_settings),
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colorScheme.error
|
color = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
@@ -451,7 +452,7 @@ private fun InfoBottomSheet(
|
|||||||
trailingContent = {
|
trailingContent = {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.delete_24px),
|
painterResource(R.drawable.delete_24px),
|
||||||
contentDescription = "Сбросить",
|
contentDescription = stringResource(R.string.reset),
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
tint = MaterialTheme.colorScheme.error
|
tint = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
@@ -480,8 +481,8 @@ private fun InfoBottomSheet(
|
|||||||
if (showResetDialog) {
|
if (showResetDialog) {
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = { showResetDialog = false },
|
onDismissRequest = { showResetDialog = false },
|
||||||
title = { Text("Сбросить все настройки?") },
|
title = { Text(stringResource(R.string.reset_all_settings_title)) },
|
||||||
text = { Text("Все настройки будут удалены, прокси остановлен. Приложение перезапустится.") },
|
text = { Text(stringResource(R.string.reset_all_settings_desc)) },
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -491,10 +492,10 @@ private fun InfoBottomSheet(
|
|||||||
colors = ButtonDefaults.textButtonColors(
|
colors = ButtonDefaults.textButtonColors(
|
||||||
contentColor = MaterialTheme.colorScheme.error
|
contentColor = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
) { Text("Сбросить") }
|
) { Text(stringResource(R.string.reset)) }
|
||||||
},
|
},
|
||||||
dismissButton = {
|
dismissButton = {
|
||||||
TextButton(onClick = { showResetDialog = false }) { Text("Отмена") }
|
TextButton(onClick = { showResetDialog = false }) { Text(stringResource(R.string.cancel)) }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -522,7 +523,7 @@ private fun RepoLinkItem(
|
|||||||
trailingContent = {
|
trailingContent = {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.open_in_new_24px),
|
painterResource(R.drawable.open_in_new_24px),
|
||||||
contentDescription = "Открыть",
|
contentDescription = stringResource(R.string.btn_open),
|
||||||
modifier = Modifier.size(18.dp),
|
modifier = Modifier.size(18.dp),
|
||||||
tint = MaterialTheme.colorScheme.primary
|
tint = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
@@ -54,7 +55,7 @@ fun LogsScreen(viewModel: MainViewModel) {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Логи") },
|
title = { Text(stringResource(R.string.logs_title)) },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -66,7 +67,7 @@ fun LogsScreen(viewModel: MainViewModel) {
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.content_copy_24px),
|
painterResource(R.drawable.content_copy_24px),
|
||||||
contentDescription = "Копировать"
|
contentDescription = stringResource(R.string.copy)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -78,7 +79,7 @@ fun LogsScreen(viewModel: MainViewModel) {
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.delete_24px),
|
painterResource(R.drawable.delete_24px),
|
||||||
contentDescription = "Очистить"
|
contentDescription = stringResource(R.string.clear)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,7 @@ fun LogsScreen(viewModel: MainViewModel) {
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
"Нет логов",
|
stringResource(R.string.no_logs),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
@@ -98,7 +99,7 @@ fun OnboardingScreen(
|
|||||||
Spacer(Modifier.height(40.dp))
|
Spacer(Modifier.height(40.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Turn Proxy",
|
text = stringResource(R.string.onboarding_title),
|
||||||
style = MaterialTheme.typography.displaySmall,
|
style = MaterialTheme.typography.displaySmall,
|
||||||
color = MaterialTheme.colorScheme.onBackground,
|
color = MaterialTheme.colorScheme.onBackground,
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
@@ -107,7 +108,7 @@ fun OnboardingScreen(
|
|||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Проксируйте WireGuard и Hysteria‑трафик\nчерез TURN‑серверы VK Calls",
|
text = stringResource(R.string.onboarding_subtitle),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.65f),
|
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.65f),
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
@@ -134,7 +135,7 @@ fun OnboardingScreen(
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.width(10.dp))
|
Spacer(Modifier.width(10.dp))
|
||||||
Text(
|
Text(
|
||||||
"Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве.",
|
stringResource(R.string.privacy_notice),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
@@ -160,7 +161,7 @@ fun OnboardingScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.wifi_24px), contentDescription = null)
|
Icon(painterResource(R.drawable.wifi_24px), contentDescription = null)
|
||||||
Spacer(Modifier.width(10.dp))
|
Spacer(Modifier.width(10.dp))
|
||||||
Text("Настроить сервер", style = MaterialTheme.typography.labelLarge)
|
Text(stringResource(R.string.setup_server), style = MaterialTheme.typography.labelLarge)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
@@ -169,7 +170,7 @@ fun OnboardingScreen(
|
|||||||
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
onSkip()
|
onSkip()
|
||||||
}) {
|
}) {
|
||||||
Text("Пропустить настройки")
|
Text(stringResource(R.string.skip_setup))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(24.dp))
|
Spacer(Modifier.height(24.dp))
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import androidx.compose.foundation.rememberScrollState
|
|||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ButtonDefaults
|
import androidx.compose.material3.ButtonDefaults
|
||||||
@@ -86,7 +87,7 @@ fun ServerManagementScreen(
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Сервер") },
|
title = { Text(stringResource(R.string.server)) },
|
||||||
actions = {
|
actions = {
|
||||||
SshStatusBadge(sshState = sshState, ip = sshConfig.ip)
|
SshStatusBadge(sshState = sshState, ip = sshConfig.ip)
|
||||||
}
|
}
|
||||||
@@ -109,11 +110,11 @@ fun ServerManagementScreen(
|
|||||||
// Status card
|
// Status card
|
||||||
Card(modifier = Modifier.fillMaxWidth()) {
|
Card(modifier = Modifier.fillMaxWidth()) {
|
||||||
Column(modifier = Modifier.padding(20.dp)) {
|
Column(modifier = Modifier.padding(20.dp)) {
|
||||||
Text("Статус сервера", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.server_status), style = MaterialTheme.typography.titleMedium)
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
StatusRow("SSH‑соединение", isConnected)
|
StatusRow(stringResource(R.string.ssh_connection), isConnected)
|
||||||
Spacer(Modifier.height(10.dp))
|
Spacer(Modifier.height(10.dp))
|
||||||
StatusRow("vk‑turn‑proxy", serverKnown?.running == true)
|
StatusRow(stringResource(R.string.vk_turn_proxy), serverKnown?.running == true)
|
||||||
|
|
||||||
when (serverState) {
|
when (serverState) {
|
||||||
is ServerState.Checking -> {
|
is ServerState.Checking -> {
|
||||||
@@ -133,7 +134,7 @@ fun ServerManagementScreen(
|
|||||||
is ServerState.Error -> {
|
is ServerState.Error -> {
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
Text(
|
Text(
|
||||||
"Ошибка: ${(serverState as ServerState.Error).message}",
|
stringResource(R.string.error_format, (serverState as ServerState.Error).message),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.error
|
color = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
@@ -144,26 +145,26 @@ fun ServerManagementScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Server config
|
// Server config
|
||||||
Text("Конфигурация сервера", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.server_config), style = MaterialTheme.typography.titleMedium)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = proxyListen,
|
value = proxyListen,
|
||||||
onValueChange = { proxyListen = it },
|
onValueChange = { proxyListen = it },
|
||||||
label = { Text("Порт прослушивания") },
|
label = { Text(stringResource(R.string.listen_port)) },
|
||||||
placeholder = { Text("0.0.0.0:56000") },
|
placeholder = { Text(stringResource(R.string.listen_port_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
supportingText = { Text("Порт, на котором сервер принимает подключения от клиентов") }
|
supportingText = { Text(stringResource(R.string.listen_port_desc)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = proxyConnect,
|
value = proxyConnect,
|
||||||
onValueChange = { proxyConnect = it },
|
onValueChange = { proxyConnect = it },
|
||||||
label = { Text("Адрес TURN‑клиента") },
|
label = { Text(stringResource(R.string.turn_client_address)) },
|
||||||
placeholder = { Text("127.0.0.1:40537") },
|
placeholder = { Text(stringResource(R.string.turn_client_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
supportingText = { Text("Локальный WireGuard/Hysteria-клиент на стороне сервера") }
|
supportingText = { Text(stringResource(R.string.turn_client_desc)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
// Action buttons
|
// Action buttons
|
||||||
@@ -181,7 +182,7 @@ fun ServerManagementScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.cloud_download_24px), null)
|
Icon(painterResource(R.drawable.cloud_download_24px), null)
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(if (serverKnown?.installed == true) "Обновить" else "Установить")
|
Text(if (serverKnown?.installed == true) stringResource(R.string.update) else stringResource(R.string.install))
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
@@ -199,7 +200,7 @@ fun ServerManagementScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.play_arrow_24px), null)
|
Icon(painterResource(R.drawable.play_arrow_24px), null)
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text("Запустить сервер")
|
Text(stringResource(R.string.start_server))
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
@@ -218,7 +219,7 @@ fun ServerManagementScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.stop_24px), null)
|
Icon(painterResource(R.drawable.stop_24px), null)
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text("Остановить сервер")
|
Text(stringResource(R.string.stop_server))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverKnown?.running == true) {
|
if (serverKnown?.running == true) {
|
||||||
@@ -233,7 +234,7 @@ fun ServerManagementScreen(
|
|||||||
.height(56.dp),
|
.height(56.dp),
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Text("Продолжить настройку клиента")
|
Text(stringResource(R.string.continue_client_setup))
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Icon(painterResource(R.drawable.arrow_forward_24px), null)
|
Icon(painterResource(R.drawable.arrow_forward_24px), null)
|
||||||
}
|
}
|
||||||
@@ -243,7 +244,7 @@ fun ServerManagementScreen(
|
|||||||
if (sshLog.isNotEmpty()) {
|
if (sshLog.isNotEmpty()) {
|
||||||
Card(modifier = Modifier.fillMaxWidth()) {
|
Card(modifier = Modifier.fillMaxWidth()) {
|
||||||
Column(modifier = Modifier.padding(20.dp)) {
|
Column(modifier = Modifier.padding(20.dp)) {
|
||||||
Text("SSH-лог", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.ssh_log_title), style = MaterialTheme.typography.titleMedium)
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
LaunchedEffect(sshLog.size) {
|
LaunchedEffect(sshLog.size) {
|
||||||
@@ -303,7 +304,7 @@ private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
Text(
|
Text(
|
||||||
if (connected) ip else "Не подключено",
|
if (connected) ip else stringResource(R.string.not_connected),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
||||||
)
|
)
|
||||||
@@ -329,7 +330,7 @@ private fun StatusRow(label: String, isActive: Boolean) {
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
Text(
|
Text(
|
||||||
if (isActive) "Активно" else "Неактивно",
|
if (isActive) stringResource(R.string.active) else stringResource(R.string.inactive),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = if (isActive) StatusGreen else MaterialTheme.colorScheme.outline
|
color = if (isActive) StatusGreen else MaterialTheme.colorScheme.outline
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import androidx.compose.material3.Scaffold
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@@ -90,13 +91,13 @@ fun SshSetupScreen(
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Подключение к серверу") },
|
title = { Text(stringResource(R.string.connect_to_server)) },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
onBack()
|
onBack()
|
||||||
}) {
|
}) {
|
||||||
Icon(painterResource(R.drawable.arrow_back_24px), contentDescription = "Назад")
|
Icon(painterResource(R.drawable.arrow_back_24px), contentDescription = stringResource(R.string.back))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -164,13 +165,13 @@ private fun FormSection(
|
|||||||
onConnect: () -> Unit
|
onConnect: () -> Unit
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
Text("Данные сервера", style = MaterialTheme.typography.titleMedium)
|
Text(stringResource(R.string.server_data), style = MaterialTheme.typography.titleMedium)
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = ip,
|
value = ip,
|
||||||
onValueChange = onIpChange,
|
onValueChange = onIpChange,
|
||||||
label = { Text("IP-адрес сервера") },
|
label = { Text(stringResource(R.string.server_ip_label)) },
|
||||||
placeholder = { Text("1.2.3.4") },
|
placeholder = { Text(stringResource(R.string.server_ip_placeholder)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri)
|
||||||
@@ -179,7 +180,7 @@ private fun FormSection(
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = port,
|
value = port,
|
||||||
onValueChange = onPortChange,
|
onValueChange = onPortChange,
|
||||||
label = { Text("SSH порт") },
|
label = { Text(stringResource(R.string.ssh_port)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
|
||||||
@@ -188,7 +189,7 @@ private fun FormSection(
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = username,
|
value = username,
|
||||||
onValueChange = onUsernameChange,
|
onValueChange = onUsernameChange,
|
||||||
label = { Text("Имя пользователя") },
|
label = { Text(stringResource(R.string.username)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true
|
singleLine = true
|
||||||
)
|
)
|
||||||
@@ -199,10 +200,10 @@ private fun FormSection(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = if (authType == "PASSWORD") "Пароль" else "Приватный ключ",
|
value = if (authType == "PASSWORD") stringResource(R.string.password) else stringResource(R.string.private_key),
|
||||||
onValueChange = {},
|
onValueChange = {},
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
label = { Text("Аутентификация") },
|
label = { Text(stringResource(R.string.authentication)) },
|
||||||
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = authDropdownExpanded) },
|
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = authDropdownExpanded) },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -212,13 +213,13 @@ private fun FormSection(
|
|||||||
expanded = authDropdownExpanded,
|
expanded = authDropdownExpanded,
|
||||||
onDismissRequest = { onAuthDropdownChange(false) }
|
onDismissRequest = { onAuthDropdownChange(false) }
|
||||||
) {
|
) {
|
||||||
DropdownMenuItem(text = { Text("Пароль") },
|
DropdownMenuItem(text = { Text(stringResource(R.string.password)) },
|
||||||
onClick = {
|
onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
onAuthTypeChange("PASSWORD")
|
onAuthTypeChange("PASSWORD")
|
||||||
onAuthDropdownChange(false)
|
onAuthDropdownChange(false)
|
||||||
})
|
})
|
||||||
DropdownMenuItem(text = { Text("Приватный ключ") },
|
DropdownMenuItem(text = { Text(stringResource(R.string.private_key)) },
|
||||||
onClick = {
|
onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
onAuthTypeChange("SSH_KEY")
|
onAuthTypeChange("SSH_KEY")
|
||||||
@@ -231,7 +232,7 @@ private fun FormSection(
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = password,
|
value = password,
|
||||||
onValueChange = onPasswordChange,
|
onValueChange = onPasswordChange,
|
||||||
label = { Text("Пароль") },
|
label = { Text(stringResource(R.string.password)) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||||
@@ -252,8 +253,8 @@ private fun FormSection(
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = sshKey,
|
value = sshKey,
|
||||||
onValueChange = onSshKeyChange,
|
onValueChange = onSshKeyChange,
|
||||||
label = { Text("Приватный ключ (PEM)") },
|
label = { Text(stringResource(R.string.private_key_pem)) },
|
||||||
placeholder = { Text("-----BEGIN RSA PRIVATE KEY-----\n...") },
|
placeholder = { Text(stringResource(R.string.private_key_placeholder)) },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(160.dp),
|
.height(160.dp),
|
||||||
@@ -291,16 +292,16 @@ private fun FormSection(
|
|||||||
},
|
},
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Text("Подключиться", style = MaterialTheme.typography.labelLarge)
|
Text(stringResource(R.string.connect_btn), style = MaterialTheme.typography.labelLarge)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ConnectionProgressCard(step: String) {
|
private fun ConnectionProgressCard(step: String) {
|
||||||
val steps = listOf(
|
val steps = listOf(
|
||||||
"Подключение к серверу...",
|
stringResource(R.string.step_connecting),
|
||||||
"Аутентификация...",
|
stringResource(R.string.step_auth),
|
||||||
"Проверка SSH..."
|
stringResource(R.string.step_ssh_check)
|
||||||
)
|
)
|
||||||
val currentIndex = steps.indexOf(step).coerceAtLeast(0)
|
val currentIndex = steps.indexOf(step).coerceAtLeast(0)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">FreeTurn</string>
|
<string name="app_name">Turn Proxy</string>
|
||||||
|
|
||||||
|
<!-- HomeScreen -->
|
||||||
|
<string name="turn_proxy_title">Turn Proxy</string>
|
||||||
|
<string name="info_desc">Информация</string>
|
||||||
|
<string name="proxy_active">Прокси активен</string>
|
||||||
|
<string name="proxy_connecting">Подключение…</string>
|
||||||
|
<string name="proxy_press_to_start">Нажмите для запуска</string>
|
||||||
|
<string name="current_settings">Текущие настройки</string>
|
||||||
|
<string name="server">Сервер</string>
|
||||||
|
<string name="threads">Потоки</string>
|
||||||
|
<string name="udp">UDP</string>
|
||||||
|
<string name="on">Вкл</string>
|
||||||
|
<string name="off">Выкл</string>
|
||||||
|
<string name="local_port">Локальный порт</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="proxy_active_stop">Прокси активен — нажмите для остановки</string>
|
||||||
|
<string name="proxy_error_restart">Ошибка — нажмите для повторного запуска</string>
|
||||||
|
<string name="start_proxy">Запустить прокси</string>
|
||||||
|
<string name="connection">Соединение</string>
|
||||||
|
<string name="not_connected">Не подключено</string>
|
||||||
|
<string name="change">Изменить</string>
|
||||||
|
<string name="configure">Настроить</string>
|
||||||
|
<string name="android_client">Android-клиент</string>
|
||||||
|
<string name="proxy_core">Прокси-ядро</string>
|
||||||
|
<string name="btn_open">Открыть</string>
|
||||||
|
<string name="reset_settings">Сбросить настройки</string>
|
||||||
|
<string name="reset">Сбросить</string>
|
||||||
|
<string name="reset_all_settings_title">Сбросить все настройки?</string>
|
||||||
|
<string name="reset_all_settings_desc">Все настройки будут удалены, прокси остановлен. Приложение перезапустится.</string>
|
||||||
|
<string name="cancel">Отмена</string>
|
||||||
|
|
||||||
|
<!-- ClientSetupScreen -->
|
||||||
|
<string name="client_title">Клиент</string>
|
||||||
|
<string name="connection_title">Подключение</string>
|
||||||
|
<string name="server_address_label">Адрес vk-turn-proxy сервера</string>
|
||||||
|
<string name="server_address_placeholder">1.2.3.4:56000</string>
|
||||||
|
<string name="server_address_support">IP и порт vk-turn-proxy на вашем VPS</string>
|
||||||
|
<string name="vk_link_label">Ссылка VK-звонок / Yandex Telemost</string>
|
||||||
|
<string name="vk_link_placeholder">https://vk.com/call/…</string>
|
||||||
|
<string name="vk_link_support">VK: Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить»)</string>
|
||||||
|
<string name="local_listen_address">Локальный адрес прослушивания</string>
|
||||||
|
<string name="local_listen_placeholder">127.0.0.1:9000</string>
|
||||||
|
<string name="local_listen_support">Адрес, на котором клиент принимает трафик от WireGuard/Hysteria</string>
|
||||||
|
<string name="parameters_title">Параметры</string>
|
||||||
|
<string name="threads_format">Потоки: %1$d</string>
|
||||||
|
<string name="threads_recommendation">Рекомендуется 4–8</string>
|
||||||
|
<string name="udp_mode">UDP-режим</string>
|
||||||
|
<string name="udp_mode_desc">Снижает задержки</string>
|
||||||
|
<string name="no_dtls">Без DTLS-шифрования</string>
|
||||||
|
<string name="no_dtls_desc">Может ускорить соединение, повышает риск блокировки</string>
|
||||||
|
<string name="core_title">Ядро</string>
|
||||||
|
<string name="custom_core">Кастомное ядро</string>
|
||||||
|
<string name="builtin_core">Встроенное ядро</string>
|
||||||
|
<string name="loaded_from_memory">Загружено из памяти устройства</string>
|
||||||
|
<string name="from_apk">Из APK (libvkturn.so)</string>
|
||||||
|
<string name="btn_load">Загрузить</string>
|
||||||
|
<string name="finish_setup">Завершить настройку</string>
|
||||||
|
|
||||||
|
<!-- LogsScreen -->
|
||||||
|
<string name="logs_title">Логи</string>
|
||||||
|
<string name="copy">Копировать</string>
|
||||||
|
<string name="clear">Очистить</string>
|
||||||
|
<string name="no_logs">Нет логов</string>
|
||||||
|
|
||||||
|
<!-- ServerManagementScreen -->
|
||||||
|
<string name="server_status">Статус сервера</string>
|
||||||
|
<string name="ssh_connection">SSH‑соединение</string>
|
||||||
|
<string name="vk_turn_proxy">vk‑turn‑proxy</string>
|
||||||
|
<string name="error_format">Ошибка: %1$s</string>
|
||||||
|
<string name="server_config">Конфигурация сервера</string>
|
||||||
|
<string name="listen_port">Порт прослушивания</string>
|
||||||
|
<string name="listen_port_placeholder">0.0.0.0:56000</string>
|
||||||
|
<string name="listen_port_desc">Порт, на котором сервер принимает подключения от клиентов</string>
|
||||||
|
<string name="turn_client_address">Адрес TURN‑клиента</string>
|
||||||
|
<string name="turn_client_placeholder">127.0.0.1:40537</string>
|
||||||
|
<string name="turn_client_desc">Локальный WireGuard/Hysteria-клиент на стороне сервера</string>
|
||||||
|
<string name="update">Обновить</string>
|
||||||
|
<string name="install">Установить</string>
|
||||||
|
<string name="start_server">Запустить сервер</string>
|
||||||
|
<string name="stop_server">Остановить сервер</string>
|
||||||
|
<string name="continue_client_setup">Продолжить настройку клиента</string>
|
||||||
|
<string name="ssh_log_title">SSH-лог</string>
|
||||||
|
<string name="active">Активно</string>
|
||||||
|
<string name="inactive">Неактивно</string>
|
||||||
|
|
||||||
|
<!-- SshSetupScreen -->
|
||||||
|
<string name="connect_to_server">Подключение к серверу</string>
|
||||||
|
<string name="back">Назад</string>
|
||||||
|
<string name="server_data">Данные сервера</string>
|
||||||
|
<string name="server_ip_label">IP-адрес сервера</string>
|
||||||
|
<string name="server_ip_placeholder">1.2.3.4</string>
|
||||||
|
<string name="ssh_port">SSH порт</string>
|
||||||
|
<string name="username">Имя пользователя</string>
|
||||||
|
<string name="password">Пароль</string>
|
||||||
|
<string name="private_key">Приватный ключ</string>
|
||||||
|
<string name="authentication">Аутентификация</string>
|
||||||
|
<string name="private_key_pem">Приватный ключ (PEM)</string>
|
||||||
|
<string name="private_key_placeholder">-----BEGIN RSA PRIVATE KEY-----\n…</string>
|
||||||
|
<string name="connect_btn">Подключиться</string>
|
||||||
|
<string name="step_connecting">Подключение к серверу…</string>
|
||||||
|
<string name="step_auth">Аутентификация…</string>
|
||||||
|
<string name="step_ssh_check">Проверка SSH…</string>
|
||||||
|
|
||||||
|
<!-- OnboardingScreen -->
|
||||||
|
<string name="onboarding_title">Turn Proxy</string>
|
||||||
|
<string name="onboarding_subtitle">Проксируйте WireGuard и Hysteria‑трафик\nчерез TURN‑серверы VK Calls</string>
|
||||||
|
<string name="privacy_notice">Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве.</string>
|
||||||
|
<string name="setup_server">Настроить сервер</string>
|
||||||
|
<string name="skip_setup">Пропустить настройки</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user