Skip to content

Commit

Permalink
Merge pull request #203 from MXCzkEVM/ring_fixes
Browse files Browse the repository at this point in the history
Ring fixes
  • Loading branch information
reasje authored Feb 26, 2025
2 parents 165ac4b + 626f2a2 commit 40fe44d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 41 deletions.
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
2 changes: 1 addition & 1 deletion packages/shared

0 comments on commit 40fe44d

Please sign in to comment.