diff --git a/phpmon/Common/Core/Constants.swift b/phpmon/Common/Core/Constants.swift index 1c67126..02311d0 100644 --- a/phpmon/Common/Core/Constants.swift +++ b/phpmon/Common/Core/Constants.swift @@ -54,6 +54,7 @@ class Constants { /** The URL that people can visit if they wish to help support the project. */ - static let DonationUrl = URL(string: "https://nicoverbruggen.be/sponsor#pay-now")! + static let DonationUrlDirect = URL(string: "https://nicoverbruggen.be/sponsor#pay-now")! + static let DonationUrl = URL(string: "https://nicoverbruggen.be/sponsor")! } diff --git a/phpmon/Domain/App/Base.lproj/Main.storyboard b/phpmon/Domain/App/Base.lproj/Main.storyboard index b9c1740..cfb8d1e 100644 --- a/phpmon/Domain/App/Base.lproj/Main.storyboard +++ b/phpmon/Domain/App/Base.lproj/Main.storyboard @@ -493,57 +493,83 @@ - + - - - - - - + + + + + + + + - + + + + + + + + + + + + + + + - + - + @@ -567,7 +593,7 @@ DQ - + Sometimes you need a really long explanation and in that case you can get a really, really long description here, along with, for example, various steps you can take. This allows for a lot of text to be displayed, yay! @@ -575,35 +601,16 @@ DQ - - - - + - - - - @@ -612,7 +619,6 @@ DQ - @@ -623,7 +629,7 @@ DQ - + diff --git a/phpmon/Domain/Notice/BetterAlert.swift b/phpmon/Domain/Notice/BetterAlert.swift index 6b30c55..9910aaa 100644 --- a/phpmon/Domain/Notice/BetterAlert.swift +++ b/phpmon/Domain/Notice/BetterAlert.swift @@ -42,7 +42,9 @@ class BetterAlert { public func withSecondary( text: String, - action: ((BetterAlertVC) -> Void)? = nil + action: ((BetterAlertVC) -> Void)? = { + vc in vc.close(with: .alertSecondButtonReturn) + } ) -> Self { self.noticeVC.buttonSecondary.title = text self.noticeVC.actionSecondary = action diff --git a/phpmon/Domain/Notice/BetterAlertVC.swift b/phpmon/Domain/Notice/BetterAlertVC.swift index 9e470d1..61adc7a 100644 --- a/phpmon/Domain/Notice/BetterAlertVC.swift +++ b/phpmon/Domain/Notice/BetterAlertVC.swift @@ -38,6 +38,10 @@ class BetterAlertVC: NSViewController { } } + override func viewDidAppear() { + view.window?.makeFirstResponder(buttonPrimary) + } + @IBAction func primaryButtonAction(_ sender: Any) { self.actionPrimary(self) } diff --git a/phpmon/Domain/Preferences/Stats.swift b/phpmon/Domain/Preferences/Stats.swift index f8449e0..0439191 100644 --- a/phpmon/Domain/Preferences/Stats.swift +++ b/phpmon/Domain/Preferences/Stats.swift @@ -86,6 +86,7 @@ class Stats { (see `didSeeSponsorEncouragement`) */ public static func evaluateSponsorMessageShouldBeDisplayed() { + if Bundle.main.bundleIdentifier?.contains("beta") ?? false { return Log.info("Sponsor messages never apply to beta builds.") } @@ -99,16 +100,24 @@ class Stats { } DispatchQueue.main.async { - let donate = Alert.present( - messageText: "startup.sponsor_encouragement.title".localized, - informativeText: "startup.sponsor_encouragement.desc".localized, - buttonTitle: "startup.sponsor_encouragement.accept".localized, - secondButtonTitle: "startup.sponsor_encouragement.skip".localized, - style: .informational) + let donate = BetterAlert() + .withInformation( + title: "startup.sponsor_encouragement.title".localized, + subtitle: "startup.sponsor_encouragement.subtitle".localized, + description: "startup.sponsor_encouragement.desc".localized + ) + .withPrimary(text: "startup.sponsor_encouragement.accept".localized) + .withSecondary(text: "startup.sponsor_encouragement.skip".localized) + .withTertiary(text: "startup.sponsor_encouragement.learn_more".localized, action: { vc in + vc.close(with: .alertThirdButtonReturn) + NSWorkspace.shared.open(Constants.DonationUrl) + }).didSelectPrimary() + if donate { Log.info("The user is an absolute badass for choosing this option. Thank you.") - NSWorkspace.shared.open(Constants.DonationUrl) + NSWorkspace.shared.open(Constants.DonationUrlDirect) } + UserDefaults.standard.set(true, forKey: InternalStats.didSeeSponsorEncouragement.rawValue) } } diff --git a/phpmon/Localizable.strings b/phpmon/Localizable.strings index dab3bc4..5751d64 100644 --- a/phpmon/Localizable.strings +++ b/phpmon/Localizable.strings @@ -302,9 +302,12 @@ You can do this by running `composer global update` in your terminal. After that // SPONSOR ENCOURAGEMENT "startup.sponsor_encouragement.title" = "If PHP Monitor has been useful to you or your company, please consider leaving a tip."; -"startup.sponsor_encouragement.desc" = "If you have already donated, then YOU are the reason why the app was able to get all these new features. In that case, this is a THANK YOU message to you.\n\nTo be 100% transparent: I plan to keep PHP Monitor open source and free. Your support makes this decision very easy.\n\n(You will only see this prompt once.)"; -"startup.sponsor_encouragement.accept" = "Yes, I would like to sponsor"; -"startup.sponsor_encouragement.skip" = "Nevermind"; +"startup.sponsor_encouragement.subtitle" = "To be 100% transparent: I plan to keep PHP Monitor open source and free. Your support makes this decision very easy.\n\n(You will only see this prompt once.)"; +"startup.sponsor_encouragement.desc" = "If you have already donated, then YOU are the reason why the app was able to get all these updates. In that case, this is a THANK YOU message to you. I appreciate the support."; + +"startup.sponsor_encouragement.accept" = "Sponsor Now"; +"startup.sponsor_encouragement.learn_more" = "Learn More"; +"startup.sponsor_encouragement.skip" = "No Thanks"; // ERROR MESSAGES (based on AlertableError)