diff --git a/kable-core/src/androidMain/kotlin/Bluetooth.kt b/kable-core/src/androidMain/kotlin/Bluetooth.kt index 6e7a0cbda..8c8a6ad36 100644 --- a/kable-core/src/androidMain/kotlin/Bluetooth.kt +++ b/kable-core/src/androidMain/kotlin/Bluetooth.kt @@ -34,18 +34,38 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart import android.bluetooth.BluetoothAdapter.ACTION_STATE_CHANGED as BLUETOOTH_STATE_CHANGED +@Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", +) public actual enum class Reason { + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Off, // BluetoothAdapter.STATE_OFF + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) TurningOff, // BluetoothAdapter.STATE_TURNING_OFF or BluetoothAdapter.STATE_BLE_TURNING_OFF + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) TurningOn, // BluetoothAdapter.STATE_TURNING_ON or BluetoothAdapter.STATE_BLE_TURNING_ON /** * [BluetoothManager] unavailable or [BluetoothManager.getAdapter] returned `null` (indicating * that Bluetooth is not available). */ + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) AdapterNotAvailable, /** Only applicable on Android 11 (API 30) and lower. */ + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) LocationServicesDisabled, } diff --git a/kable-core/src/appleMain/kotlin/Bluetooth.kt b/kable-core/src/appleMain/kotlin/Bluetooth.kt index ae34c83cf..c6bdf2fd8 100644 --- a/kable-core/src/appleMain/kotlin/Bluetooth.kt +++ b/kable-core/src/appleMain/kotlin/Bluetooth.kt @@ -18,11 +18,33 @@ import platform.CoreBluetooth.CBCentralManagerStateUnauthorized import platform.CoreBluetooth.CBCentralManagerStateUnsupported /** https://developer.apple.com/documentation/corebluetooth/cbmanagerstate */ +@Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", +) public actual enum class Reason { + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Off, // CBManagerState.poweredOff + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Resetting, // CBManagerState.resetting + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Unauthorized, // CBManagerState.unauthorized + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Unsupported, // CBManagerState.unsupported + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) Unknown, // CBManagerState.unknown } diff --git a/kable-core/src/commonMain/kotlin/Bluetooth.kt b/kable-core/src/commonMain/kotlin/Bluetooth.kt index af7c5afe7..890d512f9 100644 --- a/kable-core/src/commonMain/kotlin/Bluetooth.kt +++ b/kable-core/src/commonMain/kotlin/Bluetooth.kt @@ -7,6 +7,9 @@ import kotlinx.coroutines.flow.Flow import kotlin.jvm.JvmName import com.juul.kable.bluetooth.isSupported as isBluetoothSupported +@Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", +) public expect enum class Reason public object Bluetooth { @@ -30,11 +33,24 @@ public object Bluetooth { override fun toString(): String = "00000000-0000-1000-8000-00805F9B34FB" } + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) public sealed class Availability { + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) public data object Available : Availability() + + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) public data class Unavailable(val reason: Reason?) : Availability() } + @Deprecated( + message = "Has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) public val availability: Flow = bluetoothAvailability /** diff --git a/kable-core/src/jsMain/kotlin/BluetoothAvailability.kt b/kable-core/src/jsMain/kotlin/BluetoothAvailability.kt index 4d76b72ec..f533b1c8b 100644 --- a/kable-core/src/jsMain/kotlin/BluetoothAvailability.kt +++ b/kable-core/src/jsMain/kotlin/BluetoothAvailability.kt @@ -12,8 +12,14 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.onStart import org.w3c.dom.events.Event +@Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", +) public actual enum class Reason { /** `window.navigator.bluetooth` is undefined. */ + @Deprecated( + message = "`Bluetooth.availability` has inconsistent behavior across platforms. Will be removed in a future release. See https://github.com/JuulLabs/kable/issues/737 for more details.", + ) BluetoothUndefined, }