Skip to content

Commit 1fdc41b

Browse files
committed
further merge ota check providers
1 parent a4f0253 commit 1fdc41b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/Backend/firmware_update.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ Future<FWInfo?> getFirmwareInfo(String url, String hwVer) async {
8282
return null;
8383
}
8484

85-
@Riverpod()
86-
Future<FWInfo?> checkForFWUpdate(Ref ref, BaseStatefulDevice baseStatefulDevice) async {
85+
Future<FWInfo?> checkForFWUpdate(BaseStatefulDevice baseStatefulDevice) async {
8786
if (baseStatefulDevice.fwInfo.value != null) {
8887
return baseStatefulDevice.fwInfo.value;
8988
}
@@ -100,9 +99,9 @@ Future<FWInfo?> checkForFWUpdate(Ref ref, BaseStatefulDevice baseStatefulDevice)
10099
return fwInfo;
101100
}
102101

103-
@Riverpod()
102+
@Riverpod(keepAlive: true)
104103
Future<bool> hasOtaUpdate(Ref ref, BaseStatefulDevice baseStatefulDevice) async {
105-
FWInfo? fwInfo = await ref.read(checkForFWUpdateProvider(baseStatefulDevice).future);
104+
FWInfo? fwInfo = await checkForFWUpdate(baseStatefulDevice);
106105
Version fwVersion = baseStatefulDevice.fwVersion.value;
107106

108107
// Check if fw version is not set (0.0.0)

lib/Frontend/Widgets/manage_gear.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class _ManageGearUpdateCheckButtonState extends ConsumerState<ManageGearUpdateCh
276276
} else {
277277
setState(() {
278278
//force redownloading the json
279-
Future(() async => ref.invalidate(getBaseFirmwareInfoProvider(await widget.device.baseDeviceDefinition.getFwURL())));
279+
Future(() async => ref.invalidate(hasOtaUpdateProvider(widget.device)));
280280
_otaAvailable = ref.watch(hasOtaUpdateProvider(widget.device).future);
281281
});
282282
}

0 commit comments

Comments
 (0)