mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 14:05:18 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user