mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
🏗 WIP: Warnings window & views
This commit is contained in:
@ -85,6 +85,8 @@
|
|||||||
C41E871B2763D42300161EE0 /* DomainListVC+ContextMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41E87192763D42300161EE0 /* DomainListVC+ContextMenu.swift */; };
|
C41E871B2763D42300161EE0 /* DomainListVC+ContextMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41E87192763D42300161EE0 /* DomainListVC+ContextMenu.swift */; };
|
||||||
C4205A7E27F4D21800191A39 /* ValetProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4205A7D27F4D21800191A39 /* ValetProxy.swift */; };
|
C4205A7E27F4D21800191A39 /* ValetProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4205A7D27F4D21800191A39 /* ValetProxy.swift */; };
|
||||||
C4205A7F27F4D21800191A39 /* ValetProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4205A7D27F4D21800191A39 /* ValetProxy.swift */; };
|
C4205A7F27F4D21800191A39 /* ValetProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4205A7D27F4D21800191A39 /* ValetProxy.swift */; };
|
||||||
|
C422DDAA28A2C49900CEAC97 /* WarningListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C422DDA928A2C49900CEAC97 /* WarningListView.swift */; };
|
||||||
|
C422DDAD28A2DAC600CEAC97 /* WarningsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C422DDAC28A2DAC600CEAC97 /* WarningsWindowController.swift */; };
|
||||||
C4232EE52612526500158FC6 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = C4232EE42612526500158FC6 /* Credits.html */; };
|
C4232EE52612526500158FC6 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = C4232EE42612526500158FC6 /* Credits.html */; };
|
||||||
C42337A3281F19F000459A48 /* Xdebug.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42337A2281F19F000459A48 /* Xdebug.swift */; };
|
C42337A3281F19F000459A48 /* Xdebug.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42337A2281F19F000459A48 /* Xdebug.swift */; };
|
||||||
C42759672627662800093CAE /* NSMenuExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42759662627662800093CAE /* NSMenuExtension.swift */; };
|
C42759672627662800093CAE /* NSMenuExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42759662627662800093CAE /* NSMenuExtension.swift */; };
|
||||||
@ -339,6 +341,8 @@
|
|||||||
C41CD0282628D8EE0065BBED /* GlobalKeybindPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalKeybindPreference.swift; sourceTree = "<group>"; };
|
C41CD0282628D8EE0065BBED /* GlobalKeybindPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalKeybindPreference.swift; sourceTree = "<group>"; };
|
||||||
C41E87192763D42300161EE0 /* DomainListVC+ContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DomainListVC+ContextMenu.swift"; sourceTree = "<group>"; };
|
C41E87192763D42300161EE0 /* DomainListVC+ContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DomainListVC+ContextMenu.swift"; sourceTree = "<group>"; };
|
||||||
C4205A7D27F4D21800191A39 /* ValetProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValetProxy.swift; sourceTree = "<group>"; };
|
C4205A7D27F4D21800191A39 /* ValetProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValetProxy.swift; sourceTree = "<group>"; };
|
||||||
|
C422DDA928A2C49900CEAC97 /* WarningListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WarningListView.swift; sourceTree = "<group>"; };
|
||||||
|
C422DDAC28A2DAC600CEAC97 /* WarningsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WarningsWindowController.swift; sourceTree = "<group>"; };
|
||||||
C4232EE42612526500158FC6 /* Credits.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = Credits.html; sourceTree = "<group>"; };
|
C4232EE42612526500158FC6 /* Credits.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = Credits.html; sourceTree = "<group>"; };
|
||||||
C42337A2281F19F000459A48 /* Xdebug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Xdebug.swift; sourceTree = "<group>"; };
|
C42337A2281F19F000459A48 /* Xdebug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Xdebug.swift; sourceTree = "<group>"; };
|
||||||
C42759662627662800093CAE /* NSMenuExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSMenuExtension.swift; sourceTree = "<group>"; };
|
C42759662627662800093CAE /* NSMenuExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSMenuExtension.swift; sourceTree = "<group>"; };
|
||||||
@ -662,6 +666,7 @@
|
|||||||
C4D9ADBD27761084007277F4 /* PHP */,
|
C4D9ADBD27761084007277F4 /* PHP */,
|
||||||
C47331A0247093AC009A0597 /* Menu */,
|
C47331A0247093AC009A0597 /* Menu */,
|
||||||
C464ADAA275A7A25003FCD53 /* DomainList */,
|
C464ADAA275A7A25003FCD53 /* DomainList */,
|
||||||
|
C422DDAB28A2DAA100CEAC97 /* Warnings */,
|
||||||
C44A874628905B8500498BC4 /* Onboarding */,
|
C44A874628905B8500498BC4 /* Onboarding */,
|
||||||
5420395726135DB800FB00FA /* Preferences */,
|
5420395726135DB800FB00FA /* Preferences */,
|
||||||
C44C198F276E3A380072762D /* Progress */,
|
C44C198F276E3A380072762D /* Progress */,
|
||||||
@ -672,6 +677,14 @@
|
|||||||
path = Domain;
|
path = Domain;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
C422DDAB28A2DAA100CEAC97 /* Warnings */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C422DDAC28A2DAC600CEAC97 /* WarningsWindowController.swift */,
|
||||||
|
);
|
||||||
|
path = Warnings;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
C42337A1281F19DC00459A48 /* Extensions */ = {
|
C42337A1281F19DC00459A48 /* Extensions */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -684,6 +697,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C4297F7928970D59004C4630 /* WarningView.swift */,
|
C4297F7928970D59004C4630 /* WarningView.swift */,
|
||||||
|
C422DDA928A2C49900CEAC97 /* WarningListView.swift */,
|
||||||
);
|
);
|
||||||
path = Warning;
|
path = Warning;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1298,6 +1312,7 @@
|
|||||||
54B48B5F275F66AE006D90C5 /* Application.swift in Sources */,
|
54B48B5F275F66AE006D90C5 /* Application.swift in Sources */,
|
||||||
C4B97B78275CF1B5003F3378 /* App+ActivationPolicy.swift in Sources */,
|
C4B97B78275CF1B5003F3378 /* App+ActivationPolicy.swift in Sources */,
|
||||||
C4CE3BB827B31F2E0086CA49 /* MainMenu+Switcher.swift in Sources */,
|
C4CE3BB827B31F2E0086CA49 /* MainMenu+Switcher.swift in Sources */,
|
||||||
|
C422DDAD28A2DAC600CEAC97 /* WarningsWindowController.swift in Sources */,
|
||||||
C415937F27A1B54F00D2E1B7 /* PhpFrameworks.swift in Sources */,
|
C415937F27A1B54F00D2E1B7 /* PhpFrameworks.swift in Sources */,
|
||||||
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */,
|
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */,
|
||||||
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */,
|
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */,
|
||||||
@ -1325,6 +1340,7 @@
|
|||||||
C484437B2804BB560041A78A /* ValetProxyScanner.swift in Sources */,
|
C484437B2804BB560041A78A /* ValetProxyScanner.swift in Sources */,
|
||||||
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
||||||
C42759672627662800093CAE /* NSMenuExtension.swift in Sources */,
|
C42759672627662800093CAE /* NSMenuExtension.swift in Sources */,
|
||||||
|
C422DDAA28A2C49900CEAC97 /* WarningListView.swift in Sources */,
|
||||||
C464ADAF275A7A69003FCD53 /* DomainListVC.swift in Sources */,
|
C464ADAF275A7A69003FCD53 /* DomainListVC.swift in Sources */,
|
||||||
C44CCD4927AFF3B700CE40E5 /* MainMenu+Async.swift in Sources */,
|
C44CCD4927AFF3B700CE40E5 /* MainMenu+Async.swift in Sources */,
|
||||||
C4C1019B27C65C6F001FACC2 /* Process.swift in Sources */,
|
C4C1019B27C65C6F001FACC2 /* Process.swift in Sources */,
|
||||||
|
@ -59,6 +59,9 @@ class App {
|
|||||||
/** The window controller of the onboarding window. */
|
/** The window controller of the onboarding window. */
|
||||||
var onboardingWindowController: OnboardingWindowController?
|
var onboardingWindowController: OnboardingWindowController?
|
||||||
|
|
||||||
|
/** The window controller of the warnings window. */
|
||||||
|
var warningsWindowController: WarningsWindowController?
|
||||||
|
|
||||||
/** List of detected (installed) applications that PHP Monitor can work with. */
|
/** List of detected (installed) applications that PHP Monitor can work with. */
|
||||||
var detectedApplications: [Application] = []
|
var detectedApplications: [Application] = []
|
||||||
|
|
||||||
|
@ -93,7 +93,8 @@ extension MainMenu {
|
|||||||
if Stats.successfulLaunchCount >= 1 && !isRunningSwiftUIPreview {
|
if Stats.successfulLaunchCount >= 1 && !isRunningSwiftUIPreview {
|
||||||
Log.info("Should present the first launch screen!")
|
Log.info("Should present the first launch screen!")
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
OnboardingWindowController.show()
|
// OnboardingWindowController.show()
|
||||||
|
WarningsWindowController.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class OnboardingWindowController: PMWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func create(delegate: NSWindowDelegate?) {
|
public static func create(delegate: NSWindowDelegate?) {
|
||||||
let windowController = OnboardingWindowController()
|
let windowController = Self()
|
||||||
windowController.window = NSWindow()
|
windowController.window = NSWindow()
|
||||||
|
|
||||||
guard let window = windowController.window else { return }
|
guard let window = windowController.window else { return }
|
||||||
|
33
phpmon/Domain/SwiftUI/Warning/WarningListView.swift
Normal file
33
phpmon/Domain/SwiftUI/Warning/WarningListView.swift
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// WarningListView.swift
|
||||||
|
// PHP Monitor
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 09/08/2022.
|
||||||
|
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct WarningListView: View {
|
||||||
|
var body: some View {
|
||||||
|
List {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
WarningView(
|
||||||
|
title: "warnings.arm_compatibility_title".localized,
|
||||||
|
description: "warnings.arm_compatibility.description".localized,
|
||||||
|
documentationUrl: "https://phpmon.app/documentation/apple-silicon-transition"
|
||||||
|
)
|
||||||
|
Divider()
|
||||||
|
}.frame(height: 90)
|
||||||
|
|
||||||
|
}
|
||||||
|
.navigationTitle("Warnings")
|
||||||
|
.listStyle(.automatic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WarningListView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
WarningListView()
|
||||||
|
}
|
||||||
|
}
|
@ -11,22 +11,29 @@ import SwiftUI
|
|||||||
struct WarningView: View {
|
struct WarningView: View {
|
||||||
@State var title: String
|
@State var title: String
|
||||||
@State var description: String
|
@State var description: String
|
||||||
|
@State var documentationUrl: String?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack {
|
VStack(alignment: .leading) {
|
||||||
Image(systemName: "exclamationmark.triangle.fill")
|
HStack(spacing: 5) {
|
||||||
.resizable()
|
Image(systemName: "exclamationmark.triangle.fill")
|
||||||
.frame(width: 25, height: 25)
|
.resizable()
|
||||||
.padding()
|
.frame(width: 25, height: 25)
|
||||||
.foregroundColor(Color.orange)
|
.padding()
|
||||||
VStack(alignment: .leading, spacing: 5) {
|
.foregroundColor(Color.orange)
|
||||||
Text(title.localizedForSwiftUI)
|
VStack(alignment: .leading, spacing: 5) {
|
||||||
.fontWeight(.bold)
|
Text(title.localizedForSwiftUI)
|
||||||
Text(description.localizedForSwiftUI)
|
.fontWeight(.bold)
|
||||||
.font(.body)
|
Text(description.localizedForSwiftUI)
|
||||||
|
.font(.body)
|
||||||
}
|
}
|
||||||
}.padding()
|
if documentationUrl != nil {
|
||||||
|
Button("Learn More") {
|
||||||
|
NSWorkspace.shared.open(URL(string: documentationUrl!)!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.padding()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
45
phpmon/Domain/Warnings/WarningsWindowController.swift
Normal file
45
phpmon/Domain/Warnings/WarningsWindowController.swift
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
//
|
||||||
|
// WarningsWindowController.swift
|
||||||
|
// PHP Monitor
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 09/08/2022.
|
||||||
|
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
class WarningsWindowController: PMWindowController {
|
||||||
|
|
||||||
|
// MARK: - Window Identifier
|
||||||
|
|
||||||
|
override var windowName: String {
|
||||||
|
return "Warnings"
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func create(delegate: NSWindowDelegate?) {
|
||||||
|
let windowController = Self()
|
||||||
|
windowController.window = NSWindow()
|
||||||
|
|
||||||
|
guard let window = windowController.window else { return }
|
||||||
|
window.title = "warnings.title".localized
|
||||||
|
window.styleMask = [.titled, .closable, .miniaturizable]
|
||||||
|
window.titlebarAppearsTransparent = true
|
||||||
|
window.delegate = delegate ?? windowController
|
||||||
|
window.contentView = NSHostingView(rootView: WarningListView())
|
||||||
|
window.setContentSize(NSSize(width: 600, height: 300))
|
||||||
|
|
||||||
|
App.shared.warningsWindowController = windowController
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func show(delegate: NSWindowDelegate? = nil) {
|
||||||
|
if App.shared.warningsWindowController == nil {
|
||||||
|
Self.create(delegate: delegate)
|
||||||
|
}
|
||||||
|
|
||||||
|
App.shared.warningsWindowController?.showWindow(self)
|
||||||
|
App.shared.warningsWindowController?.window?.setCenterPosition(offsetY: 70)
|
||||||
|
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
}
|
@ -506,9 +506,14 @@ If you are seeing this message but are confused why this folder has gone missing
|
|||||||
|
|
||||||
// WARNINGS
|
// WARNINGS
|
||||||
|
|
||||||
|
"warnings.title" = "Warnings";
|
||||||
|
|
||||||
"warnings.helper_permissions_title" = "Helpers could not be written!";
|
"warnings.helper_permissions_title" = "Helpers could not be written!";
|
||||||
"warnings.helper_permissions.description" = "The helper files in `/usr/local/bin` could not be written because PHP Monitor does not have permission to write there.";
|
"warnings.helper_permissions.description" = "The helper files in `/usr/local/bin` could not be written because PHP Monitor does not have permission to write there.";
|
||||||
|
|
||||||
|
"warnings.arm_compatibility_title" = "You are running PHP Monitor using Rosetta";
|
||||||
|
"warnings.arm_compatibility.description" = "You appear to be running an ARM-compatible version of macOS, but you are currently running PHP Monitor using Rosetta. While this will work correctly, it is recommended that you use the native version of Homebrew.";
|
||||||
|
|
||||||
// ONBOARDING
|
// ONBOARDING
|
||||||
|
|
||||||
"onboarding.title" = "Welcome Tour";
|
"onboarding.title" = "Welcome Tour";
|
||||||
|
Reference in New Issue
Block a user