Skip to content

Commit

Permalink
add migration for con mode pin generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Dec 1, 2024
1 parent ffa4164 commit 866a54d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Backend/Bluetooth/bluetooth_manager_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Future<void> initFlutterBluePlus(InitFlutterBluePlusRef ref) async {
if (knownDevices.containsKey(deviceID)) {
statefulDevice = knownDevices[deviceID]!;
baseStoredDevice = statefulDevice.baseStoredDevice;
if (statefulDevice.baseStoredDevice.conModePin.isEmpty) {
int code = Random().nextInt(899999) + 100000;
baseStoredDevice.conModePin = code.toString();
Future(() => ref.read(knownDevicesProvider.notifier).add(statefulDevice));
}
//transaction.setTag('Known Device', 'Yes');
} else {
baseStoredDevice = BaseStoredDevice(deviceDefinition.uuid, deviceID, deviceDefinition.deviceType.color(ref: ref).value)..name = getNameFromBTName(deviceDefinition.btName);
Expand Down

0 comments on commit 866a54d

Please sign in to comment.