mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-12-21 11:10:08 +01:00
🐛 Address some MainActor annotations
This commit is contained in:
@@ -151,7 +151,6 @@ extension MainMenu {
|
||||
When the environment is not OK, present an alert to inform the user.
|
||||
*/
|
||||
private func onEnvironmentFail() async {
|
||||
Task { @MainActor [self] in
|
||||
NVAlert()
|
||||
.withInformation(
|
||||
title: "alert.cannot_start.title".localized,
|
||||
@@ -165,11 +164,8 @@ extension MainMenu {
|
||||
})
|
||||
.show()
|
||||
|
||||
Task { // An issue occurred, fire startup checks again after dismissal
|
||||
await startup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Detect which applications are installed that can be used to open a domain's source directory.
|
||||
|
||||
@@ -24,6 +24,7 @@ struct HeaderView: View {
|
||||
|
||||
// MARK: - NSMenuItem
|
||||
|
||||
@MainActor
|
||||
static func asMenuItem(
|
||||
text: String,
|
||||
minimumWidth: CGFloat? = nil
|
||||
|
||||
@@ -12,6 +12,7 @@ import NVAlert
|
||||
|
||||
struct ServicesView: View {
|
||||
|
||||
@MainActor
|
||||
static func asMenuItem(perRow: Int = 4) -> NSMenuItem {
|
||||
let view = {
|
||||
let rootView = Self(manager: ServicesManager.shared, perRow: perRow)
|
||||
@@ -103,6 +104,13 @@ struct ServiceView: View {
|
||||
var service: Service
|
||||
@State var isBusy: Bool = false
|
||||
|
||||
@MainActor
|
||||
private func toggleService() async {
|
||||
isBusy = true
|
||||
await ServicesManager.shared.toggleService(named: service.name)
|
||||
isBusy = false
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
Text(service.name.uppercased())
|
||||
@@ -133,11 +141,7 @@ struct ServiceView: View {
|
||||
}
|
||||
if service.status == .error {
|
||||
Button {
|
||||
Task {
|
||||
isBusy = true
|
||||
await ServicesManager.shared.toggleService(named: service.name)
|
||||
isBusy = false
|
||||
}
|
||||
Task { await toggleService() }
|
||||
} label: {
|
||||
Text("E")
|
||||
.frame(width: 12.0, height: 12.0)
|
||||
@@ -148,11 +152,7 @@ struct ServiceView: View {
|
||||
}
|
||||
if service.status == .active || service.status == .inactive {
|
||||
Button {
|
||||
Task {
|
||||
isBusy = true
|
||||
await ServicesManager.shared.toggleService(named: service.name)
|
||||
isBusy = false
|
||||
}
|
||||
Task { await toggleService() }
|
||||
} label: {
|
||||
Image(
|
||||
systemName: service.status == .active ? "checkmark" : "xmark"
|
||||
|
||||
@@ -10,6 +10,7 @@ import SwiftUI
|
||||
|
||||
struct StatsView: View {
|
||||
|
||||
@MainActor
|
||||
static func asMenuItem(memory: String, post: String, upload: String) -> NSMenuItem {
|
||||
let item = NSMenuItem()
|
||||
let view = NSHostingView(
|
||||
|
||||
Reference in New Issue
Block a user