2-10/1/1
This commit is contained in:
@@ -263,7 +263,7 @@ class RegisterCaptainController extends GetxController {
|
||||
);
|
||||
|
||||
// Get.snackbar('', '');
|
||||
// await smsEgyptController.sendSmsEgypt(phoneNumber, randomNumber.toString());
|
||||
await smsEgyptController.sendSmsEgypt(phoneNumber, randomNumber.toString());
|
||||
|
||||
lastOtpSentTime = DateTime.now(); // Update the last OTP sent time
|
||||
isSent = true;
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
// import 'package:firebase_auth/firebase_auth.dart';
|
||||
// import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
|
||||
class FacebookSignIn {
|
||||
Future<UserCredential?> signInWithFacebook() async {
|
||||
final LoginResult result = await FacebookAuth.instance.login();
|
||||
if (result.status == LoginStatus.success) {
|
||||
// Create a credential from the access token
|
||||
final OAuthCredential credential =
|
||||
FacebookAuthProvider.credential(result.accessToken!.tokenString);
|
||||
// Once signed in, return the UserCredential
|
||||
return await FirebaseAuth.instance.signInWithCredential(credential);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// class FacebookSignIn {
|
||||
// Future<UserCredential?> signInWithFacebook() async {
|
||||
// final LoginResult result = await FacebookAuth.instance.login();
|
||||
// if (result.status == LoginStatus.success) {
|
||||
// // Create a credential from the access token
|
||||
// final OAuthCredential credential =
|
||||
// FacebookAuthProvider.credential(result.accessToken!.tokenString);
|
||||
// // Once signed in, return the UserCredential
|
||||
// return await FirebaseAuth.instance.signInWithCredential(credential);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await FacebookAuth.instance.logOut();
|
||||
print('Facebook Sign Out Successful');
|
||||
} catch (e) {
|
||||
print('Error during Facebook Sign Out: $e');
|
||||
}
|
||||
}
|
||||
// Future<void> signOut() async {
|
||||
// try {
|
||||
// await FacebookAuth.instance.logOut();
|
||||
// print('Facebook Sign Out Successful');
|
||||
// } catch (e) {
|
||||
// print('Error during Facebook Sign Out: $e');
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<bool> isSignedIn() async {
|
||||
final accessToken = await FacebookAuth.instance.accessToken;
|
||||
return accessToken != null;
|
||||
}
|
||||
}
|
||||
// Future<bool> isSignedIn() async {
|
||||
// final accessToken = await FacebookAuth.instance.accessToken;
|
||||
// return accessToken != null;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -61,7 +61,7 @@ class NotificationController extends GetxController {
|
||||
priority: Priority.high,
|
||||
styleInformation: bigTextStyleInformation,
|
||||
playSound: true,
|
||||
sound: RawResourceAndroidNotificationSound(tone == '' ? 'ding' : tone),
|
||||
sound: RawResourceAndroidNotificationSound(tone),
|
||||
// audioAttributesUsage: AudioAttributesUsage.alarm,
|
||||
visibility: NotificationVisibility.public,
|
||||
autoCancel: false,
|
||||
|
||||
@@ -328,7 +328,7 @@ class MapDriverController extends GetxController {
|
||||
double _distance =
|
||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (_distance < 50) {
|
||||
if (_distance < 60) {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
isRideStarted = true;
|
||||
@@ -347,6 +347,19 @@ class MapDriverController extends GetxController {
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
CRUD()
|
||||
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
'RideIsBegin',
|
||||
@@ -586,6 +599,23 @@ class MapDriverController extends GetxController {
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferGizaServer}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
},
|
||||
);
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
});
|
||||
if (walletChecked == 'true') {
|
||||
paymentToken = await generateTokenPassenger(
|
||||
((-1) * double.parse(paymentAmount)).toString());
|
||||
@@ -652,9 +682,11 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
void cancelCheckRideFromPassenger() async {
|
||||
var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: {
|
||||
'order_id': rideId,
|
||||
}); //.then((value) {
|
||||
var res = await CRUD().get(
|
||||
link: "${AppLink.endPoint}/ride/driver_order/getOrderCancelStatus.php",
|
||||
payload: {
|
||||
'order_id': rideId,
|
||||
}); //.then((value) {
|
||||
var response = jsonDecode(res);
|
||||
canelString = response['data']['status'];
|
||||
update();
|
||||
@@ -687,6 +719,7 @@ class MapDriverController extends GetxController {
|
||||
DateTime currentTime = DateTime.now();
|
||||
void rideIsBeginPassengerTimer() async {
|
||||
int durationOfRide = int.parse(durationOfRideValue);
|
||||
double latePrice = Get.find<HomeCaptainController>().latePrice;
|
||||
update();
|
||||
int infinity = 40000;
|
||||
if (carType == 'Comfort' ||
|
||||
@@ -716,60 +749,26 @@ class MapDriverController extends GetxController {
|
||||
endNameLocation.contains('مطار') ||
|
||||
endNameLocation.contains('المطار')) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
|
||||
// : carType == 'Speed'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().speedPrice)
|
||||
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
// : carType == 'Delivery'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().deliveryPrice)
|
||||
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
? (i ~/ 60) * latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
: (i ~/ 60) * latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().mashwariPrice);
|
||||
} else if (currentTime.hour >= 21 && currentTime.hour < 0) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
|
||||
// : carType == 'Speed'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().speedPrice)
|
||||
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
// : carType == 'Delivery'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().deliveryPrice)
|
||||
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
? (i ~/ 60) * latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
: (i ~/ 60) * latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().mashwariPrice);
|
||||
} else if (currentTime.hour >= 1 && currentTime.hour < 5) {
|
||||
@@ -779,51 +778,29 @@ class MapDriverController extends GetxController {
|
||||
startNameLocation.contains('ملهى ليلي') ||
|
||||
startNameLocation.contains('Night club')) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2 +
|
||||
? (i ~/ 60) * (latePrice + .5) * 2 +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2
|
||||
int.parse(duration) * (latePrice + .5) * 2
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2 +
|
||||
? (i ~/ 60) * (latePrice + .5) * 2 +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2
|
||||
int.parse(duration) * (latePrice + .5) * 2
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
(price)
|
||||
: (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
(price);
|
||||
? (i ~/ 60) * (latePrice + .5) * 2 + (price)
|
||||
: (i ~/ 60) * (latePrice + .5) * 2 + (price);
|
||||
}
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().latePrice + .5) +
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5)
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) +
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5)
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) +
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5)
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
: price;
|
||||
} else if (currentTime.hour >= 14 && currentTime.hour <= 17) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
|
||||
Reference in New Issue
Block a user