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