diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj
index 5071de3..10c79a0 100644
--- a/PHP Monitor.xcodeproj/project.pbxproj
+++ b/PHP Monitor.xcodeproj/project.pbxproj
@@ -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 = "";
diff --git a/README.md b/README.md
index 2c713a2..2c84e63 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/SECURITY.md b/SECURITY.md
index af0009a..461d674 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -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 |
diff --git a/phpmon/AppDelegate.swift b/phpmon/AppDelegate.swift
index e0f070c..fbf2ef4 100644
--- a/phpmon/AppDelegate.swift
+++ b/phpmon/AppDelegate.swift
@@ -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
- }
-
}
diff --git a/phpmon/Domain/Core/App.swift b/phpmon/Domain/Core/App.swift
index c63778d..1551b0d 100644
--- a/phpmon/Domain/Core/App.swift
+++ b/phpmon/Domain/Core/App.swift
@@ -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.
diff --git a/phpmon/Domain/Core/Base.lproj/Main.storyboard b/phpmon/Domain/Core/Base.lproj/Main.storyboard
index 76d2107..6e3f635 100644
--- a/phpmon/Domain/Core/Base.lproj/Main.storyboard
+++ b/phpmon/Domain/Core/Base.lproj/Main.storyboard
@@ -578,13 +578,13 @@ Gw
-
+
-
+
-
+
diff --git a/phpmon/Domain/Helpers/LocalNotification.swift b/phpmon/Domain/Helpers/LocalNotification.swift
index c279840..e835773 100644
--- a/phpmon/Domain/Helpers/LocalNotification.swift
+++ b/phpmon/Domain/Helpers/LocalNotification.swift
@@ -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!)
+ }
+ }
}
}
diff --git a/phpmon/Domain/Menu/MainMenu.swift b/phpmon/Domain/Menu/MainMenu.swift
index ba7d058..1ad6479 100644
--- a/phpmon/Domain/Menu/MainMenu.swift
+++ b/phpmon/Domain/Menu/MainMenu.swift
@@ -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