19
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:sefer_admin1/constant/links.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../controller/functions/crud.dart';
|
||||
import '../../../main.dart';
|
||||
|
||||
class IntaleqTrackerScreen extends StatefulWidget {
|
||||
@@ -107,12 +108,17 @@ class _IntaleqTrackerScreenState extends State<IntaleqTrackerScreen>
|
||||
try {
|
||||
String updateUrl =
|
||||
"${_baseDir}getUpdatedLocationForAdmin.php?mode=${isLiveMode ? 'live' : 'day'}";
|
||||
await http.get(Uri.parse(updateUrl));
|
||||
print("📡 Calling Update URL: $updateUrl");
|
||||
var responseUpdate = await CRUD().post(link: updateUrl, payload: {});
|
||||
print("📡 Update Response: $responseUpdate");
|
||||
|
||||
String v = DateTime.now().millisecondsSinceEpoch.toString();
|
||||
|
||||
final responseLive =
|
||||
await http.get(Uri.parse("${_baseDir}locations_live.json?v=$v"));
|
||||
String liveUrl = "${_baseDir}locations_live.json?v=$v";
|
||||
print("📡 Calling Live JSON URL: $liveUrl");
|
||||
final responseLive = await http.get(Uri.parse(liveUrl));
|
||||
print(
|
||||
"📡 Live JSON Response (${responseLive.statusCode}): ${responseLive.body.length > 100 ? responseLive.body.substring(0, 100) : responseLive.body}");
|
||||
if (responseLive.statusCode == 200) {
|
||||
final data = json.decode(responseLive.body);
|
||||
List drivers = (data is Map && data.containsKey('drivers'))
|
||||
@@ -125,8 +131,11 @@ class _IntaleqTrackerScreenState extends State<IntaleqTrackerScreen>
|
||||
});
|
||||
}
|
||||
|
||||
final responseDay =
|
||||
await http.get(Uri.parse("${_baseDir}locations_day.json?v=$v"));
|
||||
String dayUrl = "${_baseDir}locations_day.json?v=$v";
|
||||
print("📡 Calling Day JSON URL: $dayUrl");
|
||||
final responseDay = await http.get(Uri.parse(dayUrl));
|
||||
print(
|
||||
"📡 Day JSON Response (${responseDay.statusCode}): ${responseDay.body.length > 100 ? responseDay.body.substring(0, 100) : responseDay.body}");
|
||||
if (responseDay.statusCode == 200) {
|
||||
final data = json.decode(responseDay.body);
|
||||
List drivers = (data is Map && data.containsKey('drivers'))
|
||||
|
||||
Reference in New Issue
Block a user