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

👌 Quality of life changes

- Moved DonationUrl to Constants
- Added additional menu items (visible if window is open)
- Fixed capitalisation of "WordPress" in PhpFrameworks
- Cleanup Stats
- Add new translation strings for menu items
This commit is contained in:
2022-02-01 17:51:23 +01:00
parent 40062c5091
commit 7a8f47b995
9 changed files with 91 additions and 11 deletions

View File

@ -1218,7 +1218,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 553; CURRENT_PROJECT_VERSION = 560;
DEVELOPMENT_TEAM = 8M54J5J787; DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = phpmon/Info.plist; INFOPLIST_FILE = phpmon/Info.plist;
@ -1227,7 +1227,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "5.0-rc4"; MARKETING_VERSION = "5.0-rc5";
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon; PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -1243,7 +1243,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 553; CURRENT_PROJECT_VERSION = 560;
DEVELOPMENT_TEAM = 8M54J5J787; DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = phpmon/Info.plist; INFOPLIST_FILE = phpmon/Info.plist;
@ -1252,7 +1252,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "5.0-rc4"; MARKETING_VERSION = "5.0-rc5";
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon; PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -51,4 +51,9 @@ class Constants {
"8.2" "8.2"
] ]
/**
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")!
} }

View File

@ -7,6 +7,7 @@
// //
import Foundation import Foundation
import AppKit
/** /**
Any outlets connected to the app's main menu (not the menu that shows when the icon in Any outlets connected to the app's main menu (not the menu that shows when the icon in
@ -24,6 +25,13 @@ extension AppDelegate {
// MARK: - Menu Interactions // MARK: - Menu Interactions
@IBAction func addSiteLinkPressed(_ sender: Any) {
SiteListVC.show()
guard let windowController = App.shared.siteListWindowController else { return }
windowController.pressedAddLink(nil)
}
@IBAction func reloadSiteListPressed(_ sender: Any) { @IBAction func reloadSiteListPressed(_ sender: Any) {
let vc = App.shared.siteListWindowController? let vc = App.shared.siteListWindowController?
.window?.contentViewController as? SiteListVC .window?.contentViewController as? SiteListVC
@ -37,4 +45,11 @@ extension AppDelegate {
} }
} }
@IBAction func focusSearchField(_ sender: Any) {
SiteListVC.show()
guard let windowController = App.shared.siteListWindowController else { return }
windowController.searchToolbarItem.searchField.becomeFirstResponder()
}
} }

View File

@ -50,11 +50,31 @@
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Sites" id="YTZ-bb-TOG"> <menu key="submenu" title="Sites" id="YTZ-bb-TOG">
<items> <items>
<menuItem title="Reload Site List" keyEquivalent="r" id="Ema-AU-Nbr"> <menuItem title="add-as-link" keyEquivalent="n" id="du1-bO-N2U" userLabel="Add Link" customClass="LocalizedMenuItem" customModule="PHP_Monitor" customModuleProvider="target">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="mm_add_folder_as_link"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="addSiteLinkPressed:" target="Voe-Tx-rLC" id="DzS-MY-6g0"/>
</connections>
</menuItem>
<menuItem title="reload-list" keyEquivalent="r" id="Ema-AU-Nbr" customClass="LocalizedMenuItem" customModule="PHP_Monitor" customModuleProvider="target">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="mm_reload_site_list"/>
</userDefinedRuntimeAttributes>
<connections> <connections>
<action selector="reloadSiteListPressed:" target="Voe-Tx-rLC" id="geC-Ld-haX"/> <action selector="reloadSiteListPressed:" target="Voe-Tx-rLC" id="geC-Ld-haX"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="2ux-8Q-UjK"/>
<menuItem title="focus-find" keyEquivalent="f" id="I95-fb-EL7" customClass="LocalizedMenuItem" customModule="PHP_Monitor" customModuleProvider="target">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="mm_find_in_site_list"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="focusSearchField:" target="Voe-Tx-rLC" id="O8j-1B-hll"/>
</connections>
</menuItem>
</items> </items>
</menu> </menu>
</menuItem> </menuItem>
@ -299,7 +319,7 @@
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> <customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PHP_Monitor" customModuleProvider="target"/> <customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PHP_Monitor" customModuleProvider="target"/>
</objects> </objects>
<point key="canvasLocation" x="-484" y="32"/> <point key="canvasLocation" x="-495" y="-44"/>
</scene> </scene>
<!--Window Controller--> <!--Window Controller-->
<scene sceneID="PQa-AT-b2a"> <scene sceneID="PQa-AT-b2a">
@ -589,6 +609,10 @@ Gw
<rect key="frame" x="0.0" y="0.0" width="600" height="309"/> <rect key="frame" x="0.0" y="0.0" width="600" height="309"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<customView id="j65-Lf-0lG">
<rect key="frame" x="9" y="0.0" width="581" height="203"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<scrollView autohidesScrollers="YES" horizontalLineScroll="54" horizontalPageScroll="10" verticalLineScroll="54" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p0j-eB-I2i"> <scrollView autohidesScrollers="YES" horizontalLineScroll="54" horizontalPageScroll="10" verticalLineScroll="54" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p0j-eB-I2i">
<rect key="frame" x="0.0" y="0.0" width="600" height="309"/> <rect key="frame" x="0.0" y="0.0" width="600" height="309"/>
<clipView key="contentView" id="6IL-DW-37w"> <clipView key="contentView" id="6IL-DW-37w">
@ -776,7 +800,7 @@ Gw
</viewController> </viewController>
<customObject id="HgD-aB-bQb" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> <customObject id="HgD-aB-bQb" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="251" y="742"/> <point key="canvasLocation" x="251" y="741.5"/>
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
@ -786,7 +810,7 @@ Gw
<image name="arrow.clockwise" catalog="system" width="14" height="16"/> <image name="arrow.clockwise" catalog="system" width="14" height="16"/>
<image name="plus" catalog="system" width="14" height="13"/> <image name="plus" catalog="system" width="14" height="13"/>
<namedColor name="IconColorGreen"> <namedColor name="IconColorGreen">
<color red="0.2467108965" green="0.69713878631591797" blue="0.50060153009999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.24699999392032623" green="0.69700002670288086" blue="0.50099998712539673" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
</resources> </resources>
</document> </document>

View File

@ -16,3 +16,14 @@ extension NSMenu {
} }
} }
@IBDesignable class LocalizedMenuItem: NSMenuItem {
@IBInspectable
var localizationKey: String? {
didSet {
self.title = localizationKey?.localized ?? self.title
}
}
}

View File

@ -34,7 +34,7 @@ struct PhpFrameworks {
"october/october": "OctoberCMS", "october/october": "OctoberCMS",
"sculpin/sculpin": "Sculpin", "sculpin/sculpin": "Sculpin",
"statamic/cms": "Statamic", "statamic/cms": "Statamic",
"johnpbloch/wordpress-core": "Wordpress", "johnpbloch/wordpress-core": "WordPress",
"zendframework/zendframework": "Zend", "zendframework/zendframework": "Zend",
"zendframework/zend-mvc": "Zend" "zendframework/zend-mvc": "Zend"

View File

@ -361,6 +361,10 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
SiteListVC.show() SiteListVC.show()
} }
@objc func openDonate() {
NSWorkspace.shared.open(Constants.DonationUrl)
}
@objc func terminateApp() { @objc func terminateApp() {
NSApplication.shared.terminate(nil) NSApplication.shared.terminate(nil)
} }

View File

@ -70,6 +70,21 @@ class Stats {
) )
} }
/**
Determine if the sponsor message should be displayed.
The rationale behind this is simple, some of the stats
increasing beyond a certain point indicate the app
is being used.
We evaluate, first:
- Successful version switches
OR
- Successful starts of the application
AND, of course, you must never have seen the alert before.
(see `didSeeSponsorEncouragement`)
*/
public static func evaluateSponsorMessageShouldBeDisplayed() { public static func evaluateSponsorMessageShouldBeDisplayed() {
if Bundle.main.bundleIdentifier?.contains("beta") ?? false { if Bundle.main.bundleIdentifier?.contains("beta") ?? false {
return Log.info("Sponsor messages never apply to beta builds.") return Log.info("Sponsor messages never apply to beta builds.")
@ -92,8 +107,7 @@ class Stats {
style: .informational) style: .informational)
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.")
guard let url = URL(string: "https://nicoverbruggen.be/sponsor#pay-now") else { return } NSWorkspace.shared.open(Constants.DonationUrl)
NSWorkspace.shared.open(url)
} }
UserDefaults.standard.set(true, forKey: InternalStats.didSeeSponsorEncouragement.rawValue) UserDefaults.standard.set(true, forKey: InternalStats.didSeeSponsorEncouragement.rawValue)
} }

View File

@ -52,9 +52,16 @@
"mi_sitelist" = "View Linked and Parked Domains..."; "mi_sitelist" = "View Linked and Parked Domains...";
"mi_preferences" = "Preferences..."; "mi_preferences" = "Preferences...";
"mi_donate" = "Donate...";
"mi_quit" = "Quit PHP Monitor"; "mi_quit" = "Quit PHP Monitor";
"mi_about" = "About PHP Monitor"; "mi_about" = "About PHP Monitor";
// MENU ITEMS (if window is open)
"mm_add_folder_as_link" = "Add Folder as Link...";
"mm_reload_site_list" = "Reload Site List";
"mm_find_in_site_list" = "Search in Site List";
// SITE LIST // SITE LIST
"site_list.title" = "Domains"; "site_list.title" = "Domains";