Skip to content

Commit cab2dcc

Browse files
authored
Release v2.3.1 (#548)
* Minor doc fixes (#544) * Regenerate podfile for example (#545) * Fix connection timeout on iOS (#546) Fixes #478 * Fix emitting current connection state on iOS (#547) Fixes #540 * Release 2.3.1
1 parent 10067a2 commit cab2dcc

File tree

11 files changed

+46
-96
lines changed

11 files changed

+46
-96
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.3.1
2+
3+
* Fix connection timeout on iOS
4+
* Fix emitting current connection state on iOS
5+
* Update MBA to 0.1.7:
6+
* Fix lack of disconnection event on iOS when connection fails to be established
7+
* Fix not all errors being passed through onError callbacks on Android (thanks, @eliaslecomte)
8+
19
## 2.3.0
210

311
* add `BleManager.createUnsafePeripheral()` to allow for connecting to known peripheral without launching scan first

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.3.0'
2+
version '2.3.1'
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.6'
39+
implementation 'com.github.Polidea:MultiPlatformBleAdapter:0.1.7'
4040
}

android/src/main/java/com/polidea/flutter_ble_lib/constant/ArgumentKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface ArgumentKey {
1212
String IS_AUTO_CONNECT = "isAutoConnect";
1313
String REQUEST_MTU = "requestMtu";
1414
String REFRESH_GATT = "refreshGatt";
15-
String TIMEOUT_MILLIS = "timeoutMillis";
15+
String TIMEOUT_MILLIS = "timeout";
1616
String EMIT_CURRENT_VALUE = "emitCurrentValue";
1717

1818
String LOG_LEVEL = "logLevel";

example/ios/Podfile

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,81 +10,32 @@ project 'Runner', {
1010
'Release' => :release,
1111
}
1212

13-
def parse_KV_file(file, separator='=')
14-
file_abs_path = File.expand_path(file)
15-
if !File.exists? file_abs_path
16-
return [];
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
1717
end
18-
generated_key_values = {}
19-
skip_line_start_symbols = ["#", "/"]
20-
File.foreach(file_abs_path) do |line|
21-
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22-
plugin = line.split(pattern=separator)
23-
if plugin.length == 2
24-
podname = plugin[0].strip()
25-
path = plugin[1].strip()
26-
podpath = File.expand_path("#{path}", file_abs_path)
27-
generated_key_values[podname] = podpath
28-
else
29-
puts "Invalid plugin specification: #{line}"
30-
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
3122
end
32-
generated_key_values
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
3324
end
3425

26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
3530
target 'Runner' do
3631
use_frameworks!
3732
use_modular_headers!
38-
39-
# Flutter Pod
4033

41-
copied_flutter_dir = File.join(__dir__, 'Flutter')
42-
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43-
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44-
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45-
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46-
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47-
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48-
49-
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50-
unless File.exist?(generated_xcode_build_settings_path)
51-
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52-
end
53-
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54-
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55-
56-
unless File.exist?(copied_framework_path)
57-
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58-
end
59-
unless File.exist?(copied_podspec_path)
60-
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61-
end
62-
end
63-
64-
# Keep pod path relative so it can be checked into Podfile.lock.
65-
pod 'Flutter', :path => 'Flutter'
66-
67-
# Plugin Pods
68-
69-
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70-
# referring to absolute paths on developers' machines.
71-
system('rm -rf .symlinks')
72-
system('mkdir -p .symlinks/plugins')
73-
plugin_pods = parse_KV_file('../.flutter-plugins')
74-
plugin_pods.each do |name, path|
75-
symlink = File.join('.symlinks', 'plugins', name)
76-
File.symlink(path, symlink)
77-
pod name, :path => File.join(symlink, 'ios')
78-
end
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
7935
end
8036

81-
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82-
install! 'cocoapods', :disable_input_output_paths => true
83-
8437
post_install do |installer|
8538
installer.pods_project.targets.each do |target|
86-
target.build_configurations.each do |config|
87-
config.build_settings['ENABLE_BITCODE'] = 'NO'
88-
end
39+
flutter_additional_ios_build_settings(target)
8940
end
9041
end

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
1F98025F8F407F461CB357DF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E99B52135973B0C19BFDEF7 /* Pods_Runner.framework */; };
1212
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1513
81E1240A2334F85D005D9563 /* SwiftBridging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81E124092334F85D005D9563 /* SwiftBridging.swift */; };
16-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
17-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1814
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
1915
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
2016
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
@@ -30,8 +26,6 @@
3026
dstPath = "";
3127
dstSubfolderSpec = 10;
3228
files = (
33-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
34-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3529
);
3630
name = "Embed Frameworks";
3731
runOnlyForDeploymentPostprocessing = 0;
@@ -45,7 +39,6 @@
4539
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4640
1AB7F698716680F75BACA8D9 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
4741
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
48-
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4942
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
5043
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
5144
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -54,7 +47,6 @@
5447
96C714B17D5919D3696FE535 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
5548
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
5649
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
57-
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
5850
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
5951
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
6052
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -68,8 +60,6 @@
6860
isa = PBXFrameworksBuildPhase;
6961
buildActionMask = 2147483647;
7062
files = (
71-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
72-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
7363
1F98025F8F407F461CB357DF /* Pods_Runner.framework in Frameworks */,
7464
);
7565
runOnlyForDeploymentPostprocessing = 0;
@@ -80,9 +70,7 @@
8070
9740EEB11CF90186004384FC /* Flutter */ = {
8171
isa = PBXGroup;
8272
children = (
83-
3B80C3931E831B6300D905FE /* App.framework */,
8473
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
85-
9740EEBA1CF902C7004384FC /* Flutter.framework */,
8674
9740EEB21CF90195004384FC /* Debug.xcconfig */,
8775
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
8876
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -239,9 +227,16 @@
239227
files = (
240228
);
241229
inputPaths = (
230+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
231+
"${PODS_ROOT}/../Flutter/Flutter.framework",
232+
"${BUILT_PRODUCTS_DIR}/MultiplatformBleAdapter/MultiplatformBleAdapter.framework",
233+
"${BUILT_PRODUCTS_DIR}/flutter_ble_lib/flutter_ble_lib.framework",
242234
);
243235
name = "[CP] Embed Pods Frameworks";
244236
outputPaths = (
237+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
238+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MultiplatformBleAdapter.framework",
239+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_ble_lib.framework",
245240
);
246241
runOnlyForDeploymentPostprocessing = 0;
247242
shellPath = /bin/sh;
@@ -260,7 +255,7 @@
260255
);
261256
runOnlyForDeploymentPostprocessing = 0;
262257
shellPath = /bin/sh;
263-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin\n";
258+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
264259
};
265260
9740EEB61CF901F6004384FC /* Run Script */ = {
266261
isa = PBXShellScriptBuildPhase;
@@ -336,7 +331,6 @@
336331
/* Begin XCBuildConfiguration section */
337332
249021D3217E4FDB00AE95B9 /* Profile */ = {
338333
isa = XCBuildConfiguration;
339-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
340334
buildSettings = {
341335
ALWAYS_SEARCH_USER_PATHS = NO;
342336
CLANG_ANALYZER_NONNULL = YES;
@@ -416,7 +410,6 @@
416410
};
417411
97C147031CF9000F007C117D /* Debug */ = {
418412
isa = XCBuildConfiguration;
419-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
420413
buildSettings = {
421414
ALWAYS_SEARCH_USER_PATHS = NO;
422415
CLANG_ANALYZER_NONNULL = YES;
@@ -472,7 +465,6 @@
472465
};
473466
97C147041CF9000F007C117D /* Release */ = {
474467
isa = XCBuildConfiguration;
475-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
476468
buildSettings = {
477469
ALWAYS_SEARCH_USER_PATHS = NO;
478470
CLANG_ANALYZER_NONNULL = YES;

ios/Classes/Constants/ArgumentKey.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
NSString * const ARGUMENT_KEY_IS_AUTO_CONNECT = @"isAutoConnect";
1111
NSString * const ARGUMENT_KEY_REQUEST_MTU = @"requestMtu";
1212
NSString * const ARGUMENT_KEY_REFRESH_GATT = @"refreshGatt";
13-
NSString * const ARGUMENT_KEY_TIMEOUT_MILLIS = @"timeoutMillis";
13+
NSString * const ARGUMENT_KEY_TIMEOUT_MILLIS = @"timeout";
1414
NSString * const ARGUMENT_KEY_EMIT_CURRENT_VALUE = @"emitCurrentValue";
1515

1616
NSString * const ARGUMENT_KEY_LOG_LEVEL = @"logLevel";

ios/Classes/FlutterBleLibPlugin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ - (void)observeConnectionState:(FlutterMethodCall *)call result:(FlutterResult)r
235235
BOOL emitCurrentValue = ((NSNumber *)call.arguments[ARGUMENT_KEY_EMIT_CURRENT_VALUE]).boolValue;
236236
if (emitCurrentValue == YES) {
237237
Resolve resolve = ^(id isConnected) {
238-
if ((BOOL)isConnected == YES) {
238+
if ([isConnected boolValue] == YES) {
239239
[self.connectionStateStreamHandler onConnectedEvent:call.arguments[ARGUMENT_KEY_DEVICE_IDENTIFIER]];
240240
} else {
241241
[self.connectionStateStreamHandler emitDisconnectedEvent:call.arguments[ARGUMENT_KEY_DEVICE_IDENTIFIER]];

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.3.0'
6+
s.version = '2.3.1'
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.6'
19+
s.dependency 'MultiplatformBleAdapter', '~> 0.1.7'
2020

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

lib/peripheral.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,17 @@ class Peripheral {
3535
/// guaranteed to get it after connection is successful. (Android only)
3636
/// iOS by default requests about 186 MTU size and there's nothing anyone can
3737
/// do about it.
38-
/// **NOTE**: if MTU has been request on this step, then there's no way
39-
/// to retrieve it's value later on.
38+
/// **NOTE**: if MTU has been requested on this step, then there's no way
39+
/// to retrieve its value later on.
4040
///
41-
/// Optional [requestMtu] means that the MTU will not be negotiated
42-
/// Passing `true` as [refreshGatt] leads reset services cache. This option may
41+
/// Passing `true` as [refreshGatt] will reset services cache. This option may
4342
/// be useful when a peripheral's firmware was updated and it's
4443
/// services/characteristics were added/removed/altered. (Android only)
4544
///
46-
/// Optional [timeout] is used to define time after connection is
47-
/// automatically timed out. In case of race condition were connection
45+
/// Optional [timeout] is used to define delay after which the connection is
46+
/// automatically cancelled. In case of race condition were connection
4847
/// is established right after timeout event, peripheral will be disconnected
49-
/// immediately. Timeout may happen earlier then specified due to OS
48+
/// immediately. Timeout may happen earlier than specified due to OS
5049
/// specific behavior.
5150
Future<void> connect(
5251
{bool isAutoConnect = false,

lib/src/_constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ abstract class ArgumentName {
9797
static const String isAutoConnect = "isAutoConnect";
9898
static const String requestMtu = "requestMtu";
9999
static const String refreshGatt = "refreshGatt";
100-
static const String timeoutMillis = "timeoutMillis";
100+
static const String timeoutMillis = "timeout";
101101
static const String emitCurrentValue = "emitCurrentValue";
102102

103103
static const String serviceUuid = "serviceUuid";

0 commit comments

Comments
 (0)