patch link open

This commit is contained in:
cheykrym 2025-12-18 07:52:56 +03:00
parent 1269a29ae8
commit 1e61409501
2 changed files with 10 additions and 9 deletions

View File

@ -62,8 +62,9 @@ final class AppUpdateChecker: ObservableObject {
softUpdateNotice = nil softUpdateNotice = nil
} }
func openAppStore() { func openAppStore(link overrideURL: URL? = nil) {
guard let url = needUpdateNotice?.appStoreURL guard let url = overrideURL
?? needUpdateNotice?.appStoreURL
?? forceUpdateNotice?.appStoreURL ?? forceUpdateNotice?.appStoreURL
?? softUpdateNotice?.appStoreURL else { ?? softUpdateNotice?.appStoreURL else {
return return

View File

@ -26,7 +26,7 @@ struct yobbleApp: App {
NeedUpdateView( NeedUpdateView(
title: notice.title, title: notice.title,
message: notice.message, message: notice.message,
onUpdate: { updateChecker.openAppStore() } onUpdate: { updateChecker.openAppStore(link: notice.appStoreURL) }
) )
} else { } else {
ZStack(alignment: .top) { ZStack(alignment: .top) {
@ -76,12 +76,12 @@ struct yobbleApp: App {
} }
} }
)) { notice in )) { notice in
Alert( Alert(
title: Text(notice.title), title: Text(notice.title),
message: Text(notice.message), message: Text(notice.message),
primaryButton: .default(Text(NSLocalizedString("Обновить", comment: ""))) { primaryButton: .default(Text(NSLocalizedString("Обновить", comment: ""))) {
updateChecker.openAppStore() updateChecker.openAppStore(link: notice.appStoreURL)
}, },
secondaryButton: .cancel(Text(NSLocalizedString("Позже", comment: ""))) { secondaryButton: .cancel(Text(NSLocalizedString("Позже", comment: ""))) {
updateChecker.dismissSoftUpdateIfNeeded() updateChecker.dismissSoftUpdateIfNeeded()
} }