add notification legacy support ios 15

This commit is contained in:
cheykrym 2025-10-23 18:48:52 +03:00
parent 2f8c1f3514
commit 726a6983b2
2 changed files with 74 additions and 0 deletions

View File

@ -1473,6 +1473,9 @@
} }
} }
} }
},
"Поддержка iOS 15 работает в экспериментальном режиме. Для лучшей совместимости требуется iOS 16+." : {
}, },
"Поделитесь идеями, сообщите об ошибке или расскажите, что работает отлично." : { "Поделитесь идеями, сообщите об ошибке или расскажите, что работает отлично." : {
"comment" : "feedback: info detail", "comment" : "feedback: info detail",
@ -2292,6 +2295,9 @@
} }
} }
} }
},
"Экспериментальная поддержка iOS 15" : {
}, },
"Язык" : { "Язык" : {
"localizations" : { "localizations" : {

View File

@ -14,6 +14,7 @@ struct LoginView: View {
private let themeOptions = ThemeOption.ordered private let themeOptions = ThemeOption.ordered
@State private var isShowingRegistration = false @State private var isShowingRegistration = false
@State private var showLegacySupportNotice = false
@FocusState private var focusedField: Field? @FocusState private var focusedField: Field?
private enum Field: Hashable { private enum Field: Hashable {
@ -156,9 +157,19 @@ struct LoginView: View {
dismissButton: .default(Text(NSLocalizedString("OK", comment: ""))) dismissButton: .default(Text(NSLocalizedString("OK", comment: "")))
) )
} }
.onAppear {
if shouldShowLegacySupportNotice {
showLegacySupportNotice = true
}
}
.onTapGesture { .onTapGesture {
focusedField = nil focusedField = nil
} }
if showLegacySupportNotice {
LegacySupportNoticeView(isPresented: $showLegacySupportNotice)
.transition(.opacity)
.zIndex(1)
}
} }
} }
private var themeIconName: String { private var themeIconName: String {
@ -172,11 +183,68 @@ struct LoginView: View {
} }
} }
private var shouldShowLegacySupportNotice: Bool {
#if os(iOS)
let requiredVersion = OperatingSystemVersion(majorVersion: 16, minorVersion: 0, patchVersion: 0)
return !ProcessInfo.processInfo.isOperatingSystemAtLeast(requiredVersion)
#else
return false
#endif
}
private func openLanguageSettings() { private func openLanguageSettings() {
guard let url = URL(string: UIApplication.openSettingsURLString) else { return } guard let url = URL(string: UIApplication.openSettingsURLString) else { return }
UIApplication.shared.open(url) UIApplication.shared.open(url)
} }
private struct LegacySupportNoticeView: View {
@Binding var isPresented: Bool
var body: some View {
ZStack {
Color.black.opacity(0.5)
.ignoresSafeArea()
.onTapGesture {
isPresented = false
}
VStack(spacing: 16) {
Image(systemName: "exclamationmark.triangle.fill")
.font(.system(size: 40, weight: .bold))
.foregroundColor(.yellow)
Text("Экспериментальная поддержка iOS 15")
.font(.headline)
.multilineTextAlignment(.center)
Text("Поддержка iOS 15 работает в экспериментальном режиме. Для лучшей совместимости требуется iOS 16+.")
.font(.subheadline)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
Button {
isPresented = false
} label: {
Text("Понятно")
.bold()
.frame(maxWidth: .infinity)
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(12)
}
}
.padding(24)
.background(
RoundedRectangle(cornerRadius: 20, style: .continuous)
.fill(Color(.systemBackground))
)
.frame(maxWidth: 320)
.shadow(radius: 10)
}
}
}
private var selectedThemeOption: ThemeOption { private var selectedThemeOption: ThemeOption {
ThemeOption.option(for: themeManager.theme) ThemeOption.option(for: themeManager.theme)
} }