diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index 8aac85b..586d9e1 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -3688,7 +3688,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; @@ -3719,7 +3719,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; @@ -3960,7 +3960,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; @@ -4077,7 +4077,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; @@ -4194,7 +4194,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = YES; DEVELOPMENT_TEAM = 8M54J5J787; @@ -4377,7 +4377,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1520; + CURRENT_PROJECT_VERSION = 1525; DEAD_CODE_STRIPPING = YES; DEBUG = NO; DEVELOPMENT_TEAM = 8M54J5J787; diff --git a/phpmon/Common/Core/Constants.swift b/phpmon/Common/Core/Constants.swift index 56d88a3..c6acd0c 100644 --- a/phpmon/Common/Core/Constants.swift +++ b/phpmon/Common/Core/Constants.swift @@ -116,6 +116,10 @@ struct Constants { string: "https://phpmon.app/php-unavailable" )! + static let WikiPhpUpgrade = URL( + string: "https://phpmon.app/php-upgrade" + )! + static let DonationPayment = URL( string: "https://phpmon.app/sponsor/now" )! diff --git a/phpmon/Domain/SwiftUI/Common/HelpButton.swift b/phpmon/Domain/SwiftUI/Common/HelpButton.swift index 3983869..f5a68b5 100644 --- a/phpmon/Domain/SwiftUI/Common/HelpButton.swift +++ b/phpmon/Domain/SwiftUI/Common/HelpButton.swift @@ -10,6 +10,11 @@ import Foundation import SwiftUI struct HelpButton: View { + @State var frameSize: CGFloat = 14 + @State var textSize: CGFloat = 12 + @State var shadowOpacity: CGFloat = 0.3 + @State var shadowRadius: CGFloat = 1 + var action: () -> Void var body: some View { @@ -18,9 +23,10 @@ struct HelpButton: View { Circle() .strokeBorder(Color(NSColor.separatorColor), lineWidth: 0.5) .background(Circle().foregroundColor(Color(NSColor.controlColor)).opacity(0.7)) - .shadow(color: Color(NSColor.separatorColor).opacity(0.3), radius: 1) - .frame(width: 14, height: 14) - Text("?").font(.system(size: 12, weight: .medium)) + .shadow(color: Color(NSColor.separatorColor) + .opacity(shadowOpacity), radius: shadowRadius) + .frame(width: frameSize, height: frameSize) + Text("?").font(.system(size: textSize, weight: .medium)) .foregroundColor(Color(NSColor.labelColor)) } }) diff --git a/phpmon/Modules/PHP Version Manager/UI/PhpVersionManagerView.swift b/phpmon/Modules/PHP Version Manager/UI/PhpVersionManagerView.swift index 46204d6..682f1db 100644 --- a/phpmon/Modules/PHP Version Manager/UI/PhpVersionManagerView.swift +++ b/phpmon/Modules/PHP Version Manager/UI/PhpVersionManagerView.swift @@ -9,6 +9,7 @@ import Foundation import SwiftUI +// swiftlint:disable type_body_length struct PhpVersionManagerView: View { @ObservedObject var formulae: BrewFormulaeObservable @ObservedObject var status: BusyStatus @@ -231,7 +232,11 @@ struct PhpVersionManagerView: View { } } - if formula.isInstalled { + if formula.hasUpgradedFormulaAlias { + HelpButton(frameSize: 18, textSize: 14, shadowOpacity: 1, shadowRadius: 2, action: { + NSWorkspace.shared.open(Constants.Urls.WikiPhpUpgrade) + }) + } else if formula.isInstalled { Button("phpman.buttons.uninstall".localizedForSwiftUI, role: .destructive) { Task { await self.confirmUninstall(formula) } } @@ -285,6 +290,15 @@ struct PhpVersionManagerView: View { .frame(maxWidth: .infinity, alignment: .leading) } + private func formulaIcon(for formula: BrewPhpFormula) -> some View { + Image(systemName: formula.icon) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 16, height: 16) + .foregroundColor(formula.iconColor) + .padding(.horizontal, 5) + } + private func unavailableFormula() -> some View { HStack(spacing: 5) { Text("phpman.version.unavailable".localizedForSwiftUI) @@ -295,16 +309,8 @@ struct PhpVersionManagerView: View { }) } } - - private func formulaIcon(for formula: BrewPhpFormula) -> some View { - Image(systemName: formula.icon) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 16, height: 16) - .foregroundColor(formula.iconColor) - .padding(.horizontal, 5) - } } +// swiftlint:enable type_body_length #Preview { PhpVersionManagerView(