Add Bluetooth status alerts (#385)

- Add alert UI to notify users when Bluetooth is off/unauthorized
- Monitor Bluetooth state changes in BluetoothMeshService
- Show appropriate messages for different Bluetooth states
- Add Settings button to open system settings on iOS
- Check initial Bluetooth state on app startup

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2025-08-01 21:51:32 +02:00
committed by GitHub
co-authored by jack
parent 8ec39f566d
commit b4b22e0e05
3 changed files with 74 additions and 0 deletions
+15
View File
@@ -7,6 +7,9 @@
//
import SwiftUI
#if os(iOS)
import UIKit
#endif
// MARK: - Supporting Types
@@ -227,6 +230,18 @@ struct ContentView: View {
Button("cancel", role: .cancel) {}
}
.alert("Bluetooth Required", isPresented: $viewModel.showBluetoothAlert) {
Button("Settings") {
#if os(iOS)
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url)
}
#endif
}
Button("OK", role: .cancel) {}
} message: {
Text(viewModel.bluetoothAlertMessage)
}
.onDisappear {
// Clean up timers
scrollThrottleTimer?.invalidate()