device infos

This commit is contained in:
2026-08-28 15:07:30 +05:30
parent 5723d373b2
commit 69f4f3e909
84 changed files with 4337 additions and 2339 deletions

View File

@@ -9,6 +9,7 @@ import 'package:latlong2/latlong.dart' show LatLng;
import 'package:miler/helpers/miler_router.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:miler/data/accepted_store.dart';
import 'package:geolocator/geolocator.dart';
import 'package:miler/views/helpers/constants/apiconstants.dart';
@@ -574,6 +575,29 @@ class PickupsController extends GetxController
}
}
// ── Written down, not only sent ──
//
// This figure is the only measurement of the leg that exists: the backend
// does not reliably send a distance back on `GET /miler/bookings`, and
// until now the app posted this and kept nothing, so Activity's `km
// ridden` had no row to total and printed an em dash on a day of real
// riding. Recorded against the stop so the record that gets filed carries
// it — see [kStopKmKey] and `addCompletedBookings`.
//
// Best-effort: a preferences write must never cost the rider a pickup
// that has otherwise succeeded.
if (calculatedKms > 0) {
try {
final prefs = await SharedPreferences.getInstance();
await prefs.setString(
kStopKmKey(pickupId),
calculatedKms.toStringAsFixed(2),
);
} catch (e) {
debugPrint('[PICKED] could not record the distance: $e');
}
}
final payload = <String, dynamic>{
'pickupid': pickupId,
// Not sent to the backend — the legacy shape carries it and the mapper