fall back to the tutorial menu on ios 17

This commit is contained in:
leminlimez committed 2025-07-13 14:43:11 -04:00
1 parent dfee862746
commit 99eba91bad
2 files changed
+15 -10

No files matched your search

@@ -35,6 +35,7 @@ class PosterBoardManager: ObservableObject {
guard let obj = objc_getClass("IPSettingsUtilities") as? NSObject else { return false }
langManager = obj
} else {
// TODO: Need to find the correct class for this on iOS 17
guard let obj = objc_getClass("PSLanguageSelector") as? NSObject else { return false }
langManager = obj
}
+14 -10
View File
@@ -99,17 +99,21 @@ struct ContentView: View {
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
}
Button(action: {
guard let lang = UserDefaults.standard.stringArray(forKey: "AppleLanguages")?.first else {
hideResetHelp = false // fallback to tutorial
return
}
UIApplication.shared.confirmAlert(title: NSLocalizedString("Reset Collections", comment: ""), body: NSLocalizedString("Do you want to reset collections?", comment: ""), onOK: {
if pbManager.setSystemLanguage(to: lang) {
UIApplication.shared.alert(title: NSLocalizedString("Collections Successfully Reset!", comment: ""), body: NSLocalizedString("Your PosterBoard will refresh automatically.", comment: ""))
} else {
UIApplication.shared.alert(body: "The API failed to call correctly.\nSystem Locale Code: \(lang)")
if #available(iOS 18.0, *) {
guard let lang = UserDefaults.standard.stringArray(forKey: "AppleLanguages")?.first else {
hideResetHelp = false // fallback to tutorial
return
}
}, noCancel: false)
UIApplication.shared.confirmAlert(title: NSLocalizedString("Reset Collections", comment: ""), body: NSLocalizedString("Do you want to reset collections?", comment: ""), onOK: {
if pbManager.setSystemLanguage(to: lang) {
UIApplication.shared.alert(title: NSLocalizedString("Collections Successfully Reset!", comment: ""), body: NSLocalizedString("Your PosterBoard will refresh automatically.", comment: ""))
} else {
UIApplication.shared.alert(body: "The API failed to call correctly.\nSystem Locale Code: \(lang)")
}
}, noCancel: false)
} else {
hideResetHelp = false
}
}) {
Label("Reset Collections", systemImage: "arrow.clockwise.circle")
}