Update: 2026-06-12 01:23:54

This commit is contained in:
Hamza-Ayed
2026-06-12 01:23:54 +03:00
parent 7049c7468c
commit ef6b52d2e3
47 changed files with 1480 additions and 1472 deletions

View File

@@ -59,7 +59,9 @@ if (isset($_FILES['image']) && $_FILES['image']['error'] === UPLOAD_ERR_OK) {
exit; exit;
} }
$linkImage = 'https://intaleq.xyz/siro/Admin/adminUser/invoice_images/' . $new_filename; $host = $_SERVER['HTTP_HOST'] ?? 'api.siromove.com';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$linkImage = "$protocol://$host/siro/Admin/adminUser/invoice_images/" . $new_filename;
error_log("[add_invoice.php] ✅ Image uploaded successfully: $linkImage"); error_log("[add_invoice.php] ✅ Image uploaded successfully: $linkImage");
} }

View File

@@ -1,30 +1,47 @@
<?php <?php
require_once __DIR__ . '/../connect.php'; require_once __DIR__ . '/../connect.php';
// Get the image file from the request. header('Content-Type: application/json');
$image_file = $_FILES['image'];
uploadLog("🚀 [EgyptDocuments/uploadEgyptIdBack.php] Egyptian ID back upload started.");
$driverID = filterRequest("driverID"); $driverID = filterRequest("driverID");
if (empty($driverID)) {
// Define allowed extensions uploadLog("❌ Missing driverID parameter.", 'ERROR');
$allowed_extensions = ['jpg', 'jpeg', 'png']; jsonError("driverID is required.");
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit; exit;
} }
if (isset($_FILES['image'])) {
uploadLog("$_FILES['image'] metadata", 'INFO', [
'name' => $_FILES['image']['name'] ?? 'unknown',
'type' => $_FILES['image']['type'] ?? 'unknown',
'size' => $_FILES['image']['size'] ?? 0,
'upload_error_code' => $_FILES['image']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'image' file was sent in the request.", 'WARNING');
}
if (!isset($_FILES['image']) || $_FILES['image']['error'] !== UPLOAD_ERR_OK) {
$err = $_FILES['image']['error'] ?? 'missing_file';
uploadLog("❌ File upload validation failed. Code: $err", 'ERROR');
jsonError("Image upload failed");
exit;
}
$image_file = $_FILES['image'];
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get file information // Get file information
$image_name = $image_file['name']; $image_name = $image_file['name'];
$image_size = $image_file['size']; $image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION)); $image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension // Validate file extension
if (!in_array($image_extension, $allowed_extensions)) { if (!in_array($image_extension, $allowed_extensions, true)) {
echo "Invalid image format"; uploadLog("Invalid image format extension: .$image_extension", 'ERROR');
jsonError("Invalid image format");
exit; exit;
} }
@@ -34,38 +51,42 @@ $mime_type = finfo_file($finfo, $image_file['tmp_name']);
finfo_close($finfo); finfo_close($finfo);
$allowed_mime_types = ['image/jpeg', 'image/png', 'image/jpg']; $allowed_mime_types = ['image/jpeg', 'image/png', 'image/jpg'];
if (!in_array($mime_type, $allowed_mime_types)) { if (!in_array($mime_type, $allowed_mime_types, true)) {
echo "Invalid image format (MIME mismatch)"; uploadLog("Invalid MIME type: $mime_type", 'ERROR');
jsonError("Invalid image format (MIME mismatch)");
exit; exit;
} }
// Generate a unique filename using timestamp and random string // Generate a unique filename using driverID
$new_filename = $driverID . '.' . $image_extension; $new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads // Set target directory for uploads
$target_dir = "card_image/"; $target_dir = __DIR__ . "/card_image/";
if (!is_dir($target_dir)) {
mkdir($target_dir, 0755, true);
}
// Construct target file path // Construct target file path
$target_file = $target_dir . $new_filename; $target_file = $target_dir . $new_filename;
// Move the image file to the target location // Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) { if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ; uploadLog("Failed to save image to target file: $target_file", 'ERROR');
jsonError("Failed to save image");
exit; exit;
} }
// Store additional information (modify based on your needs) // Resolve dynamic URL
$image_url = $target_dir . $new_filename; // Update if needed $host = $_SERVER['HTTP_HOST'] ?? 'api.siromove.com';
$image_details = [ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
"name" => $image_name, $image_url = "$protocol://$host/siro/EgyptDocuments/card_image/" . $new_filename;
"size" => $image_size,
"extension" => $image_extension, uploadLog("✅ Egypt ID back uploaded successfully. URL: $image_url");
printSuccess([
"status" => "success",
"url" => $image_url, "url" => $image_url,
]; "file_link" => $image_url,
"image_url" => $image_url
// Use the image details for further processing (e.g., display, store in database) ]);
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?> ?>

View File

@@ -1,30 +1,47 @@
<?php <?php
require_once __DIR__ . '/../connect.php'; require_once __DIR__ . '/../connect.php';
// Get the image file from the request. header('Content-Type: application/json');
$image_file = $_FILES['image'];
uploadLog("🚀 [EgyptDocuments/uploadEgyptidFront.php] Egyptian ID front upload started.");
$driverID = filterRequest("driverID"); $driverID = filterRequest("driverID");
if (empty($driverID)) {
// Define allowed extensions uploadLog("❌ Missing driverID parameter.", 'ERROR');
$allowed_extensions = ['jpg', 'jpeg', 'png']; jsonError("driverID is required.");
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit; exit;
} }
if (isset($_FILES['image'])) {
uploadLog("$_FILES['image'] metadata", 'INFO', [
'name' => $_FILES['image']['name'] ?? 'unknown',
'type' => $_FILES['image']['type'] ?? 'unknown',
'size' => $_FILES['image']['size'] ?? 0,
'upload_error_code' => $_FILES['image']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'image' file was sent in the request.", 'WARNING');
}
if (!isset($_FILES['image']) || $_FILES['image']['error'] !== UPLOAD_ERR_OK) {
$err = $_FILES['image']['error'] ?? 'missing_file';
uploadLog("❌ File upload validation failed. Code: $err", 'ERROR');
jsonError("Image upload failed");
exit;
}
$image_file = $_FILES['image'];
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get file information // Get file information
$image_name = $image_file['name']; $image_name = $image_file['name'];
$image_size = $image_file['size']; $image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION)); $image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension // Validate file extension
if (!in_array($image_extension, $allowed_extensions)) { if (!in_array($image_extension, $allowed_extensions, true)) {
echo "Invalid image format"; uploadLog("Invalid image format extension: .$image_extension", 'ERROR');
jsonError("Invalid image format");
exit; exit;
} }
@@ -34,38 +51,42 @@ $mime_type = finfo_file($finfo, $image_file['tmp_name']);
finfo_close($finfo); finfo_close($finfo);
$allowed_mime_types = ['image/jpeg', 'image/png', 'image/jpg']; $allowed_mime_types = ['image/jpeg', 'image/png', 'image/jpg'];
if (!in_array($mime_type, $allowed_mime_types)) { if (!in_array($mime_type, $allowed_mime_types, true)) {
echo "Invalid image format (MIME mismatch)"; uploadLog("Invalid MIME type: $mime_type", 'ERROR');
jsonError("Invalid image format (MIME mismatch)");
exit; exit;
} }
// Generate a unique filename using timestamp and random string // Generate a unique filename using driverID
$new_filename = $driverID . '.' . $image_extension; $new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads // Set target directory for uploads
$target_dir = "egypt/idFront/"; $target_dir = __DIR__ . "/egypt/idFront/";
if (!is_dir($target_dir)) {
mkdir($target_dir, 0755, true);
}
// Construct target file path // Construct target file path
$target_file = $target_dir . $new_filename; $target_file = $target_dir . $new_filename;
// Move the image file to the target location // Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) { if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ; uploadLog("Failed to save image to target file: $target_file", 'ERROR');
jsonError("Failed to save image");
exit; exit;
} }
// Store additional information (modify based on your needs) // Resolve dynamic URL
$image_url = $target_dir . $new_filename; // Update if needed $host = $_SERVER['HTTP_HOST'] ?? 'api.siromove.com';
$image_details = [ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
"name" => $image_name, $image_url = "$protocol://$host/siro/EgyptDocuments/egypt/idFront/" . $new_filename;
"size" => $image_size,
"extension" => $image_extension, uploadLog("✅ Egypt ID front uploaded successfully. URL: $image_url");
printSuccess([
"status" => "success",
"url" => $image_url, "url" => $image_url,
]; "file_link" => $image_url,
"image_url" => $image_url
// Use the image details for further processing (e.g., display, store in database) ]);
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?> ?>

View File

@@ -46,7 +46,9 @@ if (!move_uploaded_file($file['tmp_name'], $uploadPath)) {
exit; exit;
} }
$imageUrl = "https://intaleq.xyz/siro/auth/uploads/documents/" . $uniqueName ; $host = $_SERVER['HTTP_HOST'] ?? 'api-syria.siromove.com';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$imageUrl = "$protocol://$host/siro/auth/uploads/documents/" . $uniqueName ;
$imageData = file_get_contents($uploadPath); $imageData = file_get_contents($uploadPath);
$imageBase64 = base64_encode($imageData); $imageBase64 = base64_encode($imageData);
@@ -196,7 +198,7 @@ EOT
$prompt = $prompts[$type] ?? $prompts["id_front_sy"]; $prompt = $prompts[$type] ?? $prompts["id_front_sy"];
$apiKey = getenv("GEMINI_API_KEY"); $apiKey = getenv("GEMINI_API_KEY");
$apiURL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite:generateContent?key=$apiKey"; $apiURL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-lite-latest:generateContent?key=$apiKey";
$headers = ["Content-Type: application/json"]; $headers = ["Content-Type: application/json"];
$payload = [ $payload = [

View File

@@ -6,6 +6,8 @@
require_once __DIR__ . '/../../connect.php'; require_once __DIR__ . '/../../connect.php';
uploadLog("🚀 [uploadDocSyria.php] Document upload script started.");
$driverId = trim((string) filterRequest("driver_id")); $driverId = trim((string) filterRequest("driver_id"));
$type = trim((string) filterRequest("type")); $type = trim((string) filterRequest("type"));
@@ -13,8 +15,23 @@ $type = trim((string) filterRequest("type"));
if ($driverId === "") { $driverId = "unknown"; } if ($driverId === "") { $driverId = "unknown"; }
if ($type === "") { $type = "generic"; } if ($type === "") { $type = "generic"; }
uploadLog("📥 Request parameters: driver_id=$driverId, type=$type");
// ✅ التحقق من ملف الصورة // ✅ التحقق من ملف الصورة
if (isset($_FILES['image'])) {
uploadLog("$_FILES['image'] metadata", 'INFO', [
'name' => $_FILES['image']['name'] ?? 'unknown',
'type' => $_FILES['image']['type'] ?? 'unknown',
'size' => $_FILES['image']['size'] ?? 0,
'upload_error_code' => $_FILES['image']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'image' file was sent in the request.", 'WARNING');
}
if (!isset($_FILES['image']) || $_FILES['image']['error'] !== UPLOAD_ERR_OK) { if (!isset($_FILES['image']) || $_FILES['image']['error'] !== UPLOAD_ERR_OK) {
$err = $_FILES['image']['error'] ?? 'missing_file';
uploadLog("❌ File upload validation failed. Code: $err", 'ERROR');
error_log("Upload error: Image not provided or upload failed."); error_log("Upload error: Image not provided or upload failed.");
jsonError("Image upload failed"); jsonError("Image upload failed");
exit; exit;
@@ -26,6 +43,7 @@ $file = $_FILES['image'];
$allowedExt = ['jpg', 'jpeg', 'png']; $allowedExt = ['jpg', 'jpeg', 'png'];
$extension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)); $extension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($extension, $allowedExt, true)) { if (!in_array($extension, $allowedExt, true)) {
uploadLog("❌ Unsupported file extension: $extension", 'ERROR');
error_log("Unsupported file extension: $extension"); error_log("Unsupported file extension: $extension");
jsonError("Unsupported file type"); jsonError("Unsupported file type");
exit; exit;
@@ -91,7 +109,7 @@ $publicPath = "/siro/auth/uploads/documents/" . $uniqueName;
$imageUrl = rtrim(BASE_URL, '/') . $publicPath; $imageUrl = rtrim(BASE_URL, '/') . $publicPath;
// ✅ نتيجة نهائية: فقط رابط الصورة وبعض البيانات المفيدة // ✅ نتيجة نهائية: فقط رابط الصورة وبعض البيانات المفيدة
uploadLog("✅ Document upload succeeded. URL: $imageUrl");
printSuccess([ printSuccess([
$imageUrl, $imageUrl,
]); ]);

View File

@@ -16,8 +16,9 @@ try {
exit; exit;
} }
/* ================== General Settings ================== */ $host = $_SERVER['HTTP_HOST'] ?? 'api-syria.siromove.com';
$PUBLIC_BASE = "https://intaleq.xyz/driver_docs"; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$PUBLIC_BASE = "$protocol://$host/siro/auth/uploads/documents";
/* ================== 1) Input Fields ================== */ /* ================== 1) Input Fields ================== */
$raw_first_name = null; $raw_first_name = null;
@@ -38,8 +39,12 @@ try {
// vehicle_category_id, fuel_type_id // vehicle_category_id, fuel_type_id
$docKeys = [ $docKeys = [
'driver_license_front', 'id_front',
'id_back',
'driver_license',
'driver_license_back', 'driver_license_back',
'profile_picture',
'criminal_record',
'car_license_front', 'car_license_front',
'car_license_back' 'car_license_back'
]; ];
@@ -63,6 +68,7 @@ try {
} }
/* ================== 🟢 START PHONE FORMATTING LOGIC 🟢 ================== */ /* ================== 🟢 START PHONE FORMATTING LOGIC 🟢 ================== */
$country = 'Syria'; // Default
if (!empty($data['phone'])) { if (!empty($data['phone'])) {
$phone = $data['phone']; $phone = $data['phone'];
@@ -70,7 +76,14 @@ try {
$phone = preg_replace('/[ \-\(\)\+]/', '', $phone); $phone = preg_replace('/[ \-\(\)\+]/', '', $phone);
$phone = trim($phone); $phone = trim($phone);
// 2. توحيد البادئات الدولية if (strpos($phone, '962') === 0 || strpos($phone, '00962') === 0) {
if (strpos($phone, '00962') === 0) $phone = substr($phone, 2);
$country = 'Jordan';
} elseif (strpos($phone, '20') === 0 || strpos($phone, '0020') === 0) {
if (strpos($phone, '0020') === 0) $phone = substr($phone, 2);
$country = 'Egypt';
} else {
// 2. توحيد البادئات الدولية (سوريا)
if (strpos($phone, '00963') === 0) { if (strpos($phone, '00963') === 0) {
$phone = substr($phone, 2); $phone = substr($phone, 2);
} elseif (strpos($phone, '0963') === 0) { } elseif (strpos($phone, '0963') === 0) {
@@ -102,7 +115,7 @@ try {
$phone = '9639' . substr($phone, 3); $phone = '9639' . substr($phone, 3);
} }
} }
}
$data['phone'] = $phone; $data['phone'] = $phone;
} }
/* ================== 🔴 END PHONE FORMATTING LOGIC 🔴 ================== */ /* ================== 🔴 END PHONE FORMATTING LOGIC 🔴 ================== */
@@ -131,6 +144,7 @@ try {
$docUrls = []; $docUrls = [];
foreach ($docKeys as $k) { foreach ($docKeys as $k) {
$u = filterRequest($k); $u = filterRequest($k);
if (($k === 'driver_license_back' || $k === 'criminal_record') && ($u === null || $u === '')) continue;
if ($u === null || $u === '') { if ($u === null || $u === '') {
jsonError("Missing document URL: $k"); jsonError("Missing document URL: $k");
exit; exit;
@@ -142,6 +156,149 @@ try {
$docUrls[$k] = $u; $docUrls[$k] = $u;
} }
/* ================== AI PROCESSING START ================== */
$apiKey = getenv("GEMINI_API_KEY");
if ($apiKey) {
$promptBase = '
You are a highly secure AI Assistant specialized in analyzing identification and driver documents.
Country Context: ' . ($country ?? 'Syria') . '
### TASK
We are providing you with multiple images representing a driver\'s documents (National ID, Driver License, Profile Picture, Criminal Record, and Car Registration).
Extract all the required data accurately according to the exact schema provided, and perform a FACE MATCHING analysis.
Since the driver may be from Jordan, Egypt, or Syria, the layout, fields, and distribution of information between the front and back of each card varies widely by country.
Therefore, do NOT assume a specific field is on the front or the back of a card. You must scan all provided document images (e.g., both ID images, both license images) and intelligently locate the requested fields wherever they appear on the cards.
### RULES
1. Convert any Eastern-Arabic digits (٠١٢٣٤٥٦٧٨٩) to Western digits (0-9).
2. Dates must be formatted as ISO `YYYY-MM-DD`.
3. Smart Extraction: Scan all provided document images without restriction. Do not fail the overall request if some optional fields (like governorate or address or issue dates) are missing or unreadable on the card. Simply set those specific fields to `null` in the JSON, but do NOT set the overall status to failure. Overall status should only be \'failure\' if there is a critical security/authenticity issue (e.g., face mismatch, fake/forged documents, or missing primary driver identity).
4. FACE MATCHING (CRITICAL): Compare the face in the "Profile Picture" with the photos on the "National ID" and "Driver License".
5. Ensure the Criminal/Non-Conviction record is valid and matches the driver\'s name.
6. The `national_number` and `vin` (chassis) must contain Latin digits/characters only.
7. Normalize color names (e.g. "أبيض" -> "White") and provide a matching Hex code (e.g. "#FFFFFF").
8. Do NOT add markdown formatting around the output. Return ONLY raw JSON.
### REQUIRED JSON OUTPUT FORMAT
{
"status": "success|failure",
"reason": "If failure, state the reason (e.g., Face mismatch, blurry, invalid record)",
"face_match_confidence": "high|low",
"driver": {
"full_name": "", // Full name in Arabic
"national_number": "", // National ID/National number (Latin digits)
"dob": "YYYY-MM-DD", // Date of birth
"address": "", // Full address
"governorate": "", // Governorate/Site/City
"gender": "Male|Female", // Gender
"id_issue_date": "YYYY-MM-DD", // National ID issue date
"license_issue_date": "YYYY-MM-DD", // Driver license issue date
"license_expiry_date": "YYYY-MM-DD", // Driver license expiry date
"license_number": "", // Driver license number
"license_category": "", // License category (e.g., D1, B, Private, Public)
"blood_type": "", // Blood type (e.g., A+, O-)
"civil_registry": "", // Civil registry/Place of registration
"birth_place": "" // Place of birth
},
"car": {
"car_plate": "", // Full car plate (e.g., 155186 درعا)
"owner": "", // Owner full name
"vin": "", // Chassis/VIN number
"color": "", // Color name
"color_hex": "", // Color hex code (e.g., #FFFFFF)
"car_issue_date": "YYYY-MM-DD", // Car registration issue date
"inspection_date": "YYYY-MM-DD", // Car next inspection date
"make": "", // Car Make (e.g., Hyundai)
"model": "", // Car Model (e.g., H1)
"year": "", // Manufacturing year (e.g., 2019)
"fuel": "" // Fuel type (e.g., Petrol, Diesel, Electric)
}
}';
$contents = [
["role" => "user", "parts" => [["text" => $promptBase]]]
];
foreach ($docUrls as $key => $url) {
$imgData = @file_get_contents($url);
if ($imgData !== false) {
$base64 = base64_encode($imgData);
$ext = strtolower(pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION));
$mime = ($ext === 'png') ? 'image/png' : 'image/jpeg';
$contents[0]["parts"][] = ["text" => "Image type: " . $key];
$contents[0]["parts"][] = ["inlineData" => ["mimeType" => $mime, "data" => $base64]];
}
}
$apiURL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-lite-latest:generateContent?key=$apiKey";
$payload = ["contents" => $contents];
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
curl_close($ch);
if ($response) {
$aiData = json_decode($response, true);
$textRaw = $aiData['candidates'][0]['content']['parts'][0]['text'] ?? '';
$textRaw = trim(preg_replace('/```json|```/', '', $textRaw));
$json = json_decode($textRaw, true);
if ($json && isset($json['status']) && strtolower($json['status']) === 'failure') {
jsonError("AI Verification Failed: " . ($json['reason'] ?? 'Unknown reason'));
exit;
}
if ($json && isset($json['driver'])) {
$ex = $json['driver'];
if (!empty($ex['full_name'])) {
$data['name_arabic'] = $ex['full_name'];
$parts = explode(' ', trim($ex['full_name']));
if (count($parts) >= 2) {
$data['first_name'] = $parts[0];
$data['last_name'] = implode(' ', array_slice($parts, 1));
} else {
$data['first_name'] = $ex['full_name'];
$data['last_name'] = '';
}
}
if (!empty($ex['national_number'])) $data['national_number'] = $ex['national_number'];
if (!empty($ex['dob'])) {
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $ex['dob'])) {
$data['birthdate'] = $ex['dob'];
} elseif (preg_match('/^\d{4}$/', $ex['dob'])) {
$data['birthdate'] = $ex['dob'] . '-01-01';
}
}
if (!empty($ex['address'])) $data['address'] = $ex['address'];
if (!empty($ex['governorate'])) $data['site'] = $ex['governorate'];
if (!empty($ex['gender'])) $data['gender'] = $ex['gender'];
if (!empty($ex['id_issue_date'])) $data['issue_date'] = $ex['id_issue_date'];
if (!empty($ex['license_issue_date'])) $data['licenseIssueDate'] = $ex['license_issue_date'];
if (!empty($ex['license_expiry_date'])) $data['expiry_date'] = $ex['license_expiry_date'];
if (!empty($ex['license_category'])) $data['license_categories'] = $ex['license_category'];
// Not mapped directly in basic DB schema but extracted: blood_type, civil_registry, birth_place
}
if ($json && isset($json['car'])) {
$ex = $json['car'];
if (!empty($ex['car_plate'])) $car['car_plate'] = $ex['car_plate'];
if (!empty($ex['make'])) $car['make'] = $ex['make'];
if (!empty($ex['model'])) $car['model'] = $ex['model'];
if (!empty($ex['year'])) $car['year'] = $ex['year'];
if (!empty($ex['color'])) $car['color'] = $ex['color'];
if (!empty($ex['color_hex'])) $car['color_hex'] = $ex['color_hex'];
if (!empty($ex['vin'])) $car['vin'] = $ex['vin'];
if (!empty($ex['owner'])) $car['owner'] = $ex['owner'];
if (!empty($ex['fuel'])) $car['fuel'] = $ex['fuel'];
}
}
}
/* ================== AI PROCESSING END ================== */
/* ================== 2) Generate default id/email ================== */ /* ================== 2) Generate default id/email ================== */
if (empty($data['id'])) { if (empty($data['id'])) {
$data['id'] = 'DRV' . date('YmdHis') . random_int(1000, 9999); $data['id'] = 'DRV' . date('YmdHis') . random_int(1000, 9999);
@@ -320,6 +477,7 @@ $pwdHashed = password_hash($rawSecret, PASSWORD_DEFAULT);
"); ");
foreach ($docKeys as $k) { foreach ($docKeys as $k) {
if (!isset($docUrls[$k])) continue;
$url = $docUrls[$k]; $url = $docUrls[$k];
$name = basename(parse_url($url, PHP_URL_PATH) ?? ''); $name = basename(parse_url($url, PHP_URL_PATH) ?? '');
if ($name === '') { $name = $k . '_' . time() . '.jpg'; } if ($name === '') { $name = $k . '_' . time() . '.jpg'; }
@@ -330,6 +488,18 @@ $pwdHashed = password_hash($rawSecret, PASSWORD_DEFAULT);
':image_name' => $name, ':image_name' => $name,
':link' => $url, ':link' => $url,
]); ]);
if ($k === 'profile_picture') {
$insProfile = $con->prepare("
INSERT INTO imageProfileCaptain (driverID, image_name, link)
VALUES (:driverID, :image_name, :link)
");
$insProfile->execute([
':driverID' => $driverID,
':image_name' => $name,
':link' => $url,
]);
}
} }
/* ================== 10) Commit ================== */ /* ================== 10) Commit ================== */

View File

@@ -10,12 +10,17 @@ const MAX_FILE_MB = 5;
const ALLOWED_MIMES = ['image/jpeg','image/png','image/webp']; // فقط صور const ALLOWED_MIMES = ['image/jpeg','image/png','image/webp']; // فقط صور
const UPLOAD_ROOT = __DIR__ . "/../../private_uploads"; // مجلد خاص (غير عام) const UPLOAD_ROOT = __DIR__ . "/../../private_uploads"; // مجلد خاص (غير عام)
const SIGN_SECRET = getenv('SECRET_KEY_HMAC'); // غيّرها واقرأها من .env const SIGN_SECRET = getenv('SECRET_KEY_HMAC'); // غيّرها واقرأها من .env
const PUBLIC_BASE = 'https://syria.intaleq.xyz/siro'; // الدومين العلني $host = $_SERVER['HTTP_HOST'] ?? 'api-syria.siromove.com';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
define('PUBLIC_BASE', "$protocol://$host/siro");
const SIGNED_TTL_SEC = 172800; // 2 days = 60*60*24 const SIGNED_TTL_SEC = 172800; // 2 days = 60*60*24
// أنشئ مجلد الرفع إن لم يكن موجودًا // أنشئ مجلد الرفع إن لم يكن موجودًا
if (!is_dir(UPLOAD_ROOT)) { @mkdir(UPLOAD_ROOT, 0700, true); } if (!is_dir(UPLOAD_ROOT)) { @mkdir(UPLOAD_ROOT, 0700, true); }
// Log entry
uploadLog("🚀 [uploadSyrianDocs.php] Document upload script started.");
// (اختياري) هيدرز أمان // (اختياري) هيدرز أمان
$authHeader = $_SERVER['HTTP_AUTHORIZATION'] ?? ''; $authHeader = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
$hmacHeader = $_SERVER['HTTP_X_HMAC_AUTH'] ?? ''; $hmacHeader = $_SERVER['HTTP_X_HMAC_AUTH'] ?? '';
@@ -26,7 +31,10 @@ $driverId = filterRequest('driver_id');
$docType = filterRequest('doc_type'); $docType = filterRequest('doc_type');
$purpose = filterRequest('purpose'); // اختياري $purpose = filterRequest('purpose'); // اختياري
uploadLog("📥 Request params: driver_id=$driverId, doc_type=$docType");
if (empty($driverId) || empty($docType)) { if (empty($driverId) || empty($docType)) {
uploadLog("❌ Missing driver_id or doc_type params.", 'ERROR');
jsonError("driver_id and doc_type are required."); jsonError("driver_id and doc_type are required.");
exit; exit;
} }
@@ -39,12 +47,26 @@ $allowedDocTypes = [
'car_license_back', 'car_license_back',
]; ];
if (!in_array($docType, $allowedDocTypes, true)) { if (!in_array($docType, $allowedDocTypes, true)) {
uploadLog("❌ Invalid doc_type value: $docType", 'ERROR');
jsonError("Invalid doc_type."); jsonError("Invalid doc_type.");
exit; exit;
} }
// --------- التحقق من الملف --------- // --------- التحقق من الملف ---------
if (isset($_FILES['file'])) {
uploadLog("$_FILES['file'] metadata", 'INFO', [
'name' => $_FILES['file']['name'] ?? 'unknown',
'type' => $_FILES['file']['type'] ?? 'unknown',
'size' => $_FILES['file']['size'] ?? 0,
'upload_error_code' => $_FILES['file']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'file' payload was sent in the request.", 'WARNING');
}
if (!isset($_FILES['file']) || $_FILES['file']['error'] !== UPLOAD_ERR_OK) { if (!isset($_FILES['file']) || $_FILES['file']['error'] !== UPLOAD_ERR_OK) {
$err = $_FILES['file']['error'] ?? 'missing_file';
uploadLog("❌ File upload validation failed. Code: $err", 'ERROR');
jsonError("No file uploaded or upload error."); jsonError("No file uploaded or upload error.");
exit; exit;
} }
@@ -116,6 +138,7 @@ $fileUrl = PUBLIC_BASE . "/secure_image.php"
. "&signature={$signature}"; . "&signature={$signature}";
// --------- استجابة --------- // --------- استجابة ---------
uploadLog("✅ Document upload succeeded. URL: $fileUrl");
printSuccess([ printSuccess([
"status" => "success", "status" => "success",
"success_file" => true, "success_file" => true,

View File

@@ -172,6 +172,42 @@ function appLog(string $message, string $level = 'INFO'): void
@error_log($entry . PHP_EOL, 3, $logDir . '/app.log'); @error_log($entry . PHP_EOL, 3, $logDir . '/app.log');
} }
function uploadLog(string $message, string $level = 'INFO', array $context = []): void
{
$logDir = __DIR__ . '/../logs';
if (!is_dir($logDir)) {
@mkdir($logDir, 0777, true);
}
if (!isset($context['ip'])) {
$context['ip'] = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
}
if (!isset($context['user_agent'])) {
$context['user_agent'] = $_SERVER['HTTP_USER_AGENT'] ?? 'unknown';
}
if (isset($context['upload_error_code'])) {
$errCode = $context['upload_error_code'];
$context['upload_error_desc'] = match ($errCode) {
UPLOAD_ERR_OK => 'UPLOAD_ERR_OK (0): No error, file uploaded successfully.',
UPLOAD_ERR_INI_SIZE => 'UPLOAD_ERR_INI_SIZE (1): The uploaded file exceeds the upload_max_filesize directive in php.ini.',
UPLOAD_ERR_FORM_SIZE => 'UPLOAD_ERR_FORM_SIZE (2): The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
UPLOAD_ERR_PARTIAL => 'UPLOAD_ERR_PARTIAL (3): The uploaded file was only partially uploaded (common on weak/3G networks).',
UPLOAD_ERR_NO_FILE => 'UPLOAD_ERR_NO_FILE (4): No file was uploaded.',
UPLOAD_ERR_NO_TMP_DIR => 'UPLOAD_ERR_NO_TMP_DIR (6): Missing a temporary folder.',
UPLOAD_ERR_CANT_WRITE => 'UPLOAD_ERR_CANT_WRITE (7): Failed to write file to disk.',
UPLOAD_ERR_EXTENSION => 'UPLOAD_ERR_EXTENSION (8): A PHP extension stopped the file upload.',
default => "Unknown upload error code: $errCode",
};
}
$entry = date('Y-m-d H:i:s') . " [$level] " . $message;
if ($context) {
$entry .= ' | ' . json_encode($context, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
@error_log($entry . PHP_EOL, 3, $logDir . '/upload.log');
}
function debugLog(string $message): void function debugLog(string $message): void
{ {
appLog($message, 'DEBUG'); appLog($message, 'DEBUG');

View File

@@ -4,15 +4,31 @@ require_once __DIR__ . '/../../functions.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
uploadLog("🚀 [ride/card-image-driver/add.php] Card image upload started.");
try { try {
$con = Database::get('main'); $con = Database::get('main');
} catch (Exception $e) { } catch (Exception $e) {
uploadLog("❌ DB Connection failed: " . $e->getMessage(), 'ERROR');
http_response_code(500); http_response_code(500);
echo json_encode(['status' => 'Database connection failed.']); echo json_encode(['status' => 'Database connection failed.']);
exit; exit;
} }
if (isset($_FILES['image'])) {
uploadLog("$_FILES['image'] metadata", 'INFO', [
'name' => $_FILES['image']['name'] ?? 'unknown',
'type' => $_FILES['image']['type'] ?? 'unknown',
'size' => $_FILES['image']['size'] ?? 0,
'upload_error_code' => $_FILES['image']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'image' file was sent in request.", 'WARNING');
}
if (!isset($_FILES['image']) || $_FILES['image']['error'] != UPLOAD_ERR_OK) { if (!isset($_FILES['image']) || $_FILES['image']['error'] != UPLOAD_ERR_OK) {
$err = $_FILES['image']['error'] ?? 'missing_file';
uploadLog("❌ File upload validation failed. Code: $err", 'ERROR');
echo json_encode(['status' => 'The image file was not uploaded successfully.']); echo json_encode(['status' => 'The image file was not uploaded successfully.']);
exit; exit;
} }
@@ -21,6 +37,7 @@ $image_file = $_FILES['image'];
$driverID = filterRequest("driver_id"); $driverID = filterRequest("driver_id");
if (empty($driverID)) { if (empty($driverID)) {
uploadLog("❌ Missing driver_id parameter.", 'ERROR');
echo json_encode(['status' => 'Missing driver ID.']); echo json_encode(['status' => 'Missing driver ID.']);
exit; exit;
} }
@@ -58,7 +75,9 @@ if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
exit; exit;
} }
$linlImage = 'https://ride.mobile-app.store/card_image/' . $new_filename; $host = $_SERVER['HTTP_HOST'] ?? 'ride.mobile-app.store';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$linlImage = "$protocol://$host/siro/card_image/" . $new_filename;
try { try {
// استخدام Prepared Statements للحماية من الحقن (SQL Injection) // استخدام Prepared Statements للحماية من الحقن (SQL Injection)
@@ -73,6 +92,7 @@ try {
':driver_id' => $driverID ':driver_id' => $driverID
]); ]);
uploadLog("✅ Card image updated successfully for driver_id: $driverID, URL: $linlImage");
echo json_encode(['status' => 'Record updated successfully']); echo json_encode(['status' => 'Record updated successfully']);
} else { } else {
$insertStmt = $con->prepare("INSERT INTO card_images (id, driver_id, image_name, link) VALUES (SHA2(UUID(), 256), :driver_id, :image_name, :link)"); $insertStmt = $con->prepare("INSERT INTO card_images (id, driver_id, image_name, link) VALUES (SHA2(UUID(), 256), :driver_id, :image_name, :link)");
@@ -82,9 +102,11 @@ try {
':link' => $linlImage ':link' => $linlImage
]); ]);
uploadLog("✅ Card image inserted successfully for driver_id: $driverID, URL: $linlImage");
echo json_encode(['status' => 'Record inserted successfully']); echo json_encode(['status' => 'Record inserted successfully']);
} }
} catch (PDOException $e) { } catch (PDOException $e) {
uploadLog("❌ Database error: " . $e->getMessage(), 'ERROR');
error_log("Database Error in card-image-driver/add.php: " . $e->getMessage()); error_log("Database Error in card-image-driver/add.php: " . $e->getMessage());
echo json_encode(['status' => 'Database operation failed.']); echo json_encode(['status' => 'Database operation failed.']);
} }

View File

@@ -6,17 +6,30 @@
require_once __DIR__ . '/connect.php'; // يفترض أنه يستدعي core/bootstrap.php require_once __DIR__ . '/connect.php'; // يفترض أنه يستدعي core/bootstrap.php
appLog("🚀 [upload_profile_image.php] بدأ تنفيذ سكربت رفع الصورة"); uploadLog("🚀 [uploadImagePortrate.php] Profile image upload script execution started.");
try { try {
// Check if $_FILES has errors
if (isset($_FILES['image'])) {
uploadLog("$_FILES['image'] metadata", 'INFO', [
'name' => $_FILES['image']['name'] ?? 'unknown',
'type' => $_FILES['image']['type'] ?? 'unknown',
'size' => $_FILES['image']['size'] ?? 0,
'upload_error_code' => $_FILES['image']['error'] ?? UPLOAD_ERR_OK
]);
} else {
uploadLog("No 'image' file was sent in the request.", 'WARNING');
}
// 1. Rate Limiting للرفع // 1. Rate Limiting للرفع
$limiter = new RateLimiter($redis); $limiter = new RateLimiter($redis);
$limiter->enforce(RateLimiter::identifier($user_id ?? null), 'upload'); $limiter->enforce(RateLimiter::identifier($user_id ?? null), 'upload');
$driverID = filterRequest("driverID"); $driverID = filterRequest("driverID");
appLog("📥 Received driverID: $driverID"); uploadLog("📥 Received driverID: $driverID");
if (empty($driverID)) { if (empty($driverID)) {
uploadLog("❌ Driver ID is missing.", 'ERROR');
jsonError('Driver ID is required.', 400); jsonError('Driver ID is required.', 400);
} }
@@ -25,16 +38,18 @@ try {
$uploadResult = uploadImageSecure('image', $target_dir, $driverID); $uploadResult = uploadImageSecure('image', $target_dir, $driverID);
if (!$uploadResult['success']) { if (!$uploadResult['success']) {
uploadLog("❌ Image upload failed", 'ERROR', ['driverID' => $driverID, 'error' => $uploadResult['error']]);
securityLog("❌ Image upload failed", ['driverID' => $driverID, 'error' => $uploadResult['error']]); securityLog("❌ Image upload failed", ['driverID' => $driverID, 'error' => $uploadResult['error']]);
jsonError($uploadResult['error'], 400); jsonError($uploadResult['error'], 400);
} }
$new_filename = $uploadResult['filename']; $new_filename = $uploadResult['filename'];
appLog("✅ File moved successfully to: " . $uploadResult['path']); uploadLog("✅ File moved successfully to: " . $uploadResult['path']);
// 3. تحديث قاعدة البيانات // 3. تحديث قاعدة البيانات ديناميكياً
$linkImage = 'https://api.intaleq.xyz/siro_v3/portrate_captain_image/' . $new_filename; $host = $_SERVER['HTTP_HOST'] ?? 'api.siromove.com';
$uploadDate = date("Y-m-d H:i:s"); $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$linkImage = "$protocol://$host/siro/portrate_captain_image/" . $new_filename;
// تأكد من أن الاتصال قادم من connect.php أو اجلبه // تأكد من أن الاتصال قادم من connect.php أو اجلبه
$con = Database::get('main'); $con = Database::get('main');
@@ -48,7 +63,6 @@ try {
// تحديث // تحديث
$updateSQL = "UPDATE imageProfileCaptain SET image_name = ?, link = ? WHERE driverID = ?"; $updateSQL = "UPDATE imageProfileCaptain SET image_name = ?, link = ? WHERE driverID = ?";
$updateStmt = $con->prepare($updateSQL); $updateStmt = $con->prepare($updateSQL);
// Note: imageProfileCaptain doesn't seem to have 'upload_date' in the original insert, but let's check if we should add it. Let's just update image_name and link as in the insert statement.
$success = $updateStmt->execute([$new_filename, $linkImage, $driverID]); $success = $updateStmt->execute([$new_filename, $linkImage, $driverID]);
} else { } else {
// إدخال جديد // إدخال جديد
@@ -58,10 +72,10 @@ try {
} }
if ($success) { if ($success) {
appLog("✅ Record updated for driverID: $driverID"); uploadLog("✅ Record updated for driverID: $driverID, Link: $linkImage");
jsonSuccess(['file_link' => $linkImage], 'Record updated successfully.'); jsonSuccess(['file_link' => $linkImage], 'Record updated successfully.');
} else { } else {
appLog("❌ Failed to update DB record for driverID: $driverID"); uploadLog("❌ Failed to update DB record for driverID: $driverID", 'ERROR');
jsonError('Failed to update record.', 500); jsonError('Failed to update record.', 500);
} }

View File

@@ -51,8 +51,10 @@ if (!move_uploaded_file($audio_file['tmp_name'], $target_file)) {
exit; exit;
} }
// Construct the link to the uploaded audio file // Construct the link to the uploaded audio file dynamically
$base_url = 'https://api.intaleq.xyz/siro_v3/upload_audio/'; // Updated to match Siro V3 $host = $_SERVER['HTTP_HOST'] ?? 'api.siromove.com';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$base_url = "$protocol://$host/siro/upload_audio/";
$linkAudio = $base_url . $new_filename; $linkAudio = $base_url . $new_filename;

View File

@@ -1,6 +1,6 @@
import '../env/env.dart'; import '../env/env.dart';
import '../main.dart';
class AppLink { import 'box_name.dart';class AppLink {
static String seferPaymentServer = static String seferPaymentServer =
'https://walletintaleq.intaleq.xyz/v1/main'; 'https://walletintaleq.intaleq.xyz/v1/main';
static final String tripzPaymentServer0 = seferPaymentServer; static final String tripzPaymentServer0 = seferPaymentServer;
@@ -11,15 +11,64 @@ class AppLink {
// static final String endPoint = box.read(BoxName.serverChosen); // static final String endPoint = box.read(BoxName.serverChosen);
// static final String server = Env.seferCairoServer; // static final String server = Env.seferCairoServer;
static final String server = 'https://api.intaleq.xyz/siro_v3'; static String get currentCountry => box.read('countryCode') ?? 'Jordan';
static final String endPoint = 'https://api.intaleq.xyz/siro_v3';
static final String syria = 'https://syria.intaleq.xyz/siro'; static String get server {
static String paymentServer = 'https://walletintaleq.intaleq.xyz/v1/main'; switch (currentCountry) {
static String locationServer = 'https://location.intaleq.xyz/siro/ride/location'; case 'Syria': return 'https://api-syria.siromove.com/siro_v3';
static String locationServerSide = 'https://location.intaleq.xyz/siro/ride/location'; case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3';
static String mapSaasRoute = 'https://map-saas.intaleqapp.com/api/maps/route'; case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3';
static String mapSaasPlaces = 'https://map-saas.intaleqapp.com/api/geocoding/places'; default: return 'https://api.siromove.com/siro_v3';
static const String routeApiBaseUrl = "https://routesjo.intaleq.xyz/route/v1/driving"; }
}
static String get endPoint => server;
static String get syria => 'https://api-syria.siromove.com/siro';
static String get paymentServer {
switch (currentCountry) {
case 'Syria': return 'https://wallet-syria.siromove.com/v1/main';
case 'Egypt': return 'https://wallet-egypt.siromove.com/v1/main';
case 'Jordan': return 'https://wallet-jordan.siromove.com/v1/main';
default: return 'https://wallet.siromove.com/v1/main';
}
}
static String get locationServer {
switch (currentCountry) {
case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
case 'Jordan': return 'https://location-jordan.siromove.com/siro/ride/location';
default: return 'https://location.siromove.com/siro/ride/location';
}
}
static String get locationServerSide => locationServer;
static String get mapSaasRoute {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/maps/route';
case 'Egypt': return 'https://map-egypt.siromove.com/api/maps/route';
case 'Jordan': return 'https://map-jordan.siromove.com/api/maps/route';
default: return 'https://map-saas.intaleqapp.com/api/maps/route';
}
}
static String get mapSaasPlaces {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/places';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/places';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/places';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/places';
}
}
static String get routeApiBaseUrl {
switch (currentCountry) {
case 'Syria': return 'https://routes-syria.siromove.com/route/v1/driving';
case 'Egypt': return 'https://routes-egypt.siromove.com/route/v1/driving';
case 'Jordan': return 'https://routes-jordan.siromove.com/route/v1/driving';
default: return 'https://routes.siromove.com/route/v1/driving';
}
}
static String loginJwtDriver = static String loginJwtDriver =
"https://api.intaleq.xyz/siro/loginAdmin.php"; "https://api.intaleq.xyz/siro/loginAdmin.php";
//============================= //=============================

View File

@@ -20,6 +20,7 @@ import '../../views/widgets/elevated_btn.dart';
import '../functions/encrypt_decrypt.dart'; import '../functions/encrypt_decrypt.dart';
import '../notification_controller.dart'; import '../notification_controller.dart';
import 'local_notification.dart'; import 'local_notification.dart';
import 'notification_service.dart';
import 'token_access.dart'; import 'token_access.dart';
class FirebaseMessagesController extends GetxController { class FirebaseMessagesController extends GetxController {
@@ -364,66 +365,6 @@ class FirebaseMessagesController extends GetxController {
// )); // ));
// } // }
void sendNotificationAll(String title, body) async {
// Get the token you want to subtract.
String token = box.read(BoxName.tokenFCM);
tokens = box.read(BoxName.tokens);
// Subtract the token from the list of tokens.
tokens.remove(token);
// Save the list of tokens back to the box.
// box.write(BoxName.tokens, tokens);
tokens = box.read(BoxName.tokens);
for (var i = 0; i < tokens.length; i++) {
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Send the notification
final response = await http
.post(
Uri.parse(
'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'Bearer $accessToken',
},
body: jsonEncode({
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'ding.wav'
},
'priority': 'high',
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
'id': '1',
'status': 'done'
},
'to': tokens[i],
}))
.whenComplete(() {})
.catchError((e) {});
}
}
// for (var i = 0; i < tokens.length; i++) { // for (var i = 0; i < tokens.length; i++) {
// http // http
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'), // .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -452,66 +393,18 @@ class FirebaseMessagesController extends GetxController {
// } // }
//android/app/src/main/res/raw/iphone_ringtone.wav //android/app/src/main/res/raw/iphone_ringtone.wav
late String serviceAccountKeyJson; void sendNotificationAll(String title, body) async {
// Deprecated: Admin panel notifications are sent via NotificationService.
}
void sendNotificationToAnyWithoutData( void sendNotificationToAnyWithoutData(
String title, String body, String token, String tone) async { String title, String body, String token, String tone) async {
try { await NotificationService.sendNotification(
var encryptedKey = Env.privateKeyFCM; target: token,
// Log.print('encryptedKey: ${encryptedKey}'); title: title,
serviceAccountKeyJson = body: body,
EncryptionHelper.instance.decryptData(encryptedKey); category: 'fromAdmin',
// As defined above tone: tone,
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http.post(
Uri.parse(
'https://fcm.googleapis.com/v1/projects/siro-d48a7/messages:send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'Bearer $accessToken',
},
body: jsonEncode({
'message': {
'token': token,
'notification': {
'title': title,
'body': body,
},
'android': {
'notification': {
'sound': tone,
},
},
'apns': {
'payload': {
'aps': {
'sound': tone,
},
},
},
},
}),
); );
if (response.statusCode == 200) {
SnackBar(content: Text('${response.statusCode}'));
print(
'Notification sent successfully. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
} else {
print(
'Failed to send notification. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
}
} catch (e) {
print('Error sending notification: $e');
}
} }
} }

View File

@@ -1,12 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import '../../constant/links.dart';
import '../../print.dart';
class NotificationService { class NotificationService {
// تأكد من أن هذا هو الرابط الصحيح لملف الإرسال // تأكد من أن هذا هو الرابط الصحيح لملف الإرسال
static const String _serverUrl = static String get _serverUrl => '${AppLink.server.replaceAll('_v3', '')}/ride/firebase/send_fcm.php';
'https://syria.intaleq.xyz/siro/fcm/send_fcm.php';
static Future<void> sendNotification({ static Future<void> sendNotification({
required String target, required String target,

View File

@@ -1,53 +1,51 @@
import 'dart:convert'; // import 'dart:convert';
import 'package:googleapis_auth/auth_io.dart';
import '../../print.dart'; // import '../../print.dart';
class AccessTokenManager { // class AccessTokenManager {
static final AccessTokenManager _instance = AccessTokenManager._internal(); // static final AccessTokenManager _instance = AccessTokenManager._internal();
late final String serviceAccountJsonKey; // late final String serviceAccountJsonKey;
AccessToken? _accessToken; // DateTime? _expiryDate;
DateTime? _expiryDate;
AccessTokenManager._internal(); // AccessTokenManager._internal();
factory AccessTokenManager(String jsonKey) { // factory AccessTokenManager(String jsonKey) {
if (_instance._isServiceAccountKeyInitialized()) { // if (_instance._isServiceAccountKeyInitialized()) {
// Prevent re-initialization // // Prevent re-initialization
return _instance; // return _instance;
} // }
_instance.serviceAccountJsonKey = jsonKey; // _instance.serviceAccountJsonKey = jsonKey;
return _instance; // return _instance;
} // }
bool _isServiceAccountKeyInitialized() { // bool _isServiceAccountKeyInitialized() {
try { // try {
serviceAccountJsonKey; // Access to check if initialized // serviceAccountJsonKey; // Access to check if initialized
return true; // return true;
} catch (e) { // } catch (e) {
return false; // return false;
} // }
} // }
Future<String> getAccessToken() async { // Future<String> getAccessToken() async {
if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) { // if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) {
return _accessToken!.data; // return _accessToken!.data;
} // }
try { // try {
final serviceAccountCredentials = ServiceAccountCredentials.fromJson( // final serviceAccountCredentials = ServiceAccountCredentials.fromJson(
json.decode(serviceAccountJsonKey)); // json.decode(serviceAccountJsonKey));
final client = await clientViaServiceAccount( // final client = await clientViaServiceAccount(
serviceAccountCredentials, // serviceAccountCredentials,
['https://www.googleapis.com/auth/firebase.messaging'], // ['https://www.googleapis.com/auth/firebase.messaging'],
); // );
_accessToken = client.credentials.accessToken; // _accessToken = client.credentials.accessToken;
_expiryDate = client.credentials.accessToken.expiry; // _expiryDate = client.credentials.accessToken.expiry;
client.close(); // client.close();
Log.print('_accessToken!.data: ${_accessToken!.data}'); // Log.print('_accessToken!.data: ${_accessToken!.data}');
return _accessToken!.data; // return _accessToken!.data;
} catch (e) { // } catch (e) {
throw Exception('Failed to obtain access token'); // throw Exception('Failed to obtain access token');
} // }
} // }
} // }

View File

@@ -29,12 +29,12 @@ class WalletController extends GetxController {
'driverID': driverID.toString(), 'driverID': driverID.toString(),
}); });
if (res != 'failure') { if (res != 'failure') {
FirebaseMessagesController().sendNotificationToAnyWithoutData( // FirebaseMessagesController().sendNotificationToAnyWithoutData(
"لديك هدية من سفَر".tr, // "لديك هدية من سفَر".tr,
'لقد حصلت على هدية من سفر بقيمة $amount ', // 'لقد حصلت على هدية من سفر بقيمة $amount ',
token, // Access token correctly // token, // Access token correctly
'ding.wav', // 'ding.wav',
); // );
Get.snackbar('success', 'addPaymentToDriver', Get.snackbar('success', 'addPaymentToDriver',
backgroundColor: AppColor.greenColor); backgroundColor: AppColor.greenColor);
} else { } else {

View File

@@ -249,7 +249,8 @@ class CaptainDetailsPage extends StatelessWidget {
borderRadius: BorderRadius.circular(12)), borderRadius: BorderRadius.circular(12)),
), ),
onPressed: () { onPressed: () {
Get.to(() => DriverScorecardPage(driverId: data['id'].toString())); Get.to(
() => DriverScorecardPage(driverId: data['id'].toString()));
}, },
), ),
), ),
@@ -380,11 +381,11 @@ class CaptainDetailsPage extends StatelessWidget {
// Check if key is valid (might be recreated) // Check if key is valid (might be recreated)
if (controller.formCaptainPrizeKey.currentState?.validate() ?? if (controller.formCaptainPrizeKey.currentState?.validate() ??
true) { true) {
FirebaseMessagesController().sendNotificationToAnyWithoutData( // FirebaseMessagesController().sendNotificationToAnyWithoutData(
controller.titleNotify.text, // controller.titleNotify.text,
controller.bodyNotify.text, // controller.bodyNotify.text,
data['passengerToken'] ?? '', // Safety check // data['passengerToken'] ?? '', // Safety check
'order.wav'); // 'order.wav');
Get.back(); Get.back();
Get.snackbar("Success", "Notification Sent", Get.snackbar("Success", "Notification Sent",
backgroundColor: Colors.green.withOpacity(0.2)); backgroundColor: Colors.green.withOpacity(0.2));

View File

@@ -393,11 +393,11 @@ class PassengerDetailsPage extends StatelessWidget {
onPressed: () { onPressed: () {
// Validate form safely // Validate form safely
if (controller.formPrizeKey.currentState?.validate() ?? false) { if (controller.formPrizeKey.currentState?.validate() ?? false) {
FirebaseMessagesController().sendNotificationToAnyWithoutData( // FirebaseMessagesController().sendNotificationToAnyWithoutData(
controller.titleNotify.text, // controller.titleNotify.text,
controller.bodyNotify.text, // controller.bodyNotify.text,
data['passengerToken'], // data['passengerToken'],
'order.wav'); // 'order.wav');
Get.back(); Get.back();
Get.snackbar('Success', 'Notification sent successfully!', Get.snackbar('Success', 'Notification sent successfully!',
backgroundColor: Colors.green.withOpacity(0.2)); backgroundColor: Colors.green.withOpacity(0.2));

View File

@@ -12,7 +12,6 @@ import firebase_crashlytics
import firebase_messaging import firebase_messaging
import flutter_image_compress_macos import flutter_image_compress_macos
import flutter_secure_storage_macos import flutter_secure_storage_macos
import google_sign_in_ios
import local_auth_darwin import local_auth_darwin
import sqflite_darwin import sqflite_darwin
import url_launcher_macos import url_launcher_macos
@@ -25,7 +24,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin")) FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin")) LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@@ -592,62 +592,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.3" version: "6.3.3"
google_identity_services_web:
dependency: transitive
description:
name: google_identity_services_web
sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: d0a2c3bcb06e607bb11e4daca48bd4b6120f0bbc4015ccebbe757d24ea60ed2a
url: "https://pub.dev"
source: hosted
version: "6.3.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: d5e23c56a4b84b6427552f1cf3f98f716db3b1d1a647f16b96dbb5b93afa2805
url: "https://pub.dev"
source: hosted
version: "6.2.1"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: "102005f498ce18442e7158f6791033bbc15ad2dcc0afa4cf4752e2722a516c96"
url: "https://pub.dev"
source: hosted
version: "5.9.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "5f6f79cf139c197261adb6ac024577518ae48fdff8e53205c5373b5f6430a8aa"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: "460547beb4962b7623ac0fb8122d6b8268c951cf0b646dd150d60498430e4ded"
url: "https://pub.dev"
source: hosted
version: "0.12.4+4"
googleapis_auth:
dependency: "direct main"
description:
name: googleapis_auth
sha256: befd71383a955535060acde8792e7efc11d2fccd03dd1d3ec434e85b68775938
url: "https://pub.dev"
source: hosted
version: "1.6.0"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:

View File

@@ -48,7 +48,6 @@ dependencies:
# google_maps_flutter: ^2.6.1 # google_maps_flutter: ^2.6.1
flutter_map: ^7.0.0 # مكتبة OpenStreetMap للفلاتر flutter_map: ^7.0.0 # مكتبة OpenStreetMap للفلاتر
latlong2: ^0.9.1 latlong2: ^0.9.1
google_sign_in: ^6.2.1
http: ^1.0.0 http: ^1.0.0
# image: ^4.1.7 # image: ^4.1.7
image_cropper: ^8.0.2 image_cropper: ^8.0.2
@@ -60,7 +59,6 @@ dependencies:
sqflite: ^2.3.3+1 sqflite: ^2.3.3+1
url_launcher: ^6.2.6 url_launcher: ^6.2.6
# webview_flutter: ^4.7.0 # webview_flutter: ^4.7.0
googleapis_auth: ^1.6.0
firebase_crashlytics: ^4.2.0 firebase_crashlytics: ^4.2.0
flutter_image_compress: ^2.3.0 flutter_image_compress: ^2.3.0
jwt_decoder: ^2.0.1 jwt_decoder: ^2.0.1

View File

@@ -4,31 +4,76 @@ import '../main.dart';
import 'box_name.dart'; import 'box_name.dart';
class AppLink { class AppLink {
static String get serverPHP => box.read('serverPHP'); static String get serverPHP => box.read('serverPHP');
static String get paymentServer {
switch (currentCountry) {
case 'Syria': return 'https://wallet-syria.siromove.com/v1/main';
case 'Egypt': return 'https://wallet-egypt.siromove.com/v1/main';
case 'Jordan': return 'https://wallet-jordan.siromove.com/v1/main';
default: return 'https://wallet.siromove.com/v1/main';
}
}
static String get paymentServer => 'https://walletintaleq.intaleq.xyz/v1/main';
static const String appDomain = 'siromove.com'; static const String appDomain = 'siromove.com';
static String get locationServer => static String get locationServer {
'https://location.intaleq.xyz/siro/ride/location'; switch (currentCountry) {
static String get locationServerSide => case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
'https://location.intaleq.xyz/siro/ride/location'; case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
static String get mapSaasRoute => 'https://map-saas.intaleqapp.com/api/maps/route'; case 'Jordan':
static String get mapSaasPlaces => default: return 'https://location.siromove.com/siro/ride/location';
'https://map-saas.intaleqapp.com/api/geocoding/places'; }
static String get routeApiBaseUrl => }
"https://routesjo.intaleq.xyz/route/v1/driving";
static String get locationServerSide {
switch (currentCountry) {
case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
case 'Jordan':
default: return 'https://location.siromove.com/siro/ride/location';
}
}
static String get mapSaasRoute {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/maps/route';
case 'Egypt': return 'https://map-egypt.siromove.com/api/maps/route';
case 'Jordan': return 'https://map-jordan.siromove.com/api/maps/route';
default: return 'https://map-saas.intaleqapp.com/api/maps/route';
}
}
static String get mapSaasPlaces {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/places';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/places';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/places';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/places';
}
}
static String get routeApiBaseUrl {
switch (currentCountry) {
case 'Syria': return "https://routes-syria.siromove.com/route/v1/driving";
case 'Egypt': return "https://routes-egypt.siromove.com/route/v1/driving";
case 'Jordan': return "https://routes-jordan.siromove.com/route/v1/driving";
default: return "https://routes.siromove.com/route/v1/driving";
}
}
static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan'; static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan';
static String get endPoint { static String get endPoint {
switch (currentCountry) { switch (currentCountry) {
case 'Syria': case 'Syria':
return 'https://api-syria.siromove.com/intaleq_v3'; return 'https://api-syria.siromove.com/siro';
case 'Egypt': case 'Egypt':
return 'https://api-egypt.siromove.com/intaleq_v3'; return 'https://api-egypt.siromove.com/siro';
case 'Jordan': case 'Jordan':
return 'https://api-jordan.siromove.com/siro';
default: default:
return 'https://api-jordan.siromove.com/intaleq_v3'; return 'https://api.siromove.com/siro';
} }
} }
@@ -37,424 +82,463 @@ static String get routeApiBaseUrl =>
///=================ride==========================/// ///=================ride==========================///
///https://api.intaleq.xyz/siro/ride ///https://api.intaleq.xyz/siro/ride
static String get ride => '$server/ride'; static String get ride => '$server/ride';
static String get rideServer => 'https://rides.intaleq.xyz/siro/ride'; static String get rideServer => 'https://rides.intaleq.xyz/siro/ride';
///mapOSM = 'https://routesy.intaleq.xyz' ///mapOSM = 'https://routesy.intaleq.xyz'
static String get mapOSM => 'https://routesy.intaleq.xyz'; static String get mapOSM {
switch (currentCountry) {
case 'Syria': return 'https://routes-syria.siromove.com';
case 'Egypt': return 'https://routes-egypt.siromove.com';
case 'Jordan': return 'https://routes-jordan.siromove.com';
default: return 'https://routes.siromove.com';
}
}
static String get seferCairoServer => endPoint; static String get seferCairoServer => endPoint;
static String get seferGizaServer => static String get seferGizaServer =>
box.read('Giza') ?? box.read(BoxName.serverChosen); box.read('Giza') ?? box.read(BoxName.serverChosen);
static String get seferAlexandriaServer => static String get seferAlexandriaServer =>
box.read('Alexandria') ?? box.read(BoxName.serverChosen); box.read('Alexandria') ?? box.read(BoxName.serverChosen);
// static final String server = Env.serverPHP; // static final String server = Env.serverPHP;
static String get loginJwtDriver => "$server/loginJwtDriver.php"; static String get loginJwtDriver => "$server/loginJwtDriver.php";
static String get loginJwtWalletDriver => "$server/loginJwtWalletDriver.php"; static String get loginJwtWalletDriver => "$server/loginJwtWalletDriver.php";
static String get loginFirstTimeDriver => "$server/loginFirstTimeDriver.php"; static String get loginFirstTimeDriver => "$server/loginFirstTimeDriver.php";
static String get googleMapsLink => 'https://maps.googleapis.com/maps/api/'; static String get googleMapsLink => 'https://maps.googleapis.com/maps/api/';
static String get llama => 'https://api.llama-api.com/chat/completions'; static String get llama => 'https://api.llama-api.com/chat/completions';
static String get gemini => static String get gemini =>
'https://generativelanguage.googleapis.com/v1beta3/models/text-bison-001:generateText'; 'https://generativelanguage.googleapis.com/v1beta3/models/text-bison-001:generateText';
static String get test => "$server/test.php"; static String get test => "$server/test.php";
//===============contact========================== //===============contact==========================
static String get savePhones => "$ride/egyptPhones/add.php"; static String get savePhones => "$ride/egyptPhones/add.php";
static String get savePhonesSyria => "$ride/egyptPhones/syrianAdd.php"; static String get savePhonesSyria => "$ride/egyptPhones/syrianAdd.php";
static String get getPhones => "$ride/egyptPhones/get.php"; static String get getPhones => "$ride/egyptPhones/get.php";
////===============firebase========================== ////===============firebase==========================
static String get getTokens => "$ride/firebase/get.php"; static String get getTokens => "$ride/firebase/get.php";
static String get getDriverToken => "$ride/firebase/getDriverToken.php"; static String get getDriverToken => "$ride/firebase/getDriverToken.php";
static String get addTokens => "$ride/firebase/add.php"; static String get addTokens => "$ride/firebase/add.php";
static String get addTokensDriver => "$ride/firebase/addDriver.php"; static String get addTokensDriver => "$ride/firebase/addDriver.php";
static String get addTokensDriverWallet => static String get addTokensDriverWallet =>
"$paymentServer/ride/firebase/addDriver.php"; "$paymentServer/ride/firebase/addDriver.php";
//=======================Wallet=================== //=======================Wallet===================
static String get wallet => '$paymentServer/ride/passengerWallet'; static String get wallet => '$paymentServer/ride/passengerWallet';
static String get walletDriver => '$paymentServer/ride/driverWallet'; static String get walletDriver => '$paymentServer/ride/driverWallet';
static String get getAllPassengerTransaction => static String get getAllPassengerTransaction =>
"$wallet/getAllPassengerTransaction.php"; "$wallet/getAllPassengerTransaction.php";
static String get payWithMTNConfirm => static String get payWithMTNConfirm =>
"$paymentServer/ride/mtn/driver/confirm_payment.php"; "$paymentServer/ride/mtn/driver/confirm_payment.php";
static String get payWithMTNStart => static String get payWithMTNStart =>
"$paymentServer/ride/mtn/driver/mtn_start.php"; "$paymentServer/ride/mtn/driver/mtn_start.php";
static String get payWithSyriatelConfirm => static String get payWithSyriatelConfirm =>
"$paymentServer/ride/syriatel/driver/confirm_payment.php"; "$paymentServer/ride/syriatel/driver/confirm_payment.php";
static String get payWithSyriatelStart => static String get payWithSyriatelStart =>
"$paymentServer/ride/syriatel/driver/start_payment.php"; "$paymentServer/ride/syriatel/driver/start_payment.php";
static String get createMtnInvoice => "$paymentServer/ride/mtn_new/create_mtn_invoice.php"; static String get createMtnInvoice =>
static String get uploadMtnProof => "$paymentServer/ride/mtn_new/verify_payment_ai.php"; "$paymentServer/ride/mtn_new/create_mtn_invoice.php";
static String get checkMtnStatus => "$paymentServer/ride/mtn_new/check_status.php"; static String get uploadMtnProof =>
"$paymentServer/ride/mtn_new/verify_payment_ai.php";
static String get checkMtnStatus =>
"$paymentServer/ride/mtn_new/check_status.php";
static String get createCliqInvoice => "$paymentServer/ride/cliq/create_cliq_invoice.php"; static String get createCliqInvoice =>
static String get uploadCliqProof => "$paymentServer/ride/cliq/verify_payment_ai.php"; "$paymentServer/ride/cliq/create_cliq_invoice.php";
static String get checkCliqStatus => "$paymentServer/ride/cliq/check_status.php"; static String get uploadCliqProof =>
"$paymentServer/ride/cliq/verify_payment_ai.php";
static String get checkCliqStatus =>
"$paymentServer/ride/cliq/check_status.php";
static String get payWithEcashDriver => static String get payWithEcashDriver =>
"$paymentServer/ride/ecash/driver/payWithEcash.php"; "$paymentServer/ride/ecash/driver/payWithEcash.php";
static String get payWithEcashPassenger => static String get payWithEcashPassenger =>
"$paymentServer/ride/ecash/passenger/payWithEcash.php"; "$paymentServer/ride/ecash/passenger/payWithEcash.php";
// wl.tripz-egypt.com/v1/main/ride/ecash/driver // wl.tripz-egypt.com/v1/main/ride/ecash/driver
static String get getWalletByPassenger => "$wallet/getWalletByPassenger.php"; static String get getWalletByPassenger => "$wallet/getWalletByPassenger.php";
static String get getPassengersWallet => "$wallet/get.php"; static String get getPassengersWallet => "$wallet/get.php";
static String get getPassengerWalletArchive => static String get getPassengerWalletArchive =>
"$wallet/getPassengerWalletArchive.php"; "$wallet/getPassengerWalletArchive.php";
static String get addPassengersWallet => "$wallet/add.php"; static String get addPassengersWallet => "$wallet/add.php";
static String get deletePassengersWallet => "$wallet/delete.php"; static String get deletePassengersWallet => "$wallet/delete.php";
static String get updatePassengersWallet => "$wallet/update.php"; static String get updatePassengersWallet => "$wallet/update.php";
static String get getWalletByDriver => "$walletDriver/getWalletByDriver.php"; static String get getWalletByDriver => "$walletDriver/getWalletByDriver.php";
static String get transferWalletDriver => "$endPoint/ride/driverWallet/transfer.php"; static String get transferWalletDriver =>
static String get convertBudgetToPoints => "$walletDriver/convertBudgetToPoints.php"; "$endPoint/ride/driverWallet/transfer.php";
static String get driverStatistic => static String get convertBudgetToPoints =>
"$walletDriver/convertBudgetToPoints.php";
static String get driverStatistic =>
"$endPoint/ride/driverWallet/driverStatistic.php"; "$endPoint/ride/driverWallet/driverStatistic.php";
static String get getDriverDetails => static String get getDriverDetails =>
"$seferCairoServer/ride/driverWallet/getDriverDetails.php"; "$seferCairoServer/ride/driverWallet/getDriverDetails.php";
// ================= Gamification Endpoints ================= // ================= Gamification Endpoints =================
static String get getWeeklyAggregate => static String get getWeeklyAggregate =>
"$endPoint/ride/gamification/getWeeklyAggregate.php"; "$endPoint/ride/gamification/getWeeklyAggregate.php";
static String get getLeaderboard => static String get getLeaderboard =>
"$endPoint/ride/gamification/getLeaderboard.php"; "$endPoint/ride/gamification/getLeaderboard.php";
static String get claimChallengeReward => static String get claimChallengeReward =>
"$endPoint/ride/gamification/claimChallengeReward.php"; "$endPoint/ride/gamification/claimChallengeReward.php";
static String get getReferralStats => static String get getReferralStats =>
"$endPoint/ride/gamification/getReferralStats.php"; "$endPoint/ride/gamification/getReferralStats.php";
static String get getDriverBehavior => static String get getDriverBehavior =>
"$endPoint/ride/gamification/getDriverBehavior.php"; "$endPoint/ride/gamification/getDriverBehavior.php";
static String get getDriverWeekPaymentMove => static String get getDriverWeekPaymentMove =>
"$walletDriver/getDriverWeekPaymentMove.php"; "$walletDriver/getDriverWeekPaymentMove.php";
static String get getDriversWallet => "$walletDriver/get.php"; static String get getDriversWallet => "$walletDriver/get.php";
static String get addDriversWalletPoints => "$walletDriver/add.php"; static String get addDriversWalletPoints => "$walletDriver/add.php";
static String get addpromotionDriver => "$walletDriver/promotionDriver.php"; static String get addpromotionDriver => "$walletDriver/promotionDriver.php";
static String get deleteDriversWallet => "$walletDriver/delete.php"; static String get deleteDriversWallet => "$walletDriver/delete.php";
static String get updateDriversWallet => "$walletDriver/update.php"; static String get updateDriversWallet => "$walletDriver/update.php";
//=======================promo===================ride.mobile-app.store/ride/promo/get.php //=======================promo===================ride.mobile-app.store/ride/promo/get.php
static String get promo => '$server/ride/promo'; static String get promo => '$server/ride/promo';
static String get getPassengersPromo => "$promo/get.php"; static String get getPassengersPromo => "$promo/get.php";
static String get getPromoBytody => "$promo/getPromoBytody.php"; static String get getPromoBytody => "$promo/getPromoBytody.php";
static String get addPassengersPromo => "$promo/add.php"; static String get addPassengersPromo => "$promo/add.php";
static String get deletePassengersPromo => "$promo/delete.php"; static String get deletePassengersPromo => "$promo/delete.php";
static String get updatePassengersPromo => "$promo/update.php"; static String get updatePassengersPromo => "$promo/update.php";
////=======================cancelRide=================== ////=======================cancelRide===================
static String get addCancelRideFromPassenger => "$rideServer/cancelRide/add.php"; static String get addCancelRideFromPassenger =>
static String get addCancelTripFromDriverAfterApplied => "$rideServer/cancelRide/add.php";
static String get addCancelTripFromDriverAfterApplied =>
"$rideServer/cancelRide/addCancelTripFromDriverAfterApplied.php"; "$rideServer/cancelRide/addCancelTripFromDriverAfterApplied.php";
static String get cancelRide => "$rideServer/cancelRide/get.php"; static String get cancelRide => "$rideServer/cancelRide/get.php";
//-----------------ridessss------------------ //-----------------ridessss------------------
static String get addRides => "$rideServer/rides/add.php"; static String get addRides => "$rideServer/rides/add.php";
static String get getRides => "$rideServer/rides/get.php"; static String get getRides => "$rideServer/rides/get.php";
static String get getPlacesSyria => "$rideServer/places_syria/get.php"; static String get getPlacesSyria => "$rideServer/places_syria/get.php";
static String get getMishwari => "$rideServer/mishwari/get.php"; static String get getMishwari => "$rideServer/mishwari/get.php";
static String get getMishwariDriver => "$rideServer/mishwari/getDriver.php"; static String get getMishwariDriver => "$rideServer/mishwari/getDriver.php";
static String get sendChatMessage => "$server/ride/chat/send_message.php"; static String get sendChatMessage => "$server/ride/chat/send_message.php";
static String get getTripCountByCaptain => static String get getTripCountByCaptain =>
"$rideServer/rides/getTripCountByCaptain.php"; "$rideServer/rides/getTripCountByCaptain.php";
static String get getRideOrderID => "$rideServer/rides/getRideOrderID.php"; static String get getRideOrderID => "$rideServer/rides/getRideOrderID.php";
static String get getRideStatus => "$rideServer/rides/getRideStatus.php"; static String get getRideStatus => "$rideServer/rides/getRideStatus.php";
static String get getOverLayStatus => "$ride/overLay/get.php"; static String get getOverLayStatus => "$ride/overLay/get.php";
static String get getArgumentAfterAppliedFromBackground => static String get getArgumentAfterAppliedFromBackground =>
"$ride/overLay/getArgumentAfterAppliedFromBackground.php"; "$ride/overLay/getArgumentAfterAppliedFromBackground.php";
static String get addOverLayStatus => "$ride/overLay/add.php"; static String get addOverLayStatus => "$ride/overLay/add.php";
static String get getapiKey => "$ride/apiKey/get.php"; static String get getapiKey => "$ride/apiKey/get.php";
static String get getapiKeySefer => "$ride/apiKey/get.php"; static String get getapiKeySefer => "$ride/apiKey/get.php";
static String get getRideStatusBegin => "$rideServer/rides/getRideStatusBegin.php"; static String get getRideStatusBegin =>
static String get getRideStatusFromStartApp => "$rideServer/rides/getRideStatusBegin.php";
static String get getRideStatusFromStartApp =>
"$rideServer/rides/getRideStatusFromStartApp.php"; "$rideServer/rides/getRideStatusFromStartApp.php";
static String get updateRides => "$rideServer/rides/update.php"; static String get updateRides => "$rideServer/rides/update.php";
static String get updateRideAndCheckIfApplied => static String get updateRideAndCheckIfApplied =>
"$rideServer/rides/updateRideAndCheckIfApplied.php"; "$rideServer/rides/updateRideAndCheckIfApplied.php";
static String get updateStausFromSpeed => static String get updateStausFromSpeed =>
"$rideServer/rides/updateStausFromSpeed.php"; "$rideServer/rides/updateStausFromSpeed.php";
static String get deleteRides => "$rideServer/rides/delete.php"; static String get deleteRides => "$rideServer/rides/delete.php";
//-----------------DriverPayment------------------ //-----------------DriverPayment------------------
static String get addDriverScam => "$ride/driver_scam/add.php"; static String get addDriverScam => "$ride/driver_scam/add.php";
static String get getDriverScam => "$ride/driver_scam/get.php"; static String get getDriverScam => "$ride/driver_scam/get.php";
/////////---getKazanPercent===//////////// /////////---getKazanPercent===////////////
static String get getKazanPercent => "$ride/kazan/get.php"; static String get getKazanPercent => "$ride/kazan/get.php";
static String get addKazanPercent => "$ride/kazan/add.php"; static String get addKazanPercent => "$ride/kazan/add.php";
////-----------------DriverPayment------------------ ////-----------------DriverPayment------------------
static String get addDrivePayment => "$paymentServer/ride/payment/add.php"; static String get addDrivePayment => "$paymentServer/ride/payment/add.php";
static String get payWithPayMobCardDriver => static String get payWithPayMobCardDriver =>
"$paymentServer/ride/payMob/paymob_driver/payWithCard.php"; "$paymentServer/ride/payMob/paymob_driver/payWithCard.php";
static String get payWithWallet => static String get payWithWallet =>
"$paymentServer/ride/payMob/paymob_driver/payWithWallet.php"; "$paymentServer/ride/payMob/paymob_driver/payWithWallet.php";
static String get paymetVerifyDriver => static String get paymetVerifyDriver =>
"$paymentServer/ride/payMob/paymob_driver/paymet_verfy.php"; "$paymentServer/ride/payMob/paymob_driver/paymet_verfy.php";
static String get updatePaymetToPaid => static String get updatePaymetToPaid =>
"$paymentServer/ride/payment/updatePaymetToPaid.php"; "$paymentServer/ride/payment/updatePaymetToPaid.php";
static String get paymobPayoutDriverWallet => static String get paymobPayoutDriverWallet =>
"$paymentServer/ride/payMob/paymob_driver/paymob_payout.php'"; "$paymentServer/ride/payMob/paymob_driver/paymob_payout.php'";
static String get addSeferWallet => "$paymentServer/ride/seferWallet/add.php"; static String get addSeferWallet => "$paymentServer/ride/seferWallet/add.php";
static String get getSeferWallet => "$paymentServer/ride/seferWallet/get.php"; static String get getSeferWallet => "$paymentServer/ride/seferWallet/get.php";
static String get addDriverPaymentPoints => static String get addDriverPaymentPoints =>
"$paymentServer/ride/driverPayment/add.php"; "$paymentServer/ride/driverPayment/add.php";
static String get addPaymentTokenDriver => static String get addPaymentTokenDriver =>
"$paymentServer/ride/driverWallet/addPaymentToken.php"; //driverWallet/addPaymentToken.php "$paymentServer/ride/driverWallet/addPaymentToken.php"; //driverWallet/addPaymentToken.php
static String get addPaymentTokenPassenger => static String get addPaymentTokenPassenger =>
"$paymentServer/ride/passengerWallet/addPaymentTokenPassenger.php"; "$paymentServer/ride/passengerWallet/addPaymentTokenPassenger.php";
static String get getDriverPaymentPoints => static String get getDriverPaymentPoints =>
"$paymentServer/ride/driverWallet/get.php"; "$paymentServer/ride/driverWallet/get.php";
static String get getDriverPaymentToday => "$paymentServer/ride/payment/get.php"; static String get getDriverPaymentToday =>
static String get getCountRide => "$rideServer/payment/getCountRide.php"; "$paymentServer/ride/payment/get.php";
static String get getAllPaymentFromRide => static String get getCountRide => "$rideServer/payment/getCountRide.php";
static String get getAllPaymentFromRide =>
"$paymentServer/ride/payment/getAllPayment.php"; "$paymentServer/ride/payment/getAllPayment.php";
static String get getAllPaymentVisa => static String get getAllPaymentVisa =>
"$paymentServer/ride/payment/getAllPaymentVisa.php"; "$paymentServer/ride/payment/getAllPaymentVisa.php";
//-----------------Passenger NotificationCaptain------------------ //-----------------Passenger NotificationCaptain------------------
static String get addNotificationPassenger => static String get addNotificationPassenger =>
"$ride/notificationPassenger/add.php"; "$ride/notificationPassenger/add.php";
static String get getNotificationPassenger => static String get getNotificationPassenger =>
"$ride/notificationPassenger/get.php"; "$ride/notificationPassenger/get.php";
static String get updateNotificationPassenger => static String get updateNotificationPassenger =>
"$ride/notificationPassenger/update.php"; "$ride/notificationPassenger/update.php";
//-----------------Driver NotificationCaptain------------------ //-----------------Driver NotificationCaptain------------------
static String get addNotificationCaptain => "$ride/notificationCaptain/add.php"; static String get addNotificationCaptain =>
static String get addWaitingRide => "$ride/notificationCaptain/addWaitingRide.php"; "$ride/notificationCaptain/add.php";
static String get deleteAvailableRide => static String get addWaitingRide =>
"$ride/notificationCaptain/addWaitingRide.php";
static String get deleteAvailableRide =>
"$ride/notificationCaptain/deleteAvailableRide.php"; "$ride/notificationCaptain/deleteAvailableRide.php";
static String get updateWaitingRide => static String get updateWaitingRide =>
"$ride/notificationCaptain/updateWaitingTrip.php"; "$ride/notificationCaptain/updateWaitingTrip.php";
static String get getRideWaiting => static String get getRideWaiting =>
"$endPoint/ride/notificationCaptain/getRideWaiting.php"; "$endPoint/ride/notificationCaptain/getRideWaiting.php";
static String get getNotificationCaptain => "$ride/notificationCaptain/get.php"; static String get getNotificationCaptain =>
static String get updateNotificationCaptain => "$ride/notificationCaptain/get.php";
static String get updateNotificationCaptain =>
"$ride/notificationCaptain/update.php"; "$ride/notificationCaptain/update.php";
static String get deleteNotificationCaptain => static String get deleteNotificationCaptain =>
"$ride/notificationCaptain/delete.php"; "$ride/notificationCaptain/delete.php";
//-----------------Api Key------------------ //-----------------Api Key------------------
static String get addApiKey => "$ride/apiKey/add.php"; static String get addApiKey => "$ride/apiKey/add.php";
static String get getApiKey => "$ride/apiKey/get.php"; static String get getApiKey => "$ride/apiKey/get.php";
static String get getCnMap => "$server/auth/cnMap.php"; static String get getCnMap => "$server/auth/cnMap.php";
static String get getPromptDriverDocumentsEgypt => static String get getPromptDriverDocumentsEgypt =>
"$server/auth/captin/getPromptDriverDocumentsEgypt.php"; "$server/auth/captin/getPromptDriverDocumentsEgypt.php";
static String get updateApiKey => "$ride/apiKey/update.php"; static String get updateApiKey => "$ride/apiKey/update.php";
static String get deleteApiKey => "$ride/apiKey/delete.php"; static String get deleteApiKey => "$ride/apiKey/delete.php";
static String get checkPhoneNumberISVerfiedDriver => static String get checkPhoneNumberISVerfiedDriver =>
"$auth/checkPhoneNumberISVerfiedDriver.php"; "$auth/checkPhoneNumberISVerfiedDriver.php";
static String get getTesterApp => "$auth/Tester/getTesterApp.php"; static String get getTesterApp => "$auth/Tester/getTesterApp.php";
static String get updateTesterApp => "$auth/Tester/updateTesterApp.php"; static String get updateTesterApp => "$auth/Tester/updateTesterApp.php";
//-----------------healthInsuranceProvider------------------ //-----------------healthInsuranceProvider------------------
static String get addHealthInsuranceProvider => "$server/driver_assurance/add.php"; static String get addHealthInsuranceProvider =>
static String get getHealthInsuranceProvider => "$server/driver_assurance/get.php"; "$server/driver_assurance/add.php";
static String get getHealthInsuranceProvider =>
"$server/driver_assurance/get.php";
//-----------------Feed Back------------------ //-----------------Feed Back------------------
static String get addFeedBack => "$ride/feedBack/add.php"; static String get addFeedBack => "$ride/feedBack/add.php";
static String get getFeedBack => "$ride/feedBack/get.php"; static String get getFeedBack => "$ride/feedBack/get.php";
static String get updateFeedBack => "$ride/feedBack/updateFeedBack.php"; static String get updateFeedBack => "$ride/feedBack/updateFeedBack.php";
static String get add_solve_all => "$server/ride/feedBack/add_solve_all.php"; static String get add_solve_all => "$server/ride/feedBack/add_solve_all.php";
static String get uploadAudio => "$server/upload_audio.php"; static String get uploadAudio => "$server/upload_audio.php";
//-----------------Tips------------------ //-----------------Tips------------------
static String get addTips => "$ride/tips/add.php"; static String get addTips => "$ride/tips/add.php";
static String get getTips => "$ride/tips/get.php"; static String get getTips => "$ride/tips/get.php";
static String get updateTips => "$ride/tips/update.php"; static String get updateTips => "$ride/tips/update.php";
//-----------------Help Center------------------ //-----------------Help Center------------------
static String get addhelpCenter => "$ride/helpCenter/add.php"; static String get addhelpCenter => "$ride/helpCenter/add.php";
static String get gethelpCenter => "$ride/helpCenter/get.php"; static String get gethelpCenter => "$ride/helpCenter/get.php";
static String get getByIdhelpCenter => "$ride/helpCenter/getById.php"; static String get getByIdhelpCenter => "$ride/helpCenter/getById.php";
static String get updatehelpCenter => "$ride/helpCenter/update.php"; static String get updatehelpCenter => "$ride/helpCenter/update.php";
static String get deletehelpCenter => "$ride/helpCenter/delete.php"; static String get deletehelpCenter => "$ride/helpCenter/delete.php";
//-----------------license------------------ //-----------------license------------------
static String get addLicense => "$ride/license/add.php"; static String get addLicense => "$ride/license/add.php";
static String get getLicense => "$ride/license/get.php"; static String get getLicense => "$ride/license/get.php";
static String get updateLicense => "$ride/license/updateFeedBack.php"; static String get updateLicense => "$ride/license/updateFeedBack.php";
//-----------------RegisrationCar------------------ //-----------------RegisrationCar------------------
static String get addRegisrationCar => "$ride/RegisrationCar/add.php"; static String get addRegisrationCar => "$ride/RegisrationCar/add.php";
static String get getRegisrationCar => "$endPoint/ride/RegisrationCar/get.php"; static String get getRegisrationCar =>
static String get updateRegisrationCar => "$ride/RegisrationCar/update.php"; "$endPoint/ride/RegisrationCar/get.php";
static String get makeDefaultCar => "$ride/RegisrationCar/makeDefaultCar.php"; static String get updateRegisrationCar => "$ride/RegisrationCar/update.php";
static String get makeDefaultCar => "$ride/RegisrationCar/makeDefaultCar.php";
//-----------------DriverOrder------------------ //-----------------DriverOrder------------------
static String get addDriverOrder => "$ride/driver_order/add.php"; static String get addDriverOrder => "$ride/driver_order/add.php";
static String get getDriverOrder => "$ride/driver_order/get.php"; static String get getDriverOrder => "$ride/driver_order/get.php";
static String get getOrderCancelStatus => static String get getOrderCancelStatus =>
"$ride/driver_order/getOrderCancelStatus.php"; "$ride/driver_order/getOrderCancelStatus.php";
static String get updateDriverOrder => "$ride/driver_order/update.php"; static String get updateDriverOrder => "$ride/driver_order/update.php";
static String get deleteDriverOrder => "$ride/driver_order/delete.php"; static String get deleteDriverOrder => "$ride/driver_order/delete.php";
// ===================================== // =====================================
static String get addRateToPassenger => "$ride/rate/add.php"; static String get addRateToPassenger => "$ride/rate/add.php";
static String get addRateToDriver => "$ride/rate/addRateToDriver.php"; static String get addRateToDriver => "$ride/rate/addRateToDriver.php";
static String get addRateApp => "$ride/rate/add_rate_app.php"; static String get addRateApp => "$ride/rate/add_rate_app.php";
static String get sendEmailRateingApp => "$ride/rate/sendEmailRateingApp.php"; static String get sendEmailRateingApp => "$ride/rate/sendEmailRateingApp.php";
static String get getDriverRate => "$ride/rate/getDriverRate.php"; static String get getDriverRate => "$ride/rate/getDriverRate.php";
static String get getPassengerRate => "$ride/rate/getPassengerRate.php"; static String get getPassengerRate => "$ride/rate/getPassengerRate.php";
////////////////emails ============// ////////////////emails ============//
static String get sendEmailToPassengerForTripDetails => static String get sendEmailToPassengerForTripDetails =>
"$ride/rides/emailToPassengerTripDetail.php"; "$ride/rides/emailToPassengerTripDetail.php";
static String get sendEmailToDrivertransaction => static String get sendEmailToDrivertransaction =>
"$server/Admin/sendEmailToDrivertransaction.php"; "$server/Admin/sendEmailToDrivertransaction.php";
// =========================================== // ===========================================
static String get pathImage => "$server/upload/types/"; static String get pathImage => "$server/upload/types/";
static String get uploadImage => "$server/uploadImage.php"; static String get uploadImage => "$server/uploadImage.php";
static String get uploadImage1 => "$server/uploadImage1.php"; static String get uploadImage1 => "$server/uploadImage1.php";
static String get uploadImagePortrate => "$server/uploadImagePortrate.php"; static String get uploadImagePortrate => "$server/uploadImagePortrate.php";
static String get uploadSyrianDocs => "$syria/auth/syria/uploadSyrianDocs.php"; static String get uploadSyrianDocs =>
static String get uploadImageType => "$server/uploadImageType.php"; "$syria/auth/syria/uploadSyrianDocs.php";
static String get uploadImageType => "$server/uploadImageType.php";
//=============egypt documents ============== //=============egypt documents ==============
static String get uploadEgyptidFront => static String get uploadEgyptidFront =>
"$server/EgyptDocuments/uploadEgyptidFront.php"; "$server/EgyptDocuments/uploadEgyptidFront.php";
static String get uploadEgypt => "$server/uploadEgypt.php"; static String get uploadEgypt => "$server/uploadEgypt.php";
static String get uploadEgypt1 => "$server/uploadEgypt1.php"; static String get uploadEgypt1 => "$server/uploadEgypt1.php";
//==================certifcate========== //==================certifcate==========
// static String location = '$endPoint/ride/location'; // static String location = '$endPoint/ride/location';
static String get getCarsLocationByPassenger => "$locationServer/get.php"; static String get getCarsLocationByPassenger => "$locationServer/get.php";
static String get addpassengerLocation => static String get addpassengerLocation =>
"$locationServer/addpassengerLocation.php"; "$locationServer/addpassengerLocation.php";
static String get getLocationAreaLinks => static String get getLocationAreaLinks =>
"$locationServer/get_location_area_links.php"; "$locationServer/get_location_area_links.php";
static String get getLatestLocationPassenger => static String get getLatestLocationPassenger =>
"$locationServer/getLatestLocationPassenger.php"; "$locationServer/getLatestLocationPassenger.php";
static String get getFemalDriverLocationByPassenger => static String get getFemalDriverLocationByPassenger =>
"$locationServer/getFemalDriver.php"; "$locationServer/getFemalDriver.php";
static String get getDriverCarsLocationToPassengerAfterApplied => static String get getDriverCarsLocationToPassengerAfterApplied =>
"$locationServer/getDriverCarsLocationToPassengerAfterApplied.php"; "$locationServer/getDriverCarsLocationToPassengerAfterApplied.php";
static String get addCarsLocationByPassenger => "$locationServer/add.php"; static String get addCarsLocationByPassenger => "$locationServer/add.php";
static String get saveBehavior => "$locationServer/save_behavior.php"; static String get saveBehavior => "$locationServer/save_behavior.php";
static String get addCarsLocationGizaEndpoint => "$locationServer/add.php"; static String get addCarsLocationGizaEndpoint => "$locationServer/add.php";
static String get addCarsLocationAlexandriaEndpoint => "$locationServer/add.php"; static String get addCarsLocationAlexandriaEndpoint =>
static String get addCarsLocationCairoEndpoint => "$locationServer/add.php"; "$locationServer/add.php";
static String get deleteCarsLocationByPassenger => "$locationServer/delete.php"; static String get addCarsLocationCairoEndpoint => "$locationServer/add.php";
static String get updateCarsLocationByPassenger => "$locationServer/update.php"; static String get deleteCarsLocationByPassenger =>
static String get getTotalDriverDuration => "$locationServer/delete.php";
static String get updateCarsLocationByPassenger =>
"$locationServer/update.php";
static String get getTotalDriverDuration =>
"$locationServer/getTotalDriverDuration.php"; "$locationServer/getTotalDriverDuration.php";
static String get getRidesDriverByDay => "$locationServer/getRidesDriverByDay.php"; static String get getRidesDriverByDay =>
static String get getTotalDriverDurationToday => "$locationServer/getRidesDriverByDay.php";
static String get getTotalDriverDurationToday =>
"$locationServer/getTotalDriverDurationToday.php"; "$locationServer/getTotalDriverDurationToday.php";
//==================get_driver_behavior.php============= //==================get_driver_behavior.php=============
static String get get_driver_behavior => static String get get_driver_behavior =>
'$ride/driver_behavior/get_driver_behavior.php'; '$ride/driver_behavior/get_driver_behavior.php';
//==================cars new drivers============= //==================cars new drivers=============
static String get addNewCarsDrivers => '$ride/carDrivers/add.php'; static String get addNewCarsDrivers => '$ride/carDrivers/add.php';
static String get getNewCarsDrivers => '$ride/carDrivers/get.php'; static String get getNewCarsDrivers => '$ride/carDrivers/get.php';
static String get deleteNewCarsDrivers => '$ride/carDrivers/delete.php'; static String get deleteNewCarsDrivers => '$ride/carDrivers/delete.php';
//==================Blog============= //==================Blog=============
static String get profile => '$ride/profile'; static String get profile => '$ride/profile';
static String get getprofile => "$profile/get.php"; static String get getprofile => "$profile/get.php";
static String get getCaptainProfile => "$profile/getCaptainProfile.php"; static String get getCaptainProfile => "$profile/getCaptainProfile.php";
static String get addprofile => "$profile/add.php"; static String get addprofile => "$profile/add.php";
static String get deleteprofile => "$profile/delete.php"; static String get deleteprofile => "$profile/delete.php";
static String get updateprofile => "$profile/update.php"; static String get updateprofile => "$profile/update.php";
static String get updateDriverEmail => "$profile/updateDriverEmail.php"; static String get updateDriverEmail => "$profile/updateDriverEmail.php";
//===================Auth============ //===================Auth============
static String get getUnifiedCode => "$ride/invitor/get_unified_code.php"; static String get getUnifiedCode => "$ride/invitor/get_unified_code.php";
static String get addUnifiedInvite => "$ride/invitor/add_unified_invite.php"; static String get addUnifiedInvite => "$ride/invitor/add_unified_invite.php";
static String get claimDriverReward => "$ride/invitor/claim_driver_reward.php"; static String get claimDriverReward =>
static String get getDriverReferrals => "$ride/invitor/get_driver_referrals.php"; "$ride/invitor/claim_driver_reward.php";
static String get getDriverReferrals =>
"$ride/invitor/get_driver_referrals.php";
static String get addInviteDriver => "$ride/invitor/add.php"; static String get addInviteDriver => "$ride/invitor/add.php";
static String get addInvitationPassenger => static String get addInvitationPassenger =>
"$ride/invitor/addInvitationPassenger.php"; "$ride/invitor/addInvitationPassenger.php";
static String get getInviteDriver => "$ride/invitor/get.php"; static String get getInviteDriver => "$ride/invitor/get.php";
static String get getDriverInvitationToPassengers => static String get getDriverInvitationToPassengers =>
"$ride/invitor/getDriverInvitationToPassengers.php"; "$ride/invitor/getDriverInvitationToPassengers.php";
static String get updateInviteDriver => "$ride/invitor/update.php"; static String get updateInviteDriver => "$ride/invitor/update.php";
static String get updatePassengerGift => static String get updatePassengerGift =>
"$server/ride/invitor/updatePassengerGift.php"; "$server/ride/invitor/updatePassengerGift.php";
static String get claimInviteReward => "$server/ride/invitor/claim.php"; static String get claimInviteReward => "$server/ride/invitor/claim.php";
static String get updateInvitationCodeFromRegister => static String get updateInvitationCodeFromRegister =>
"$ride/invitor/updateInvitationCodeFromRegister.php"; "$ride/invitor/updateInvitationCodeFromRegister.php";
static String get register_driver_and_car => static String get register_driver_and_car =>
"$auth/syria/driver/register_driver_and_car.php"; "$auth/syria/driver/register_driver_and_car.php";
static String get updateDriverInvitationDirectly => static String get updateDriverInvitationDirectly =>
"$ride/invitor/updateDriverInvitationDirectly.php"; "$ride/invitor/updateDriverInvitationDirectly.php";
static String get updatePassengersInvitation => static String get updatePassengersInvitation =>
"$ride/invitor/updatePassengersInvitation.php"; "$ride/invitor/updatePassengersInvitation.php";
//===================Auth============ //===================Auth============
static String get auth => '$server/auth'; static String get auth => '$server/auth';
static String get login => "$auth/login.php"; static String get login => "$auth/login.php";
static String get signUp => "$auth/signup.php"; static String get signUp => "$auth/signup.php";
static String get updateDriverClaim => "$auth/captin/updateDriverClaim.php"; static String get updateDriverClaim => "$auth/captin/updateDriverClaim.php";
static String get updateShamCashDriver => "$auth/captin/updateShamCashDriver.php"; static String get updateShamCashDriver =>
static String get sendVerifyEmail => "$auth/sendVerifyEmail.php"; "$auth/captin/updateShamCashDriver.php";
static String get passengerRemovedAccountEmail => static String get sendVerifyEmail => "$auth/sendVerifyEmail.php";
static String get passengerRemovedAccountEmail =>
"$auth/passengerRemovedAccountEmail.php"; "$auth/passengerRemovedAccountEmail.php";
static String get verifyEmail => "$auth/verifyEmail.php"; static String get verifyEmail => "$auth/verifyEmail.php";
//===================Auth Captin============ //===================Auth Captin============
static String get authCaptin => '$server/auth/captin'; static String get authCaptin => '$server/auth/captin';
static String get loginCaptin => "$authCaptin/login.php"; static String get loginCaptin => "$authCaptin/login.php";
static String get loginFromGoogleCaptin => "$authCaptin/loginFromGoogle.php"; static String get loginFromGoogleCaptin => "$authCaptin/loginFromGoogle.php";
static String get loginUsingCredentialsWithoutGoogle => static String get loginUsingCredentialsWithoutGoogle =>
"$authCaptin/loginUsingCredentialsWithoutGoogle.php"; "$authCaptin/loginUsingCredentialsWithoutGoogle.php";
static String get packageInfo => "$server/auth/packageInfo.php"; static String get packageInfo => "$server/auth/packageInfo.php";
static String get signUpCaptin => "$authCaptin/register.php"; static String get signUpCaptin => "$authCaptin/register.php";
static String get addCriminalDocuments => "$authCaptin/addCriminalDocuments.php"; static String get addCriminalDocuments =>
static String get sendVerifyEmailCaptin => "$authCaptin/sendVerifyEmail.php"; "$authCaptin/addCriminalDocuments.php";
static String get sendVerifyOtpMessage => static String get sendVerifyEmailCaptin => "$authCaptin/sendVerifyEmail.php";
static String get sendVerifyOtpMessage =>
"$server/auth/captin/sendOtpMessageDriver.php"; "$server/auth/captin/sendOtpMessageDriver.php";
static String get verifyOtpMessage => "$server/auth/verifyOtpMessage.php"; static String get verifyOtpMessage => "$server/auth/verifyOtpMessage.php";
static String get verifyOtpDriver => "$server/auth/captin/verifyOtpDriver.php"; static String get verifyOtpDriver =>
static String get verifyEmailCaptin => "$authCaptin/verifyEmail.php"; "$server/auth/captin/verifyOtpDriver.php";
static String get removeUser => "$authCaptin/removeAccount.php"; static String get verifyEmailCaptin => "$authCaptin/verifyEmail.php";
static String get deletecaptainAccounr => "$authCaptin/deletecaptainAccounr.php"; static String get removeUser => "$authCaptin/removeAccount.php";
static String get updateAccountBank => "$authCaptin/updateAccountBank.php"; static String get deletecaptainAccounr =>
static String get getAccount => "$authCaptin/getAccount.php"; "$authCaptin/deletecaptainAccounr.php";
static String get uploadImageToAi => "$auth/document_syria/ai_document.php"; static String get updateAccountBank => "$authCaptin/updateAccountBank.php";
static String get isPhoneVerified => "$auth/syria/driver/isPhoneVerified.php"; static String get getAccount => "$authCaptin/getAccount.php";
static String get uploadImageToAi => "$auth/document_syria/ai_document.php";
static String get isPhoneVerified => "$auth/syria/driver/isPhoneVerified.php";
//===================Admin Captin============ //===================Admin Captin============
static String get getPassengerDetailsByPassengerID => static String get getPassengerDetailsByPassengerID =>
"$server/Admin/getPassengerDetailsByPassengerID.php"; "$server/Admin/getPassengerDetailsByPassengerID.php";
static String get getPassengerDetails => "$server/Admin/getPassengerDetails.php"; static String get getPassengerDetails =>
static String get getPassengerbyEmail => "$server/Admin/getPassengerbyEmail.php"; "$server/Admin/getPassengerDetails.php";
static String get addAdminUser => "$server/Admin/adminUser/add.php"; static String get getPassengerbyEmail =>
static String get addError => "$server/Admin/errorApp.php"; "$server/Admin/getPassengerbyEmail.php";
static String get getAdminUser => "$server/Admin/adminUser/get.php"; static String get addAdminUser => "$server/Admin/adminUser/add.php";
static String get getCaptainDetailsByEmailOrIDOrPhone => static String get addError => "$server/Admin/errorApp.php";
static String get getAdminUser => "$server/Admin/adminUser/get.php";
static String get getCaptainDetailsByEmailOrIDOrPhone =>
"$server/Admin/AdminCaptain/getCaptainDetailsByEmailOrIDOrPhone.php"; "$server/Admin/AdminCaptain/getCaptainDetailsByEmailOrIDOrPhone.php";
static String get getCaptainDetails => "$server/Admin/AdminCaptain/get.php"; static String get getCaptainDetails => "$server/Admin/AdminCaptain/get.php";
static String get getRidesPerMonth => static String get getRidesPerMonth =>
"$server/Admin/AdminRide/getRidesPerMonth.php"; "$server/Admin/AdminRide/getRidesPerMonth.php";
static String get getRidesDetails => "$server/Admin/AdminRide/get.php"; static String get getRidesDetails => "$server/Admin/AdminRide/get.php";
//////////Sms egypt/////////// //////////Sms egypt///////////
static String get sendSms => "https://sms.kazumi.me/api/sms/send-sms"; static String get sendSms => "https://sms.kazumi.me/api/sms/send-sms";
static String get senddlr => "https://sms.kazumi.me/api/sms/send-dlr"; static String get senddlr => "https://sms.kazumi.me/api/sms/send-dlr";
static String get sendvalidity => "https://sms.kazumi.me/api/sms/send-validity"; static String get sendvalidity =>
static String get sendmany => "https://sms.kazumi.me/api/sms/send-many"; "https://sms.kazumi.me/api/sms/send-validity";
static String get checkCredit => "https://sms.kazumi.me/api/sms/check-credit"; static String get sendmany => "https://sms.kazumi.me/api/sms/send-many";
static String get checkStatus => "https://sms.kazumi.me/api/sms/check-status"; static String get checkCredit => "https://sms.kazumi.me/api/sms/check-credit";
static String get getSender => "$server/auth/sms/getSender.php"; static String get checkStatus => "https://sms.kazumi.me/api/sms/check-status";
static String get updatePhoneInvalidSMS => static String get getSender => "$server/auth/sms/getSender.php";
static String get updatePhoneInvalidSMS =>
"$server/auth/sms/updatePhoneInvalidSMS.php"; "$server/auth/sms/updatePhoneInvalidSMS.php";
//////////////service/////////// //////////////service///////////
static String get serviceApp => "$server/serviceapp"; static String get serviceApp => "$server/serviceapp";
static String get getComplaintAllData => "$serviceApp/getComplaintAllData.php"; static String get getComplaintAllData =>
static String get getComplaintAllDataForDriver => "$serviceApp/getComplaintAllData.php";
static String get getComplaintAllDataForDriver =>
"$serviceApp/getComplaintAllDataForDriver.php"; "$serviceApp/getComplaintAllDataForDriver.php";
} }

View File

@@ -279,9 +279,7 @@ class RegisterCaptainController extends GetxController {
// box.read(BoxName.driverID).toString(), // box.read(BoxName.driverID).toString(),
// box.read(BoxName.emailDriver).toString(), // box.read(BoxName.emailDriver).toString(),
// ); // );
// Get.offAll(() => SyrianCardAI());
Get.to(() => RegistrationView()); Get.to(() => RegistrationView());
// } else {
// Get.snackbar('title', 'message'); // Get.snackbar('title', 'message');
// } // }
} }
@@ -313,7 +311,7 @@ class RegisterCaptainController extends GetxController {
if (formKey.currentState!.validate()) { if (formKey.currentState!.validate()) {
isLoading = true; isLoading = true;
update(); update();
Get.to(() => AiPage()); Get.to(() => RegistrationView());
} }
} }

View File

@@ -1,98 +0,0 @@
import 'package:siro_driver/constant/box_name.dart';
import 'package:siro_driver/controller/auth/captin/login_captin_controller.dart';
import 'package:siro_driver/controller/functions/crud.dart';
import 'package:siro_driver/main.dart';
import 'package:siro_driver/views/auth/captin/cards/sms_signup.dart';
import 'package:siro_driver/views/home/on_boarding_page.dart';
import 'package:siro_driver/views/widgets/error_snakbar.dart';
import 'package:get/get.dart';
import 'package:google_sign_in/google_sign_in.dart';
import '../../views/auth/captin/ai_page.dart';
import '../functions/add_error.dart';
import '../functions/encrypt_decrypt.dart';
class GoogleSignInHelper {
static final GoogleSignIn _googleSignIn = GoogleSignIn.instance;
// متغير ثابت لحفظ حالة المستخدم محلياً كبديل لخاصية currentUser المحذوفة
static GoogleSignInAccount? _cachedUser;
static Future<GoogleSignInAccount?> signIn() async {
try {
final GoogleSignInAccount? googleUser =
await _googleSignIn.authenticate();
if (googleUser != null) {
_cachedUser = googleUser; // حفظ الجلسة في الكاش المحلي
await _handleSignUp(googleUser);
if (box.read(BoxName.countryCode) == 'Egypt') {
Get.to(() => SmsSignupEgypt());
} else if (box.read(BoxName.countryCode) == 'Jordan') {
Get.to(() => AiPage());
}
}
return googleUser;
} catch (error) {
return null;
}
}
Future<GoogleSignInAccount?> signInFromLogin() async {
try {
final GoogleSignInAccount? googleUser =
await _googleSignIn.authenticate();
if (googleUser != null) {
_cachedUser = googleUser; // حفظ الجلسة في الكاش المحلي
await _handleSignUp(googleUser);
final driverID =
(box.read(BoxName.driverID)?.toString()) ?? 'Unknown ID';
final emailDriver =
(box.read(BoxName.emailDriver)?.toString()) ?? 'Unknown Email';
print('Driver ID: $driverID');
print('Driver Email: $emailDriver');
await Get.find<LoginDriverController>()
.loginWithGoogleCredential(driverID, emailDriver);
}
return googleUser;
} catch (error, stackTrace) {
mySnackeBarError('$error');
CRUD.addError(error.toString(), stackTrace.toString(),
'GoogleSignInAccount?> signInFromLogin()');
return null;
}
}
static Future<void> _handleSignUp(GoogleSignInAccount user) async {
box.write(BoxName.driverID, (user.id) ?? 'Unknown ID');
box.write(BoxName.emailDriver, (user.email) ?? 'Unknown Email');
}
static Future<void> signOut() async {
try {
await _googleSignIn.signOut();
} catch (error) {
// التعامل مع الخطأ بصمت إذا كانت جلسة جوجل فارغة مسبقاً
} finally {
_cachedUser = null; // مسح الكاش المحلي بشكل إلزامي
await _handleSignOut();
}
}
static Future<void> _handleSignOut() async {
box.erase();
storage.deleteAll();
Get.offAll(OnBoardingPage());
}
// استخدام الكاش المحلي بدلاً من استدعاء المكتبة
static GoogleSignInAccount? getCurrentUser() {
return _cachedUser;
}
}

View File

@@ -264,12 +264,23 @@ class RegistrationController extends GetxController {
/// خريطة لتخزين روابط المستندات بعد الرفع /// خريطة لتخزين روابط المستندات بعد الرفع
final Map<String, String> docUrls = { final Map<String, String> docUrls = {
'driver_license_front': '', 'id_front': '',
'id_back': '',
'driver_license': '',
'driver_license_back': '', 'driver_license_back': '',
'profile_picture': '',
'criminal_record': '',
'car_license_front': '', 'car_license_front': '',
'car_license_back': '', 'car_license_back': '',
}; };
String getCriminalRecordTitle() {
String currentCountry = box.read(BoxName.countryCode) ?? 'Jordan';
if (currentCountry == 'Syria') return 'لا حكم عليه'.tr;
if (currentCountry == 'Egypt') return 'فيش وتشبيه'.tr;
return 'عدم محكومية'.tr;
}
/// التصرّف العام لاختيار/قص/ضغط/رفع الصورة حسب type /// التصرّف العام لاختيار/قص/ضغط/رفع الصورة حسب type
Future<void> choosImage(String link, String imageType) async { Future<void> choosImage(String link, String imageType) async {
try { try {
@@ -329,13 +340,17 @@ class RegistrationController extends GetxController {
} }
} }
/// ترفع الملف وترجع رابط الصورة النهائي كـ String /// ترفع الملف وترجع رابط الصورة النهائي كـ String مع إعادة المحاولة في حال فشل الاتصال
Future<String> uploadImage( Future<String> uploadImage(
File file, Map<String, String> data, String link) async { File file, Map<String, String> data, String link) async {
int maxRetries = 3;
int attempt = 0;
while (attempt < maxRetries) {
attempt++;
try {
final uri = Uri.parse(link); final uri = Uri.parse(link);
final request = http.MultipartRequest('POST', uri); final request = http.MultipartRequest('POST', uri);
// الهيدرز (كما عندك)
final headers = <String, String>{ final headers = <String, String>{
'Authorization': 'Authorization':
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}', 'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
@@ -343,23 +358,20 @@ class RegistrationController extends GetxController {
}; };
request.headers.addAll(headers); request.headers.addAll(headers);
// اسم الملف: driverID.jpg (اختياري)
final forcedName = '${box.read(BoxName.driverID) ?? 'image'}.jpg'; final forcedName = '${box.read(BoxName.driverID) ?? 'image'}.jpg';
// إضافة الملف (من المسار مباشرة أسلم من الـ stream)
request.files.add( request.files.add(
await http.MultipartFile.fromPath( await http.MultipartFile.fromPath(
'image', // تأكد أنه نفس اسم الحقل على السيرفر 'image',
file.path, file.path,
filename: forcedName, filename: forcedName,
), ),
); );
// الحقول الإضافية
data.forEach((k, v) => request.fields[k] = v); data.forEach((k, v) => request.fields[k] = v);
// الإرسال // المهلة الزمنية 120 ثانية لتناسب الاتصالات الضعيفة
final streamed = await request.send(); final streamed = await request.send().timeout(const Duration(seconds: 120));
final res = await http.Response.fromStream(streamed); final res = await http.Response.fromStream(streamed);
if (res.statusCode != 200) { if (res.statusCode != 200) {
@@ -367,7 +379,6 @@ class RegistrationController extends GetxController {
'Failed to upload image: ${res.statusCode} - ${res.body}'); 'Failed to upload image: ${res.statusCode} - ${res.body}');
} }
// نحاول استخراج رابط الصورة من أكثر من مفتاح محتمل
final body = jsonDecode(res.body); final body = jsonDecode(res.body);
final String? url = body['url'] ?? final String? url = body['url'] ??
body['file_link'] ?? body['file_link'] ??
@@ -375,12 +386,20 @@ class RegistrationController extends GetxController {
(body['data'] is Map ? body['data']['url'] : null); (body['data'] is Map ? body['data']['url'] : null);
if (url == null || url.isEmpty) { if (url == null || url.isEmpty) {
// لو السيرفر يرجع هيكل مختلف، عدّل هنا المفتاح حسب استجابتك الفعلية
throw Exception( throw Exception(
'Upload succeeded but no image URL found in response: ${res.body}'); 'Upload succeeded but no image URL found in response: ${res.body}');
} }
return url; return url;
} catch (e) {
Log.print("⚠️ [Image Upload Attempt $attempt Failed] Error: $e");
if (attempt >= maxRetries) {
rethrow;
}
await Future.delayed(Duration(seconds: attempt * 2));
}
}
throw Exception('Upload failed after $maxRetries attempts');
} }
Future<File> compressImage(File file) async { Future<File> compressImage(File file) async {
@@ -398,7 +417,7 @@ class RegistrationController extends GetxController {
return File(result!.path); return File(result!.path);
} }
// دالة رفع إلى السيرفر السوري: ترجع file_url (Signed URL) // دالة رفع إلى السيرفر السوري مع مهلة 120 ثانية وإعادة محاولة تلقائية في حال الفشل
Future<String> uploadToSyria({ Future<String> uploadToSyria({
required String docType, required String docType,
required File file, required File file,
@@ -406,9 +425,13 @@ class RegistrationController extends GetxController {
required String authHeader, required String authHeader,
required String hmacHeader, required String hmacHeader,
required String driverId, required String driverId,
Duration timeout = const Duration(seconds: 60), Duration timeout = const Duration(seconds: 120),
http.Client? clientOverride, http.Client? clientOverride,
}) async { }) async {
int maxRetries = 3;
int attempt = 0;
while (attempt < maxRetries) {
attempt++;
final client = clientOverride ?? http.Client(); final client = clientOverride ?? http.Client();
try { try {
final mime = lookupMimeType(file.path) ?? 'image/jpeg'; final mime = lookupMimeType(file.path) ?? 'image/jpeg';
@@ -432,26 +455,11 @@ class RegistrationController extends GetxController {
), ),
); );
// ====== الطباعة قبل الإرسال ======
// Log.print('--- Syrian Upload Request ---');
// Log.print('URL: $syrianUploadUri');
// // Log.print('Method: POST');
// // Log.print('Headers: ${req.headers}');
// Log.print('Fields: ${req.fields}');
// // Log.print(
// // 'File: ${file.path} (${await file.length()} bytes, mime: $mime)');
// Log.print('-----------------------------');
// الإرسال
final streamed = await client.send(req).timeout(timeout); final streamed = await client.send(req).timeout(timeout);
final resp = await http.Response.fromStream(streamed); final resp = await http.Response.fromStream(streamed);
// ====== الطباعة بعد الاستجابة ====== Log.print('--- Syrian Upload Response (Attempt $attempt) ---');
// Log.print('--- Syrian Upload Response ---');
Log.print('Status: ${resp.statusCode}'); Log.print('Status: ${resp.statusCode}');
// Log.print('Headers: ${resp.headers}');
// Log.print('Body: ${resp.body}');
// Log.print('-------------------------------');
Map<String, dynamic> j = {}; Map<String, dynamic> j = {};
try { try {
@@ -460,26 +468,29 @@ class RegistrationController extends GetxController {
Log.print('⚠️ Failed to parse JSON: $e'); Log.print('⚠️ Failed to parse JSON: $e');
} }
// التحمّل لشكلين من الـ JSON:
final statusOk = j['status'] == 'success'; final statusOk = j['status'] == 'success';
final fileUrl = (j['file_url'] ?? j['message']?['file_url'])?.toString(); final fileUrl = (j['file_url'] ?? j['message']?['file_url'])?.toString();
final fileName =
(j['file_name'] ?? j['message']?['file_name'])?.toString();
if (resp.statusCode == 200 && if (resp.statusCode == 200 &&
statusOk && statusOk &&
(fileUrl?.isNotEmpty ?? false)) { (fileUrl?.isNotEmpty ?? false)) {
// Log.print(
// '✅ Syrian upload success: $fileUrl (file: ${fileName ?? "-"})');
return fileUrl!; return fileUrl!;
} }
throw Exception( throw Exception(
'❌ Syrian upload failed ($docType): ${j['message'] ?? resp.body}'); '❌ Syrian upload failed ($docType): ${j['message'] ?? resp.body}');
} catch (e) {
Log.print("⚠️ [Syria Upload Attempt $attempt Failed] Error: $e");
if (attempt >= maxRetries) {
rethrow;
}
await Future.delayed(Duration(seconds: attempt * 2));
} finally { } finally {
if (clientOverride == null) client.close(); if (clientOverride == null) client.close();
} }
} }
throw Exception('Syrian upload failed after $maxRetries attempts');
}
Future<void> submitRegistration() async { Future<void> submitRegistration() async {
// 0) دوال/مساعدات محلية // 0) دوال/مساعدات محلية
@@ -490,19 +501,24 @@ class RegistrationController extends GetxController {
} }
// 1) تحقق من وجود الروابط // 1) تحقق من وجود الروابط
final driverFrontUrl = docUrls['driver_license_front']; final idFrontUrl = docUrls['id_front'];
final driverBackUrl = docUrls['driver_license_back']; final idBackUrl = docUrls['id_back'];
final driverLicenseUrl = docUrls['driver_license'];
final driverLicenseBackUrl = docUrls['driver_license_back'];
final profilePicUrl = docUrls['profile_picture'];
final criminalRecordUrl = docUrls['criminal_record'];
final carFrontUrl = docUrls['car_license_front']; final carFrontUrl = docUrls['car_license_front'];
final carBackUrl = docUrls['car_license_back']; final carBackUrl = docUrls['car_license_back'];
Log.print(driverFrontUrl.toString());
Log.print(driverBackUrl.toString());
Log.print(carFrontUrl.toString());
Log.print(carBackUrl.toString());
if (driverFrontUrl == null || final isSyria = box.read(BoxName.countryCode) == 'Syria';
driverBackUrl == null ||
carFrontUrl == null || if (idFrontUrl == null || idFrontUrl.isEmpty ||
carBackUrl == null) { idBackUrl == null || idBackUrl.isEmpty ||
driverLicenseUrl == null || driverLicenseUrl.isEmpty ||
(isSyria && (driverLicenseBackUrl == null || driverLicenseBackUrl.isEmpty)) ||
profilePicUrl == null || profilePicUrl.isEmpty ||
carFrontUrl == null || carFrontUrl.isEmpty ||
carBackUrl == null || carBackUrl.isEmpty) {
mySnackbarWarning('Please wait for all documents to finish uploading before registering.'.tr); mySnackbarWarning('Please wait for all documents to finish uploading before registering.'.tr);
return; return;
} }
@@ -607,10 +623,14 @@ class RegistrationController extends GetxController {
} }
// --- روابط الصور --- // --- روابط الصور ---
_addField(fields, 'driver_license_front', driverFrontUrl!); _addField(fields, 'id_front', idFrontUrl);
_addField(fields, 'driver_license_back', driverBackUrl!); _addField(fields, 'id_back', idBackUrl);
_addField(fields, 'car_license_front', carFrontUrl!); _addField(fields, 'driver_license', driverLicenseUrl);
_addField(fields, 'car_license_back', carBackUrl!); if (isSyria) _addField(fields, 'driver_license_back', driverLicenseBackUrl);
_addField(fields, 'profile_picture', profilePicUrl);
_addField(fields, 'criminal_record', criminalRecordUrl);
_addField(fields, 'car_license_front', carFrontUrl);
_addField(fields, 'car_license_back', carBackUrl);
req.fields.addAll(fields); req.fields.addAll(fields);

View File

@@ -19,7 +19,6 @@ import '../../views/auth/captin/criminal_documents_page.dart';
import '../../views/home/Captin/home_captain/home_captin.dart'; import '../../views/home/Captin/home_captain/home_captin.dart';
import '../../views/home/Captin/orderCaptin/order_request_page.dart'; import '../../views/home/Captin/orderCaptin/order_request_page.dart';
import '../../views/home/Captin/orderCaptin/vip_order_page.dart'; import '../../views/home/Captin/orderCaptin/vip_order_page.dart';
import '../auth/google_sign.dart';
import '../functions/face_detect.dart'; import '../functions/face_detect.dart';
import '../home/captin/map_driver_controller.dart'; import '../home/captin/map_driver_controller.dart';
import 'local_notification.dart'; import 'local_notification.dart';
@@ -219,7 +218,7 @@ class FirebaseMessagesController extends GetxController {
case 'token change': case 'token change':
case 'TOKEN_CHANGE': case 'TOKEN_CHANGE':
GoogleSignInHelper.signOut(); box.remove(BoxName.jwt);
break; break;
case 'face detect': case 'face detect':

View File

@@ -1,10 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:get/get.dart'; // للترجمة .tr import 'package:get/get.dart'; // للترجمة .tr
import '../../constant/links.dart';
class NotificationService { class NotificationService {
static const String _serverUrl = static String get _serverUrl => '${AppLink.ride}/firebase/send_fcm.php';
'https://api.intaleq.xyz/siro/ride/firebase/send_fcm.php';
static Future<void> sendNotification({ static Future<void> sendNotification({
required String target, required String target,

View File

@@ -489,25 +489,58 @@ class ScanDocumentsByApi extends GetxController {
final String token = box.read(BoxName.jwt)?.toString().split(AppInformation.addd)[0] ?? ''; final String token = box.read(BoxName.jwt)?.toString().split(AppInformation.addd)[0] ?? '';
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? ''; final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
final String driverID = box.read(BoxName.driverID).toString();
final String link = AppLink.uploadImagePortrate;
var request = http.MultipartRequest( int maxRetries = 3;
'POST', int attempt = 0;
Uri.parse(AppLink.uploadImagePortrate), String responseString = '';
);
while (attempt < maxRetries) {
attempt++;
final client = http.Client();
try {
Log.print('[UPLOAD_LOGGER] 🚀 [uploadImagePortrate] Attempt $attempt/$maxRetries started. Link: $link, Image Size: ${imagePortrait.length} bytes');
var request = http.MultipartRequest('POST', Uri.parse(link));
request.files.add( request.files.add(
http.MultipartFile.fromBytes('image', imagePortrait), http.MultipartFile.fromBytes('image', imagePortrait, filename: '$driverID.jpg'),
); );
request.headers.addAll({ request.headers.addAll({
'Authorization': 'Bearer $token', 'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint, 'X-Device-FP': fingerPrint,
}); });
request.fields['driverID'] = box.read(BoxName.driverID).toString(); request.fields['driverID'] = driverID;
var response = await request.send(); final startTime = DateTime.now();
var responseData = await response.stream.toBytes(); var streamedResponse = await client.send(request).timeout(const Duration(seconds: 120));
var responseString = String.fromCharCodes(responseData); var res = await http.Response.fromStream(streamedResponse);
final duration = DateTime.now().difference(startTime);
Log.print('[UPLOAD_LOGGER] 📥 [uploadImagePortrate] Attempt $attempt response received in ${duration.inSeconds}s. Status Code: ${res.statusCode}');
Log.print('[UPLOAD_LOGGER] 📥 [uploadImagePortrate] Response Body: ${res.body}');
if (res.statusCode == 200) {
responseString = res.body;
break; // Success
} else {
throw Exception('Failed to upload portrait: ${res.statusCode} - ${res.body}');
}
} catch (e, st) {
Log.print('[UPLOAD_LOGGER] ⚠️ [uploadImagePortrate] Attempt $attempt failed. Error: $e', stackTrace: st);
if (attempt >= maxRetries) {
isLoading = false;
update();
rethrow;
}
final waitSeconds = attempt * 2;
Log.print('[UPLOAD_LOGGER] ⏳ Waiting $waitSeconds seconds before retrying...');
await Future.delayed(Duration(seconds: waitSeconds));
} finally {
client.close();
}
}
isLoading = false; isLoading = false;
update(); update();

View File

@@ -303,13 +303,28 @@ class ImageController extends GetxController {
} }
} }
uploadImage(File file, Map data, String link) async { Future<dynamic> _uploadMultipartFile({
required File file,
required Map data,
required String link,
required String fileKey,
required String filename,
required String methodLabel,
}) async {
final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]; final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0];
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? ''; final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
final int fileSizeBytes = await file.length();
int maxRetries = 3;
int attempt = 0;
while (attempt < maxRetries) {
attempt++;
final client = http.Client();
try {
Log.print('[UPLOAD_LOGGER] 🚀 [$methodLabel] Attempt $attempt/$maxRetries started. Link: $link, File Size: $fileSizeBytes bytes');
var request = http.MultipartRequest('POST', Uri.parse(link)); var request = http.MultipartRequest('POST', Uri.parse(link));
Log.print('uploadImage -> $link');
request.headers.addAll({ request.headers.addAll({
'Authorization': 'Bearer $token', 'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint, 'X-Device-FP': fingerPrint,
@@ -319,67 +334,73 @@ class ImageController extends GetxController {
var stream = http.ByteStream(file.openRead()); var stream = http.ByteStream(file.openRead());
request.files.add( request.files.add(
http.MultipartFile( http.MultipartFile(
'image', fileKey,
stream, stream,
length, length,
filename: '${box.read(BoxName.driverID)}.jpg', filename: filename,
), ),
); );
data.forEach((key, value) { data.forEach((key, value) {
request.fields[key] = value; request.fields[key.toString()] = value.toString();
}); });
var myrequest = await request.send(); final startTime = DateTime.now();
var res = await http.Response.fromStream(myrequest); var streamedResponse = await client.send(request).timeout(const Duration(seconds: 120));
Log.print('uploadImage response [${res.statusCode}]: ${res.body}'); var res = await http.Response.fromStream(streamedResponse);
final duration = DateTime.now().difference(startTime);
Log.print('[UPLOAD_LOGGER] 📥 [$methodLabel] Attempt $attempt response received in ${duration.inSeconds}s. Status Code: ${res.statusCode}');
Log.print('[UPLOAD_LOGGER] 📥 [$methodLabel] Response Body: ${res.body}');
if (res.statusCode == 200) { if (res.statusCode == 200) {
return jsonDecode(res.body); final decoded = jsonDecode(res.body);
if (decoded is Map && decoded['status'] == 'failure') {
throw Exception('Server returned failure status: ${decoded['message']}');
}
return decoded;
} else { } else {
throw Exception('Failed to upload image: ${res.statusCode} - ${res.body}'); throw Exception('Failed to upload image: ${res.statusCode} - ${res.body}');
} }
} catch (e, st) {
Log.print('[UPLOAD_LOGGER] ⚠️ [$methodLabel] Attempt $attempt failed. Error: $e', stackTrace: st);
if (attempt >= maxRetries) {
rethrow;
}
final waitSeconds = attempt * 2;
Log.print('[UPLOAD_LOGGER] ⏳ Waiting $waitSeconds seconds before retrying...');
await Future.delayed(Duration(seconds: waitSeconds));
} finally {
client.close();
}
}
throw Exception('Upload failed after $maxRetries attempts');
}
uploadImage(File file, Map data, String link) async {
return _uploadMultipartFile(
file: file,
data: data,
link: link,
fileKey: 'image',
filename: '${box.read(BoxName.driverID)}.jpg',
methodLabel: 'uploadImage',
);
} }
uploadNewCar(File file, Map data, String link) async { uploadNewCar(File file, Map data, String link) async {
final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]; return _uploadMultipartFile(
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? ''; file: file,
data: data,
var request = http.MultipartRequest('POST', Uri.parse(link)); link: link,
request.headers.addAll({ fileKey: 'image',
'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint,
});
var length = await file.length();
var stream = http.ByteStream(file.openRead());
request.files.add(
http.MultipartFile(
'image',
stream,
length,
filename: '${box.read(BoxName.driverID)}.jpg', filename: '${box.read(BoxName.driverID)}.jpg',
), methodLabel: 'uploadNewCar',
); );
data.forEach((key, value) {
request.fields[key] = value;
});
var myrequest = await request.send();
var res = await http.Response.fromStream(myrequest);
Log.print('uploadNewCar response [${res.statusCode}]: ${res.body}');
if (res.statusCode == 200) {
return jsonDecode(res.body);
} else {
throw Exception('Failed to upload image: ${res.statusCode} - ${res.body}');
}
} }
choosImagePicture(String link, String imageType) async { choosImagePicture(String link, String imageType) async {
final pickedImage = await picker.pickImage( final pickedImage = await picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
// preferredCameraDevice: CameraDevice.rear,
// maxHeight: Get.height * .3,
// maxWidth: Get.width * .9,
// imageQuality: 100,
); );
image = File(pickedImage!.path); image = File(pickedImage!.path);
@@ -400,8 +421,7 @@ class ImageController extends GetxController {
myImage = File(pickedImage.path); myImage = File(pickedImage.path);
isloading = true; isloading = true;
update(); update();
// Save the cropped image
// File savedCroppedImage = File(croppedFile!.path);
File compressedImage = await compressImage(File(croppedFile!.path)); File compressedImage = await compressImage(File(croppedFile!.path));
print('link =$link'); print('link =$link');
try { try {
@@ -411,7 +431,6 @@ class ImageController extends GetxController {
link, link,
); );
// Save the returned URL from the V3 backend to local storage
if (response != null && response['status'] == 'success' && response['message'] != null) { if (response != null && response['status'] == 'success' && response['message'] != null) {
if (response['message']['file_link'] != null) { if (response['message']['file_link'] != null) {
box.write(BoxName.driverPhotoUrl, response['message']['file_link'].toString()); box.write(BoxName.driverPhotoUrl, response['message']['file_link'].toString());
@@ -427,37 +446,14 @@ class ImageController extends GetxController {
} }
uploadImagePicture(File file, Map data, String link) async { uploadImagePicture(File file, Map data, String link) async {
final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]; return _uploadMultipartFile(
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? ''; file: file,
data: data,
var request = http.MultipartRequest('POST', Uri.parse(link)); link: link,
request.headers.addAll({ fileKey: 'image',
'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint,
});
var length = await file.length();
var stream = http.ByteStream(file.openRead());
request.files.add(
http.MultipartFile(
'image',
stream,
length,
filename: '${box.read(BoxName.driverID)}.jpg', filename: '${box.read(BoxName.driverID)}.jpg',
), methodLabel: 'uploadImagePicture',
); );
data.forEach((key, value) {
request.fields[key] = value;
});
var myrequest = await request.send();
var res = await http.Response.fromStream(myrequest);
Log.print('uploadImagePicture response [${res.statusCode}]: ${res.body}');
if (res.statusCode == 200) {
return jsonDecode(res.body);
} else {
throw Exception('Failed to upload image: ${res.statusCode} - ${res.body}');
}
} }
} }

View File

@@ -15,7 +15,6 @@ import '../../../constant/links.dart';
import '../../../constant/style.dart'; import '../../../constant/style.dart';
import '../../../controller/auth/apple_sigin.dart'; import '../../../controller/auth/apple_sigin.dart';
import '../../../controller/auth/captin/login_captin_controller.dart'; import '../../../controller/auth/captin/login_captin_controller.dart';
import '../../../controller/auth/google_sign.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../print.dart'; import '../../../print.dart';
import '../../widgets/elevated_btn.dart'; import '../../widgets/elevated_btn.dart';
@@ -300,14 +299,6 @@ class _LoginCaptinState extends State<LoginCaptin> with WidgetsBindingObserver {
style: AppStyle.title, style: AppStyle.title,
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
_buildSocialButton(
text: 'Sign In with Google'.tr,
icon: FontAwesome.google,
backgroundColor: AppColor.redColor,
onPressed: () async {
GoogleSignInHelper().signInFromLogin();
},
),
if (Platform.isIOS) ...[ if (Platform.isIOS) ...[
const SizedBox(height: 16), const SizedBox(height: 16),
_buildSocialButton( _buildSocialButton(

View File

@@ -6,7 +6,6 @@ import 'package:siro_driver/views/widgets/elevated_btn.dart';
import 'package:siro_driver/views/widgets/my_scafold.dart'; import 'package:siro_driver/views/widgets/my_scafold.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
import '../../../controller/auth/google_sign.dart';
class RegisterCaptin extends StatelessWidget { class RegisterCaptin extends StatelessWidget {
const RegisterCaptin({super.key}); const RegisterCaptin({super.key});
@@ -178,21 +177,7 @@ class RegisterCaptin extends StatelessWidget {
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
height: Get.height * .3, height: Get.height * .3,
width: Get.width * .8, width: Get.width * .8,
child: Center( )
child: Text(
'Sign in with Google for easier email and name entry'.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
),
),
MyElevatedButton(
title: 'Sign In by Google'.tr,
onPressed: () async {
// await GoogleSignInHelper.signIn();
},
kolor: AppColor.blueColor,
),
], ],
), ),
)) ))

View File

@@ -2,7 +2,9 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../constant/box_name.dart';
import '../../../controller/auth/syria/registration_controller.dart'; import '../../../controller/auth/syria/registration_controller.dart';
import '../../../main.dart';
class RegistrationView extends StatelessWidget { class RegistrationView extends StatelessWidget {
const RegistrationView({Key? key}) : super(key: key); const RegistrationView({Key? key}) : super(key: key);
@@ -367,32 +369,47 @@ class RegistrationView extends StatelessWidget {
const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
const SizedBox(height: 20), const SizedBox(height: 20),
_buildImagePickerBox( _buildImagePickerBox(
'Driver License (Front)'.tr, 'National ID (Front)'.tr,
ctrl.docUrls['driver_license_front'], ctrl.docUrls['id_front'],
// () => ctrl.pickImage(ImageType.driverLicenseFront), () async => await ctrl.choosImage(linkUpload, 'id_front'),
() async =>
await ctrl.choosImage(linkUpload, 'driver_license_front'),
), ),
_buildImagePickerBox(
'National ID (Back)'.tr,
ctrl.docUrls['id_back'],
() async => await ctrl.choosImage(linkUpload, 'id_back'),
),
_buildImagePickerBox(
'Driver License (Front)'.tr,
ctrl.docUrls['driver_license'],
() async => await ctrl.choosImage(linkUpload, 'driver_license'),
),
if (box.read(BoxName.countryCode) == 'Syria')
_buildImagePickerBox( _buildImagePickerBox(
'Driver License (Back)'.tr, 'Driver License (Back)'.tr,
ctrl.docUrls['driver_license_back'], ctrl.docUrls['driver_license_back'],
() async => () async =>
await ctrl.choosImage(linkUpload, 'driver_license_back'), await ctrl.choosImage(linkUpload, 'driver_license_back'),
// () => ctrl.pickImage(ImageType.driverLicenseBack), ),
_buildImagePickerBox(
'Profile Picture'.tr,
ctrl.docUrls['profile_picture'],
() async => await ctrl.choosImage(linkUpload, 'profile_picture'),
),
_buildImagePickerBox(
ctrl.getCriminalRecordTitle(),
ctrl.docUrls['criminal_record'],
() async => await ctrl.choosImage(linkUpload, 'criminal_record'),
), ),
_buildImagePickerBox( _buildImagePickerBox(
'Car Registration (Front)'.tr, 'Car Registration (Front)'.tr,
ctrl.docUrls['car_license_front'], ctrl.docUrls['car_license_front'],
() async => () async =>
await ctrl.choosImage(linkUpload, 'car_license_front'), await ctrl.choosImage(linkUpload, 'car_license_front'),
// () => ctrl.pickImage(ImageType.carLicenseFront),
), ),
_buildImagePickerBox( _buildImagePickerBox(
'Car Registration (Back)'.tr, 'Car Registration (Back)'.tr,
ctrl.docUrls['car_license_back'], ctrl.docUrls['car_license_back'],
() async => await ctrl.choosImage(linkUpload, 'car_license_back'), () async => await ctrl.choosImage(linkUpload, 'car_license_back'),
// () => ctrl.pickImage(ImageType.carLicenseBack),
), ),
], ],
), ),

View File

@@ -21,7 +21,6 @@ import flutter_secure_storage_darwin
import flutter_tts import flutter_tts
import flutter_webrtc import flutter_webrtc
import geolocator_apple import geolocator_apple
import google_sign_in_ios
import just_audio import just_audio
import local_auth_darwin import local_auth_darwin
import location import location
@@ -52,7 +51,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin")) FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin")) LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))

View File

@@ -1045,14 +1045,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
google_cloud:
dependency: transitive
description:
name: google_cloud
sha256: b385e20726ef5315d302c5933bfb728103116c5be2d3d17094b01a82da538c1f
url: "https://pub.dev"
source: hosted
version: "0.5.0"
google_fonts: google_fonts:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1061,62 +1053,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.1.0" version: "8.1.0"
google_identity_services_web:
dependency: transitive
description:
name: google_identity_services_web
sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: df5c15533814ed20b7d9e1c5a40a73f174e5d5017bd2669b1c72fb6596fde812
url: "https://pub.dev"
source: hosted
version: "7.2.11"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950
url: "https://pub.dev"
source: hosted
version: "6.3.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14
url: "https://pub.dev"
source: hosted
version: "1.1.3"
googleapis_auth:
dependency: "direct main"
description:
name: googleapis_auth
sha256: "2a8895c3885197f96bb2fd91ee0ae77b53ff3874c7b1f1eadb6566248e880958"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:

View File

@@ -57,8 +57,6 @@ dependencies:
flutter_overlay_window: ^0.5.0 flutter_overlay_window: ^0.5.0
flutter_tts: ^4.0.2 flutter_tts: ^4.0.2
geolocator: ^14.0.2 geolocator: ^14.0.2
google_sign_in: ^7.2.0
googleapis_auth: ^2.0.0
image_cropper: ^12.1.1 image_cropper: ^12.1.1
image_picker: ^1.0.4 image_picker: ^1.0.4
internet_connection_checker: ^3.0.1 internet_connection_checker: ^3.0.1

View File

@@ -3,54 +3,108 @@ import 'package:siro_rider/main.dart';
class AppLink { class AppLink {
static const String appDomain = 'siromove.com'; static const String appDomain = 'siromove.com';
///https://walletintaleq.intaleq.xyz/v1/main
static String get paymentServer => 'https://walletintaleq.intaleq.xyz/v2/main';
///https://api.intaleq.xyz/siro/ride/location
static String get location => 'https://api.intaleq.xyz/siro_v3/ride/location';
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات.
/// https://routesy.intaleq.xyz for syria
/// for jordan https://routesjo.intaleq.xyz
static String get routesOsm => 'https://routesy.intaleq.xyz';
static String get mapSaasRoute => 'https://map-saas.intaleqapp.com/api/maps/route';
static String get reverseGeocoding =>
'https://map-saas.intaleqapp.com/api/geocoding/reverse';
static String get searchGeocoding =>
'https://map-saas.intaleqapp.com/api/geocoding/search';
static String get mapSaasPlaces =>
'https://map-saas.intaleqapp.com/api/geocoding/places';
///https://location.intaleq.xyz/siro/ride/location
///locationServerSide هو السيرفر الجانبي الخاص بموقع السائقين، حيث يتم إرسال تحديثات الموقع من التطبيق إلى هذا السيرفر، ومن ثم يقوم هذا السيرفر بتوزيع هذه التحديثات إلى الركاب المتصلين الذين يتابعون السائق في الوقت الحقيقي.
static String get locationServerSide =>
'https://location.intaleq.xyz/siro/ride/location';
static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan'; static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan';
///https://api.intaleq.xyz/siro static String get paymentServer {
switch (currentCountry) {
case 'Syria': return 'https://wallet-syria.siromove.com/v1/main';
case 'Egypt': return 'https://wallet-egypt.siromove.com/v1/main';
case 'Jordan': return 'https://wallet-jordan.siromove.com/v1/main';
default: return 'https://wallet.siromove.com/v1/main';
}
}
static String get location {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com/siro_v3/ride/location';
case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3/ride/location';
case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3/ride/location';
default: return 'https://api.siromove.com/siro_v3/ride/location';
}
}
static String get locationServerSide {
switch (currentCountry) {
case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
case 'Jordan': return 'https://location-jordan.siromove.com/siro/ride/location';
default: return 'https://location.siromove.com/siro/ride/location';
}
}
static String get routesOsm {
switch (currentCountry) {
case 'Syria': return 'https://routes-syria.siromove.com';
case 'Egypt': return 'https://routes-egypt.siromove.com';
case 'Jordan': return 'https://routes-jordan.siromove.com';
default: return 'https://routes.siromove.com';
}
}
static String get mapSaasRoute {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/maps/route';
case 'Egypt': return 'https://map-egypt.siromove.com/api/maps/route';
case 'Jordan': return 'https://map-jordan.siromove.com/api/maps/route';
default: return 'https://map-saas.intaleqapp.com/api/maps/route';
}
}
static String get reverseGeocoding {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/reverse';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/reverse';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/reverse';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/reverse';
}
}
static String get searchGeocoding {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/search';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/search';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/search';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/search';
}
}
static String get mapSaasPlaces {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/places';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/places';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/places';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/places';
}
}
static String get endPoint => server; static String get endPoint => server;
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات. static String get rideServerSide {
/// https://rides.intaleq.xyz/siro switch (currentCountry) {
static String get rideServerSide => 'https://rides.intaleq.xyz/siro'; case 'Syria': return 'https://api-syria.siromove.com/siro';
case 'Egypt': return 'https://api-egypt.siromove.com/siro';
case 'Jordan': return 'https://api-jordan.siromove.com/siro';
default: return 'https://api.siromove.com/siro';
}
}
/// main api link for all api calls except rides and location
static String get server { static String get server {
switch (currentCountry) { switch (currentCountry) {
case 'Syria': case 'Syria': return 'https://api-syria.siromove.com/siro_v3';
return 'https://api-syria.siromove.com/siro_v3'; case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3';
case 'Egypt': case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3';
return 'https://api-egypt.siromove.com/siro_v3'; default: return 'https://api.siromove.com/siro_v3';
case 'Jordan':
default:
return 'https://api-jordan.siromove.com/siro_v3';
} }
} }
///https://rides.intaleq.xyz static String get serverSocket {
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات. switch (currentCountry) {
static String get serverSocket => 'https://rides.intaleq.xyz'; case 'Syria': return 'https://api-syria.siromove.com';
case 'Egypt': return 'https://api-egypt.siromove.com';
case 'Jordan': return 'https://api-jordan.siromove.com';
default: return 'https://api.siromove.com';
}
}
/// ///
static String get googleMapsLink => 'https://maps.googleapis.com/maps/api/'; static String get googleMapsLink => 'https://maps.googleapis.com/maps/api/';

View File

@@ -1,149 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../../print.dart';
import '../functions/crud.dart';
import '../../onbording_page.dart';
import 'login_controller.dart';
class GoogleSignInHelper {
// ✅ GoogleSignIn singleton
static final GoogleSignIn _signIn = GoogleSignIn.instance;
static GoogleSignInAccount? _lastUser;
/// 👇 استدعها في main() مرة واحدة
static Future<void> init() async {
await _signIn.initialize(
serverClientId:
'594687661098-2u640akrb3k7sak5t0nqki6f4v6hq1bq.apps.googleusercontent.com',
);
// Events listener
_signIn.authenticationEvents.listen((event) async {
if (event is GoogleSignInAuthenticationEventSignIn) {
_lastUser = event.user;
await _handleSignUp(event.user);
} else if (event is GoogleSignInAuthenticationEventSignOut) {
_lastUser = null;
}
});
// silent login if possible
try {
await _signIn.attemptLightweightAuthentication();
} catch (e) {
Log.print("Error: $e");
}
}
/// ✅ تسجيل دخول عادي
static Future<GoogleSignInAccount?> signIn() async {
try {
final user =
await _signIn.authenticate(scopeHint: const ['email', 'profile']);
_lastUser = user;
await _handleSignUp(user);
// اطبع القيم (للتأكد)
Log.print("Google ID: ${user.id}");
Log.print("Email: ${user.email}");
Log.print("Name: ${user.displayName}");
Log.print("Photo: ${user.photoUrl}");
return user;
} on PlatformException catch (e) {
if (e.code == 'sign_in_required') {
await showGooglePlayServicesError();
}
return null;
} catch (e) {
await addError("Google Sign-In error: $e", "signIn()");
return null;
}
}
/// ✅ تسجيل دخول مخصص لشاشة Login (مع استدعاء الكنترولر)
static Future<GoogleSignInAccount?> signInFromLogin() async {
await init();
final user = await signIn();
if (user != null) {
await Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(),
box.read(BoxName.email).toString(),
);
}
return user;
}
/// ✅ طلب سكوبات إضافية (بديل withScopes القديم)
static Future<void> requestExtraScopes(List<String> scopes) async {
final user = _lastUser;
if (user == null) return;
await user.authorizationClient.authorizeScopes(scopes);
}
/// ✅ تسجيل خروج
static Future<void> signOut() async {
await _signIn.signOut();
await _handleSignOut();
}
static GoogleSignInAccount? getCurrentUser() => _lastUser;
// ================= Helpers ==================
static Future<void> _handleSignUp(GoogleSignInAccount user) async {
box.write(BoxName.passengerID, user.id);
box.write(BoxName.email, user.email);
box.write(BoxName.name, user.displayName ?? '');
box.write(BoxName.passengerPhotoUrl, user.photoUrl ?? '');
}
static Future<void> _handleSignOut() async {
box.erase();
Get.offAll(OnBoardingPage());
}
static Future<void> addError(String error, String where) async {
await CRUD().post(link: AppLink.addError, payload: {
'error': error,
'userId': box.read(BoxName.driverID) ?? box.read(BoxName.passengerID),
'userType': box.read(BoxName.driverID) != null ? 'Driver' : 'Passenger',
'phone': box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver),
'device': where,
});
}
static Future<void> showGooglePlayServicesError() async {
const playStoreUrl =
'https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en_US';
final uri = Uri.parse(playStoreUrl);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
showDialog(
context: Get.context!,
builder: (context) => AlertDialog(
title: Text('Error'.tr),
content: Text(
'Could not open the Google Play Store. Please update Google Play Services manually.'
.tr,
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text('Close'.tr),
),
],
),
);
}
}
}

View File

@@ -1,50 +1,50 @@
import 'dart:convert'; // import 'dart:convert';
import 'package:googleapis_auth/auth_io.dart'; // import 'package:googleapis_auth/auth_io.dart';
class AccessTokenManager { // class AccessTokenManager {
static final AccessTokenManager _instance = AccessTokenManager._internal(); // static final AccessTokenManager _instance = AccessTokenManager._internal();
late final String serviceAccountJsonKey; // late final String serviceAccountJsonKey;
AccessToken? _accessToken; // AccessToken? _accessToken;
DateTime? _expiryDate; // DateTime? _expiryDate;
AccessTokenManager._internal(); // AccessTokenManager._internal();
factory AccessTokenManager(String jsonKey) { // factory AccessTokenManager(String jsonKey) {
if (_instance._isServiceAccountKeyInitialized()) { // if (_instance._isServiceAccountKeyInitialized()) {
// Prevent re-initialization // // Prevent re-initialization
return _instance; // return _instance;
} // }
_instance.serviceAccountJsonKey = jsonKey; // _instance.serviceAccountJsonKey = jsonKey;
return _instance; // return _instance;
} // }
bool _isServiceAccountKeyInitialized() { // bool _isServiceAccountKeyInitialized() {
try { // try {
serviceAccountJsonKey; // Access to check if initialized // serviceAccountJsonKey; // Access to check if initialized
return true; // return true;
} catch (e) { // } catch (e) {
return false; // return false;
} // }
} // }
Future<String> getAccessToken() async { // Future<String> getAccessToken() async {
if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) { // if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) {
return _accessToken!.data; // return _accessToken!.data;
} // }
try { // try {
final serviceAccountCredentials = ServiceAccountCredentials.fromJson( // final serviceAccountCredentials = ServiceAccountCredentials.fromJson(
json.decode(serviceAccountJsonKey)); // json.decode(serviceAccountJsonKey));
final client = await clientViaServiceAccount( // final client = await clientViaServiceAccount(
serviceAccountCredentials, // serviceAccountCredentials,
['https://www.googleapis.com/auth/firebase.messaging'], // ['https://www.googleapis.com/auth/firebase.messaging'],
); // );
_accessToken = client.credentials.accessToken; // _accessToken = client.credentials.accessToken;
_expiryDate = client.credentials.accessToken.expiry; // _expiryDate = client.credentials.accessToken.expiry;
client.close(); // client.close();
return _accessToken!.data; // return _accessToken!.data;
} catch (e) { // } catch (e) {
throw Exception('Failed to obtain access token'); // throw Exception('Failed to obtain access token');
} // }
} // }
} // }

View File

@@ -15,7 +15,6 @@ import '../../print.dart';
import '../../views/Rate/rate_captain.dart'; import '../../views/Rate/rate_captain.dart';
import '../../views/home/map_page_passenger.dart'; import '../../views/home/map_page_passenger.dart';
import '../../views/home/profile/promos_passenger_page.dart'; import '../../views/home/profile/promos_passenger_page.dart';
import '../auth/google_sign.dart';
import 'package:siro_rider/controller/voice_call_controller.dart'; import 'package:siro_rider/controller/voice_call_controller.dart';
import '../home/map/ride_lifecycle_controller.dart'; import '../home/map/ride_lifecycle_controller.dart';
import '../home/map/ride_state.dart'; import '../home/map/ride_state.dart';
@@ -159,7 +158,7 @@ class FirebaseMessagesController extends GetxController {
if (Platform.isAndroid) { if (Platform.isAndroid) {
notificationController.showNotification(title, body, 'cancel'); notificationController.showNotification(title, body, 'cancel');
} }
GoogleSignInHelper.signOut(); box.remove(BoxName.jwt);
} else if (category == 'Driver Is Going To Passenger') { } else if (category == 'Driver Is Going To Passenger') {
// <-- كان 'Driver Is Going To Passenger' // <-- كان 'Driver Is Going To Passenger'
Get.find<RideLifecycleController>().isDriverInPassengerWay = true; Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
@@ -253,9 +252,7 @@ class FirebaseMessagesController extends GetxController {
rideIdVal: rideId.toString(), rideIdVal: rideId.toString(),
); );
} }
} } else if (category == 'Order Applied') {
else if (category == 'Order Applied') {
if (Platform.isAndroid) { if (Platform.isAndroid) {
notificationController.showNotification( notificationController.showNotification(
'The order Accepted by another Driver'.tr, 'The order Accepted by another Driver'.tr,
@@ -317,7 +314,7 @@ class FirebaseMessagesController extends GetxController {
// notificationController.showNotification( // notificationController.showNotification(
// 'token change'.tr, 'token change'.tr, 'cancel'); // 'token change'.tr, 'token change'.tr, 'cancel');
// } // }
// GoogleSignInHelper.signOut(); // // GoogleSignInHelper.signOut();
// } else if (message.notification!.title! == 'Driver Is Going To Passenger') { // } else if (message.notification!.title! == 'Driver Is Going To Passenger') {
// Get.find<RideLifecycleController>().isDriverInPassengerWay = true; // Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
// Get.find<RideLifecycleController>().update(); // Get.find<RideLifecycleController>().update();

View File

@@ -1,12 +1,12 @@
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../constant/links.dart';
import '../../print.dart'; // للترجمة .tr import '../../print.dart'; // للترجمة .tr
class NotificationService { class NotificationService {
static const String _serverUrl = static String get _serverUrl => '${AppLink.server}/ride/firebase/send_fcm.php';
'https://api.intaleq.xyz/siro/ride/firebase/send_fcm.php';
static Future<void> sendNotification({ static Future<void> sendNotification({
required String target, required String target,

View File

@@ -19,7 +19,6 @@ import flutter_secure_storage_darwin
import flutter_tts import flutter_tts
import flutter_webrtc import flutter_webrtc
import geolocator_apple import geolocator_apple
import google_sign_in_ios
import just_audio import just_audio
import local_auth_darwin import local_auth_darwin
import location import location
@@ -49,7 +48,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin")) FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin")) LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))

View File

@@ -885,14 +885,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
google_cloud:
dependency: transitive
description:
name: google_cloud
sha256: b385e20726ef5315d302c5933bfb728103116c5be2d3d17094b01a82da538c1f
url: "https://pub.dev"
source: hosted
version: "0.5.0"
google_fonts: google_fonts:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -901,62 +893,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.1.0" version: "8.1.0"
google_identity_services_web:
dependency: transitive
description:
name: google_identity_services_web
sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: df5c15533814ed20b7d9e1c5a40a73f174e5d5017bd2669b1c72fb6596fde812
url: "https://pub.dev"
source: hosted
version: "7.2.11"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950
url: "https://pub.dev"
source: hosted
version: "6.3.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14
url: "https://pub.dev"
source: hosted
version: "1.1.3"
googleapis_auth:
dependency: "direct main"
description:
name: googleapis_auth
sha256: "2a8895c3885197f96bb2fd91ee0ae77b53ff3874c7b1f1eadb6566248e880958"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:

View File

@@ -59,12 +59,10 @@ dependencies:
webview_flutter_wkwebview: ^3.14.0 webview_flutter_wkwebview: ^3.14.0
just_audio: ^0.10.5 just_audio: ^0.10.5
# share: ^2.0.4 # share: ^2.0.4
google_sign_in: ^7.2.0
sign_in_with_apple: ^7.0.1 sign_in_with_apple: ^7.0.1
firebase_auth: ^6.1.4 firebase_auth: ^6.1.4
device_info_plus: ^12.1.0 device_info_plus: ^12.1.0
# uni_links: ^0.5.1 # uni_links: ^0.5.1
googleapis_auth: ^2.0.0
flutter_confetti: ^0.5.1 flutter_confetti: ^0.5.1
# intl_phone_field: ^3.1.0 # intl_phone_field: ^3.1.0
flutter_contacts: ^1.1.9+2 flutter_contacts: ^1.1.9+2

View File

@@ -9,22 +9,80 @@ class AppLink {
static final String seferAlexandriaServer = Env.seferAlexandriaServer; static final String seferAlexandriaServer = Env.seferAlexandriaServer;
static final String seferCairoServer = Env.seferCairoServer; static final String seferCairoServer = Env.seferCairoServer;
static final String seferGizaServer = Env.seferGizaServer; static final String seferGizaServer = Env.seferGizaServer;
static String paymentServer = 'https://walletintaleq.intaleq.xyz/v1/main'; static String get currentCountry => box.read('countryCode') ?? 'Jordan';
static String locationServer = 'https://location.intaleq.xyz/siro/ride/location';
static String location = locationServer; static String get paymentServer {
static String locationServerSide = 'https://location.intaleq.xyz/siro/ride/location'; switch (currentCountry) {
static String mapSaasRoute = 'https://map-saas.intaleqapp.com/api/maps/route'; case 'Syria': return 'https://wallet-syria.siromove.com/v1/main';
static String mapSaasPlaces = 'https://map-saas.intaleqapp.com/api/geocoding/places'; case 'Egypt': return 'https://wallet-egypt.siromove.com/v1/main';
static const String routeApiBaseUrl = "https://routesjo.intaleq.xyz/route/v1/driving"; case 'Jordan': return 'https://wallet-jordan.siromove.com/v1/main';
static final String syria = 'https://syria.intaleq.xyz/siro'; default: return 'https://wallet.siromove.com/v1/main';
}
}
static String get locationServer {
switch (currentCountry) {
case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
case 'Jordan': return 'https://location-jordan.siromove.com/siro/ride/location';
default: return 'https://location.siromove.com/siro/ride/location';
}
}
static String get location => locationServer;
static String get locationServerSide => locationServer;
static String get mapSaasRoute {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/maps/route';
case 'Egypt': return 'https://map-egypt.siromove.com/api/maps/route';
case 'Jordan': return 'https://map-jordan.siromove.com/api/maps/route';
default: return 'https://map-saas.intaleqapp.com/api/maps/route';
}
}
static String get mapSaasPlaces {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/places';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/places';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/places';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/places';
}
}
static String get routeApiBaseUrl {
switch (currentCountry) {
case 'Syria': return 'https://routes-syria.siromove.com/route/v1/driving';
case 'Egypt': return 'https://routes-egypt.siromove.com/route/v1/driving';
case 'Jordan': return 'https://routes-jordan.siromove.com/route/v1/driving';
default: return 'https://routes.siromove.com/route/v1/driving';
}
}
static String get syria => 'https://api-syria.siromove.com/siro';
static String seferPaymentServer0 = box.read('seferPaymentServer'); static String seferPaymentServer0 = box.read('seferPaymentServer');
static final String endPoint = 'https://api.intaleq.xyz/siro_v3'; static String get endPoint {
static final String rideServer = 'https://rides.intaleq.xyz/siro'; switch (currentCountry) {
// static final String server = Env.serverPHP; case 'Syria': return 'https://api-syria.siromove.com/siro_v3';
static String getBestDriver = "$server/Admin/driver/getBestDriver.php"; case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3';
static final String server = 'https://api.intaleq.xyz/siro_v3'; case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3';
default: return 'https://api.siromove.com/siro_v3';
}
}
static String get rideServer {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com/siro';
case 'Egypt': return 'https://api-egypt.siromove.com/siro';
case 'Jordan': return 'https://api-jordan.siromove.com/siro';
default: return 'https://api.siromove.com/siro';
}
}
static String get getBestDriver => "$server/Admin/driver/getBestDriver.php";
static String get server => endPoint;
static final String jwtService = '$server/jwtService.php'; static final String jwtService = '$server/jwtService.php';
static String addError = "$server/Admin/errorApp.php"; static String addError = "$server/Admin/errorApp.php";

View File

@@ -13,7 +13,6 @@ import firebase_messaging
import flutter_image_compress_macos import flutter_image_compress_macos
import flutter_local_notifications import flutter_local_notifications
import flutter_secure_storage_macos import flutter_secure_storage_macos
import google_sign_in_ios
import share_plus import share_plus
import sqflite_darwin import sqflite_darwin
import url_launcher_macos import url_launcher_macos
@@ -27,7 +26,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@@ -600,54 +600,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.3" version: "6.3.3"
google_identity_services_web:
dependency: transitive
description:
name: google_identity_services_web
sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: df5c15533814ed20b7d9e1c5a40a73f174e5d5017bd2669b1c72fb6596fde812
url: "https://pub.dev"
source: hosted
version: "7.2.11"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950
url: "https://pub.dev"
source: hosted
version: "6.3.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14
url: "https://pub.dev"
source: hosted
version: "1.1.3"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:

View File

@@ -49,7 +49,6 @@ dependencies:
url_launcher: ^6.3.0 url_launcher: ^6.3.0
flutter_launcher_icons: ^0.14.3 flutter_launcher_icons: ^0.14.3
envied: ^1.1.1 envied: ^1.1.1
google_sign_in: ^7.1.1
firebase_auth: ^6.0.0 firebase_auth: ^6.0.0
vibration: ^3.1.3 vibration: ^3.1.3
flutter_secure_storage: ^9.2.2 flutter_secure_storage: ^9.2.2