This commit is contained in:
Hamza-Ayed
2024-07-07 12:25:20 +03:00
parent 819a32eec1
commit 9925e12447
8 changed files with 189 additions and 164 deletions

View File

@@ -74,7 +74,7 @@ class LoginController extends GetxController {
var jsonDecoeded = jsonDecode(res);
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['verified'] == 1) {
jsonDecoeded['data'][0]['verified'].toString() == '1') {
//
box.write(BoxName.isVerified, '1');
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);

View File

@@ -93,15 +93,28 @@ class RegisterController extends GetxController {
.post(link: AppLink.checkPhoneNumberISVerfiedPassenger, payload: {
'phone_number': '+2${phoneController.text}',
});
// if (responseCheker != 'failure') {
var d = jsonDecode(responseCheker);
if (d['message'][0]['verified'].toString() == '1') {
Get.snackbar('Phone number is verified before'.tr, '',
backgroundColor: AppColor.greenColor);
box.write(BoxName.isVerified, '1');
box.write(BoxName.phone, '+2${phoneController.text}');
Get.offAll(const MapPagePassenger());
// }
if (responseCheker != 'failure') {
var d = jsonDecode(responseCheker);
if (d['message'][0]['verified'].toString() == '1') {
Get.snackbar('Phone number is verified before'.tr, '',
backgroundColor: AppColor.greenColor);
box.write(BoxName.isVerified, '1');
box.write(BoxName.phone, '+2${phoneController.text}');
Get.offAll(const MapPagePassenger());
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': '+2${phoneController.text}',
'token': randomNumber.toString(),
});
await smsEgyptController.sendSmsEgypt(
phoneController.text.toString(), randomNumber.toString());
isSent = true;
remainingTime = 300; // Reset to 5 minutes
startTimer();
isLoading = false;
update();
}
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': '+2${phoneController.text}',
@@ -115,6 +128,8 @@ class RegisterController extends GetxController {
startTimer();
isLoading = false;
update();
// Get.snackbar(responseCheker, 'message');
}
}
}

View File

@@ -894,8 +894,9 @@ class MapPassengerController extends GetxController {
try {
Uri uri = Uri.parse(link);
if (uri.host == 'maps.google.com') {
if (uri.host == 'maps.google.com' || uri.host == 'www.google.com') {
String? query = uri.queryParameters['q'];
query ??= uri.queryParameters['ll'];
if (query != null) {
List<String> coordinates = query.split(',');
@@ -910,6 +911,9 @@ class MapPassengerController extends GetxController {
};
}
}
} else if (uri.host == 'goo.gl') {
// Shortened URLs might need to be expanded first
// Implement additional logic to expand the URL here if necessary
}
} catch (e) {
print('Error parsing WhatsApp location link: $e');
@@ -1164,7 +1168,7 @@ class MapPassengerController extends GetxController {
}
void delayAndFetchRideStatus(String rideId) {
Timer(const Duration(milliseconds: 200), () async {
Timer(const Duration(seconds: 1), () async {
if (shouldFetch) {
if (remainingTimeToPassengerFromDriverAfterApplied > 0) {
var res = await getRideStatus(rideId);
@@ -1197,7 +1201,7 @@ class MapPassengerController extends GetxController {
}
void delayAndFetchRideStatusForAllDriverAvailable(String rideId) {
Timer(const Duration(milliseconds: 200), () async {
Timer(const Duration(milliseconds: 1000), () async {
if (shouldFetch) {
var res = await getRideStatus(rideId);
// var decod = jsonDecode(res);
@@ -1532,8 +1536,8 @@ class MapPassengerController extends GetxController {
await Future.delayed(const Duration(seconds: 4));
if (rideTimerBegin == true || statusRide == 'Apply') {
await getDriverCarsLocationToPassengerAfterApplied();
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
}
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
}
}
@@ -2107,6 +2111,7 @@ class MapPassengerController extends GetxController {
reloadMarkers() async {
if (statusRide == 'wait') {
clearMarkersExceptStartEnd();
await getCarsLocationByPassengerAndReloadMarker();
await getNearestDriverByPassengerLocation();
}