Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielheitsch committed Jan 6, 2025
2 parents ab82cbf + 9d7f0a0 commit e93099f
Show file tree
Hide file tree
Showing 89 changed files with 1,698 additions and 87 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ In case you are using ProGuard add the following snippet to your `proguard-rules

This will prevent issues like [#131](https://github.com/PhilipsHue/flutter_reactive_ble/issues/131).

### iOS
### iOS / MacOS

For iOS it is required you add the following entries to the `Info.plist` file of your app. It is not allowed to access Core BLuetooth without this. See [our example app](https://github.com/PhilipsHue/flutter_reactive_ble/blob/master/example/ios/Runner/Info.plist) on how to implement this. For more indepth details: [Blog post on iOS bluetooth permissions](https://medium.com/flawless-app-stories/handling-ios-13-bluetooth-permissions-26c6a8cbb816)
For iOS/MacOS it is required you add the following entries to the `Info.plist` file of your app. It is not allowed to access Core BLuetooth without this. See [our example app](https://github.com/PhilipsHue/flutter_reactive_ble/blob/master/example/ios/Runner/Info.plist) on how to implement this. For more indepth details: [Blog post on iOS bluetooth permissions](https://medium.com/flawless-app-stories/handling-ios-13-bluetooth-permissions-26c6a8cbb816)

iOS13 and higher
* NSBluetoothAlwaysUsageDescription

iOS12 and lower
* NSBluetoothPeripheralUsageDescription

For MacOS, make sure to enable Bluetooth from Capabilities

## Usage
### Initialization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _CharacteristicInteractionDialogState extends State<_CharacteristicInterac
late String writeOutput;
late String subscribeOutput;
late TextEditingController textEditingController;
late StreamSubscription<List<int>>? subscribeStream;
StreamSubscription<List<int>>? subscribeStream;

@override
void initState() {
Expand Down
6 changes: 2 additions & 4 deletions example/lib/src/ui/device_detail/device_interaction_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ class _DeviceInteractionTabState extends State<_DeviceInteractionTab> {
child: const Text("Discover Services"),
),
ElevatedButton(
onPressed: widget.viewModel.deviceConnected
? readRssi
: null,
onPressed: widget.viewModel.deviceConnected ? readRssi : null,
child: const Text("Get RSSI"),
),
],
Expand Down Expand Up @@ -285,7 +283,7 @@ class _ServiceDiscoveryListState extends State<_ServiceDiscoveryList> {
child: ExpansionPanelList(
expansionCallback: (int index, bool isExpanded) {
setState(() {
if (isExpanded) {
if (!isExpanded) {
_expandedItems.remove(index);
} else {
_expandedItems.add(index);
Expand Down
7 changes: 7 additions & 0 deletions example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
12 changes: 12 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import reactive_ble_mobile

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ReactiveBlePlugin.register(with: registry.registrar(forPlugin: "ReactiveBlePlugin"))
}
43 changes: 43 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
34 changes: 34 additions & 0 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PODS:
- FlutterMacOS (1.0.0)
- Protobuf (3.24.3)
- reactive_ble_mobile (0.0.1):
- Flutter
- FlutterMacOS
- Protobuf (~> 3.5)
- SwiftProtobuf (~> 1.0)
- SwiftProtobuf (1.23.0)

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- reactive_ble_mobile (from `Flutter/ephemeral/.symlinks/plugins/reactive_ble_mobile/darwin`)

SPEC REPOS:
trunk:
- Protobuf
- SwiftProtobuf

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
reactive_ble_mobile:
:path: Flutter/ephemeral/.symlinks/plugins/reactive_ble_mobile/darwin

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
Protobuf: 970f7ee93a3a08e3cf64859b8efd95ee32b4f87f
reactive_ble_mobile: 856183aeda09f2a676bbaecbea8915c3cb1d33df
SwiftProtobuf: b70d65f419fbfe61a2d58003456ca5da58e337d6

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
Loading

0 comments on commit e93099f

Please sign in to comment.