ios_app/Shared/Views/Tab/Profile/Settings/SettingsView.swift
2025-07-16 06:40:07 +03:00

99 lines
3.9 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import SwiftUI
struct SettingsView: View {
@ObservedObject var viewModel: LoginViewModel
@AppStorage("isDarkMode") private var isDarkMode: Bool = true
var body: some View {
Form {
// MARK: - Профиль
Section(header: Text("Профиль")) {
NavigationLink(destination: EditProfileView()) {
Label("Мой профиль", systemImage: "person.crop.circle")
}
}
// MARK: - Безопасность
Section(header: Text("Безопасность")) {
NavigationLink(destination: Text("Заглушка: Сменить пароль")) {
Label("Сменить пароль", systemImage: "key")
}
NavigationLink(destination: Text("Заглушка: Двухфакторная аутентификация")) {
Label("Двухфакторная аутентификация", systemImage: "lock.shield")
}
NavigationLink(destination: Text("Заглушка: Активные сессии")) {
Label("Активные сессии", systemImage: "iphone")
}
}
// MARK: - Приложение
Section(header: Text("Приложение")) {
Button(action: openLanguageSettings) {
Label("Язык", systemImage: "globe")
}
Toggle(isOn: $isDarkMode) {
Label("Тёмная тема", systemImage: "moon.fill")
}
NavigationLink(destination: Text("Заглушка: Хранилище данных")) {
Label("Данные", systemImage: "externaldrive")
}
NavigationLink(destination: Text("Заглушка: Другие настройки")) {
Label("Другое", systemImage: "ellipsis.circle")
}
}
// MARK: - Уведомления
Section(header: Text("Уведомления")) {
NavigationLink(destination: Text("Заглушка: Push-уведомления")) {
Label("Push-уведомления", systemImage: "bell")
}
}
// MARK: - Поддержка
Section(header: Text("Поддержка")) {
NavigationLink(destination: Text("Заглушка: Частые вопросы")) {
Label("Частые вопросы", systemImage: "questionmark.circle")
}
NavigationLink(destination: Text("Заглушка: Обратная связь")) {
Label("Обратная связь", systemImage: "paperplane")
}
}
// MARK: - О приложении
Section(header: Text("О приложении")) {
VStack(alignment: .leading, spacing: 6) {
Text(AppInfo.text_1)
Text(AppInfo.text_2)
Text(AppInfo.text_3)
}
.font(.footnote)
.foregroundColor(.gray)
.padding(.vertical, 4)
}
// MARK: - Выход
Section {
Button(action: {
viewModel.logoutCurrentUser()
}) {
HStack {
Image(systemName: "arrow.backward.square")
Text("Выйти из аккаунта")
}
.foregroundColor(.red)
}
}
}
.navigationTitle("Настройки")
}
private func openLanguageSettings() {
guard let url = URL(string: UIApplication.openSettingsURLString) else { return }
UIApplication.shared.open(url)
}
}