diff --git a/backend/core/Services/FcmService.php b/backend/core/Services/FcmService.php index 5be2e69f..bb409ae4 100644 --- a/backend/core/Services/FcmService.php +++ b/backend/core/Services/FcmService.php @@ -17,8 +17,12 @@ class FcmService $this->serviceAccountFile = $envPath; } elseif (file_exists('/keys/firebase_service_account.json')) { $this->serviceAccountFile = '/keys/firebase_service_account.json'; - } else { + } elseif (file_exists(__DIR__ . '/../../keys/firebase_service_account.json')) { $this->serviceAccountFile = __DIR__ . '/../../keys/firebase_service_account.json'; + } elseif (file_exists(__DIR__ . '/../../ride/firebase/service-account.json')) { + $this->serviceAccountFile = __DIR__ . '/../../ride/firebase/service-account.json'; + } else { + $this->serviceAccountFile = __DIR__ . '/../../keys/firebase_service_account.json'; // Default fallback } } @@ -64,7 +68,13 @@ class FcmService 'message' => [ 'token' => $token, 'data' => $processedData, - 'android' => ['priority' => 'HIGH'], + 'android' => [ + 'priority' => 'HIGH', + 'notification' => [ + 'sound' => $tone === 'ding' ? 'default' : $tone, + 'channel_id' => 'high_importance_channel' + ] + ], ], ]; @@ -73,10 +83,11 @@ class FcmService 'title' => $title, 'body' => $body, ]; + $iosSound = $tone === 'ding' || $tone === 'default' ? 'default' : (str_ends_with($tone, '.caf') ? $tone : $tone . '.caf'); $payload['message']['apns'] = [ 'payload' => [ 'aps' => [ - 'sound' => $tone === 'ding' ? 'default' : $tone + 'sound' => $iosSound ] ] ]; diff --git a/siro_admin/lib/constant/links.dart b/siro_admin/lib/constant/links.dart index d6c5fcc5..ece62023 100644 --- a/siro_admin/lib/constant/links.dart +++ b/siro_admin/lib/constant/links.dart @@ -101,7 +101,7 @@ class AppLink { } } - static String loginJwtDriver = "https://api.intaleq.xyz/siro/loginAdmin.php"; + static String loginJwtDriver = "$server/loginAdmin.php"; //============================= //============================= static final getAllFingerprints = diff --git a/siro_admin/lib/controller/functions/crud.dart b/siro_admin/lib/controller/functions/crud.dart index 42bee14e..2a4c6f3c 100644 --- a/siro_admin/lib/controller/functions/crud.dart +++ b/siro_admin/lib/controller/functions/crud.dart @@ -100,7 +100,10 @@ class CRUD { ); Log.print('Status Code: ${response.statusCode}'); - Log.print('Response Body: ${response.body}'); + String preview = response.body.length > 500 + ? '${response.body.substring(0, 500)}... (truncated)' + : response.body; + Log.print('Response Body: $preview'); Log.print('------------------'); if (response.statusCode == 200) { @@ -157,7 +160,10 @@ class CRUD { ); Log.print('Status Code: ${response.statusCode}'); - Log.print('Response Body: ${response.body}'); + String preview = response.body.length > 500 + ? '${response.body.substring(0, 500)}... (truncated)' + : response.body; + Log.print('Response Body: $preview'); Log.print('-------------------'); if (response.statusCode == 200) { diff --git a/siro_admin/lib/views/admin/drivers/driver_the_best.dart b/siro_admin/lib/views/admin/drivers/driver_the_best.dart index 5110d57b..08a1042e 100644 --- a/siro_admin/lib/views/admin/drivers/driver_the_best.dart +++ b/siro_admin/lib/views/admin/drivers/driver_the_best.dart @@ -4,6 +4,8 @@ import 'package:get_storage/get_storage.dart'; // Ensure get_storage is in pubsp import 'package:siro_admin/controller/functions/wallet.dart'; import 'package:siro_admin/views/widgets/snackbar.dart'; +import 'package:siro_admin/constant/links.dart'; + // --- New Controller to handle the specific JSON URL --- class DriverCacheController extends GetxController { List drivers = []; @@ -32,7 +34,7 @@ class DriverCacheController extends GetxController { try { // Using GetConnect to fetch the JSON directly final response = await GetConnect().get( - 'https://api.intaleq.xyz/siro/ride/location/active_drivers_cache.json', + '${AppLink.server}/ride/location/active_drivers_cache.json', ); if (response.body != null && response.body is Map) {