Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ring fixes #203

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ class BlueberryRingUseCase extends ReactiveUseCase {
Future<void> getBlueberryRingsNearby(BuildContext context) async {
_bluetoothUseCase.startScanning(
// withServices: [bluetoothServiceUUID],
// withKeywords: ['Mi', ],
withKeywords: ['2301', 'BBRING'],
// withKeywords: ['Mi', 'Buds Pro'],
// Mi Band service uuid
// withServices: [Guid.fromString('0000fee0-0000-1000-8000-00805f9b34fb')]
// withNames: ['Buds Pro'],
);

await _bluetoothUseCase.getScanResults(context);
update(selectedBlueberryRing, _bluetoothUseCase.selectedScanResult.value);
update(selectedBlueberryRing, _bluetoothUseCase.selectedScanResult.valueOrNull);

_bluetoothUseCase.stopScanner();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';

import 'package:collection/collection.dart';
Expand Down Expand Up @@ -48,39 +49,39 @@ class BluetoothHelper {
await bluetoothUseCase.turnOnBluetoothAndProceed();

// Get the options data
final List<String>? withNames = options.filters != null
? options.filters!
.where((filter) => filter.name != null)
.map((filter) => filter.name!)
.toList()
: [];
final List<String>? withKeywords = options.filters != null
? options.filters!
.where((filter) => filter.namePrefix != null)
.map((filter) => filter.namePrefix!)
.toList()
: [];
final List<blue_plus.MsdFilter>? withMsd = options.filters != null
? options.filters!
.expand((filter) => filter.manufacturerData ?? [])
.toList()
.firstOrNull
: [];
final List<blue_plus.ServiceDataFilter>? withServiceData = options.filters != null
? options.filters!
.expand((filter) => filter.serviceData ?? [])
.toList()
.firstOrNull
: [];
final List<blue_plus.Guid> withServices =
(withKeywords?.isNotEmpty ?? false) && Platform.isAndroid ? [] : options.filters?[0].services ?? [];
bluetoothUseCase.startScanning(
withServices: options.filters != null
? options.filters!
.expand((filter) => filter.services ?? [])
.toList()
.firstOrNull
: [],
withRemoteIds:
null, // No direct mapping in RequestDeviceOptions, adjust as necessary
withNames: options.filters != null
? options.filters!
.where((filter) => filter.name != null)
.map((filter) => filter.name!)
.toList()
: [],
withKeywords: options.filters != null
? options.filters!
.where((filter) => filter.namePrefix != null)
.map((filter) => filter.namePrefix!)
.toList()
: [],
withMsd: options.filters != null
? options.filters!
.expand((filter) => filter.manufacturerData ?? [])
.toList()
.firstOrNull
: [],
withServiceData: options.filters != null
? options.filters!
.expand((filter) => filter.serviceData ?? [])
.toList()
.firstOrNull
: [],
withServices: withServices,
withRemoteIds: null,
withNames: withNames,
withKeywords: withKeywords,
withMsd: withMsd,
withServiceData: withServiceData,
continuousUpdates: true,
continuousDivisor: 2,
androidUsesFineLocation: true,
Expand Down Expand Up @@ -281,7 +282,7 @@ class BluetoothHelper {
loading(false);
BluetoothDevice? responseDevice;
state.selectedScanResult = bluetoothUseCase.selectedScanResult.value;
if (state.selectedScanResult != null) {
if (state.selectedScanResult != null) {
responseDevice = BluetoothDevice.getBluetoothDeviceFromScanResult(
state.selectedScanResult!);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,6 @@ class SendCryptoPresenter extends CompletePresenter<SendCryptoState> {
// }
navigator?.pushReplacement(route(const WalletPage()));
});
// Future.delayed(const Duration(milliseconds: 200), () {
// navigator?.popUntil((route) {
// return route.settings.name?.contains('WalletPage') ?? false;
// });
// });
}
return null;
}
Expand Down