From 641328760684472a9a3c6191d15dcab249d92271 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Fri, 24 Mar 2023 01:03:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Fix=20updater=20bundle=20logic,?= =?UTF-8?q?=20skip=20release=20notes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PHP Monitor.xcodeproj/project.pbxproj | 11 +++++----- phpmon-updater/LaunchControl.swift | 8 +------ phpmon/Domain/App/AppUpdater.swift | 30 +++++++++++++++------------ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index 2bc7b87..2dd5ccb 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -3299,6 +3299,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1205; DEAD_CODE_STRIPPING = YES; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; @@ -3328,7 +3329,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1200; + CURRENT_PROJECT_VERSION = 1205; DEAD_CODE_STRIPPING = YES; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; @@ -3557,7 +3558,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1200; + CURRENT_PROJECT_VERSION = 1205; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; @@ -3668,7 +3669,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1200; + CURRENT_PROJECT_VERSION = 1205; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; @@ -3779,7 +3780,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1200; + CURRENT_PROJECT_VERSION = 1205; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; @@ -3952,7 +3953,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1200; + CURRENT_PROJECT_VERSION = 1205; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; diff --git a/phpmon-updater/LaunchControl.swift b/phpmon-updater/LaunchControl.swift index 4adceff..deef6ac 100644 --- a/phpmon-updater/LaunchControl.swift +++ b/phpmon-updater/LaunchControl.swift @@ -24,14 +24,8 @@ class LaunchControl { public static func terminateApplications(bundleIds: [String]) async { let runningApplications = NSWorkspace.shared.runningApplications - // Look for these instances - let ids = [ - "com.nicoverbruggen.phpmon.dev", - "com.nicoverbruggen.phpmon" - ] - // Terminate all instances found - for id in ids { + for id in bundleIds { if let phpmon = runningApplications.first(where: { (application) in return application.bundleIdentifier == id }) { diff --git a/phpmon/Domain/App/AppUpdater.swift b/phpmon/Domain/App/AppUpdater.swift index 4456ae9..7a314d2 100644 --- a/phpmon/Domain/App/AppUpdater.swift +++ b/phpmon/Domain/App/AppUpdater.swift @@ -26,7 +26,7 @@ class AppUpdater { var caskUrl = Constants.Urls.StableBuildCaskFile - if App.identifier.contains("phpmon.eap") { + if App.identifier.contains(".phpmon.eap") { caskUrl = Constants.Urls.EarlyAccessCaskFile } else if App.identifier.contains(".phpmon.dev") { caskUrl = Constants.Urls.DevBuildCaskFile @@ -72,7 +72,7 @@ class AppUpdater { : "brew upgrade phpmon" Task { @MainActor in - BetterAlert().withInformation( + var alert = BetterAlert().withInformation( title: "updater.alerts.newer_version_available.title" .localized(latestVersionOnline.humanReadable), subtitle: "updater.alerts.newer_version_available.subtitle" @@ -89,17 +89,21 @@ class AppUpdater { vc.close(with: .OK) } ) - .withSecondary( - text: "updater.alerts.buttons.release_notes".localized, - action: { _ in - let urlSegments = self.caskFile.url.split(separator: "/") - let tag = urlSegments[urlSegments.count - 2] // ../download/{tag}/{file.zip} - NSWorkspace.shared.open( - Constants.Urls.GitHubReleases.appendingPathComponent("/tag/\(tag)") - ) - } - ) - .withTertiary(text: "updater.alerts.buttons.dismiss".localized, action: { vc in + + if !App.identifier.contains(".phpmon.eap") { + alert = alert.withSecondary( + text: "updater.alerts.buttons.release_notes".localized, + action: { _ in + let urlSegments = self.caskFile.url.split(separator: "/") + let tag = urlSegments[urlSegments.count - 2] // ../download/{tag}/{file.zip} + NSWorkspace.shared.open( + Constants.Urls.GitHubReleases.appendingPathComponent("/tag/\(tag)") + ) + } + ) + } + + alert.withTertiary(text: "updater.alerts.buttons.dismiss".localized, action: { vc in vc.close(with: .OK) }) .show()