Skip to content

Commit

Permalink
Updated version to 0.0.7
Browse files Browse the repository at this point in the history
Added last few missing public api documentation
Added web as the only supported platform
  • Loading branch information
jeroen1602 committed Mar 27, 2022
1 parent f464128 commit 5dbd076
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.7

* Added `getCharacteristics` to the bluetooth service to get all the characteristics.
* Set target platform to web for [pub.dev](https://pub.dev/packages/flutter_web_bluetooth/) target platform list (it will still compile when used in non-native programs.)
* Added documentation to the last few public interfaces

## 0.0.6+2

* Fixed the behavior subject stream not returning the stored value causing some implementations to wait forever.
Expand Down
7 changes: 7 additions & 0 deletions lib/src/bluetooth_characteristic_properties.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ part of flutter_web_bluetooth;
/// then it will throw a [NotSupportedError].
///
class BluetoothCharacteristicProperties {
///
/// A constructor for new characteristic properties.
///
/// **This should only be done by the library or if you're testing.**
///
/// To get an instance use [BluetoothCharacteristic.properties].
///
BluetoothCharacteristicProperties(this._properties);

final WebBluetoothCharacteristicProperties _properties;
Expand Down
8 changes: 8 additions & 0 deletions lib/src/flutter_web_bluetooth_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ part of flutter_web_bluetooth;
/// See: [FlutterWebBluetooth].
///
abstract class FlutterWebBluetoothInterface {
///
/// An interface for [FlutterWebBluetooth] to make sure that both the
/// unsupported and web version have the same api.
///
/// See: [FlutterWebBluetooth].
///
FlutterWebBluetoothInterface();

///
/// Get if the bluetooth api is available in this browser. This will only
/// check if the api is in the `navigator`. Not if anything is available.
Expand Down
8 changes: 7 additions & 1 deletion lib/src/flutter_web_bluetooth_unsupported.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import 'dart:typed_data';
import 'package:flutter_web_bluetooth/js_web_bluetooth.dart';
import 'package:meta/meta.dart';

import '../web_bluetooth_logger.dart';
import '../shared/web_behavior_subject.dart';
import '../web_bluetooth_logger.dart';

part 'bluetooth_characteristic.dart';

Expand Down Expand Up @@ -61,6 +61,12 @@ class FlutterWebBluetooth extends FlutterWebBluetoothInterface {

static FlutterWebBluetooth? _instance;

///
/// Get an instance of the library. There will always only be one instance.
///
/// **Note:** this is the unsupported variant that is exposed in io builds,
/// check the web version where the functions actually work!
///
static FlutterWebBluetoothInterface get instance {
return _instance ??= FlutterWebBluetooth._();
}
Expand Down
13 changes: 13 additions & 0 deletions lib/web/bluetooth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ class _NativeBluetooth {
///
@visibleForTesting
class NativeBluetooth {
///
/// Create a new instance of [NativeBluetooth] with the default
/// implementations for the methods that will call the actual methods
/// on the navigator in the background.
///
/// Using the constructor can be used if you want to rest the native bluetooth
/// implementation for testing using [setNativeBluetooth].
///
/// Otherwise the Fake library can be used to overwrite the methods for testing
///
@visibleForTesting
NativeBluetooth();

///
/// Should return a promise (which will be converted to a future using
/// [JSUtils.promiseToFuture]) with a [bool] if bluetooth is available on
Expand Down
2 changes: 0 additions & 2 deletions lib/web/web_bluetooth_remote_gatt_characteristic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ part of js_web_bluetooth;
///
/// You can get a [WebBluetoothRemoteGATTCharacteristic] from
/// [WebBluetoothRemoteGATTService.getCharacteristic], and
/// ignore: deprecated_member_use_from_same_package
/// [WebBluetoothRemoteGATTService.getCharacteristics].
///
/// See:
Expand Down Expand Up @@ -484,7 +483,6 @@ class WebBluetoothRemoteGATTCharacteristic {
/// **This should only be done by the library or if you're testing.**
///
/// To get an instance use [WebBluetoothRemoteGATTService.getCharacteristic],
/// ignore: deprecated_member_use_from_same_package
/// and [WebBluetoothRemoteGATTService.getCharacteristics].
///
WebBluetoothRemoteGATTCharacteristic.fromJSObject(
Expand Down
3 changes: 0 additions & 3 deletions lib/web/web_bluetooth_remote_gatt_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class WebBluetoothRemoteGATTService {
///
/// See:
///
/// ignore: deprecated_member_use_from_same_package
/// - [getCharacteristics]
///
/// - https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTService/getCharacteristic
Expand All @@ -136,14 +135,12 @@ class WebBluetoothRemoteGATTService {
}

///
/// ignore: deprecated_member_use_from_same_package
/// Check to see if the [getCharacteristics] function exists on the js object.
///
/// It may not exist on some browsers.
///
/// See:
///
/// ignore: deprecated_member_use_from_same_package
/// - [getCharacteristics]
///
bool hasGetCharacteristicsFunction() {
Expand Down
2 changes: 1 addition & 1 deletion lib/web_bluetooth_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Logger get webBluetoothLogger {
}

///
/// Overwrite the logger used so you can do decide where the log messages go.
/// Overwrite the logger used so you can decide where the log messages go.
///
/// If you want to go back to the default logger at a later date then just call
/// [initWebBluetoothLogger] to overwrite the user set logger for the default one.
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: flutter_web_bluetooth
description: A library to use the web bluetooth api in your web project. Will play nice if used in IO projects.
version: 0.0.6+2
version: 0.0.7
homepage: https://github.com/jeroen1602/flutter_web_bluetooth/
repository: https://github.com/jeroen1602/flutter_web_bluetooth/
issue_tracker: https://github.com/jeroen1602/flutter_web_bluetooth/issues/

environment:
sdk: ">=2.12.0 <3.0.0"

platforms:
web:

dependencies:
js: '>=0.6.3 <0.7.0'
meta: '>=1.3.0 <1.8.0'
Expand Down

0 comments on commit 5dbd076

Please sign in to comment.