updated the sheet

This commit is contained in:
2026-08-28 18:16:28 +05:30
parent 69f4f3e909
commit 074cc0eccf
43 changed files with 2617 additions and 1201 deletions

View File

@@ -3,6 +3,7 @@ import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:miler/Models/login/login.dart';
import 'package:miler/data/api_config.dart';
import 'package:miler/data/heartbeat.dart';
import 'package:miler/data/mock_backend.dart';
import 'package:miler/data/miler_api.dart';
import 'package:miler/data/service_profile.dart';
@@ -93,7 +94,7 @@ class AuthProvider {
int? pin,
String? pinRaw,
}) async {
// The legacy `jupiter.doormile.app/.../rider/login` path that used to sit
// The legacy `rider/login` path on the retired backend that used to sit
// behind a flag here is gone with the rest of the old backend.
return _loginNew(
contactNo: contactNo,
@@ -303,6 +304,15 @@ class AuthProvider {
'logid': 0,
'partnerid': 0,
'configid': 0,
// ── Zero is not a safe default for this one ──
//
// Every other field here is an *identifier*, and an unknown identifier
// is honestly zero. `logseconds` is a **cadence**, and zero read as a
// cadence means "never beat" — which is exactly how both call sites in
// [RiderLogController] took it, so the rider-log loop never started on
// a v1 deployment and the console lost battery, connection, GPS and
// the rider's live position with it. See [kDefaultLogSeconds].
'logseconds': kDefaultLogSeconds,
// ── Which line of work this rider is on ──
//
// The server's answer first, the build's declared tenant only when
@@ -432,24 +442,6 @@ class AuthProvider {
}
}
// Convenience: send using a Login model body
Future<http.Response> loginWith(Login request) async {
final uri = Uri.parse(
'https://jupiter.doormile.app/live/api/v2/users/rider/login',
);
final body = request.toJson();
debugPrint('[AUTH][LOGIN] URL: ${uri.toString()}');
debugPrint('[AUTH][LOGIN] Body: ${json.encode(body)}');
final res = await http.post(
uri,
headers: {'Content-Type': 'application/json'},
body: json.encode(body),
);
debugPrint('[AUTH][LOGIN] Status: ${res.statusCode}');
debugPrint('[AUTH][LOGIN] Response: ${res.body}');
return res;
}
// Convenience: parsed response as Login model
Future<Login> loginParsed({
required String contactNo,
@@ -498,7 +490,14 @@ class AuthProvider {
await prefs.setInt('partnerid', details['partnerid'] ?? 0);
await prefs.setInt('partnerId', details['partnerid'] ?? 0);
await prefs.setInt('configid', details['configid'] ?? 0);
await prefs.setInt('logseconds', details['logseconds'] ?? 0);
// Not `?? 0`. This is read back as the heartbeat's interval, and a zero
// there stops the loop starting at all — see [resolveLogSeconds]. A
// legacy backend that sends a real cadence still wins; anything else
// lands on the 30s floor rather than on silence.
await prefs.setInt(
'logseconds',
resolveLogSeconds(details['logseconds']),
);
await prefs.setInt('locationid', details['locationid'] ?? 0);
await prefs.setInt('tenantid', details['tenantid'] ?? 0);