diff --git a/bluetooth_low_energy/CHANGELOG.md b/bluetooth_low_energy/CHANGELOG.md index 7092ddf..2a8881a 100644 --- a/bluetooth_low_energy/CHANGELOG.md +++ b/bluetooth_low_energy/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.1 + +* Fix the issue that [completion was called duplicately caused by CoW](https://github.com/yanshouwang/bluetooth_low_energy/issues/36). + ## 5.0.0 * Now `CentralManager#writeCharacteristic` and `PeripheralManager#writeCharacteristic` will fragment the value automatically, the maximum write length is 512 bytes. diff --git a/bluetooth_low_energy/example/ios/Podfile.lock b/bluetooth_low_energy/example/ios/Podfile.lock index 01f97ed..90d7b93 100644 --- a/bluetooth_low_energy/example/ios/Podfile.lock +++ b/bluetooth_low_energy/example/ios/Podfile.lock @@ -26,4 +26,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/bluetooth_low_energy/example/ios/Runner.xcodeproj/project.pbxproj b/bluetooth_low_energy/example/ios/Runner.xcodeproj/project.pbxproj index 138e46c..a833137 100644 --- a/bluetooth_low_energy/example/ios/Runner.xcodeproj/project.pbxproj +++ b/bluetooth_low_energy/example/ios/Runner.xcodeproj/project.pbxproj @@ -468,7 +468,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -647,7 +647,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -670,7 +670,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/bluetooth_low_energy/example/pubspec.lock b/bluetooth_low_energy/example/pubspec.lock index 3a998ac..cfb0e6a 100644 --- a/bluetooth_low_energy/example/pubspec.lock +++ b/bluetooth_low_energy/example/pubspec.lock @@ -23,7 +23,7 @@ packages: path: ".." relative: true source: path - version: "5.0.0" + version: "5.0.1" bluetooth_low_energy_android: dependency: transitive description: @@ -36,10 +36,10 @@ packages: dependency: transitive description: name: bluetooth_low_energy_darwin - sha256: "9f28475bb878b5a48c2746c776010bc77d7040b5fead128295d22f0ce6ef5995" + sha256: "8cbb1a9ac97a217f6f45dca58510df457e8b70f861c36d3bf8cf2640c669e1cd" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.1" bluetooth_low_energy_linux: dependency: transitive description: diff --git a/bluetooth_low_energy/pubspec.yaml b/bluetooth_low_energy/pubspec.yaml index 907f91b..530e1c7 100644 --- a/bluetooth_low_energy/pubspec.yaml +++ b/bluetooth_low_energy/pubspec.yaml @@ -1,6 +1,6 @@ name: bluetooth_low_energy description: A Flutter plugin for controlling the bluetooth low energy, supports central and peripheral apis. -version: 5.0.0 +version: 5.0.1 homepage: https://github.com/yanshouwang/bluetooth_low_energy environment: @@ -12,7 +12,7 @@ dependencies: sdk: flutter bluetooth_low_energy_platform_interface: ^5.0.0 bluetooth_low_energy_android: ^5.0.0 - bluetooth_low_energy_darwin: ^5.0.0 + bluetooth_low_energy_darwin: ^5.0.1 bluetooth_low_energy_windows: ^5.0.0 bluetooth_low_energy_linux: ^5.0.0 diff --git a/bluetooth_low_energy_darwin/CHANGELOG.md b/bluetooth_low_energy_darwin/CHANGELOG.md index a8ab5fc..a4461ef 100644 --- a/bluetooth_low_energy_darwin/CHANGELOG.md +++ b/bluetooth_low_energy_darwin/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.1 + +* Fix the issue that [completion was called duplicately caused by CoW](https://github.com/yanshouwang/bluetooth_low_energy/issues/36). + ## 5.0.0 * Now `CentralManager#writeCharacteristic` and `PeripheralManager#writeCharacteristic` will fragment the value automatically, the maximum write length is 512 bytes. diff --git a/bluetooth_low_energy_darwin/darwin/Classes/MyCentralManager.swift b/bluetooth_low_energy_darwin/darwin/Classes/MyCentralManager.swift index bfa6883..c4924f7 100644 --- a/bluetooth_low_energy_darwin/darwin/Classes/MyCentralManager.swift +++ b/bluetooth_low_energy_darwin/darwin/Classes/MyCentralManager.swift @@ -403,10 +403,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didDiscoverCharacteristics(peripheral: CBPeripheral, service: CBService, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = service.hash.toInt64() - guard var completions = _discoverCharacteristicsCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _discoverCharacteristicsCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { @@ -431,10 +428,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didDiscoverDescriptors(peripheral: CBPeripheral, characteristic: CBCharacteristic, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = characteristic.hash.toInt64() - guard var completions = _discoverDescriptorsCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _discoverDescriptorsCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { @@ -461,8 +455,7 @@ class MyCentralManager: MyCentralManagerHostApi { let hashCodeArgs = characteristic.hash.toInt64() let value = characteristic.value ?? Data() let valueArgs = FlutterStandardTypedData(bytes: value) - var completions = _readCharacteristicCompletions[uuidArgs] - guard let completion = completions?.removeValue(forKey: hashCodeArgs) else { + guard let completion = _readCharacteristicCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { _api.onCharacteristicNotified(uuidArgs: uuidArgs, hashCodeArgs: hashCodeArgs, valueArgs: valueArgs) {_ in } return } @@ -476,10 +469,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didWriteCharacteristicValue(peripheral: CBPeripheral, characteristic: CBCharacteristic, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = characteristic.hash.toInt64() - guard var completions = _writeCharacteristicCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _writeCharacteristicCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { @@ -492,10 +482,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didUpdateCharacteristicNotificationState(peripheral: CBPeripheral, characteristic: CBCharacteristic, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = characteristic.hash.toInt64() - guard var completions = _setCharacteristicNotifyStateCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _setCharacteristicNotifyStateCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { @@ -508,10 +495,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didUpdateDescriptorValue(peripheral: CBPeripheral, descriptor: CBDescriptor, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = descriptor.hash.toInt64() - guard var completions = _readDescriptorCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _readDescriptorCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { @@ -561,10 +545,7 @@ class MyCentralManager: MyCentralManagerHostApi { func didWriteDescriptorValue(peripheral: CBPeripheral, descriptor: CBDescriptor, error: Error?) { let uuidArgs = peripheral.identifier.toArgs() let hashCodeArgs = descriptor.hash.toInt64() - guard var completions = _writeDescriptorCompletions[uuidArgs] else { - return - } - guard let completion = completions.removeValue(forKey: hashCodeArgs) else { + guard let completion = _writeDescriptorCompletions[uuidArgs]?.removeValue(forKey: hashCodeArgs) else { return } if error == nil { diff --git a/bluetooth_low_energy_darwin/example/ios/Runner.xcodeproj/project.pbxproj b/bluetooth_low_energy_darwin/example/ios/Runner.xcodeproj/project.pbxproj index 138e46c..a833137 100644 --- a/bluetooth_low_energy_darwin/example/ios/Runner.xcodeproj/project.pbxproj +++ b/bluetooth_low_energy_darwin/example/ios/Runner.xcodeproj/project.pbxproj @@ -468,7 +468,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -647,7 +647,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -670,7 +670,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = JJSB6LL9HD; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/bluetooth_low_energy_darwin/example/pubspec.lock b/bluetooth_low_energy_darwin/example/pubspec.lock index 7896fe6..8d12d70 100644 --- a/bluetooth_low_energy_darwin/example/pubspec.lock +++ b/bluetooth_low_energy_darwin/example/pubspec.lock @@ -15,7 +15,7 @@ packages: path: ".." relative: true source: path - version: "5.0.0" + version: "5.0.1" bluetooth_low_energy_platform_interface: dependency: "direct main" description: diff --git a/bluetooth_low_energy_darwin/pubspec.yaml b/bluetooth_low_energy_darwin/pubspec.yaml index 48ccc98..8f6a1e5 100644 --- a/bluetooth_low_energy_darwin/pubspec.yaml +++ b/bluetooth_low_energy_darwin/pubspec.yaml @@ -1,6 +1,6 @@ name: bluetooth_low_energy_darwin description: iOS and macOS implementation of the bluetooth_low_energy plugin. -version: 5.0.0 +version: 5.0.1 homepage: https://github.com/yanshouwang/bluetooth_low_energy environment: