Skip to content

Commit e0b4415

Browse files
mikolakŁukasz RejmanbartoszwilkpawelByszewskiTomoLV
authored
Release 2.2.5 (#476)
* Fix capitalization style for UUID and constant names (#437) * Fix capitalization of UUID in Service * Fix capitalization of UUID in ScanResult * Fix capitalization of UUID in Peripheral * Rename bytes to value * Fix capitalization of UUID in metadata strings in ScanResult * Fix constants capitalization in BleError * Revert "Fix capitalization of UUID in metadata strings in ScanResult" This reverts commit 08516ec. * Fix capitalization of UUID in managers for classes * Fix capitalization of UUID for InternalBleManager * Fix capitalization of UUID in CharacteristicsMixin * Fix capitalization of UUID in DevicesMixin * Rename bytes to value in internal classes * Add unit tests for Service (#439) * unit test for BleManager * [descriptor] override equals & hashcode functions * [tests] add: mock classes for managers * [service] add: service tests * [tests] create characteristics and descriptors using separate generators * [service][tests] cover generating transactionId when it's not specified * [service][tests] clear mocks interactions after each test * [service][tests] add missing test for getting all descriptors for specified characteristic Co-authored-by: Paweł Byszewski <[email protected]> * Descriptor unit tests (#441) * unit test for BleManager * [descriptor] override equals & hashcode functions * [tests] add: mock classes for managers * [tests] create characteristics and descriptors using separate generators * [descriptor] add: tests * [descriptor] fix: test names * [tests] move all mocks declarations to one aggregate file * [ble-manager][test] add matcher to always check objects' references * [descriptor][test] add tests that check uniquity of transactionId Co-authored-by: pawelByszewski <[email protected]> * [iOS] Fixed casting of Bool arguments received from dart (#451) * Remove root level `Flutter User Facing API.dart` (#455) * rename root level file naming interfered with certain build_runner code generators * remove flutter_user_facing_api.dart * Handle destroyClient call on iOS (#461) * Handle destroyClient call on iOS * Add missing semicolon * [Android] Fix race condition in ConnectionStateStreamHanderl (#468) (#469) * [Android] Fix race condition in ConnectionStateStreamHanderl (#468) Add extra null check and synchronized block in async callback * [Android] Move json generation back into try catch block (#468) * Update pubspec format (#418) * Remove author field * Add supported platforms * Enforce Flutter version * Release 2.2.5 Co-authored-by: Łukasz Rejman <[email protected]> Co-authored-by: Bartosz Wilk <[email protected]> Co-authored-by: Paweł Byszewski <[email protected]> Co-authored-by: pawelByszewski <[email protected]> Co-authored-by: Tomasz Bogusz <[email protected]> Co-authored-by: Dustin Graham <[email protected]> Co-authored-by: Leo Huang <[email protected]>
1 parent 7d55135 commit e0b4415

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.2.5
2+
3+
* add missing handling of destroyClient call on iOS
4+
* fix race condition in ConnectionStateStreamHandler (thanks, @cbreezier!)
5+
* fix issue with picking incorrect characteristic on Android when there are multiple characteristics with the same UUID on the peripheral
6+
* update pubspec format to properly display supported platforms
7+
* fix messages in IllegalStateExceptions on Android
8+
19
## 2.2.4
210

311
* Fix issue where `withResponse` argument was always true when writing to a characteristic on iOS

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.polidea.flutter_ble_lib'
2-
version '2.2.4'
2+
version '2.2.5'
33

44
buildscript {
55
repositories {
@@ -36,5 +36,5 @@ android {
3636

3737
dependencies {
3838
implementation 'androidx.annotation:annotation:1.1.0'
39-
implementation 'com.github.Polidea:MultiPlatformBleAdapter:0.1.5'
39+
implementation 'com.github.Polidea:MultiPlatformBleAdapter:0.1.6'
4040
}

android/src/main/java/com/polidea/flutter_ble_lib/event/ConnectionStateStreamHandler.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@ synchronized public void onCancel(Object o) {
2727

2828
synchronized public void onNewConnectionState(final ConnectionStateChange connectionState) {
2929
if (eventSink != null) {
30+
final ConnectionStateStreamHandler that = this;
3031
new Handler(Looper.getMainLooper()).post(new Runnable() {
3132
@Override
3233
public void run() {
33-
try {
34-
eventSink.success(connectionStateChangeJsonConverter.toJson(connectionState));
35-
} catch (JSONException e) {
36-
eventSink.error("-1", e.getMessage(), e.getStackTrace());
34+
synchronized (that) {
35+
// Check again for null - by the time we get into this async runnable our eventSink
36+
// may have been canceled
37+
if (eventSink != null) {
38+
try {
39+
eventSink.success(connectionStateChangeJsonConverter.toJson(connectionState));
40+
} catch (JSONException e) {
41+
eventSink.error("-1", e.getMessage(), e.getStackTrace());
42+
}
43+
}
3744
}
3845
}
3946
});

ios/Classes/FlutterBleLibPlugin.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
6969
- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result {
7070
if ([METHOD_NAME_CREATE_CLIENT isEqualToString:call.method]) {
7171
[self createClient:call result:result];
72+
} else if ([METHOD_NAME_DESTROY_CLIENT isEqualToString:call.method]) {
73+
[self destroyClient];
7274
} else if ([METHOD_NAME_ENABLE_RADIO isEqualToString:call.method]) {
7375
[self enable:call result:result];
7476
} else if ([METHOD_NAME_DISABLE_RADIO isEqualToString:call.method]) {

ios/flutter_ble_lib.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'flutter_ble_lib'
6-
s.version = '2.2.4'
6+
s.version = '2.2.5'
77
s.summary = 'A new flutter plugin project.'
88
s.description = <<-DESC
99
A new flutter plugin project.
@@ -16,7 +16,7 @@ A new flutter plugin project.
1616
s.public_header_files = 'Classes/**/*.h'
1717
s.dependency 'Flutter'
1818
s.swift_versions = ['4.0', '4.2', '5.0']
19-
s.dependency 'MultiplatformBleAdapter', '~> 0.1.5'
19+
s.dependency 'MultiplatformBleAdapter', '~> 0.1.6'
2020

2121
s.ios.deployment_target = '8.0'
2222
end

pubspec.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: flutter_ble_lib
22
description: FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..
3-
version: 2.2.4
4-
author: "Polidea <[email protected]>"
3+
version: 2.2.5
54
homepage: https://github.com/Polidea/FlutterBleLib
65

76
environment:
87
sdk: ">=2.1.0 <3.0.0"
8+
# Flutter versions prior to 1.10 did not support the flutter.plugin.platforms map.
9+
flutter: ">=1.10.0 <2.0.0"
910

1011
dependencies:
1112
collection: ^1.14.11
@@ -30,8 +31,12 @@ flutter:
3031
# be modified. They are used by the tooling to maintain consistency when
3132
# adding or updating assets for this project.
3233
plugin:
33-
androidPackage: com.polidea.flutter_ble_lib
34-
pluginClass: FlutterBleLibPlugin
34+
platforms:
35+
android:
36+
package: com.polidea.flutter_ble_lib
37+
pluginClass: FlutterBleLibPlugin
38+
ios:
39+
pluginClass: FlutterBleLibPlugin
3540
# To add assets to your plugin package, add an assets section, like this:
3641
# assets:
3742
# - images/a_dot_burr.jpeg

0 commit comments

Comments
 (0)