fix(location): add refresh success feedback and fix queueCommands null crash
This commit is contained in:
@@ -73,11 +73,9 @@ class LocationScreen extends ConsumerWidget {
|
||||
.read(legacyDeviceViewModelProvider.notifier)
|
||||
.setSelectedDevice(device);
|
||||
},
|
||||
onRefreshPosition: () {
|
||||
ref
|
||||
.read(legacyDeviceViewModelProvider.notifier)
|
||||
.refreshPositions();
|
||||
},
|
||||
onRefreshPosition: () => ref
|
||||
.read(legacyDeviceViewModelProvider.notifier)
|
||||
.refreshPositions(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class LocationMap extends ConsumerStatefulWidget {
|
||||
final bool showRouteTrail;
|
||||
final bool isLoadingHistory;
|
||||
final ValueChanged<DeviceEntity> onDeviceChanged;
|
||||
final VoidCallback onRefreshPosition;
|
||||
final Future<void> Function() onRefreshPosition;
|
||||
|
||||
const LocationMap({
|
||||
super.key,
|
||||
@@ -685,9 +685,14 @@ class _LocationMapState extends ConsumerState<LocationMap>
|
||||
unawaited(
|
||||
ref.read(sfTrackingProvider).legacyLocationMapRefreshTapped(),
|
||||
);
|
||||
widget.onRefreshPosition();
|
||||
if (!mounted) return;
|
||||
await showInfoDialog(context, I18n.locationMapRefreshRequested);
|
||||
try {
|
||||
await widget.onRefreshPosition();
|
||||
if (!mounted) return;
|
||||
await showSuccessDialog(context, I18n.positionUpdated);
|
||||
} catch (_) {
|
||||
if (!mounted) return;
|
||||
await showErrorDialog(context, I18n.errorPositions);
|
||||
}
|
||||
},
|
||||
onCenterTap: _centerOnDevice,
|
||||
onToggleFollow: () async {
|
||||
|
||||
Reference in New Issue
Block a user