add ios 15 banner in settings

This commit is contained in:
cheykrym 2025-12-10 03:31:11 +03:00
parent 9013549362
commit ab9f5eca71

View File

@ -13,6 +13,12 @@ struct SettingsView: View {
var body: some View {
Form {
if shouldShowLegacySupportBanner {
LegacySupportBanner()
.listRowInsets(EdgeInsets(top: 12, leading: 0, bottom: 4, trailing: 0))
.listRowBackground(Color.clear)
}
// MARK: - Профиль
Section(header: Text(NSLocalizedString("Профиль", comment: ""))) {
// NavigationLink(destination: EditProfileView()) {
@ -171,4 +177,41 @@ struct SettingsView: View {
themeManager.setTheme(mappedTheme)
}
private var shouldShowLegacySupportBanner: Bool {
#if os(iOS)
let requiredVersion = OperatingSystemVersion(majorVersion: 16, minorVersion: 0, patchVersion: 0)
return !ProcessInfo.processInfo.isOperatingSystemAtLeast(requiredVersion)
#else
return false
#endif
}
}
private struct LegacySupportBanner: View {
var body: some View {
HStack(alignment: .top, spacing: 12) {
Image(systemName: "exclamationmark.triangle.fill")
.font(.system(size: 24, weight: .semibold))
.foregroundColor(.yellow)
VStack(alignment: .leading, spacing: 4) {
Text("Экспериментальная поддержка iOS 15")
.font(.headline)
Text("Поддержка iOS 15 работает в экспериментальном режиме. Для лучшей совместимости требуется iOS 16+.")
.font(.subheadline)
.foregroundColor(.secondary)
}
Spacer(minLength: 0)
}
.padding(16)
.background(
RoundedRectangle(cornerRadius: 14, style: .continuous)
.fill(Color.yellow.opacity(0.15))
)
.overlay(
RoundedRectangle(cornerRadius: 14, style: .continuous)
.stroke(Color.yellow.opacity(0.4), lineWidth: 1)
)
}
}