From 726a6983b2dce7aa6f06957c199b88fc1a2c1198 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Thu, 23 Oct 2025 18:48:52 +0300 Subject: [PATCH] add notification legacy support ios 15 --- yobble/Resources/Localizable.xcstrings | 6 +++ yobble/Views/Login/LoginView.swift | 68 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index 02bcd40..ae543f9 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -1473,6 +1473,9 @@ } } } + }, + "Поддержка iOS 15 работает в экспериментальном режиме. Для лучшей совместимости требуется iOS 16+." : { + }, "Поделитесь идеями, сообщите об ошибке или расскажите, что работает отлично." : { "comment" : "feedback: info detail", @@ -2292,6 +2295,9 @@ } } } + }, + "Экспериментальная поддержка iOS 15" : { + }, "Язык" : { "localizations" : { diff --git a/yobble/Views/Login/LoginView.swift b/yobble/Views/Login/LoginView.swift index 2b2ecc4..488a696 100644 --- a/yobble/Views/Login/LoginView.swift +++ b/yobble/Views/Login/LoginView.swift @@ -14,6 +14,7 @@ struct LoginView: View { private let themeOptions = ThemeOption.ordered @State private var isShowingRegistration = false + @State private var showLegacySupportNotice = false @FocusState private var focusedField: Field? private enum Field: Hashable { @@ -156,9 +157,19 @@ struct LoginView: View { dismissButton: .default(Text(NSLocalizedString("OK", comment: ""))) ) } + .onAppear { + if shouldShowLegacySupportNotice { + showLegacySupportNotice = true + } + } .onTapGesture { focusedField = nil } + if showLegacySupportNotice { + LegacySupportNoticeView(isPresented: $showLegacySupportNotice) + .transition(.opacity) + .zIndex(1) + } } } 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() { guard let url = URL(string: UIApplication.openSettingsURLString) else { return } 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 { ThemeOption.option(for: themeManager.theme) }