From cd67c350b4da377e39b3c634d8cf35b588d47277 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Wed, 3 Dec 2025 09:05:16 +0300 Subject: [PATCH] patch --- yobble/Resources/Localizable.xcstrings | 3 ++ yobble/Views/Login/LoginView.swift | 56 +++++++++++++---------- yobble/Views/Login/RegistrationView.swift | 26 ++++++----- 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index bdffb2b..6fadc3a 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -6,6 +6,9 @@ }, "(без текста)" : { + }, + "@" : { + }, "@%@" : { "localizations" : { diff --git a/yobble/Views/Login/LoginView.swift b/yobble/Views/Login/LoginView.swift index 090bac7..8adce5c 100644 --- a/yobble/Views/Login/LoginView.swift +++ b/yobble/Views/Login/LoginView.swift @@ -148,18 +148,22 @@ struct PasswordLoginView: View { } VStack(alignment: .leading, spacing: 12) { - TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.username) - .padding() - .background(Color(.secondarySystemBackground)) - .cornerRadius(12) - .autocapitalization(.none) - .disableAutocorrection(true) - .focused($focusedField, equals: .username) - .onChange(of: viewModel.username) { newValue in - if newValue.count > 32 { - viewModel.username = String(newValue.prefix(32)) + HStack(spacing: 8) { + Text("@") + .foregroundColor(.secondary) + TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.username) + .autocapitalization(.none) + .disableAutocorrection(true) + .focused($focusedField, equals: .username) + .onChange(of: viewModel.username) { newValue in + if newValue.count > 32 { + viewModel.username = String(newValue.prefix(32)) + } } - } + } + .padding() + .background(Color(.secondarySystemBackground)) + .cornerRadius(12) if !isUsernameValid && !viewModel.username.isEmpty { Text(NSLocalizedString("Неверный логин", comment: "Неверный логин")) @@ -412,20 +416,24 @@ private struct PasswordlessRequestView: View { // Text(NSLocalizedString("Логин", comment: "")) // .font(.subheadline) // .foregroundColor(.secondary) - TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.passwordlessLogin) - .textContentType(.username) - .keyboardType(.default) - .autocapitalization(.none) - .disableAutocorrection(true) - .padding() - .background(Color(.secondarySystemBackground)) - .cornerRadius(12) - .focused($isFieldFocused) - .onChange(of: viewModel.passwordlessLogin) { newValue in - if newValue.count > 32 { - viewModel.passwordlessLogin = String(newValue.prefix(32)) + HStack(spacing: 8) { + Text("@") + .foregroundColor(.secondary) + TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.passwordlessLogin) + .textContentType(.username) + .keyboardType(.default) + .autocapitalization(.none) + .disableAutocorrection(true) + .focused($isFieldFocused) + .onChange(of: viewModel.passwordlessLogin) { newValue in + if newValue.count > 32 { + viewModel.passwordlessLogin = String(newValue.prefix(32)) + } } - } + } + .padding() + .background(Color(.secondarySystemBackground)) + .cornerRadius(12) if !isLoginValid && !viewModel.passwordlessLogin.isEmpty { Text(NSLocalizedString("Неверный логин", comment: "")) .foregroundColor(.red) diff --git a/yobble/Views/Login/RegistrationView.swift b/yobble/Views/Login/RegistrationView.swift index e356b30..2c3d704 100644 --- a/yobble/Views/Login/RegistrationView.swift +++ b/yobble/Views/Login/RegistrationView.swift @@ -75,18 +75,22 @@ struct RegistrationView: View { Group { VStack(alignment: .leading, spacing: 4) { - TextField(NSLocalizedString("Введите логин", comment: "Логин"), text: $username) - .autocapitalization(.none) - .disableAutocorrection(true) - .focused($focusedField, equals: .username) - .padding() - .background(Color(.secondarySystemBackground)) - .cornerRadius(12) - .onChange(of: username) { newValue in - if newValue.count > 32 { - username = String(newValue.prefix(32)) + HStack(spacing: 8) { + Text("@") + .foregroundColor(.secondary) + TextField(NSLocalizedString("Введите логин", comment: "Логин"), text: $username) + .autocapitalization(.none) + .disableAutocorrection(true) + .focused($focusedField, equals: .username) + .onChange(of: username) { newValue in + if newValue.count > 32 { + username = String(newValue.prefix(32)) + } } - } + } + .padding() + .background(Color(.secondarySystemBackground)) + .cornerRadius(12) if !isUsernameValid && !username.isEmpty { Text(NSLocalizedString("Логин должен быть от 3 до 32 символов (английские буквы, цифры, _)", comment: ""))