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