add skip recomendet update
This commit is contained in:
parent
2679f31c4e
commit
19967ead13
@ -12,6 +12,15 @@ struct AppUpdateNotice: Identifiable {
|
|||||||
let id = UUID()
|
let id = UUID()
|
||||||
let kind: Kind
|
let kind: Kind
|
||||||
let appStoreURL: URL
|
let appStoreURL: URL
|
||||||
|
let skipBuild: Int?
|
||||||
|
|
||||||
|
init(kind: Kind, appStoreURL: URL, skipBuild: Int? = nil) {
|
||||||
|
self.kind = kind
|
||||||
|
self.appStoreURL = appStoreURL
|
||||||
|
self.skipBuild = skipBuild
|
||||||
|
}
|
||||||
|
|
||||||
|
var canSkip: Bool { skipBuild != nil }
|
||||||
|
|
||||||
var title: String {
|
var title: String {
|
||||||
switch kind {
|
switch kind {
|
||||||
@ -58,7 +67,10 @@ final class AppUpdateChecker: ObservableObject {
|
|||||||
Task { await fetchRemoteConfig() }
|
Task { await fetchRemoteConfig() }
|
||||||
}
|
}
|
||||||
|
|
||||||
func dismissSoftUpdateIfNeeded() {
|
func dismissSoftUpdateIfNeeded(skipBuild: Int? = nil) {
|
||||||
|
if let skipBuild {
|
||||||
|
lastCheckedAppBuild = skipBuild
|
||||||
|
}
|
||||||
softUpdateNotice = nil
|
softUpdateNotice = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +149,11 @@ final class AppUpdateChecker: ObservableObject {
|
|||||||
|
|
||||||
if buildNumber < config.recommendedBuild && config.recommendedBuild != lastCheckedAppBuild {
|
if buildNumber < config.recommendedBuild && config.recommendedBuild != lastCheckedAppBuild {
|
||||||
// lastCheckedAppBuild = config.recommendedBuild
|
// lastCheckedAppBuild = config.recommendedBuild
|
||||||
softUpdateNotice = AppUpdateNotice(kind: .soft, appStoreURL: appStoreURL)
|
softUpdateNotice = AppUpdateNotice(
|
||||||
|
kind: .soft,
|
||||||
|
appStoreURL: appStoreURL,
|
||||||
|
skipBuild: config.recommendedBuild
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,7 +83,7 @@ struct yobbleApp: App {
|
|||||||
updateChecker.openAppStore(link: notice.appStoreURL)
|
updateChecker.openAppStore(link: notice.appStoreURL)
|
||||||
},
|
},
|
||||||
secondaryButton: .cancel(Text(NSLocalizedString("Позже", comment: ""))) {
|
secondaryButton: .cancel(Text(NSLocalizedString("Позже", comment: ""))) {
|
||||||
updateChecker.dismissSoftUpdateIfNeeded()
|
updateChecker.dismissSoftUpdateIfNeeded(skipBuild: notice.skipBuild)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user