patch
This commit is contained in:
parent
f9026ebf87
commit
b8ffca967b
@ -400,6 +400,9 @@
|
|||||||
},
|
},
|
||||||
"Вход по коду пока недоступен. Заглушка." : {
|
"Вход по коду пока недоступен. Заглушка." : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"Вход по паролю" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Вы" : {
|
"Вы" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@ -540,6 +543,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Если предпочитаете классический вход, используйте логин и пароль." : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Заблокированные" : {
|
"Заблокированные" : {
|
||||||
|
|
||||||
|
|||||||
@ -103,38 +103,9 @@ struct PasswordLoginView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
ScrollView(showsIndicators: false) {
|
||||||
ZStack {
|
VStack(alignment: .leading, spacing: 24) {
|
||||||
Color.clear // чтобы поймать тап
|
LoginTopBar(openLanguageSettings: openLanguageSettings)
|
||||||
.contentShape(Rectangle())
|
|
||||||
.onTapGesture {
|
|
||||||
focusedField = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
VStack {
|
|
||||||
HStack {
|
|
||||||
|
|
||||||
Button(action: openLanguageSettings) {
|
|
||||||
Text("🌍")
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
Menu {
|
|
||||||
ForEach(themeOptions) { option in
|
|
||||||
Button(action: { selectTheme(option) }) {
|
|
||||||
themeMenuContent(for: option)
|
|
||||||
.opacity(option.isEnabled ? 1.0 : 0.5)
|
|
||||||
}
|
|
||||||
.disabled(!option.isEnabled)
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Image(systemName: themeIconName)
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onTapGesture {
|
|
||||||
focusedField = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
focusedField = nil
|
focusedField = nil
|
||||||
@ -142,22 +113,26 @@ struct PasswordLoginView: View {
|
|||||||
viewModel.showPasswordlessRequest()
|
viewModel.showPasswordlessRequest()
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 6) {
|
||||||
Image(systemName: "arrow.left")
|
Image(systemName: "arrow.left")
|
||||||
Text(NSLocalizedString("Войти по коду", comment: ""))
|
Text(NSLocalizedString("Войти по коду", comment: ""))
|
||||||
}
|
}
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.blue)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.padding(.top, 4)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
Text(NSLocalizedString("Вход по паролю", comment: ""))
|
||||||
|
.font(.largeTitle).bold()
|
||||||
|
Text(NSLocalizedString("Если предпочитаете классический вход, используйте логин и пароль.", comment: ""))
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
TextField(NSLocalizedString("Логин", comment: ""), text: $viewModel.username)
|
TextField(NSLocalizedString("Логин", comment: ""), text: $viewModel.username)
|
||||||
.padding()
|
.padding()
|
||||||
.background(Color(.secondarySystemBackground))
|
.background(Color(.secondarySystemBackground))
|
||||||
.cornerRadius(8)
|
.cornerRadius(12)
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
.focused($focusedField, equals: .username)
|
.focused($focusedField, equals: .username)
|
||||||
@ -167,18 +142,16 @@ struct PasswordLoginView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Показываем ошибку для логина
|
|
||||||
if !isUsernameValid && !viewModel.username.isEmpty {
|
if !isUsernameValid && !viewModel.username.isEmpty {
|
||||||
Text(NSLocalizedString("Неверный логин", comment: "Неверный логин"))
|
Text(NSLocalizedString("Неверный логин", comment: "Неверный логин"))
|
||||||
.foregroundColor(.red)
|
.foregroundColor(.red)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Показываем поле пароля
|
|
||||||
SecureField(NSLocalizedString("Пароль", comment: ""), text: $viewModel.password)
|
SecureField(NSLocalizedString("Пароль", comment: ""), text: $viewModel.password)
|
||||||
.padding()
|
.padding()
|
||||||
.background(Color(.secondarySystemBackground))
|
.background(Color(.secondarySystemBackground))
|
||||||
.cornerRadius(8)
|
.cornerRadius(12)
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
.focused($focusedField, equals: .password)
|
.focused($focusedField, equals: .password)
|
||||||
.onChange(of: viewModel.password) { newValue in
|
.onChange(of: viewModel.password) { newValue in
|
||||||
@ -187,21 +160,12 @@ struct PasswordLoginView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Показываем ошибку для пароля
|
|
||||||
if !isPasswordValid && !viewModel.password.isEmpty {
|
if !isPasswordValid && !viewModel.password.isEmpty {
|
||||||
Text(NSLocalizedString("Неверный пароль", comment: "Неверный пароль"))
|
Text(NSLocalizedString("Неверный пароль", comment: "Неверный пароль"))
|
||||||
.foregroundColor(.red)
|
.foregroundColor(.red)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// TermsAgreementCard(
|
|
||||||
// isAccepted: $viewModel.hasAcceptedTerms,
|
|
||||||
// openTerms: {
|
|
||||||
// viewModel.loadTermsIfNeeded()
|
|
||||||
// isShowingTerms = true
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// .padding(.vertical, 12)
|
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Toggle(NSLocalizedString("Режим мессенжера", comment: ""), isOn: $isMessengerModeEnabled)
|
Toggle(NSLocalizedString("Режим мессенжера", comment: ""), isOn: $isMessengerModeEnabled)
|
||||||
@ -212,7 +176,6 @@ struct PasswordLoginView: View {
|
|||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
.padding(.vertical, 8)
|
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
viewModel.login()
|
viewModel.login()
|
||||||
@ -220,40 +183,42 @@ struct PasswordLoginView: View {
|
|||||||
if viewModel.isLoading {
|
if viewModel.isLoading {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(CircularProgressViewStyle())
|
.progressViewStyle(CircularProgressViewStyle())
|
||||||
.padding()
|
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.background(Color.gray.opacity(0.6))
|
.padding()
|
||||||
.cornerRadius(8)
|
|
||||||
} else {
|
} else {
|
||||||
Text(NSLocalizedString("Войти", comment: ""))
|
Text(NSLocalizedString("Войти", comment: ""))
|
||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
.padding()
|
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
.background(isLoginButtonEnabled ? Color.blue : Color.gray)
|
.background(isLoginButtonEnabled ? Color.blue : Color.gray)
|
||||||
.cornerRadius(8)
|
.cornerRadius(12)
|
||||||
}
|
|
||||||
}
|
|
||||||
.disabled(!isLoginButtonEnabled)
|
.disabled(!isLoginButtonEnabled)
|
||||||
|
|
||||||
// Spacer()
|
|
||||||
|
|
||||||
// Кнопка регистрации
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
isShowingRegistration = true
|
isShowingRegistration = true
|
||||||
viewModel.hasAcceptedTerms = false
|
viewModel.hasAcceptedTerms = false
|
||||||
}) {
|
}) {
|
||||||
Text(NSLocalizedString("Нет аккаунта? Регистрация", comment: "Регистрация"))
|
Text(NSLocalizedString("Нет аккаунта? Регистрация", comment: "Регистрация"))
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.blue)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
.padding(.top, 10)
|
.padding(.top, 4)
|
||||||
.sheet(isPresented: $isShowingRegistration) {
|
.sheet(isPresented: $isShowingRegistration) {
|
||||||
RegistrationView(viewModel: viewModel, isPresented: $isShowingRegistration)
|
RegistrationView(viewModel: viewModel, isPresented: $isShowingRegistration)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer(minLength: 0)
|
||||||
|
}
|
||||||
|
.padding(.vertical, 32)
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 24)
|
||||||
|
.background(Color(.systemBackground).ignoresSafeArea())
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
.onTapGesture {
|
||||||
|
focusedField = nil
|
||||||
}
|
}
|
||||||
.padding()
|
|
||||||
.loginErrorAlert(viewModel: viewModel)
|
.loginErrorAlert(viewModel: viewModel)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if !hasResetTermsOnAppear {
|
if !hasResetTermsOnAppear {
|
||||||
@ -264,15 +229,6 @@ struct PasswordLoginView: View {
|
|||||||
showLegacySupportNotice = true
|
showLegacySupportNotice = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onTapGesture {
|
|
||||||
focusedField = nil
|
|
||||||
}
|
|
||||||
if showLegacySupportNotice {
|
|
||||||
LegacySupportNoticeView(isPresented: $showLegacySupportNotice)
|
|
||||||
.transition(.opacity)
|
|
||||||
.zIndex(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.fullScreenCover(isPresented: $isShowingTerms) {
|
.fullScreenCover(isPresented: $isShowingTerms) {
|
||||||
TermsFullScreenView(
|
TermsFullScreenView(
|
||||||
isPresented: $isShowingTerms,
|
isPresented: $isShowingTerms,
|
||||||
@ -290,6 +246,12 @@ struct PasswordLoginView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.overlay(alignment: .center) {
|
||||||
|
if showLegacySupportNotice {
|
||||||
|
LegacySupportNoticeView(isPresented: $showLegacySupportNotice)
|
||||||
|
.transition(.opacity)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private var themeIconName: String {
|
private var themeIconName: String {
|
||||||
switch themeManager.theme {
|
switch themeManager.theme {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user