mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Fix no warnings view
This commit is contained in:
@ -78,6 +78,7 @@
|
||||
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; };
|
||||
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */; };
|
||||
C41C1B4B22B019FF00E7CF16 /* ActivePhpInstallation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4A22B019FF00E7CF16 /* ActivePhpInstallation.swift */; };
|
||||
C41C708D28AA7F7900E8D498 /* NoWarningsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C708C28AA7F7900E8D498 /* NoWarningsView.swift */; };
|
||||
C41CA5ED2774F8EE00A2C80E /* DomainListVC+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41CA5EC2774F8EE00A2C80E /* DomainListVC+Actions.swift */; };
|
||||
C41CA5EE2774F8EE00A2C80E /* DomainListVC+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41CA5EC2774F8EE00A2C80E /* DomainListVC+Actions.swift */; };
|
||||
C41CD0292628D8EE0065BBED /* GlobalKeybindPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41CD0282628D8EE0065BBED /* GlobalKeybindPreference.swift */; };
|
||||
@ -343,6 +344,7 @@
|
||||
C41C1B4022B0098000E7CF16 /* phpmon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = phpmon.entitlements; sourceTree = "<group>"; };
|
||||
C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarImageGenerator.swift; sourceTree = "<group>"; };
|
||||
C41C1B4A22B019FF00E7CF16 /* ActivePhpInstallation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivePhpInstallation.swift; sourceTree = "<group>"; };
|
||||
C41C708C28AA7F7900E8D498 /* NoWarningsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoWarningsView.swift; sourceTree = "<group>"; };
|
||||
C41CA5EC2774F8EE00A2C80E /* DomainListVC+Actions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DomainListVC+Actions.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>"; };
|
||||
@ -711,6 +713,7 @@
|
||||
children = (
|
||||
C4297F7928970D59004C4630 /* WarningView.swift */,
|
||||
C422DDA928A2C49900CEAC97 /* WarningListView.swift */,
|
||||
C41C708C28AA7F7900E8D498 /* NoWarningsView.swift */,
|
||||
);
|
||||
path = Warning;
|
||||
sourceTree = "<group>";
|
||||
@ -1288,6 +1291,7 @@
|
||||
C43603A0275E67610028EFC6 /* AppDelegate+Notifications.swift in Sources */,
|
||||
5489625828312FAD004F647A /* CreatedFromFile.swift in Sources */,
|
||||
C4068CA727B07A1300544CD5 /* SelectPreferenceView.swift in Sources */,
|
||||
C41C708D28AA7F7900E8D498 /* NoWarningsView.swift in Sources */,
|
||||
C4080FF627BD8C6400BF2C6B /* BetterAlert.swift in Sources */,
|
||||
C4E0F7ED27BEBDA9007475F2 /* NSWindowExtension.swift in Sources */,
|
||||
C4205A7E27F4D21800191A39 /* ValetProxy.swift in Sources */,
|
||||
|
33
phpmon/Domain/SwiftUI/Warning/NoWarningsView.swift
Normal file
33
phpmon/Domain/SwiftUI/Warning/NoWarningsView.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// NoWarningsView.swift
|
||||
// PHP Monitor
|
||||
//
|
||||
// Created by Nico Verbruggen on 15/08/2022.
|
||||
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NoWarningsView: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .center, spacing: 15) {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.resizable()
|
||||
.renderingMode(.template)
|
||||
.foregroundColor(Color.green)
|
||||
.frame(width: 24, height: 24)
|
||||
VStack(alignment: .center) {
|
||||
Text("warnings.none".localizedForSwiftUI)
|
||||
}
|
||||
|
||||
}
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.padding(25)
|
||||
}
|
||||
}
|
||||
|
||||
struct NoWarningsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
NoWarningsView()
|
||||
}
|
||||
}
|
@ -9,7 +9,11 @@
|
||||
import SwiftUI
|
||||
|
||||
struct WarningListView: View {
|
||||
@State var warnings: [Warning] = WarningManager.shared.warnings
|
||||
@State var warnings: [Warning]
|
||||
|
||||
init(empty: Bool = false) {
|
||||
self.warnings = empty ? [] : WarningManager.shared.warnings
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@ -47,17 +51,21 @@ struct WarningListView: View {
|
||||
|
||||
List {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(warnings) { warning in
|
||||
Group {
|
||||
WarningView(
|
||||
title: warning.title,
|
||||
paragraphs: warning.paragraphs,
|
||||
documentationUrl: warning.url
|
||||
)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
if warnings.isEmpty {
|
||||
NoWarningsView()
|
||||
} else {
|
||||
ForEach(warnings) { warning in
|
||||
Group {
|
||||
WarningView(
|
||||
title: warning.title,
|
||||
paragraphs: warning.paragraphs,
|
||||
documentationUrl: warning.url
|
||||
)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Divider()
|
||||
}.padding(5)
|
||||
Divider()
|
||||
}.padding(5)
|
||||
}
|
||||
}
|
||||
}.frame(minHeight: 0, maxHeight: .infinity).padding(5)
|
||||
}
|
||||
@ -70,7 +78,14 @@ struct WarningListView: View {
|
||||
|
||||
struct WarningListView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WarningListView()
|
||||
WarningListView(empty: true)
|
||||
.frame(width: 600, height: 480)
|
||||
|
||||
/*
|
||||
WarningListView()
|
||||
// TODO: Figure out how the empty() only applies to this single instance
|
||||
// .empty()
|
||||
.frame(width: 600, height: 480)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,18 @@ class WarningManager {
|
||||
func checkEnvironment() async {
|
||||
self.warnings = []
|
||||
|
||||
if ProcessInfo.processInfo.environment["EXTREME_DOCTOR_MODE"] != nil {
|
||||
// For debugging purposes, we may wish to see all possible evaluations listed
|
||||
self.warnings = self.evaluations
|
||||
} else {
|
||||
// Otherwise, loop over the actual evaluations and list the warnings
|
||||
await loopOverEvaluations()
|
||||
}
|
||||
|
||||
MainMenu.shared.rebuild()
|
||||
}
|
||||
|
||||
private func loopOverEvaluations() async {
|
||||
for check in self.evaluations {
|
||||
if await check.applies() {
|
||||
Log.info("[DOCTOR] \(check.name) (!)")
|
||||
@ -69,13 +81,5 @@ class WarningManager {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// For debugging purposes, we may wish to see all possible evaluations listed
|
||||
if ProcessInfo.processInfo.environment["EXTREME_DOCTOR_MODE"] != nil {
|
||||
self.warnings = self.evaluations
|
||||
}
|
||||
|
||||
MainMenu.shared.rebuild()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -530,6 +530,8 @@ If you are seeing this message but are confused why this folder has gone missing
|
||||
"warnings.arm_compatibility.title" = "You are running PHP Monitor using Rosetta on Apple Silicon, which means your PHP environment is also running via 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.";
|
||||
|
||||
"warnings.none" = "There are no recommendations available for you right now. You're all good!";
|
||||
|
||||
// ONBOARDING
|
||||
|
||||
"onboarding.title" = "Welcome Tour";
|
||||
|
Reference in New Issue
Block a user