From a28238425deaa69566692d28323aa1b18de69997 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Fri, 12 Sep 2025 20:45:34 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20WIP:=20Change=20how=20upda?= =?UTF-8?q?te=20check=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Common/Core/Constants.swift | 29 ++++------- phpmon/Domain/App/App.swift | 5 ++ phpmon/Domain/App/AppUpdater.swift | 8 +-- phpmon/Domain/App/Base.lproj/Main.storyboard | 52 +++++++++---------- .../Integrations/Homebrew/CaskFile.swift | 9 +++- 5 files changed, 50 insertions(+), 53 deletions(-) diff --git a/phpmon/Common/Core/Constants.swift b/phpmon/Common/Core/Constants.swift index af1b941..763f5a8 100644 --- a/phpmon/Common/Core/Constants.swift +++ b/phpmon/Common/Core/Constants.swift @@ -134,30 +134,21 @@ struct Constants { string: "https://phpmon.app/sponsor/now" )! + static let EarlyAccessChangelog = URL( + string: "https://phpmon.app/early-access/release-notes" + )! + + // API endpoints (via api.phpmon.app) + + static let UpdateCheckEndpoint = URL( + string: "https://api.phpmon.test/api/v1/update-check" + ) + // GitHub URLs (do not alias these) static let GitHubReleases = URL( string: "https://github.com/nicoverbruggen/phpmon/releases" )! - - static let StableBuildCaskFile = URL( - string: "https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon.rb" - )! - - static let DevBuildCaskFile = URL( - string: "https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon-dev.rb" - )! - - // EAP URLs - - static let EarlyAccessCaskFile = URL( - string: "https://phpmon.app/builds/early-access/sponsors/phpmon-eap.rb" - )! - - static let EarlyAccessChangelog = URL( - string: "https://phpmon.app/early-access/release-notes" - )! - } } diff --git a/phpmon/Domain/App/App.swift b/phpmon/Domain/App/App.swift index 0f65c60..038c435 100644 --- a/phpmon/Domain/App/App.swift +++ b/phpmon/Domain/App/App.swift @@ -53,6 +53,11 @@ class App { return machine } + static var macVersion: String { + let version = ProcessInfo.processInfo.operatingSystemVersion + return "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)" + } + /** A fake architecture. When set, the real machine's system architecture is not used, diff --git a/phpmon/Domain/App/AppUpdater.swift b/phpmon/Domain/App/AppUpdater.swift index 7ca668a..ac3ad34 100644 --- a/phpmon/Domain/App/AppUpdater.swift +++ b/phpmon/Domain/App/AppUpdater.swift @@ -25,13 +25,7 @@ class AppUpdater { Log.info("The app will search for updates...") - var caskUrl = Constants.Urls.StableBuildCaskFile - - if App.identifier.contains(".phpmon.eap") { - caskUrl = Constants.Urls.EarlyAccessCaskFile - } else if App.identifier.contains(".phpmon.dev") { - caskUrl = Constants.Urls.DevBuildCaskFile - } + var caskUrl = URL(string: "https://api.phpmon.test/api/v1/update-check")! guard let caskFile = await CaskFile.from(url: caskUrl) else { Log.err("The contents of the CaskFile at '\(caskUrl.absoluteString)' could not be retrieved.") diff --git a/phpmon/Domain/App/Base.lproj/Main.storyboard b/phpmon/Domain/App/Base.lproj/Main.storyboard index 23f5f18..d1f5eac 100644 --- a/phpmon/Domain/App/Base.lproj/Main.storyboard +++ b/phpmon/Domain/App/Base.lproj/Main.storyboard @@ -436,7 +436,7 @@ - + @@ -582,7 +582,7 @@ Gw - + @@ -593,7 +593,7 @@ Gw - + @@ -617,7 +617,7 @@ Gw - + @@ -706,7 +706,7 @@ Gw - + @@ -717,7 +717,7 @@ Gw - + @@ -735,7 +735,7 @@ Gw - + @@ -750,7 +750,7 @@ Gw - + @@ -758,7 +758,7 @@ Gw -