1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

👌 Constants as struct

This commit is contained in:
2022-02-20 15:29:24 +01:00
parent c952c3d031
commit a0fe68f3ab
4 changed files with 18 additions and 8 deletions

View File

@ -7,7 +7,7 @@
import Cocoa import Cocoa
class Constants { struct Constants {
/** /**
* The latest PHP version that is considered to be stable at the time of release. * The latest PHP version that is considered to be stable at the time of release.
@ -51,8 +51,18 @@ class Constants {
"8.2" "8.2"
] ]
static let DonationUrlDirect = URL(string: "https://nicoverbruggen.be/sponsor#pay-now")! struct Urls {
static let DonationUrl = URL(string: "https://nicoverbruggen.be/sponsor")!
static let FrequentlyAskedQuestionsUrl = URL(string: "https://github.com/nicoverbruggen/phpmon#%EF%B8%8F-faq--troubleshooting")! static let DonationPayment = URL(
string: "https://nicoverbruggen.be/sponsor#pay-now"
)!
static let DonationPage = URL(
string: "https://nicoverbruggen.be/sponsor"
)!
static let FrequentlyAskedQuestions = URL(
string: "https://github.com/nicoverbruggen/phpmon#%EF%B8%8F-faq--troubleshooting"
)!
}
} }

View File

@ -77,7 +77,7 @@ extension MainMenu {
}) })
.withSecondary(text: "alert.fix_my_valet_done.stay".localized(PhpEnv.brewPhpVersion)) .withSecondary(text: "alert.fix_my_valet_done.stay".localized(PhpEnv.brewPhpVersion))
.withTertiary(text: "", action: { alert in .withTertiary(text: "", action: { alert in
NSWorkspace.shared.open(Constants.FrequentlyAskedQuestionsUrl) NSWorkspace.shared.open(Constants.Urls.FrequentlyAskedQuestions)
}) })
.show() .show()
} }

View File

@ -323,7 +323,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
} }
@objc func openDonate() { @objc func openDonate() {
NSWorkspace.shared.open(Constants.DonationUrl) NSWorkspace.shared.open(Constants.Urls.DonationPage)
} }
@objc func terminateApp() { @objc func terminateApp() {

View File

@ -110,12 +110,12 @@ class Stats {
.withSecondary(text: "startup.sponsor_encouragement.skip".localized) .withSecondary(text: "startup.sponsor_encouragement.skip".localized)
.withTertiary(text: "", action: { vc in .withTertiary(text: "", action: { vc in
vc.close(with: .alertThirdButtonReturn) vc.close(with: .alertThirdButtonReturn)
NSWorkspace.shared.open(Constants.DonationUrl) NSWorkspace.shared.open(Constants.Urls.DonationPage)
}).didSelectPrimary() }).didSelectPrimary()
if donate { if donate {
Log.info("The user is an absolute badass for choosing this option. Thank you.") Log.info("The user is an absolute badass for choosing this option. Thank you.")
NSWorkspace.shared.open(Constants.DonationUrlDirect) NSWorkspace.shared.open(Constants.Urls.DonationPayment)
} }
UserDefaults.standard.set(true, forKey: InternalStats.didSeeSponsorEncouragement.rawValue) UserDefaults.standard.set(true, forKey: InternalStats.didSeeSponsorEncouragement.rawValue)