|
|
|
@ -122,7 +122,7 @@ struct PadelClubApp: App { |
|
|
|
Task.detached(priority: .high) { |
|
|
|
Task.detached(priority: .high) { |
|
|
|
if let requiredVersion = await self._retrieveRequiredVersion() { |
|
|
|
if let requiredVersion = await self._retrieveRequiredVersion() { |
|
|
|
let cleanedRequired = requiredVersion.replacingOccurrences(of: "\n", with: "") |
|
|
|
let cleanedRequired = requiredVersion.replacingOccurrences(of: "\n", with: "") |
|
|
|
Logger.log(">>> VERSION = \(requiredVersion)") |
|
|
|
Logger.log(">>> REQUIRED VERSION = \(requiredVersion)") |
|
|
|
if let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { |
|
|
|
if let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { |
|
|
|
await MainActor.run { |
|
|
|
await MainActor.run { |
|
|
|
self.blockApp = VersionComparator.compare(cleanedRequired, currentVersion) == 1 |
|
|
|
self.blockApp = VersionComparator.compare(cleanedRequired, currentVersion) == 1 |
|
|
|
@ -134,9 +134,16 @@ struct PadelClubApp: App { |
|
|
|
|
|
|
|
|
|
|
|
fileprivate func _retrieveRequiredVersion() async -> String? { |
|
|
|
fileprivate func _retrieveRequiredVersion() async -> String? { |
|
|
|
let requiredVersionURL = URLs.main.extend(path: "static/misc/required-version.txt") |
|
|
|
let requiredVersionURL = URLs.main.extend(path: "static/misc/required-version.txt") |
|
|
|
return try? String(contentsOf: requiredVersionURL, encoding: .utf8) |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
let (data, _) = try await URLSession.shared.data(from: requiredVersionURL) |
|
|
|
|
|
|
|
return String(data: data, encoding: .utf8) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.log("Error fetching required version: \(error)") |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func _handleIncomingURL(_ url: URL) { |
|
|
|
private func _handleIncomingURL(_ url: URL) { |
|
|
|
// Parse the URL |
|
|
|
// Parse the URL |
|
|
|
let pathComponents = url.pathComponents |
|
|
|
let pathComponents = url.pathComponents |
|
|
|
|