From 33afb00065c90f47efec32e6073ce229e27154b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kojdecki?= Date: Tue, 17 Nov 2020 18:53:43 +0100 Subject: [PATCH] Fix emitting current connection state on iOS (#547) Fixes #540 --- CHANGELOG.md | 1 + ios/Classes/FlutterBleLibPlugin.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 993dcb26..e16706e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.3.1 * Fix connection timeout on iOS +* Fix emitting current connection state on iOS ## 2.3.0 diff --git a/ios/Classes/FlutterBleLibPlugin.m b/ios/Classes/FlutterBleLibPlugin.m index de3e5f04..f8cfea44 100644 --- a/ios/Classes/FlutterBleLibPlugin.m +++ b/ios/Classes/FlutterBleLibPlugin.m @@ -235,7 +235,7 @@ - (void)observeConnectionState:(FlutterMethodCall *)call result:(FlutterResult)r BOOL emitCurrentValue = ((NSNumber *)call.arguments[ARGUMENT_KEY_EMIT_CURRENT_VALUE]).boolValue; if (emitCurrentValue == YES) { Resolve resolve = ^(id isConnected) { - if ((BOOL)isConnected == YES) { + if ([isConnected boolValue] == YES) { [self.connectionStateStreamHandler onConnectedEvent:call.arguments[ARGUMENT_KEY_DEVICE_IDENTIFIER]]; } else { [self.connectionStateStreamHandler emitDisconnectedEvent:call.arguments[ARGUMENT_KEY_DEVICE_IDENTIFIER]];