mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Apply correct business logic in AirQualityDataLoadingStrategy
.
This commit is contained in:
@ -26,10 +26,10 @@ final class AirQualityDataLoadingStrategy implements AnalyticsDataLoadingStrateg
|
|||||||
final spaceTreeBloc = context.read<SpaceTreeBloc>();
|
final spaceTreeBloc = context.read<SpaceTreeBloc>();
|
||||||
final isSpaceSelected = spaceTreeBloc.state.selectedSpaces.contains(space.uuid);
|
final isSpaceSelected = spaceTreeBloc.state.selectedSpaces.contains(space.uuid);
|
||||||
|
|
||||||
if (isSpaceSelected) {
|
final hasSelectedSpaces = spaceTreeBloc.state.selectedSpaces.isNotEmpty;
|
||||||
clearData(context);
|
if (hasSelectedSpaces) clearData(context);
|
||||||
return;
|
|
||||||
}
|
if (isSpaceSelected) return;
|
||||||
|
|
||||||
spaceTreeBloc
|
spaceTreeBloc
|
||||||
..add(const SpaceTreeClearSelectionEvent())
|
..add(const SpaceTreeClearSelectionEvent())
|
||||||
@ -44,7 +44,9 @@ final class AirQualityDataLoadingStrategy implements AnalyticsDataLoadingStrateg
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void clearData(BuildContext context) {
|
void clearData(BuildContext context) {
|
||||||
context.read<SpaceTreeBloc>().add(const SpaceTreeClearSelectionEvent());
|
context.read<SpaceTreeBloc>().add(
|
||||||
|
const AnalyticsClearAllSpaceTreeSelectionsEvent(),
|
||||||
|
);
|
||||||
FetchAirQualityDataHelper.clearAllData(context);
|
FetchAirQualityDataHelper.clearAllData(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user