Skip to content

Commit

Permalink
Merge pull request #117 from PhilipsHue/fix-issue-devicescan-android-…
Browse files Browse the repository at this point in the history
…on-hot-restart

Fix issue devicescan android on hot restart
  • Loading branch information
remonh87 authored Oct 7, 2020
2 parents 42c4d61 + 2df004d commit 755b89a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.5.2

* Update Android protobuf and depedencies to support new Android sdk.
* Fix #114 Throwing faulty error when executing hot restart during scanning on Android.

## 2.5.1

* Update Podfile to support latest Flutter version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ class ScanDevicesHandler(private val bleClient: com.signify.hue.flutterreactiveb
}

fun stopDeviceScan() {
scanForDevicesDisposable.dispose()
scanParameters = null
if (this::scanForDevicesDisposable.isInitialized) scanForDevicesDisposable.let {
if (!it.isDisposed) {
it.dispose()
scanParameters = null
}
}
}

fun prepareScan(scanMessage: pb.ScanForDevicesRequest) {
stopDeviceScan()
val filter = scanMessage.serviceUuidsList
.map { ParcelUuid(UuidConverter().uuidFromByteArray(it.data.toByteArray())) }
val scanMode = createScanMode(scanMessage.scanMode)

scanParameters = ScanParameters(filter, scanMode, scanMessage.requireLocationServicesEnabled)
}

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.5.1"
version: "2.5.2"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_reactive_ble_example
description: Demonstrates how to use the flutter_reactive_ble plugin.
version: 2.5.1
version: 2.5.2
publish_to: 'none'

environment:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_reactive_ble
description: Reactive Bluetooth Low Energy (BLE) plugin that can communicate with multiple devices
version: 2.5.1
version: 2.5.2
homepage: https://github.com/PhilipsHue/flutter_reactive_ble

environment:
Expand Down

0 comments on commit 755b89a

Please sign in to comment.