8/17/1
This commit is contained in:
7
.env
7
.env
@@ -14,7 +14,12 @@ chatGPTkeySeferNew=zg-Z4AJcAROgNXjgrEIU8fKC9XrxgUE4Qtrrlq1yiux0jL3dITSXrXlBl
|
||||
secretKey=zg_ropj_57Iiv6MFCBFq3C2n6IXlmjykpxDmW93SW3vvXh68UA9T5FORTWgWsT37StKsOPdwDdsy8qR9srMUluahs3nPHvgBa33tGk90vV5XrXlBl
|
||||
stripe_publishableKe=vg_ropj_57Iiv6MFCBFq3C2n6kNJnZByV6nuDtXe9IjEPOfhmpDtWmt3MLR0gQpiHcQmAFMUPrZc3QiCDjxBZLbxDC3efxWxz33bWH1ZgrsXrXlBl
|
||||
llamaKey=RR-EuyoFDUvfRDBj46fZKAtKJ3voM8Mt768cPeJV7GNdAkPTKdY8Odm9n4ggGqI5GyoXrXlBl
|
||||
serverPHP=https://api.sefer.live/sefer
|
||||
serverPHP=https://sefer.click/sefer
|
||||
seferAlexandriaServer=https://seferalexandria.site/sefer
|
||||
seferPaymentServer=https://seferpayment.shop/sefer/ride
|
||||
seferCairoServer=https://sefer.click/sefer
|
||||
seferGizaServer=https://sefergiza.site/sefer
|
||||
# serverPHP=https://api.sefer.live/sefer
|
||||
cohere=Aulwd8y5SPWos0hJhG0toUf8gOhUUrpf5Q2TPmVGXrXlBl
|
||||
claudeAiAPI=zg-qbc-qvo39-xWOxIGwWTOzCFBnIYSKKhfyz_KVAvrH-6_4ZEJL68G_QBH26oeTOMMoQug9KuOjjKSP_A4S3SUDlbxR9duVzoQ-MkX_UQQQXrXlBl
|
||||
payPalClientId=QALymfNI5Tzt4s-ysoz6vD4_nqX0SUtkC_qYV-Ugk5gaM_8Z-kg4L53k8Uux_4jEWXDkNpXGSWPpIzDFXrXlBl
|
||||
|
||||
@@ -55,8 +55,8 @@ android {
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 34
|
||||
versionCode 54
|
||||
versionName '1.5.54'
|
||||
versionCode 55
|
||||
versionName '1.5.55'
|
||||
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>45</string>
|
||||
<string>47</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>4.3.45</string>
|
||||
<string>4.3.47</string>
|
||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||
<string>NO</string>
|
||||
<key>GMSApiKey</key>
|
||||
|
||||
@@ -5,6 +5,7 @@ class BoxName {
|
||||
|
||||
static const String tokenParent = "tokenParent";
|
||||
static const String lang = "lang";
|
||||
static const String serverChosen = "serverChosen";
|
||||
static const String gender = "gender";
|
||||
static const String carType = "carType";
|
||||
static const String carPlate = "carPlate";
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/env/env.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
|
||||
class AppLink {
|
||||
static final String server = Env.serverPHP;
|
||||
// static final String seferPaymentServer = Env.seferPaymentServer;
|
||||
static final String seferPaymentServer = '${Env.seferCairoServer}/ride';
|
||||
static final String seferAlexandriaServer = Env.seferAlexandriaServer;
|
||||
static final String seferCairoServer = Env.seferCairoServer;
|
||||
static final String seferGizaServer = Env.seferGizaServer;
|
||||
|
||||
static final String endPoint = box.read(BoxName.serverChosen);
|
||||
static final String server = endPoint;
|
||||
|
||||
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
||||
static String llama = 'https://api.llama-api.com/chat/completions';
|
||||
static String gemini =
|
||||
@@ -16,8 +26,8 @@ class AppLink {
|
||||
static String packageInfo = "$server/auth/packageInfo.php";
|
||||
|
||||
//=======================Wallet===================
|
||||
static String wallet = '$server/ride/passengerWallet';
|
||||
static String walletDriver = '$server/ride/driverWallet';
|
||||
static String wallet = '$seferPaymentServer/passengerWallet';
|
||||
static String walletDriver = '$seferPaymentServer/driverWallet';
|
||||
static String getAllPassengerTransaction =
|
||||
"$wallet/getAllPassengerTransaction.php";
|
||||
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
|
||||
@@ -25,8 +35,8 @@ class AppLink {
|
||||
static String getPassengerWalletArchive =
|
||||
"$wallet/getPassengerWalletArchive.php";
|
||||
|
||||
static String addDrivePayment = "$ride/payment/add.php";
|
||||
static String addSeferWallet = "$ride/seferWallet/add.php";
|
||||
static String addDrivePayment = "$seferPaymentServer/payment/add.php";
|
||||
static String addSeferWallet = "$seferPaymentServer/seferWallet/add.php";
|
||||
static String addPassengersWallet = "$wallet/add.php";
|
||||
static String deletePassengersWallet = "$wallet/delete.php";
|
||||
static String updatePassengersWallet = "$wallet/update.php";
|
||||
@@ -47,19 +57,22 @@ class AppLink {
|
||||
|
||||
////=======================cancelRide===================
|
||||
static String ride = '$server/ride';
|
||||
static String addCancelRideFromPassenger = "$server/ride/cancelRide/add.php";
|
||||
static String cancelRide = "$server/ride/cancelRide/get.php";
|
||||
static String addCancelRideFromPassenger =
|
||||
"$endPoint/ride/cancelRide/add.php";
|
||||
static String cancelRide = "$endPoint/ride/cancelRide/get.php";
|
||||
//-----------------ridessss------------------
|
||||
static String addRides = "$ride/rides/add.php";
|
||||
static String getRides = "$ride/rides/get.php";
|
||||
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
||||
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
||||
static String getRides = "$endPoint/ride/rides/get.php";
|
||||
static String getRideOrderID = "$endPoint/ride/rides/getRideOrderID.php";
|
||||
static String getRideStatus = "$endPoint/ride/rides/getRideStatus.php";
|
||||
static String getRideStatusBegin =
|
||||
"$endPoint/ride/rides/getRideStatusBegin.php";
|
||||
static String getRideStatusFromStartApp =
|
||||
"$ride/rides/getRideStatusFromStartApp.php";
|
||||
static String updateRides = "$ride/rides/update.php";
|
||||
static String updateStausFromSpeed = "$ride/rides/updateStausFromSpeed.php";
|
||||
static String deleteRides = "$ride/rides/delete.php";
|
||||
static String updateRides = "$endPoint/ride/rides/update.php";
|
||||
static String updateStausFromSpeed =
|
||||
"$endPoint/ride/rides/updateStausFromSpeed.php";
|
||||
static String deleteRides = "$endPoint/ride/rides/delete.php";
|
||||
|
||||
//-----------------DriverPayment------------------
|
||||
static String adddriverScam = "$ride/driver_scam/add.php";
|
||||
@@ -128,7 +141,7 @@ class AppLink {
|
||||
static String updateLicense = "$ride/license/updateFeedBack.php";
|
||||
//-----------------RegisrationCar------------------
|
||||
static String addRegisrationCar = "$ride/RegisrationCar/add.php";
|
||||
static String getRegisrationCar = "$ride/RegisrationCar/get.php";
|
||||
static String getRegisrationCar = "$endPoint/ride/RegisrationCar/get.php";
|
||||
static String selectDriverAndCarForMishwariTrip =
|
||||
"$ride/RegisrationCar/selectDriverAndCarForMishwariTrip.php";
|
||||
static String updateRegisrationCar = "$ride/RegisrationCar/update.php";
|
||||
@@ -169,7 +182,7 @@ class AppLink {
|
||||
static String uploadEgypt = "$server/uploadEgypt.php";
|
||||
|
||||
//==================certifcate==========
|
||||
static String location = '$server/ride/location';
|
||||
static String location = '$endPoint/ride/location';
|
||||
static String getCarsLocationByPassenger = "$location/get.php";
|
||||
static String addpassengerLocation = "$location/addpassengerLocation.php";
|
||||
static String getCarsLocationByPassengerSpeed = "$location/getSpeed.php";
|
||||
|
||||
@@ -181,6 +181,14 @@ class RegisterController extends GetxController {
|
||||
payload: payload,
|
||||
);
|
||||
if (res1 != 'failure') {
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
|
||||
payload: payload,
|
||||
);
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferGizaServer}/auth/signup.php',
|
||||
payload: payload,
|
||||
);
|
||||
box.write(BoxName.isVerified, '1');
|
||||
box.write(BoxName.phone, '+2${phoneController.text}');
|
||||
Get.offAll(const MapPagePassenger());
|
||||
|
||||
@@ -195,11 +195,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
await Get.find<MapPassengerController>()
|
||||
.getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 7000);
|
||||
|
||||
Get.find<MapPassengerController>()
|
||||
.confirmRideForAllDriverAvailable();
|
||||
.reSearchAfterCanceledFromDriver();
|
||||
},
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
|
||||
@@ -28,9 +28,11 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
Log.print('payload: ${payload}');
|
||||
print(response.body);
|
||||
Log.print('response.request: ${response.request}');
|
||||
Log.print('response.reasonPhrase: ${response.reasonPhrase}');
|
||||
|
||||
Log.print('response.body: ${response.body}');
|
||||
// print(payload);
|
||||
// if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
@@ -231,8 +233,10 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
print(response.body);
|
||||
Log.print('payload: ${payload}');
|
||||
// print(response.request);
|
||||
Log.print('response.request: ${response.request}');
|
||||
Log.print('response.body: ${response.body}');
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
|
||||
@@ -218,7 +218,7 @@ class MapPassengerController extends GetxController {
|
||||
bool currentLocationToFormPlaces3 = false;
|
||||
bool currentLocationToFormPlaces4 = false;
|
||||
List currentLocationToFormPlacesAll = [];
|
||||
late String driverToken;
|
||||
late String driverToken = '';
|
||||
int carsOrder = 0;
|
||||
int wayPointIndex = 0;
|
||||
late double kazan;
|
||||
@@ -559,7 +559,7 @@ class MapPassengerController extends GetxController {
|
||||
remainingTimeToPassengerFromDriverAfterApplied =
|
||||
timeToPassengerFromDriverAfterApplied - secondsElapsed;
|
||||
|
||||
if (remainingTimeToPassengerFromDriverAfterApplied < 69) {
|
||||
if (remainingTimeToPassengerFromDriverAfterApplied < 59) {
|
||||
if (rideTimerBegin == false) {
|
||||
rideTimerBegin = true;
|
||||
}
|
||||
@@ -1016,11 +1016,13 @@ class MapPassengerController extends GetxController {
|
||||
late String make = '';
|
||||
late String licensePlate = '';
|
||||
confirmRideForFirstDriver() async {
|
||||
startCarLocationSearch(box.read(BoxName.carType));
|
||||
// await getCarsLocationByPassengerAndReloadMarker();
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
await getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 7000);
|
||||
await getNearestDriverByPassengerLocationAPIGOOGLE();
|
||||
|
||||
if (dataCarsLocationByPassenger != 'failure') {
|
||||
if (dataCarsLocationByPassenger != 'failure' ||
|
||||
dataCarsLocationByPassenger != null) {
|
||||
driverToken =
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();
|
||||
driverPhone =
|
||||
@@ -1050,7 +1052,6 @@ class MapPassengerController extends GetxController {
|
||||
isDriversTokensSend = false;
|
||||
|
||||
update();
|
||||
|
||||
await CRUD().post(link: AppLink.addRides, payload: {
|
||||
"start_location": //'${data[0]['start_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
@@ -1131,6 +1132,51 @@ class MapPassengerController extends GetxController {
|
||||
Log.print(
|
||||
'body: ${dataCarsLocationByPassenger['message'][carsOrder]['token']}');
|
||||
});
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferAlexandriaServer}/ride/rides/add.php',
|
||||
payload: {
|
||||
"start_location": //'${data[0]['start_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location": //'${data[0]['end_address']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
"price": totalPassenger.toStringAsFixed(2),
|
||||
"passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString(),
|
||||
"status": "waiting",
|
||||
'carType': box.read(BoxName.carType),
|
||||
"price_for_driver": totalPassenger.toString(),
|
||||
"price_for_passenger": totalME.toString(),
|
||||
"distance": distance.toString(),
|
||||
"paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
});
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferGizaServer}/ride/rides/add.php',
|
||||
payload: {
|
||||
"start_location": //'${data[0]['start_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location": //'${data[0]['end_address']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
"price": totalPassenger.toStringAsFixed(2),
|
||||
"passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString(),
|
||||
"status": "waiting",
|
||||
'carType': box.read(BoxName.carType),
|
||||
"price_for_driver": totalPassenger.toString(),
|
||||
"price_for_passenger": totalME.toString(),
|
||||
"distance": distance.toString(),
|
||||
"paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
});
|
||||
|
||||
delayAndFetchRideStatus(rideId);
|
||||
if (shouldFetch == false) {
|
||||
startTimer();
|
||||
@@ -1156,8 +1202,6 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
bool isDriversTokensSend = false;
|
||||
confirmRideForAllDriverAvailable() async {
|
||||
// isDriversTokensSend = true;
|
||||
|
||||
driversToken.remove(driverToken);
|
||||
PaymentController paymentController = Get.find<PaymentController>();
|
||||
rideConfirm = true;
|
||||
@@ -1206,6 +1250,7 @@ class MapPassengerController extends GetxController {
|
||||
kazan.toStringAsFixed(0),
|
||||
passengerRate.toStringAsFixed(2),
|
||||
];
|
||||
Log.print('body: ${body}');
|
||||
for (var i = 1; i < driversToken.length; i++) {
|
||||
FirebaseMessagesController().sendNotificationToDriverMapPolyline(
|
||||
'OrderSpeed',
|
||||
@@ -1255,8 +1300,8 @@ class MapPassengerController extends GetxController {
|
||||
// }
|
||||
tick++;
|
||||
} else {
|
||||
timer
|
||||
.cancel(); // Stop the timer if remainingTimeToPassengerFromDriverAfterApplied <= 0
|
||||
timer.cancel();
|
||||
// Stop the timer if remainingTimeToPassengerFromDriverAfterApplied <= 0
|
||||
}
|
||||
} else {
|
||||
timer.cancel(); // Stop the timer if shouldFetch is false
|
||||
@@ -1269,124 +1314,132 @@ class MapPassengerController extends GetxController {
|
||||
"No Captain Accepted Your Order".tr,
|
||||
"We are looking for a captain but the price may increase to let a captain accept"
|
||||
.tr,
|
||||
backgroundColor: AppColor.bronze,
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
);
|
||||
}
|
||||
|
||||
void delayAndFetchRideStatusForAllDriverAvailable(String rideId) async {
|
||||
startCarLocationSearch(box.read(BoxName.carType));
|
||||
int attemptCounter = 0;
|
||||
const int maxAttempts = 15;
|
||||
int attemptCounter = 0;
|
||||
bool isApplied = false;
|
||||
tick = 0;
|
||||
Log.print('tick delayAndFetchRideStatusForAllDriverAvailable: ${tick}');
|
||||
|
||||
void fetchRideStatus() async {
|
||||
if (shouldFetch && attemptCounter < maxAttempts) {
|
||||
if (attemptCounter < maxAttempts && !isApplied) {
|
||||
attemptCounter++;
|
||||
tick++;
|
||||
var res = await getRideStatus(rideId);
|
||||
|
||||
if (res.toString() == 'Apply') {
|
||||
getUpdatedRideForDriverApply(rideId);
|
||||
|
||||
shouldFetch = false; // Stop further fetches
|
||||
isApplied = true;
|
||||
shouldFetch = false;
|
||||
statusRide = 'Apply';
|
||||
rideConfirm = false;
|
||||
isSearchingWindow = false;
|
||||
update();
|
||||
startTimerFromDriverToPassengerAfterApplied();
|
||||
} else {
|
||||
Timer(const Duration(seconds: 2),
|
||||
fetchRideStatus); // Continue fetching for other statuses
|
||||
}
|
||||
} else {
|
||||
// Stop fetching after maxAttempts or if shouldFetch is false
|
||||
shouldFetch = false;
|
||||
MyDialog().getDialog('upgrade price'.tr,
|
||||
'You can upgrade price to may driver accept your order'.tr, () {
|
||||
Get.back();
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: "Increase Your Trip Fee (Optional)".tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Column(
|
||||
children: [
|
||||
Text(
|
||||
"We haven't found any drivers yet. Consider increasing your trip fee to make your offer more attractive to drivers."
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
increasFeeFromPassenger.text =
|
||||
(totalPassenger + 6).toStringAsFixed(1);
|
||||
// mapPassengerController.increasFeeFromPassenger.text =
|
||||
// mapPassengerController.totalPassenger
|
||||
// .toStringAsFixed(1);
|
||||
update();
|
||||
},
|
||||
icon: Column(
|
||||
children: [
|
||||
Text(
|
||||
'6',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.greenColor),
|
||||
child: const Icon(
|
||||
Icons.arrow_circle_up,
|
||||
size: 30,
|
||||
color: AppColor.secondaryColor,
|
||||
} else if (attemptCounter >= maxAttempts) {
|
||||
shouldFetch = false;
|
||||
// If the status is still not "Apply" after 15 attempts
|
||||
MyDialog().getDialog('upgrade price'.tr,
|
||||
'You can upgrade price to may driver accept your order'.tr, () {
|
||||
Get.back();
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: "Increase Your Trip Fee (Optional)".tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Column(
|
||||
children: [
|
||||
Text(
|
||||
"We haven't found any drivers yet. Consider increasing your trip fee to make your offer more attractive to drivers."
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
increasFeeFromPassenger.text =
|
||||
(totalPassenger + 6).toStringAsFixed(1);
|
||||
update();
|
||||
},
|
||||
icon: Column(
|
||||
children: [
|
||||
Text(
|
||||
'6',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
),
|
||||
],
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.greenColor),
|
||||
child: const Icon(
|
||||
Icons.arrow_circle_up,
|
||||
size: 30,
|
||||
color: AppColor.secondaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Form(
|
||||
key: increaseFeeFormKey,
|
||||
child: MyTextForm(
|
||||
controller: increasFeeFromPassenger,
|
||||
label: totalPassenger.toStringAsFixed(2),
|
||||
hint: totalPassenger.toStringAsFixed(2),
|
||||
type: TextInputType.number),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Form(
|
||||
key: increaseFeeFormKey,
|
||||
child: MyTextForm(
|
||||
controller: increasFeeFromPassenger,
|
||||
label: totalPassenger.toStringAsFixed(2),
|
||||
hint: totalPassenger.toStringAsFixed(2),
|
||||
type: TextInputType.number),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
MyElevatedButton(
|
||||
title: "No, thanks",
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
cancelRide();
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: "Increase Fee".tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
increaseFeeByPassengerAndReOrder();
|
||||
})
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
MyElevatedButton(
|
||||
title: "No, thanks",
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
cancelRide();
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: "Increase Fee".tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
increaseFeeByPassengerAndReOrder();
|
||||
})
|
||||
],
|
||||
);
|
||||
});
|
||||
update();
|
||||
print('Stopped fetching ride status after 30 seconds.');
|
||||
);
|
||||
});
|
||||
update();
|
||||
print('Stopped fetching ride status after 15 attempts.');
|
||||
} else {
|
||||
Timer(const Duration(seconds: 2), fetchRideStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fetchRideStatus(); // Initial call to start the process
|
||||
}
|
||||
|
||||
reSearchAfterCanceledFromDriver() async {
|
||||
await getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 7000);
|
||||
|
||||
confirmRideForAllDriverAvailable();
|
||||
shouldFetch = true; // Stop further fetches
|
||||
statusRide = 'wait';
|
||||
rideConfirm = true;
|
||||
isSearchingWindow = true;
|
||||
update();
|
||||
}
|
||||
|
||||
void start15SecondTimer(String rideId) {
|
||||
Timer(const Duration(seconds: 15), () {
|
||||
delayAndFetchRideStatusForAllDriverAvailable(rideId);
|
||||
@@ -1581,7 +1634,7 @@ class MapPassengerController extends GetxController {
|
||||
Log.print('searchInterval: ${searchInterval}');
|
||||
int boundIncreaseStep = 2500; // Initial bounds in meters
|
||||
Log.print('boundIncreaseStep: ${boundIncreaseStep}');
|
||||
int maxAttempts = 6; // Maximum attempts to increase bounds
|
||||
int maxAttempts = 3; // Maximum attempts to increase bounds
|
||||
int maxBoundIncreaseStep = 6000; // Maximum bounds increase step
|
||||
int attempt = 0; // Current attempt
|
||||
Log.print('initial attempt: ${attempt}');
|
||||
@@ -1598,7 +1651,8 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
} else if (reloadStartApp == true) {
|
||||
Log.print('reloadStartApp: ${reloadStartApp}');
|
||||
foundCars = await getCarsLocationByPassengerAndReloadMarker(
|
||||
carType, boundIncreaseStep);
|
||||
Log.print('foundCars: ${foundCars}');
|
||||
@@ -1624,6 +1678,36 @@ class MapPassengerController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
String getLocationArea(double latitude, double longitude) {
|
||||
// Giza Boundary Check
|
||||
if (latitude >= 29.904975 &&
|
||||
latitude <= 30.143372 &&
|
||||
longitude >= 30.787030 &&
|
||||
longitude <= 31.238843) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferGizaServer);
|
||||
return 'Giza';
|
||||
}
|
||||
// Cairo Boundary Check
|
||||
else if (latitude >= 29.918901 &&
|
||||
latitude <= 30.198857 &&
|
||||
longitude >= 31.215009 &&
|
||||
longitude <= 31.532186) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
return 'Cairo';
|
||||
}
|
||||
// Alexandria Boundary Check
|
||||
else if (latitude >= 30.396286 &&
|
||||
latitude <= 31.654458 &&
|
||||
longitude >= 29.041139 &&
|
||||
longitude <= 32.626259) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferAlexandriaServer);
|
||||
return 'Alexandria';
|
||||
}
|
||||
|
||||
// Return 'Unknown' if outside defined areas
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
Future<bool> getCarsLocationByPassengerAndReloadMarker(
|
||||
String carType, int boundIncreaseStep) async {
|
||||
if (statusRide == 'wait') {
|
||||
@@ -1631,6 +1715,7 @@ class MapPassengerController extends GetxController {
|
||||
LatLngBounds bounds = calculateBounds(passengerLocation.latitude,
|
||||
passengerLocation.longitude, boundIncreaseStep.toDouble());
|
||||
var res;
|
||||
// await getLocation();
|
||||
|
||||
switch (carType) {
|
||||
case 'Lady':
|
||||
@@ -1680,6 +1765,9 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
if (res == 'failure') {
|
||||
noCarString = true;
|
||||
dataCarsLocationByPassenger = 'failure';
|
||||
update();
|
||||
return false;
|
||||
} else {
|
||||
noCarString = false;
|
||||
@@ -1930,6 +2018,8 @@ class MapPassengerController extends GetxController {
|
||||
}));
|
||||
} else if (res1['status'] == 'success') {
|
||||
var tokenParent = res1['data'][0]['token'];
|
||||
Get.snackbar("The invitation was sent successfully".tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
"Trip Monitoring".tr,
|
||||
"Trip Monitoring".tr,
|
||||
@@ -2029,9 +2119,14 @@ class MapPassengerController extends GetxController {
|
||||
.toString());
|
||||
|
||||
BitmapDescriptor icon =
|
||||
datadriverCarsLocationToPassengerAfterApplied['message'][0]['model']
|
||||
.toString()
|
||||
.contains('دراجة')
|
||||
datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||
['model']
|
||||
.toString()
|
||||
.contains('دراجة') ||
|
||||
datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||
['make']
|
||||
.toString()
|
||||
.contains('دراجة')
|
||||
? motoIcon
|
||||
: datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||
['gender'] ==
|
||||
@@ -2155,14 +2250,14 @@ class MapPassengerController extends GetxController {
|
||||
clearPlacesDestination();
|
||||
clearPolyline();
|
||||
data = [];
|
||||
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
"id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
// await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
||||
// "order_id": rideId.toString(), // Convert to String
|
||||
// "status": 'Cancel'
|
||||
// });
|
||||
// await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
// "id": rideId.toString(), // Convert to String
|
||||
// "status": 'Cancel'
|
||||
// });
|
||||
Get.offAll(const MapPagePassenger());
|
||||
}
|
||||
}
|
||||
@@ -2516,6 +2611,7 @@ class MapPassengerController extends GetxController {
|
||||
(_locationData.latitude != null && _locationData.longitude != null
|
||||
? LatLng(_locationData.latitude!, _locationData.longitude!)
|
||||
: null)!;
|
||||
getLocationArea(passengerLocation.latitude, passengerLocation.longitude);
|
||||
newStartPointLocation = passengerLocation;
|
||||
speed = _locationData.speed!;
|
||||
// //print location details
|
||||
@@ -2563,30 +2659,34 @@ class MapPassengerController extends GetxController {
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
bool reloadStartApp = false;
|
||||
|
||||
startMarkerReloading() async {
|
||||
Log.print('AppLink.endPoint: ${AppLink.endPoint}');
|
||||
int reloadCount = 0;
|
||||
if (reloadStartApp == false) {
|
||||
Timer.periodic(const Duration(seconds: 5), (timer) async {
|
||||
reloadCount++;
|
||||
Log.print('reloadCount: ${reloadCount}');
|
||||
|
||||
Timer.periodic(const Duration(seconds: 5), (timer) async {
|
||||
reloadCount++;
|
||||
Log.print('reloadCount: ${reloadCount}');
|
||||
if (!rideConfirm) {
|
||||
clearMarkersExceptStartEnd();
|
||||
// _smoothlyUpdateMarker();
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
await getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 6000);
|
||||
await getNearestDriverByPassengerLocation();
|
||||
Log.print('reloadMarkers: from startMarkerReloading');
|
||||
} else {
|
||||
// runWhenRideIsBegin();
|
||||
}
|
||||
|
||||
if (!rideConfirm) {
|
||||
clearMarkersExceptStartEnd();
|
||||
// _smoothlyUpdateMarker();
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
await getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 6000);
|
||||
await getNearestDriverByPassengerLocation();
|
||||
Log.print('reloadMarkers: from startMarkerReloadin');
|
||||
} else {
|
||||
// runWhenRideIsBegin();
|
||||
}
|
||||
|
||||
if (reloadCount >= 10) {
|
||||
timer.cancel(); // Stop the timer after 5 reloads
|
||||
}
|
||||
});
|
||||
if (reloadCount >= 6) {
|
||||
reloadStartApp = true;
|
||||
timer.cancel(); // Stop the timer after 5 reloads
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String durationByPassenger = '';
|
||||
@@ -2602,39 +2702,41 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
if (!rideConfirm) {
|
||||
if (dataCarsLocationByPassenger != 'failure') {
|
||||
if (dataCarsLocationByPassenger['message'].length > 0) {
|
||||
for (var i = 0;
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
if (dataCarsLocationByPassenger != null) {
|
||||
if (dataCarsLocationByPassenger['message'].length > 0) {
|
||||
for (var i = 0;
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
|
||||
// Calculate the distance between the passenger's location and the current driver's location
|
||||
final distance = Geolocator.distanceBetween(
|
||||
passengerLocation.latitude,
|
||||
passengerLocation.longitude,
|
||||
double.parse(carLocation['latitude']),
|
||||
double.parse(carLocation['longitude']),
|
||||
);
|
||||
durationToPassenger = (distance * 25 * (1000 / 3600))
|
||||
.round(); //////35 is avg of speed in city
|
||||
// Update the UI with the distance and duration
|
||||
update();
|
||||
|
||||
// If the distance is less than the nearest distance, update the nearest driver
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
|
||||
nearestCar = CarLocation(
|
||||
distance: distance,
|
||||
duration:
|
||||
0, // We don't have duration information from Geolocator
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
// Calculate the distance between the passenger's location and the current driver's location
|
||||
final distance = Geolocator.distanceBetween(
|
||||
passengerLocation.latitude,
|
||||
passengerLocation.longitude,
|
||||
double.parse(carLocation['latitude']),
|
||||
double.parse(carLocation['longitude']),
|
||||
);
|
||||
|
||||
// Update the UI with the nearest driver
|
||||
durationToPassenger = (distance * 25 * (1000 / 3600))
|
||||
.round(); //////35 is avg of speed in city
|
||||
// Update the UI with the distance and duration
|
||||
update();
|
||||
|
||||
// If the distance is less than the nearest distance, update the nearest driver
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
|
||||
nearestCar = CarLocation(
|
||||
distance: distance,
|
||||
duration:
|
||||
0, // We don't have duration information from Geolocator
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
);
|
||||
|
||||
// Update the UI with the nearest driver
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2665,7 +2767,7 @@ class MapPassengerController extends GetxController {
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${passengerLocation.latitude},${passengerLocation.longitude}&units=metric&key=${AK.mapAPIKEY}';
|
||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
if (response != null && response['status'] == "OK") {
|
||||
var data = response;
|
||||
// Extract distance and duration from the response and handle accordingly
|
||||
int distance1 =
|
||||
@@ -2701,6 +2803,7 @@ class MapPassengerController extends GetxController {
|
||||
// Handle the distance and duration as needed
|
||||
else {
|
||||
// 'Failed to retrieve distance and duration: ${response['status']}');
|
||||
Log.print('${response['status']}: ${response['status']}}');
|
||||
// Handle the failure case
|
||||
}
|
||||
}
|
||||
@@ -2788,7 +2891,8 @@ class MapPassengerController extends GetxController {
|
||||
isLoading = true;
|
||||
update();
|
||||
remainingTime = 25; //to make cancel every call
|
||||
startCarLocationSearch(box.read(BoxName.carType));
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
getCarsLocationByPassengerAndReloadMarker(box.read(BoxName.carType), 7000);
|
||||
// await getCarsLocationByPassengerAndReloadMarker();
|
||||
var coordDestination = destination.split(',');
|
||||
double latPassengerDestination = double.parse(coordDestination[0]);
|
||||
@@ -2992,7 +3096,9 @@ class MapPassengerController extends GetxController {
|
||||
getMapPoints(String originSteps, String destinationSteps, int index) async {
|
||||
isWayPointStopsSheetUtilGetMap = false;
|
||||
// haveSteps = true;
|
||||
startCarLocationSearch(box.read(BoxName.carType));
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
await getCarsLocationByPassengerAndReloadMarker(
|
||||
box.read(BoxName.carType), 7000);
|
||||
// await getCarsLocationByPassengerAndReloadMarker();
|
||||
// isLoading = true;
|
||||
update();
|
||||
@@ -3439,6 +3545,12 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void startFetchingData() {
|
||||
Timer.periodic(Duration(milliseconds: 50), (Timer timer) async {
|
||||
await getKazanPercent();
|
||||
});
|
||||
}
|
||||
|
||||
getPassengerRate() async {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getPassengerRate,
|
||||
@@ -3467,10 +3579,12 @@ class MapPassengerController extends GetxController {
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
await getLocation();
|
||||
|
||||
// await addToken();
|
||||
await getKazanPercent();
|
||||
await getPassengerRate();
|
||||
await getRideStatusFromStartApp();
|
||||
getKazanPercent();
|
||||
getPassengerRate();
|
||||
getRideStatusFromStartApp();
|
||||
reloadStartApp = false;
|
||||
startMarkerReloading();
|
||||
Get.put(TextToSpeechController());
|
||||
box.write(BoxName.carType, 'yet');
|
||||
|
||||
@@ -22,8 +22,8 @@ class ComplaintController extends GetxController {
|
||||
'passengerId': box.read(BoxName.passengerID).toString(),
|
||||
'feedBack': complaintController.text
|
||||
});
|
||||
var d = jsonDecode(res);
|
||||
if (d['status'].toString() == 'success') {
|
||||
// var d = jsonDecode(res);
|
||||
if (res != 'failure') {
|
||||
Get.defaultDialog(
|
||||
title: 'Success'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
|
||||
@@ -154,7 +154,9 @@ iOS [https://getapp.cc/app/6458734951]
|
||||
"You have call from driver": " لديك مكالمة من السائق",
|
||||
"Comfort": "كمفورت",
|
||||
"Speed": "سبيد",
|
||||
"The invitation was sent successfully": "تم إرسال الدعوة بنجاح",
|
||||
"Lady": "ليدي",
|
||||
"You should select your country": "يجب عليك اختيار بلدك",
|
||||
"Delivery": "توصيل",
|
||||
"Mashwari": "مشواري",
|
||||
'The driver waiting you in picked location .':
|
||||
|
||||
@@ -49,6 +49,11 @@ List<CarType> carTypes = [
|
||||
carDetail: 'Mashwari without end point'.tr,
|
||||
image: 'assets/images/freeRide.png',
|
||||
),
|
||||
// CarType(
|
||||
// carType: 'Family',
|
||||
// carDetail: 'Family for 7 passenger'.tr,
|
||||
// image: 'assets/images/Family.png',
|
||||
// ),
|
||||
];
|
||||
|
||||
class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
@@ -84,8 +85,9 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
hexToColor(driver['color_hex'].toString()),
|
||||
color: hexToColor(
|
||||
driver['color_hex'].toString()) ??
|
||||
Colors.amber,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(),
|
||||
),
|
||||
@@ -119,7 +121,8 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: hexToColor(
|
||||
driver['color_hex'].toString()),
|
||||
driver['color_hex'].toString()) ??
|
||||
AppColor.bronze,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(),
|
||||
),
|
||||
|
||||
@@ -378,8 +378,12 @@ class CountryPicker extends StatelessWidget {
|
||||
box.write(
|
||||
BoxName.countryCode, //
|
||||
controller.selectedCountry); // Already saved in English
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
||||
Get.off(LoginPage());
|
||||
if (controller.selectedCountry == null) {
|
||||
Get.snackbar("You should select your country".tr, '');
|
||||
} else {
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
||||
Get.off(LoginPage());
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user