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

♻️ Require at least macOS 11, various refactors

This commit is contained in:
2021-12-05 02:54:03 +01:00
parent 924edf6f96
commit 46867ad25e
8 changed files with 55 additions and 27 deletions

View File

@ -738,7 +738,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "4.1-beta2";
MARKETING_VERSION = 5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -763,7 +763,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "4.1-beta2";
MARKETING_VERSION = 5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -21,7 +21,7 @@ PHP Monitor also gives you quick access to various useful functionality (like ac
PHP Monitor is a universal application that runs on Apple Silicon **and** Intel-based Macs.
* macOS 10.14 Mojave or higher (works on macOS 11 Big Sur and macOS 12 Monterey)
* macOS 11 Big Sur or higher (supports macOS 12 Monterey)
* Homebrew is installed in `/usr/local/homebrew` or `/opt/homebrew`
* The brew formula `php` has to be installed (which version is detected)
* Laravel Valet 2.13 or higher

View File

@ -6,6 +6,7 @@ Generally speaking, only the latest version of **PHP Monitor** is supported:
| Version | Apple silicon | Supported | Supported macOS | Deployment Target | Detected PHP Versions |
| ------- | ------------- | ------------------ | ----- | ----- | ----- |
| 5.0 | ✅ Universal binary | ✅ | Big Sur (11.0) and Monterey (12.0) | macOS 11+ | PHP 5.6—PHP 8.2 |
| 4.0 | ✅ Universal binary | ✅ | Big Sur (11.0) and Monterey (12.0) | macOS 10.14+ | PHP 5.6—PHP 8.2 |
| 3.5 | ✅ Universal binary | ❌ | Big Sur (11.0) and Monterey (12.0) | macOS 10.14+ | PHP 5.6—PHP 8.2 |
| 3.0—3.4 | ✅ Universal binary | ❌ | Big Sur (11.0) | macOS 10.14+ | PHP 5.6—PHP 8.1 |

View File

@ -49,6 +49,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
When the application initializes, create all singletons.
*/
override init() {
print("==================================")
print("PHP MONITOR by Nico Verbruggen")
print("Version \(App.version)")
print("==================================")
self.sharedShell = Shell.user
self.state = App.shared
self.menu = MainMenu.shared
@ -61,27 +65,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
/**
When the application has finished launching, we'll want to set up
the user notification center delegate, and kickoff the menu
the user notification center permissions, and kickoff the menu
startup procedure.
*/
func applicationDidFinishLaunching(_ aNotification: Notification) {
NSUserNotificationCenter.default.delegate = self
LocalNotification.askForPermission()
self.menu.startup()
}
// MARK: - NSUserNotificationCenterDelegate
/**
When a notification is sent, the delegate of the notification center
is asked whether the notification should be presented or not. Since
the user can now disable notifications per application since macOS
Catalina, any and all notifications should be displayed.
*/
func userNotificationCenter(
_ center: NSUserNotificationCenter,
shouldPresent notification: NSUserNotification
) -> Bool {
return true
}
}

View File

@ -73,6 +73,15 @@ class App {
}
}
/**
Retrieve the version number from the main info dictionary, Info.plist.
*/
static var version: String {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
return "\(version) (\(build))"
}
/**
The version that the `php` formula via Brew is aliased to on the current system.

View File

@ -578,13 +578,13 @@ Gw
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="69" horizontalPageScroll="10" verticalLineScroll="69" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p0j-eB-I2i">
<rect key="frame" x="0.0" y="0.0" width="550" height="345"/>
<rect key="frame" x="0.0" y="0.0" width="550" height="344"/>
<clipView key="contentView" id="6IL-DW-37w">
<rect key="frame" x="1" y="1" width="548" height="343"/>
<rect key="frame" x="1" y="1" width="548" height="342"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowHeight="69" rowSizeStyle="automatic" viewBased="YES" id="cp3-34-pQj">
<rect key="frame" x="0.0" y="0.0" width="548" height="343"/>
<rect key="frame" x="0.0" y="0.0" width="548" height="342"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="17" height="0.0"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>

View File

@ -6,14 +6,42 @@
//
import Foundation
import UserNotifications
class LocalNotification {
public static func askForPermission() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert], completionHandler: { granted, error in
if granted {
print("PHP Monitor has permission to show notifications.")
} else {
print("PHP Monitor does not have permission to show notifications.")
}
if let error = error {
print("PHP Monitor encounted an error determining notification permissions:")
print(error)
}
})
}
public static func send(title: String, subtitle: String) {
let notification = NSUserNotification()
notification.title = title
notification.subtitle = subtitle
NSUserNotificationCenter.default.deliver(notification)
let content = UNMutableNotificationContent()
content.title = title
content.body = subtitle
let uuidString = UUID().uuidString
let request = UNNotificationRequest(
identifier: uuidString,
content: content,
trigger: nil
)
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.add(request) { (error) in
if error != nil {
print(error!)
}
}
}
}

View File

@ -62,6 +62,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
// Attempt to find out more info about Valet
let valet = Valet()
print("PHP Monitor has extracted the version number of Valet: \(valet.version)")
print("PHP Monitor is ready to serve!")
// Schedule a request to fetch the PHP version every 60 seconds
DispatchQueue.main.async { [self] in