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

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

View File

@@ -279,9 +279,7 @@ class RegisterCaptainController extends GetxController {
// box.read(BoxName.driverID).toString(),
// box.read(BoxName.emailDriver).toString(),
// );
// Get.offAll(() => SyrianCardAI());
Get.to(() => RegistrationView());
// } else {
// Get.snackbar('title', 'message');
// }
}
@@ -313,7 +311,7 @@ class RegisterCaptainController extends GetxController {
if (formKey.currentState!.validate()) {
isLoading = true;
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 = {
'driver_license_front': '',
'id_front': '',
'id_back': '',
'driver_license': '',
'driver_license_back': '',
'profile_picture': '',
'criminal_record': '',
'car_license_front': '',
'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
Future<void> choosImage(String link, String imageType) async {
try {
@@ -329,58 +340,66 @@ class RegistrationController extends GetxController {
}
}
/// ترفع الملف وترجع رابط الصورة النهائي كـ String
/// ترفع الملف وترجع رابط الصورة النهائي كـ String مع إعادة المحاولة في حال فشل الاتصال
Future<String> uploadImage(
File file, Map<String, String> data, String link) async {
final uri = Uri.parse(link);
final request = http.MultipartRequest('POST', uri);
int maxRetries = 3;
int attempt = 0;
while (attempt < maxRetries) {
attempt++;
try {
final uri = Uri.parse(link);
final request = http.MultipartRequest('POST', uri);
// الهيدرز (كما عندك)
final headers = <String, String>{
'Authorization':
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
};
request.headers.addAll(headers);
final headers = <String, String>{
'Authorization':
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
};
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(
await http.MultipartFile.fromPath(
'image', // تأكد أنه نفس اسم الحقل على السيرفر
file.path,
filename: forcedName,
),
);
request.files.add(
await http.MultipartFile.fromPath(
'image',
file.path,
filename: forcedName,
),
);
// الحقول الإضافية
data.forEach((k, v) => request.fields[k] = v);
data.forEach((k, v) => request.fields[k] = v);
// الإرسال
final streamed = await request.send();
final res = await http.Response.fromStream(streamed);
// المهلة الزمنية 120 ثانية لتناسب الاتصالات الضعيفة
final streamed = await request.send().timeout(const Duration(seconds: 120));
final res = await http.Response.fromStream(streamed);
if (res.statusCode != 200) {
throw Exception(
'Failed to upload image: ${res.statusCode} - ${res.body}');
if (res.statusCode != 200) {
throw Exception(
'Failed to upload image: ${res.statusCode} - ${res.body}');
}
final body = jsonDecode(res.body);
final String? url = body['url'] ??
body['file_link'] ??
body['image_url'] ??
(body['data'] is Map ? body['data']['url'] : null);
if (url == null || url.isEmpty) {
throw Exception(
'Upload succeeded but no image URL found in response: ${res.body}');
}
return url;
} catch (e) {
Log.print("⚠️ [Image Upload Attempt $attempt Failed] Error: $e");
if (attempt >= maxRetries) {
rethrow;
}
await Future.delayed(Duration(seconds: attempt * 2));
}
}
// نحاول استخراج رابط الصورة من أكثر من مفتاح محتمل
final body = jsonDecode(res.body);
final String? url = body['url'] ??
body['file_link'] ??
body['image_url'] ??
(body['data'] is Map ? body['data']['url'] : null);
if (url == null || url.isEmpty) {
// لو السيرفر يرجع هيكل مختلف، عدّل هنا المفتاح حسب استجابتك الفعلية
throw Exception(
'Upload succeeded but no image URL found in response: ${res.body}');
}
return url;
throw Exception('Upload failed after $maxRetries attempts');
}
Future<File> compressImage(File file) async {
@@ -398,7 +417,7 @@ class RegistrationController extends GetxController {
return File(result!.path);
}
// دالة رفع إلى السيرفر السوري: ترجع file_url (Signed URL)
// دالة رفع إلى السيرفر السوري مع مهلة 120 ثانية وإعادة محاولة تلقائية في حال الفشل
Future<String> uploadToSyria({
required String docType,
required File file,
@@ -406,79 +425,71 @@ class RegistrationController extends GetxController {
required String authHeader,
required String hmacHeader,
required String driverId,
Duration timeout = const Duration(seconds: 60),
Duration timeout = const Duration(seconds: 120),
http.Client? clientOverride,
}) async {
final client = clientOverride ?? http.Client();
try {
final mime = lookupMimeType(file.path) ?? 'image/jpeg';
final parts = mime.split('/');
final req = http.MultipartRequest('POST', syrianUploadUri);
req.headers.addAll({
'Authorization': authHeader,
'X-HMAC-Auth': hmacHeader,
});
req.fields['driver_id'] = driverId;
req.fields['doc_type'] = docType;
req.files.add(
await http.MultipartFile.fromPath(
'file',
file.path,
filename: p.basename(file.path),
contentType: MediaType(parts.first, parts.last),
),
);
// ====== الطباعة قبل الإرسال ======
// 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 resp = await http.Response.fromStream(streamed);
// ====== الطباعة بعد الاستجابة ======
// Log.print('--- Syrian Upload Response ---');
Log.print('Status: ${resp.statusCode}');
// Log.print('Headers: ${resp.headers}');
// Log.print('Body: ${resp.body}');
// Log.print('-------------------------------');
Map<String, dynamic> j = {};
int maxRetries = 3;
int attempt = 0;
while (attempt < maxRetries) {
attempt++;
final client = clientOverride ?? http.Client();
try {
j = jsonDecode(resp.body) as Map<String, dynamic>;
final mime = lookupMimeType(file.path) ?? 'image/jpeg';
final parts = mime.split('/');
final req = http.MultipartRequest('POST', syrianUploadUri);
req.headers.addAll({
'Authorization': authHeader,
'X-HMAC-Auth': hmacHeader,
});
req.fields['driver_id'] = driverId;
req.fields['doc_type'] = docType;
req.files.add(
await http.MultipartFile.fromPath(
'file',
file.path,
filename: p.basename(file.path),
contentType: MediaType(parts.first, parts.last),
),
);
final streamed = await client.send(req).timeout(timeout);
final resp = await http.Response.fromStream(streamed);
Log.print('--- Syrian Upload Response (Attempt $attempt) ---');
Log.print('Status: ${resp.statusCode}');
Map<String, dynamic> j = {};
try {
j = jsonDecode(resp.body) as Map<String, dynamic>;
} catch (e) {
Log.print('⚠️ Failed to parse JSON: $e');
}
final statusOk = j['status'] == 'success';
final fileUrl = (j['file_url'] ?? j['message']?['file_url'])?.toString();
if (resp.statusCode == 200 &&
statusOk &&
(fileUrl?.isNotEmpty ?? false)) {
return fileUrl!;
}
throw Exception(
'❌ Syrian upload failed ($docType): ${j['message'] ?? resp.body}');
} catch (e) {
Log.print('⚠️ Failed to parse JSON: $e');
Log.print("⚠️ [Syria Upload Attempt $attempt Failed] Error: $e");
if (attempt >= maxRetries) {
rethrow;
}
await Future.delayed(Duration(seconds: attempt * 2));
} finally {
if (clientOverride == null) client.close();
}
// التحمّل لشكلين من الـ JSON:
final statusOk = j['status'] == 'success';
final fileUrl = (j['file_url'] ?? j['message']?['file_url'])?.toString();
final fileName =
(j['file_name'] ?? j['message']?['file_name'])?.toString();
if (resp.statusCode == 200 &&
statusOk &&
(fileUrl?.isNotEmpty ?? false)) {
// Log.print(
// '✅ Syrian upload success: $fileUrl (file: ${fileName ?? "-"})');
return fileUrl!;
}
throw Exception(
'❌ Syrian upload failed ($docType): ${j['message'] ?? resp.body}');
} finally {
if (clientOverride == null) client.close();
}
throw Exception('Syrian upload failed after $maxRetries attempts');
}
Future<void> submitRegistration() async {
@@ -490,19 +501,24 @@ class RegistrationController extends GetxController {
}
// 1) تحقق من وجود الروابط
final driverFrontUrl = docUrls['driver_license_front'];
final driverBackUrl = docUrls['driver_license_back'];
final idFrontUrl = docUrls['id_front'];
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 carBackUrl = docUrls['car_license_back'];
Log.print(driverFrontUrl.toString());
Log.print(driverBackUrl.toString());
Log.print(carFrontUrl.toString());
Log.print(carBackUrl.toString());
if (driverFrontUrl == null ||
driverBackUrl == null ||
carFrontUrl == null ||
carBackUrl == null) {
final isSyria = box.read(BoxName.countryCode) == 'Syria';
if (idFrontUrl == null || idFrontUrl.isEmpty ||
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);
return;
}
@@ -607,10 +623,14 @@ class RegistrationController extends GetxController {
}
// --- روابط الصور ---
_addField(fields, 'driver_license_front', driverFrontUrl!);
_addField(fields, 'driver_license_back', driverBackUrl!);
_addField(fields, 'car_license_front', carFrontUrl!);
_addField(fields, 'car_license_back', carBackUrl!);
_addField(fields, 'id_front', idFrontUrl);
_addField(fields, 'id_back', idBackUrl);
_addField(fields, 'driver_license', driverLicenseUrl);
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);

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

View File

@@ -1,10 +1,10 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:get/get.dart'; // للترجمة .tr
import '../../constant/links.dart';
class NotificationService {
static const String _serverUrl =
'https://api.intaleq.xyz/siro/ride/firebase/send_fcm.php';
static String get _serverUrl => '${AppLink.ride}/firebase/send_fcm.php';
static Future<void> sendNotification({
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 fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
final String driverID = box.read(BoxName.driverID).toString();
final String link = AppLink.uploadImagePortrate;
var request = http.MultipartRequest(
'POST',
Uri.parse(AppLink.uploadImagePortrate),
);
int maxRetries = 3;
int attempt = 0;
String responseString = '';
request.files.add(
http.MultipartFile.fromBytes('image', imagePortrait),
);
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(
http.MultipartFile.fromBytes('image', imagePortrait, filename: '$driverID.jpg'),
);
request.headers.addAll({
'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint,
});
request.fields['driverID'] = box.read(BoxName.driverID).toString();
request.headers.addAll({
'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint,
});
request.fields['driverID'] = driverID;
var response = await request.send();
var responseData = await response.stream.toBytes();
var responseString = String.fromCharCodes(responseData);
final startTime = DateTime.now();
var streamedResponse = await client.send(request).timeout(const Duration(seconds: 120));
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;
update();

View File

@@ -303,83 +303,104 @@ 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 fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
final int fileSizeBytes = await file.length();
var request = http.MultipartRequest('POST', Uri.parse(link));
Log.print('uploadImage -> $link');
int maxRetries = 3;
int attempt = 0;
request.headers.addAll({
'Authorization': 'Bearer $token',
'X-Device-FP': fingerPrint,
});
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));
request.headers.addAll({
'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',
),
);
data.forEach((key, value) {
request.fields[key] = value;
});
var length = await file.length();
var stream = http.ByteStream(file.openRead());
request.files.add(
http.MultipartFile(
fileKey,
stream,
length,
filename: filename,
),
);
data.forEach((key, value) {
request.fields[key.toString()] = value.toString();
});
var myrequest = await request.send();
var res = await http.Response.fromStream(myrequest);
Log.print('uploadImage response [${res.statusCode}]: ${res.body}');
if (res.statusCode == 200) {
return jsonDecode(res.body);
} else {
throw Exception('Failed to upload image: ${res.statusCode} - ${res.body}');
final startTime = DateTime.now();
var streamedResponse = await client.send(request).timeout(const Duration(seconds: 120));
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) {
final decoded = jsonDecode(res.body);
if (decoded is Map && decoded['status'] == 'failure') {
throw Exception('Server returned failure status: ${decoded['message']}');
}
return decoded;
} else {
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 {
final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0];
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
var request = http.MultipartRequest('POST', Uri.parse(link));
request.headers.addAll({
'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',
),
return _uploadMultipartFile(
file: file,
data: data,
link: link,
fileKey: 'image',
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 {
final pickedImage = await picker.pickImage(
source: ImageSource.gallery,
// preferredCameraDevice: CameraDevice.rear,
// maxHeight: Get.height * .3,
// maxWidth: Get.width * .9,
// imageQuality: 100,
);
image = File(pickedImage!.path);
@@ -400,8 +421,7 @@ class ImageController extends GetxController {
myImage = File(pickedImage.path);
isloading = true;
update();
// Save the cropped image
// File savedCroppedImage = File(croppedFile!.path);
File compressedImage = await compressImage(File(croppedFile!.path));
print('link =$link');
try {
@@ -411,7 +431,6 @@ class ImageController extends GetxController {
link,
);
// Save the returned URL from the V3 backend to local storage
if (response != null && response['status'] == 'success' && response['message'] != null) {
if (response['message']['file_link'] != null) {
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 {
final String token = r(box.read(BoxName.jwt)).split(AppInformation.addd)[0];
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
var request = http.MultipartRequest('POST', Uri.parse(link));
request.headers.addAll({
'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',
),
return _uploadMultipartFile(
file: file,
data: data,
link: link,
fileKey: 'image',
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 '../../../controller/auth/apple_sigin.dart';
import '../../../controller/auth/captin/login_captin_controller.dart';
import '../../../controller/auth/google_sign.dart';
import '../../../main.dart';
import '../../../print.dart';
import '../../widgets/elevated_btn.dart';
@@ -300,14 +299,6 @@ class _LoginCaptinState extends State<LoginCaptin> with WidgetsBindingObserver {
style: AppStyle.title,
),
const SizedBox(height: 24),
_buildSocialButton(
text: 'Sign In with Google'.tr,
icon: FontAwesome.google,
backgroundColor: AppColor.redColor,
onPressed: () async {
GoogleSignInHelper().signInFromLogin();
},
),
if (Platform.isIOS) ...[
const SizedBox(height: 16),
_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 '../../../constant/colors.dart';
import '../../../controller/auth/google_sign.dart';
class RegisterCaptin extends StatelessWidget {
const RegisterCaptin({super.key});
@@ -178,21 +177,7 @@ class RegisterCaptin extends StatelessWidget {
decoration: AppStyle.boxDecoration1,
height: Get.height * .3,
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:get/get.dart';
import '../../../constant/box_name.dart';
import '../../../controller/auth/syria/registration_controller.dart';
import '../../../main.dart';
class RegistrationView extends StatelessWidget {
const RegistrationView({Key? key}) : super(key: key);
@@ -367,32 +369,47 @@ class RegistrationView extends StatelessWidget {
const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
const SizedBox(height: 20),
_buildImagePickerBox(
'Driver License (Front)'.tr,
ctrl.docUrls['driver_license_front'],
// () => ctrl.pickImage(ImageType.driverLicenseFront),
() async =>
await ctrl.choosImage(linkUpload, 'driver_license_front'),
'National ID (Front)'.tr,
ctrl.docUrls['id_front'],
() async => await ctrl.choosImage(linkUpload, 'id_front'),
),
_buildImagePickerBox(
'Driver License (Back)'.tr,
ctrl.docUrls['driver_license_back'],
() async =>
await ctrl.choosImage(linkUpload, 'driver_license_back'),
// () => ctrl.pickImage(ImageType.driverLicenseBack),
'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(
'Driver License (Back)'.tr,
ctrl.docUrls['driver_license_back'],
() async =>
await ctrl.choosImage(linkUpload, 'driver_license_back'),
),
_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(
'Car Registration (Front)'.tr,
ctrl.docUrls['car_license_front'],
() async =>
await ctrl.choosImage(linkUpload, 'car_license_front'),
// () => ctrl.pickImage(ImageType.carLicenseFront),
),
_buildImagePickerBox(
'Car Registration (Back)'.tr,
ctrl.docUrls['car_license_back'],
() async => await ctrl.choosImage(linkUpload, 'car_license_back'),
// () => ctrl.pickImage(ImageType.carLicenseBack),
),
],
),