feat: add status notifications for server monitoring

- Add notification preferences (Status Notifications and Alert Notifications toggles)
- Implement ping failure/recovery notifications when servers go offline/online
- Track individual service status changes and notify when services fail
- Request notification permissions on app launch
- Services like DNS, FTP, SSH, etc. now trigger alerts when status changes
- Notifications only sent when settings are enabled

Changes:
- PreferencesView: Add NotificationsPreferencesView with two toggles
- PingService: Add notification support with state tracking for ping events
- MainView: Add service status monitoring with change detection
- Track previous service states to detect transitions
This commit is contained in:
Micha
2026-01-03 15:48:01 +01:00
parent e7b776942b
commit 7a286c68e3
3 changed files with 97 additions and 12 deletions

View File

@@ -260,19 +260,18 @@ private struct UpdatesPreferencesView: View {
}
private struct NotificationsPreferencesView: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Text("Notifications")
.font(.headline)
.padding(.bottom)
@AppStorage("enableStatusNotifications") private var enableStatusNotifications: Bool = true
@AppStorage("enableAlertNotifications") private var enableAlertNotifications: Bool = true
Text("Configure notification behavior here.")
.foregroundColor(.secondary)
var body: some View {
VStack(alignment: .leading, spacing: 18) {
Toggle("Status Notifications", isOn: $enableStatusNotifications)
Toggle("Alert Notifications", isOn: $enableAlertNotifications)
Spacer()
}
.toggleStyle(.switch)
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
}
}