From 84c725040f32fbff12680b4fdaebe31556791f28 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 1 Aug 2026 05:29:35 +0300 Subject: [PATCH] Update: 2026-08-01 05:29:35 --- intaleq_driver/lib/constant/links.dart | 8 +++-- .../auth/captin/login_captin_controller.dart | 11 +++---- .../auth/captin/phone_helper_controller.dart | 6 ++++ .../home/captin/destination_controller.dart | 2 +- .../home/captin/home_captain_controller.dart | 2 +- .../Captin/home_captain/drawer_captain.dart | 33 +++++++++++-------- loction_server/siro/connect.php | 2 +- .../ride/shamcash/create_invoice_shamcash.php | 4 +-- 8 files changed, 40 insertions(+), 28 deletions(-) diff --git a/intaleq_driver/lib/constant/links.dart b/intaleq_driver/lib/constant/links.dart index 65e128e..ad902a2 100755 --- a/intaleq_driver/lib/constant/links.dart +++ b/intaleq_driver/lib/constant/links.dart @@ -26,7 +26,7 @@ class AppLink { static String get locationServer => locationServerSide; static String get locationServerSide { - return 'https://api.intaleqapp.com/loction_server/intaleq/ride/location'; + return 'https://api.intaleqapp.com/loction_server/siro/ride/location'; } static String get locationSocketUrl { @@ -251,8 +251,10 @@ class AppLink { static String get paymobPayoutDriverWallet => "$paymentServer/ride/payMob/paymob_driver/paymob_payout.php"; - static String get addSeferWallet => "$paymentServer/ride/intaleqWallet/add.php"; - static String get getSeferWallet => "$paymentServer/ride/intaleqWallet/get.php"; + static String get addSeferWallet => + "$paymentServer/ride/intaleqWallet/add.php"; + static String get getSeferWallet => + "$paymentServer/ride/intaleqWallet/get.php"; static String get addDriverPaymentPoints => "$paymentServer/ride/driverPayment/add.php"; static String get addPaymentTokenDriver => diff --git a/intaleq_driver/lib/controller/auth/captin/login_captin_controller.dart b/intaleq_driver/lib/controller/auth/captin/login_captin_controller.dart index c7cbe20..48972b8 100755 --- a/intaleq_driver/lib/controller/auth/captin/login_captin_controller.dart +++ b/intaleq_driver/lib/controller/auth/captin/login_captin_controller.dart @@ -449,13 +449,8 @@ class LoginDriverController extends GetxController { box.write(BoxName.carTypeOfDriver, 'Awfar Car'); } - // ✅ الحصول على توكن access بدل registration قبل أي طلبات بعد تسجيل الدخول - Log.print('🔑 Getting access token after login...'); - String fingerPrint = await DeviceHelper.getDeviceFingerprint(); - // await storage.write( - // key: BoxName.fingerPrint, value: fingerPrint.toString()); - // await getJWT(); - // Log.print('🔑 Access token obtained.'); + // (لا داعي لتوليد توكن جديد هنا، فعملية OTP قد زودتنا بتوكن Access صحيح وتم حفظه في الذاكرة) + Log.print('✅ Access token is already saved from the login process.'); // add invitations if (box.read(BoxName.isInstall) == null || @@ -483,6 +478,8 @@ class LoginDriverController extends GetxController { final serverFp = serverData['data'][0]['fingerPrint'].toString(); final tokenMismatch = storedToken.isNotEmpty && serverToken != storedToken; + + String fingerPrint = await DeviceHelper.getDeviceFingerprint(); Log.print( '🔍 [FP_COMPARE] serverFp: $serverFp | localFp: ${fingerPrint.toString()} | tokenMismatch: $tokenMismatch | serverToken: $serverToken | storedToken: $storedToken'); if (tokenMismatch) { diff --git a/intaleq_driver/lib/controller/auth/captin/phone_helper_controller.dart b/intaleq_driver/lib/controller/auth/captin/phone_helper_controller.dart index ff43e3f..d65e365 100644 --- a/intaleq_driver/lib/controller/auth/captin/phone_helper_controller.dart +++ b/intaleq_driver/lib/controller/auth/captin/phone_helper_controller.dart @@ -88,6 +88,12 @@ class PhoneAuthHelper { if (isRegistered) { // ✅ السائق مسجل مسبقًا - سجل دخوله واذهب إلى الصفحة الرئيسية final driver = data['message']['driver']; + final jwt = data['message']['jwt']; + + if (jwt != null) { + await storage.write(key: BoxName.jwt, value: jwt.toString()); + } + // mySnackbarSuccess('Welcome back, ${driver['first_name']}!'); // حفظ بيانات السائق إذا أردت: diff --git a/intaleq_driver/lib/controller/home/captin/destination_controller.dart b/intaleq_driver/lib/controller/home/captin/destination_controller.dart index 40efbc5..d52a6dc 100644 --- a/intaleq_driver/lib/controller/home/captin/destination_controller.dart +++ b/intaleq_driver/lib/controller/home/captin/destination_controller.dart @@ -45,7 +45,7 @@ class DestinationController extends GetxController { if (response != null && response is Map && response['status'] == 'success') { final data = response['message']; - if (data != null) { + if (data != null && data is Map) { final lat = double.tryParse(data['target_latitude']?.toString() ?? '0') ?? 0.0; final lng = double.tryParse(data['target_longitude']?.toString() ?? '0') ?? 0.0; activeLatLng = LatLng(lat, lng); diff --git a/intaleq_driver/lib/controller/home/captin/home_captain_controller.dart b/intaleq_driver/lib/controller/home/captin/home_captain_controller.dart index dfa1632..280d2a6 100755 --- a/intaleq_driver/lib/controller/home/captin/home_captain_controller.dart +++ b/intaleq_driver/lib/controller/home/captin/home_captain_controller.dart @@ -939,7 +939,7 @@ class HomeCaptainController extends GetxController { bool isZeroCommissionActive = false; getCountRideToday() async { - var res = await CRUD().get( + var res = await CRUD().getWallet( link: AppLink.getCountRide, payload: {'driver_id': box.read(BoxName.driverID).toString()}); data = jsonDecode(res); diff --git a/intaleq_driver/lib/views/home/Captin/home_captain/drawer_captain.dart b/intaleq_driver/lib/views/home/Captin/home_captain/drawer_captain.dart index 2026d8f..14f36d2 100755 --- a/intaleq_driver/lib/views/home/Captin/home_captain/drawer_captain.dart +++ b/intaleq_driver/lib/views/home/Captin/home_captain/drawer_captain.dart @@ -320,11 +320,13 @@ class UserHeader extends StatelessWidget { fontSize: 18, shadows: [Shadow(blurRadius: 2, color: Colors.black26)]), ), - accountEmail: - (box.read(BoxName.emailDriver).toString().contains('siroapp') || - box.read(BoxName.emailDriver).toString().contains('intaleqapp')) - ? Text('Your email not updated yet'.tr) - : Text(box.read(BoxName.emailDriver)), + accountEmail: (box + .read(BoxName.emailDriver) + .toString() + .contains('siroapp') || + box.read(BoxName.emailDriver).toString().contains('intaleqapp')) + ? Text('Your email not updated yet'.tr) + : Text(box.read(BoxName.emailDriver)), currentAccountPicture: GetBuilder( builder: (controller) => Stack( clipBehavior: Clip.none, @@ -334,7 +336,8 @@ class UserHeader extends StatelessWidget { shape: BoxShape.circle, border: Border.all(color: Colors.white, width: 2), boxShadow: [ - BoxShadow(color: Colors.black.withValues(alpha: 0.3), blurRadius: 5) + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), blurRadius: 5) ], ), child: controller.isloading @@ -349,13 +352,17 @@ class UserHeader extends StatelessWidget { : null, // [تعديل هام]: في حال فشل تحميل الصورة (غير موجودة) - onBackgroundImageError: (exception, stackTrace) { - // طباعة الخطأ في الكونسول للتوضيح - debugPrint( - "Profile image not found or error loading: $exception"); - // استدعاء نافذة التنبيه - _showUploadPhotoDialog(context, controller); - }, + onBackgroundImageError: (box + .read(BoxName.driverPhotoUrl) + ?.toString() + .isNotEmpty == + true) + ? (exception, stackTrace) { + debugPrint( + "Profile image not found or error loading: $exception"); + _showUploadPhotoDialog(context, controller); + } + : null, // أيقونة بديلة تظهر في الخلفية إذا لم تكن الصورة موجودة backgroundColor: Colors.grey.shade300, diff --git a/loction_server/siro/connect.php b/loction_server/siro/connect.php index 32a8cbb..e889777 100755 --- a/loction_server/siro/connect.php +++ b/loction_server/siro/connect.php @@ -50,7 +50,7 @@ try { //$con->exec("SET time_zone = '+03:00'"); // --- JWT Authentication --- // include "encrypt_decrypt.php"; - include "functions.php"; // Include the functions file + include __DIR__ . "/functions.php"; // Include the functions file $decodedToken = authenticateJWT(); // Call the authentication function diff --git a/payment_server/v2/main/ride/shamcash/create_invoice_shamcash.php b/payment_server/v2/main/ride/shamcash/create_invoice_shamcash.php index 66cbfef..daf2118 100755 --- a/payment_server/v2/main/ride/shamcash/create_invoice_shamcash.php +++ b/payment_server/v2/main/ride/shamcash/create_invoice_shamcash.php @@ -30,8 +30,8 @@ try { } else { // إنشاء فاتورة جديدة برقم عشوائي $invoice_number = random_int(100000, 999999); - $stmtIns = $con->prepare("INSERT INTO invoices_shamcash (invoice_number, driverID, phone, amount, status, created_at) VALUES (?, ?, ?, ?, 'pending', NOW())"); - $stmtIns->execute([$invoice_number, $driverID, $phone ?: null, $amount]); + $stmtIns = $con->prepare("INSERT INTO invoices_shamcash (invoice_number, driverID, amount, status, created_at) VALUES (?, ?, ?, 'pending', NOW())"); + $stmtIns->execute([$invoice_number, $driverID, $amount]); } echo json_encode([