mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-03 09:04:32 -04:00
feat(connections): handle hardware without Bluetooth for Android XR (#7318)
This commit is contained in:
1 parent
8038a19e95
commit
f62885df2b
27 files changed
+183
-43
No files matched your search
@@ -56,6 +56,7 @@ import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.compose.resources.StringResource
|
||||
import org.jetbrains.compose.resources.getString
|
||||
import org.meshtastic.core.common.gpsDisabled
|
||||
import org.meshtastic.core.common.hasBluetoothLe
|
||||
import org.meshtastic.core.common.util.CommonUri
|
||||
import org.meshtastic.core.common.util.ioDispatcher
|
||||
import java.net.URLEncoder
|
||||
@@ -291,6 +292,12 @@ actual fun rememberOpenWifiSettings(): () -> Unit {
|
||||
actual val bleScanRequiresLocationServices: Boolean =
|
||||
android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S
|
||||
|
||||
@Composable
|
||||
actual fun isBluetoothSupported(): Boolean {
|
||||
val context = LocalContext.current
|
||||
return remember(context) { context.hasBluetoothLe() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun isBluetoothDisabled(): Boolean {
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -102,6 +102,9 @@ expect val bleScanRequiresLocationServices: Boolean
|
||||
*/
|
||||
@Composable expect fun isBluetoothDisabled(): Boolean
|
||||
|
||||
/** Returns whether the device has Bluetooth LE hardware at all, so a BLE surface is worth offering. */
|
||||
@Composable expect fun isBluetoothSupported(): Boolean
|
||||
|
||||
/**
|
||||
* Returns whether the device currently lacks any transport that can back the network-scan discovery (no active Wi-Fi,
|
||||
* Ethernet, or VPN). Cellular alone is **not** sufficient — a carrier uplink does not place the device on the same
|
||||
|
||||
@@ -70,6 +70,8 @@ actual val bleScanRequiresLocationServices: Boolean = false
|
||||
|
||||
@Composable actual fun isBluetoothDisabled(): Boolean = false
|
||||
|
||||
@Composable actual fun isBluetoothSupported(): Boolean = true
|
||||
|
||||
@Composable actual fun isWifiUnavailable(): Boolean = false
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -162,6 +162,8 @@ actual val bleScanRequiresLocationServices: Boolean = false
|
||||
/** JVM — Bluetooth adapter state is not surfaced on Desktop. */
|
||||
@Composable actual fun isBluetoothDisabled(): Boolean = false
|
||||
|
||||
@Composable actual fun isBluetoothSupported(): Boolean = true
|
||||
|
||||
/** JVM — local-network availability is not gated on Desktop. */
|
||||
@Composable actual fun isWifiUnavailable(): Boolean = false
|
||||
|
||||
|
||||
Reference in new issue
Block a user