refactor: upgrade API endpoints to v3 and refactor navigation and response handling across controllers

This commit is contained in:
Hamza-Ayed
2026-04-28 01:13:15 +03:00
parent 13ef5f21b7
commit 6bfc15abb2
10 changed files with 366 additions and 220 deletions

View File

@@ -230,8 +230,16 @@ ${'Download the Intaleq app now and enjoy your ride!'.tr}
Get.snackbar('Success'.tr, 'Invite sent successfully'.tr,
backgroundColor: Colors.green, colorText: Colors.white);
String expirationTime = d['message']['expirationTime'].toString();
String inviteCode = d['message']['inviteCode'].toString();
// التحقق الديناميكي من مكان البيانات (V1 vs V3)
var payload = d['data'] ?? d['message'];
// إذا كان الـ message نصاً وليس خريطة (Map)، نأخذ البيانات من المستوى الأعلى
if (payload is String) {
payload = d;
}
String expirationTime = (payload['expirationTime'] ?? '').toString();
String inviteCode = (payload['inviteCode'] ?? '').toString();
// New and improved WhatsApp message for better user engagement.
String message =

View File

@@ -26,8 +26,8 @@ class OrderHistoryController extends GetxController {
update();
} else {
var jsonDecoded = jsonDecode(res);
orderHistoryListPassenger = jsonDecoded['data'];
var rawData = jsonDecoded['data'] ?? jsonDecoded['message'];
orderHistoryListPassenger = rawData is List ? rawData : [];
isloading = false;
update();
}