import SwiftUI struct EmailSecuritySettingsView: View { @State private var isLoginCodesEnabled = false @State private var activeAlert: EmailSecurityAlert? var body: some View { Form { Section(header: Text(NSLocalizedString("Защита входа", comment: "Раздел защиты входа через email"))) { Toggle(NSLocalizedString("Получать коды на email при входе", comment: "Переключатель отправки кодов при входе"), isOn: Binding( get: { isLoginCodesEnabled }, set: { _ in activeAlert = EmailSecurityAlert( title: NSLocalizedString("Скоро", comment: "Заголовок заглушки"), message: NSLocalizedString("Функция пока недоступна.", comment: "Сообщение заглушки") ) isLoginCodesEnabled = false } )) Text(NSLocalizedString("Мы отправим код подтверждения на привязанный email каждый раз при входе.", comment: "Описание работы кодов при входе")) .font(.footnote) .foregroundColor(.secondary) } Section(header: Text(NSLocalizedString("Подтверждение email", comment: "Раздел подтверждения email"))) { Text(NSLocalizedString("Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки.", comment: "Описание необходимости подтверждения email")) .font(.callout) .foregroundColor(.secondary) Button(NSLocalizedString("Отправить письмо подтверждения", comment: "Кнопка отправки письма подтверждения")) { activeAlert = EmailSecurityAlert( title: NSLocalizedString("Скоро", comment: "Заголовок заглушки"), message: NSLocalizedString("Мы отправим письмо, как только функция будет готова.", comment: "Сообщение при недоступной отправке письма") ) } } } .navigationTitle(NSLocalizedString("Email", comment: "Заголовок экрана настроек email")) .navigationBarTitleDisplayMode(.inline) .alert(item: $activeAlert) { alert in Alert( title: Text(alert.title), message: Text(alert.message), dismissButton: .default(Text(NSLocalizedString("OK", comment: "Общий текст кнопки OK"))) ) } } } private struct EmailSecurityAlert: Identifiable { let id = UUID() let title: String let message: String } #if DEBUG struct EmailSecuritySettingsView_Previews: PreviewProvider { static var previews: some View { NavigationView { EmailSecuritySettingsView() } } } #endif