fix: bootloader device card persistence fix
This commit is contained in:
@ -47,6 +47,7 @@ class _DevicesTabPageState extends ConsumerState<DevicesTabPage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_isBootloaderScanStarting = true;
|
_isBootloaderScanStarting = true;
|
||||||
|
_clearBootloaderDevice();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final bluetooth = await ref.read(bluetoothProvider.future);
|
final bluetooth = await ref.read(bluetoothProvider.future);
|
||||||
@ -83,7 +84,16 @@ class _DevicesTabPageState extends ConsumerState<DevicesTabPage> {
|
|||||||
(device) => device != null && _isBootloaderAdvertisement(device),
|
(device) => device != null && _isBootloaderAdvertisement(device),
|
||||||
orElse: () => null,
|
orElse: () => null,
|
||||||
);
|
);
|
||||||
if (!mounted || dfuDevice == null || dfuDevice.id == _dfuDevice?.id) {
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dfuDevice == null) {
|
||||||
|
_clearBootloaderDevice();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dfuDevice.id == _dfuDevice?.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +102,16 @@ class _DevicesTabPageState extends ConsumerState<DevicesTabPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _clearBootloaderDevice() {
|
||||||
|
if (!mounted || _dfuDevice == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_dfuDevice = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
bool _isBootloaderAdvertisement(DiscoveredDevice device) {
|
bool _isBootloaderAdvertisement(DiscoveredDevice device) {
|
||||||
final name = device.name.trim();
|
final name = device.name.trim();
|
||||||
if (name == 'US-DFU' || name == 'UniversalShifters DFU') {
|
if (name == 'US-DFU' || name == 'UniversalShifters DFU') {
|
||||||
@ -126,6 +146,7 @@ class _DevicesTabPageState extends ConsumerState<DevicesTabPage> {
|
|||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_clearBootloaderDevice();
|
||||||
context.push(
|
context.push(
|
||||||
'/bootloader_recovery_update',
|
'/bootloader_recovery_update',
|
||||||
extra: BootloaderRecoveryUpdateArgs(
|
extra: BootloaderRecoveryUpdateArgs(
|
||||||
|
|||||||
Reference in New Issue
Block a user