This commit is contained in:
cheykrym 2025-12-18 02:46:12 +03:00
parent dd61970357
commit 43a9d477a9

View File

@ -87,9 +87,9 @@ final class AppUpdateChecker: ObservableObject {
return return
} }
print("buildNumber", buildNumber) print("buildNumber", buildNumber)
print("config", config.notSupportedBuild, config.minSupportedBuild, config.recommendedBuild) print("config", config.notSupportedBuild, config.minSupportedBuild, config.recommendedBuild)
let requiresDoUpdate = buildNumber <= config.notSupportedBuild let requiresDoUpdate = buildNumber <= config.notSupportedBuild
if requiresDoUpdate, let info = config.forceUpdate { if requiresDoUpdate, let info = config.forceUpdate {
forceUpdateNotice = AppUpdateNotice(kind: .force, title: info.title, message: info.message, appStoreURL: appStoreURL) forceUpdateNotice = AppUpdateNotice(kind: .force, title: info.title, message: info.message, appStoreURL: appStoreURL)
@ -124,17 +124,10 @@ final class AppUpdateChecker: ObservableObject {
} }
private struct RemoteBuildConfiguration: Decodable { private struct RemoteBuildConfiguration: Decodable {
struct UpdateInfo: Decodable {
let title: String
let message: String
}
let schemaVersion: Int let schemaVersion: Int
let notSupportedBuild: Int let notSupportedBuild: Int
let minSupportedBuild: Int let minSupportedBuild: Int
let recommendedBuild: Int let recommendedBuild: Int
let forceUpdate: UpdateInfo?
let softUpdate: UpdateInfo?
let appStoreURL: URL? let appStoreURL: URL?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
@ -153,8 +146,6 @@ private struct RemoteBuildConfiguration: Decodable {
notSupportedBuild = try container.decode(Int.self, forKey: .notSupportedBuild) notSupportedBuild = try container.decode(Int.self, forKey: .notSupportedBuild)
minSupportedBuild = try container.decode(Int.self, forKey: .minSupportedBuild) minSupportedBuild = try container.decode(Int.self, forKey: .minSupportedBuild)
recommendedBuild = try container.decode(Int.self, forKey: .recommendedBuild) recommendedBuild = try container.decode(Int.self, forKey: .recommendedBuild)
forceUpdate = try container.decodeIfPresent(UpdateInfo.self, forKey: .forceUpdate)
softUpdate = try container.decodeIfPresent(UpdateInfo.self, forKey: .softUpdate)
if let urlString = try container.decodeIfPresent(String.self, forKey: .appStoreURL) { if let urlString = try container.decodeIfPresent(String.self, forKey: .appStoreURL) {
appStoreURL = URL(string: urlString) appStoreURL = URL(string: urlString)
} else { } else {