10/26/1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/controller/functions/location_background_controller.dart';
|
||||
@@ -25,7 +26,10 @@ class LoginDriverController extends GetxController {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController phoneController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
TextEditingController passwordController2 = TextEditingController();
|
||||
bool isAgreeTerms = false;
|
||||
bool isGoogleDashOpen = false;
|
||||
bool isGoogleLogin = false;
|
||||
bool isloading = false;
|
||||
late int isTest = 1;
|
||||
final FlutterSecureStorage _storage = const FlutterSecureStorage();
|
||||
@@ -35,6 +39,11 @@ class LoginDriverController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void changeGoogleDashOpen() {
|
||||
isGoogleDashOpen = !isGoogleDashOpen;
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
box.read(BoxName.isTest) == null ||
|
||||
@@ -80,6 +89,32 @@ class LoginDriverController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
String generateUniqueIdFromEmail(String email) {
|
||||
// Step 1: Extract the local part of the email
|
||||
String localPart = email.split('@')[0];
|
||||
|
||||
// Step 2: Replace invalid characters (if any)
|
||||
String cleanLocalPart = localPart.replaceAll(RegExp(r'[^a-zA-Z0-9]'), '');
|
||||
|
||||
// Step 3: Ensure it does not exceed 24 characters
|
||||
if (cleanLocalPart.length > 24) {
|
||||
cleanLocalPart = cleanLocalPart.substring(0, 24);
|
||||
}
|
||||
|
||||
// Step 4: Generate a random suffix if needed
|
||||
String suffix = generateRandomSuffix(24 - cleanLocalPart.length);
|
||||
|
||||
return cleanLocalPart + suffix;
|
||||
}
|
||||
|
||||
String generateRandomSuffix(int length) {
|
||||
const String chars =
|
||||
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
Random random = Random();
|
||||
return List.generate(length, (index) => chars[random.nextInt(chars.length)])
|
||||
.join('');
|
||||
}
|
||||
|
||||
loginUsingCredentials(String driverID, email) async {
|
||||
isloading = true;
|
||||
update();
|
||||
@@ -207,6 +242,135 @@ class LoginDriverController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
loginUsingCredentialsWithoutGoogle(String password, email) async {
|
||||
isloading = true;
|
||||
isGoogleLogin = true;
|
||||
update();
|
||||
var res = await CRUD()
|
||||
.get(link: AppLink.loginUsingCredentialsWithoutGoogle, payload: {
|
||||
'email': email,
|
||||
'password': password,
|
||||
});
|
||||
box.write(BoxName.emailDriver, email.toString());
|
||||
print(res);
|
||||
if (res == 'failure') {
|
||||
//Failure
|
||||
if (box.read(BoxName.phoneVerified).toString() == '1') {
|
||||
Get.offAll(() => EgyptCardAI());
|
||||
} else {
|
||||
Get.offAll(() => SmsSignupEgypt());
|
||||
}
|
||||
|
||||
isloading = false;
|
||||
update();
|
||||
// Get.snackbar('Failure', '', backgroundColor: Colors.red);
|
||||
} else {
|
||||
var jsonDecoeded = jsonDecode(res);
|
||||
if (jsonDecoeded.isNotEmpty) {
|
||||
if (jsonDecoeded['status'] == 'success' &&
|
||||
jsonDecoeded['data'][0]['is_verified'].toString() == '1') {
|
||||
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
|
||||
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
|
||||
box.write(BoxName.isTest, '1');
|
||||
box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']);
|
||||
box.write(BoxName.phoneVerified,
|
||||
jsonDecoeded['data'][0]['is_verified'].toString());
|
||||
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
|
||||
box.write(BoxName.nameArabic, jsonDecoeded['data'][0]['name_arabic']);
|
||||
box.write(
|
||||
BoxName.bankCodeDriver, jsonDecoeded['data'][0]['bankCode']);
|
||||
box.write(BoxName.accountBankNumberDriver,
|
||||
jsonDecoeded['data'][0]['accountBank']);
|
||||
box.write(
|
||||
BoxName.nameDriver,
|
||||
'${jsonDecoeded['data'][0]['first_name']}'
|
||||
' ${jsonDecoeded['data'][0]['last_name']}');
|
||||
if ((jsonDecoeded['data'][0]['model'].toString().contains('دراجه') ||
|
||||
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
|
||||
if (jsonDecoeded['data'][0]['gender'].toString() == 'Male') {
|
||||
box.write(BoxName.carTypeOfDriver, 'Scooter');
|
||||
} else {
|
||||
box.write(BoxName.carTypeOfDriver, 'Pink Bike');
|
||||
}
|
||||
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) >
|
||||
2017) {
|
||||
if (jsonDecoeded['data'][0]['gender'].toString() != 'Male') {
|
||||
box.write(BoxName.carTypeOfDriver, 'Lady');
|
||||
} else {
|
||||
box.write(BoxName.carTypeOfDriver, 'Comfort');
|
||||
}
|
||||
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) >
|
||||
2002 &&
|
||||
int.parse(jsonDecoeded['data'][0]['year'].toString()) < 2017) {
|
||||
box.write(BoxName.carTypeOfDriver, 'Speed');
|
||||
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) <
|
||||
2002) {
|
||||
box.write(BoxName.carTypeOfDriver, 'Awfar Car');
|
||||
}
|
||||
updateAppTester(AppInformation.appName);
|
||||
|
||||
var token = await CRUD().get(
|
||||
link: AppLink.getDriverToken,
|
||||
payload: {'captain_id': box.read(BoxName.driverID).toString()});
|
||||
|
||||
if (token != 'failure') {
|
||||
if (jsonDecode(token)['data'][0]['token'] !=
|
||||
box.read(BoxName.tokenDriver)) {
|
||||
Get.put(FirebaseMessagesController())
|
||||
.sendNotificationToAnyWithoutData(
|
||||
'token change'.tr,
|
||||
'change device'.tr,
|
||||
jsonDecode(token)['data'][0]['token'].toString(),
|
||||
'promo.wav');
|
||||
Get.defaultDialog(
|
||||
title: 'you will use this device?'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () async {
|
||||
await CRUD()
|
||||
.post(link: AppLink.addTokensDriver, payload: {
|
||||
'token': box.read(BoxName.tokenDriver),
|
||||
'captain_id': box.read(BoxName.driverID).toString()
|
||||
});
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.seferAlexandriaServer}/ride/firebase/addDriver.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenDriver),
|
||||
'captain_id':
|
||||
box.read(BoxName.driverID).toString()
|
||||
});
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.seferGizaServer}/ride/firebase/addDriver.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenDriver),
|
||||
'captain_id':
|
||||
box.read(BoxName.driverID).toString()
|
||||
});
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Get.off(() => HomeCaptain());
|
||||
// Get.off(() => LoginCaptin());
|
||||
} else {
|
||||
Get.offAll(() => SmsSignupEgypt());
|
||||
// Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
// backgroundColor: Colors.redAccent);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
Get.snackbar('failure'.tr, '', backgroundColor: AppColor.redColor);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loginByBoxData() async {
|
||||
Get.to(() => HomeCaptain());
|
||||
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
||||
|
||||
@@ -296,10 +296,19 @@ class RegisterCaptainController extends GetxController {
|
||||
// link: AppLink.updateAccountBank,
|
||||
// payload: {'phone': '+2${phoneController.text}'});
|
||||
// if (res1 != 'failure') {
|
||||
await Get.put(LoginDriverController()).loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
);
|
||||
Get.find<LoginDriverController>().isGoogleLogin == true
|
||||
? await Get.put(LoginDriverController())
|
||||
.loginUsingCredentialsWithoutGoogle(
|
||||
Get.find<LoginDriverController>()
|
||||
.passwordController
|
||||
.text
|
||||
.toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
)
|
||||
: await Get.put(LoginDriverController()).loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
);
|
||||
// Get.to(EgyptCardAI());
|
||||
// } else {
|
||||
// Get.snackbar('title', 'message');
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:google_sign_in/google_sign_in.dart';
|
||||
|
||||
import '../../onbording_page.dart';
|
||||
import '../../views/auth/captin/ai_page.dart';
|
||||
import '../functions/add_error.dart';
|
||||
|
||||
class GoogleSignInHelper {
|
||||
static final GoogleSignIn _googleSignIn = GoogleSignIn(
|
||||
@@ -81,7 +82,6 @@ class GoogleSignInHelper {
|
||||
// Get.snackbar('Google Sign-In error', '$error',
|
||||
// backgroundColor: AppColor.redColor);
|
||||
// // Log error details
|
||||
// print('Google Sign-In error: $error');
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
@@ -97,9 +97,6 @@ class GoogleSignInHelper {
|
||||
final emailDriver =
|
||||
box.read(BoxName.emailDriver)?.toString() ?? 'Unknown Email';
|
||||
|
||||
// print('Driver ID: $driverID');
|
||||
// print('Email Driver: $emailDriver');
|
||||
|
||||
await Get.find<LoginDriverController>()
|
||||
.loginUsingCredentials(driverID, emailDriver);
|
||||
}
|
||||
@@ -109,26 +106,10 @@ class GoogleSignInHelper {
|
||||
Get.snackbar('Google Sign-In error', '$error',
|
||||
backgroundColor: AppColor.redColor);
|
||||
addError(error.toString(), 'GoogleSignInAccount?> signInFromLogin()');
|
||||
print('Google Sign-In error: $error');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
addError(String error, where) async {
|
||||
CRUD().post(link: AppLink.addError, payload: {
|
||||
'error': error.toString(), // Example error description
|
||||
'userId': box.read(BoxName.driverID) ??
|
||||
box.read(BoxName.passengerID), // Example user ID
|
||||
'userType': box.read(BoxName.driverID) != null
|
||||
? 'Driver'
|
||||
: 'passenger', // Example user type
|
||||
'phone': box.read(BoxName.phone) ??
|
||||
box.read(BoxName.phoneDriver), // Example phone number
|
||||
|
||||
'device': where
|
||||
});
|
||||
}
|
||||
|
||||
// Method to handle Google Sign-Out
|
||||
static Future<void> signOut() async {
|
||||
try {
|
||||
@@ -172,10 +153,7 @@ class GoogleSignInHelper {
|
||||
box.write(BoxName.emailDriver, user.email);
|
||||
// box.write(BoxName.nameDriver, user.displayName);
|
||||
// box.write(BoxName.driverPhotoUrl, user.photoUrl);
|
||||
print(box.read(BoxName.driverID).toString());
|
||||
print(
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
);
|
||||
|
||||
// Perform any additional sign-up tasks or API calls here
|
||||
// For example, you can send the user data to your server for registration
|
||||
}
|
||||
|
||||
@@ -113,9 +113,13 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> fireBaseTitles(RemoteMessage message) async {
|
||||
if (message.notification!.title! == 'Order'.tr) {
|
||||
if (message.notification!.title! == 'OrderSpeed'.tr) {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification('Order'.tr, '', 'order', '');
|
||||
NotificationController().showNotification(
|
||||
message.notification!.title.toString(),
|
||||
message.notification!.body.toString(),
|
||||
'order',
|
||||
'');
|
||||
}
|
||||
// await FirebaseMessagesController().showOverlayNotification(message);
|
||||
var myListString = message.data['DriverList'];
|
||||
@@ -157,17 +161,34 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
// Get.to(const VipOrderPage());
|
||||
} else if (message.notification!.title! == 'message From passenger'.tr) {
|
||||
passengerDialog(message.notification!.body!);
|
||||
// passengerDialog(message.notification!.body!);
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController()
|
||||
.showNotification('message From passenger'.tr, ''.tr, 'ding', '');
|
||||
}
|
||||
MyDialog().getDialog(
|
||||
'message From passenger'.tr, message.notification!.body!, () {
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Hi ,I will go now'.tr,
|
||||
// 'I will go now'.tr,
|
||||
// Get.find<MapPassengerController>().driverToken, []);
|
||||
// Get.find<MapPassengerController>()
|
||||
// .startTimerDriverWaitPassenger5Minute();
|
||||
Get.back();
|
||||
});
|
||||
} else if (message.notification!.title == 'Cancel') {
|
||||
cancelTripDialog1();
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController()
|
||||
.showNotification('Cancel'.tr, ''.tr, 'cancel', '');
|
||||
}
|
||||
MyDialog().getDialog(
|
||||
'Passenger Cancel Trip'.tr,
|
||||
'Trip Cancelled. The cost of the trip will be added to your wallet.'
|
||||
.tr, () {
|
||||
box.write(BoxName.rideStatus, 'Cancel');
|
||||
Get.offAll(HomeCaptain());
|
||||
});
|
||||
// cancelTripDialog1();
|
||||
} else if (message.notification!.title! == 'token change') {
|
||||
// NotificationController1()
|
||||
// .showNotification('token change'.tr, 'token change', 'cancel');
|
||||
@@ -181,24 +202,16 @@ class FirebaseMessagesController extends GetxController {
|
||||
String result0 = await faceDetector();
|
||||
// Handle the result here, e.g., show a dialog or update the UI
|
||||
var result = jsonDecode(result0);
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Face Detection Result'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Text(
|
||||
MyDialogContent().getDialog(
|
||||
'Face Detection Result'.tr,
|
||||
Text(
|
||||
result['similar'].toString() == 'true'
|
||||
? 'similar'.tr
|
||||
: 'not similar'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
backgroundColor: result['similar'].toString() == 'true'
|
||||
? AppColor.greenColor
|
||||
: AppColor.redColor,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
), () {
|
||||
Get.back();
|
||||
});
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I will go now') {
|
||||
@@ -279,13 +292,21 @@ class FirebaseMessagesController extends GetxController {
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else if (message.notification!.title! == 'OrderSpeed') {
|
||||
} else if (message.notification!.title! == 'Order') {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
message.notification!.title.toString(),
|
||||
message.notification!.body.toString(),
|
||||
'order',
|
||||
'');
|
||||
}
|
||||
var myListString = message.data['DriverList'];
|
||||
// var points = message.data['PolylineJson'];
|
||||
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
// var myPoints = jsonDecode(points) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
Get.put(HomeCaptainController()).changeRideId();
|
||||
update();
|
||||
Get.to(() => OrderSpeedRequest(), arguments: {
|
||||
'myListString': myListString,
|
||||
|
||||
19
lib/controller/functions/add_error.dart
Normal file
19
lib/controller/functions/add_error.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../main.dart';
|
||||
import 'crud.dart';
|
||||
|
||||
addError(String error, where) async {
|
||||
CRUD().post(link: AppLink.addError, payload: {
|
||||
'error': error.toString(), // Example error description
|
||||
'userId': box.read(BoxName.driverID) ??
|
||||
box.read(BoxName.passengerID), // Example user ID
|
||||
'userType': box.read(BoxName.driverID) != null
|
||||
? 'Driver'
|
||||
: 'passenger', // Example user type
|
||||
'phone': box.read(BoxName.phone) ??
|
||||
box.read(BoxName.phoneDriver), // Example phone number
|
||||
|
||||
'device': where
|
||||
});
|
||||
}
|
||||
29
lib/controller/functions/audio_controller.dart
Normal file
29
lib/controller/functions/audio_controller.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AudioController extends GetxController {
|
||||
final AudioPlayer _audioPlayer = AudioPlayer();
|
||||
|
||||
Future<void> playAudio() async {
|
||||
// Check if the platform is Android
|
||||
if (Theme.of(Get.context!).platform == TargetPlatform.android) {
|
||||
try {
|
||||
// Load the audio file from the raw resources
|
||||
await _audioPlayer.setAsset(
|
||||
'assets/order1.wav'); // Adjust the path based on your project structure
|
||||
_audioPlayer.play();
|
||||
} catch (e) {
|
||||
// Handle errors, such as file not found
|
||||
print('Error playing audio: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// Release resources when done
|
||||
_audioPlayer.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/info.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/functions/device_info.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
@@ -312,7 +314,13 @@ class AI extends GetxController {
|
||||
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
|
||||
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
|
||||
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
|
||||
'password': '123456',
|
||||
'password':
|
||||
Get.find<LoginDriverController>().passwordController.text.isEmpty
|
||||
? box.read(BoxName.emailDriver).toString()
|
||||
: Get.find<LoginDriverController>()
|
||||
.passwordController
|
||||
.text
|
||||
.toString(),
|
||||
'gender': responseIdEgyptBack['gender']?.toString() ?? 'Not specified',
|
||||
'license_type':
|
||||
responseIdEgyptDriverLicense['license_type']?.toString() ??
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:SEFER/controller/home/captin/order_request_controller.dart';
|
||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||
import 'package:bubble_head/bubble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -303,9 +305,6 @@ class MapDriverController extends GetxController {
|
||||
box.read(BoxName.name).toString(),
|
||||
tokenPassenger,
|
||||
'start.wav');
|
||||
if (box.read(BoxName.googlaMapApp) == true) {
|
||||
await openGoogleMapFromDriverToPassenger();
|
||||
}
|
||||
}
|
||||
|
||||
bool isSocialPressed = false;
|
||||
@@ -346,6 +345,7 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
void startRideFromStartApp() {
|
||||
// if (box.read(BoxName.rideStatus) == 'Begin') {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
isRideStarted = true;
|
||||
@@ -354,6 +354,8 @@ class MapDriverController extends GetxController {
|
||||
timeWaitingPassenger = 0;
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
update();
|
||||
// }
|
||||
|
||||
// rideIsBeginPassengerTimer();
|
||||
}
|
||||
|
||||
@@ -398,20 +400,15 @@ class MapDriverController extends GetxController {
|
||||
// var d = jsonDecode(res);
|
||||
|
||||
update();
|
||||
Get.back();
|
||||
// Start updating location and moving camera
|
||||
// updateLocation();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}),
|
||||
);
|
||||
Get.back();
|
||||
MyDialog().getDialog('Your are far from passenger location'.tr,
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,15 +483,10 @@ class MapDriverController extends GetxController {
|
||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distance2 > 60) {
|
||||
Get.defaultDialog(
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
MyDialog().getDialog('Your are far from passenger location'.tr,
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
} else {
|
||||
double costOfWaiting5Minute = box.read(BoxName.countryCode) == 'Egypt'
|
||||
? (distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * 1)
|
||||
@@ -559,36 +551,22 @@ class MapDriverController extends GetxController {
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to exit ride ?'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
if (distanceToDestination > 900 ||
|
||||
(double.parse(distance) < 1000 &&
|
||||
distanceToDestination > 500)) {
|
||||
Get.back();
|
||||
finishRideFromDriver1();
|
||||
} else {
|
||||
Get.back();
|
||||
if (distanceToDestination < 150) {
|
||||
// todo add scam from start point and dont move
|
||||
// finishRideFromDriver1();
|
||||
}
|
||||
MyDialog().getDialog('you are not moved yet !'.tr, '', () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: Colors.red,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () {
|
||||
if (distanceToDestination > 900 ||
|
||||
(double.parse(distance) < 1000 && distanceToDestination > 150)) {
|
||||
Get.back();
|
||||
finishRideFromDriver1();
|
||||
} else {
|
||||
Get.back();
|
||||
if (distanceToDestination <= 150) {
|
||||
// todo add scam from start point and dont move
|
||||
// finishRideFromDriver1();
|
||||
}
|
||||
MyDialog().getDialog('you are not moved yet !'.tr, '', () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String paymentToken = '';
|
||||
@@ -736,17 +714,12 @@ class MapDriverController extends GetxController {
|
||||
isPassengerInfoWindow = false;
|
||||
clearPolyline();
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
title: 'Order Cancelled'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: 'Order Cancelled by Passenger'.tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.offAll(HomeCaptain());
|
||||
},
|
||||
),
|
||||
MyDialog().getDialog(
|
||||
'Order Cancelled'.tr,
|
||||
'Order Cancelled by Passenger'.tr,
|
||||
() {
|
||||
Get.offAll(HomeCaptain());
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -827,29 +800,25 @@ class MapDriverController extends GetxController {
|
||||
: (i ~/ 60) * (latePrice + .5) * 2 + (price);
|
||||
}
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) + price
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) +
|
||||
price
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) +
|
||||
price
|
||||
: price;
|
||||
} else if (currentTime.hour >= 14 && currentTime.hour <= 17) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
? Get.find<HomeCaptainController>().heavyPrice *
|
||||
((i ~/ 60) - int.parse(duration)) +
|
||||
price -
|
||||
(0.5 * int.parse(duration))
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
? Get.find<HomeCaptainController>().heavyPrice *
|
||||
((i ~/ 60) - int.parse(duration)) +
|
||||
price -
|
||||
(0.5 * int.parse(duration))
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice) +
|
||||
@@ -1191,11 +1160,21 @@ class MapDriverController extends GetxController {
|
||||
late String startNameLocation;
|
||||
late String endNameLocation;
|
||||
|
||||
Future<void> runGoogleMapDirectly() async {
|
||||
if (box.read(BoxName.googlaMapApp) == true) {
|
||||
if (Platform.isAndroid) {
|
||||
Bubble().startBubbleHead(sendAppToBackground: true);
|
||||
}
|
||||
await openGoogleMapFromDriverToPassenger();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
// Get the passenger location from the arguments.
|
||||
// await argumentLoading();
|
||||
runGoogleMapDirectly();
|
||||
addCustomCarIcon();
|
||||
addCustomPassengerIcon();
|
||||
addCustomStartIcon();
|
||||
|
||||
@@ -3,13 +3,11 @@ import 'dart:convert';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'dart:math' as math;
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../functions/audio_controller.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
import 'home_captain_controller.dart';
|
||||
@@ -33,10 +31,14 @@ class OrderRequestController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// AudioController audioController = Get.put(AudioController());
|
||||
|
||||
// audioController.playAudio();
|
||||
// getRefusedOrderByCaptain();
|
||||
initilizeOrderPage();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
|
||||
// calculateConsumptionFuel();
|
||||
update();
|
||||
super.onInit();
|
||||
|
||||
@@ -63,6 +63,7 @@ class MyTranslation extends Translations {
|
||||
"Criminal Record": "السجل الجنائي",
|
||||
"ID Documents Back": "الوثيقه الشخصية - الخلفية",
|
||||
"Driver's License": "رخصة القيادة",
|
||||
"No, still Waiting.": "لا، ما زلت في انتظار.",
|
||||
"you can show video how to setup":
|
||||
"يمكنك عرض فيديو حول كيفية الإعداد",
|
||||
"don't start trip if not": "لا تبدأ الرحلة إذا لم",
|
||||
@@ -544,6 +545,7 @@ Store your money with us and receive it in your bank as a monthly salary.''':
|
||||
"for your first registration!": "للتسجيل الأول!",
|
||||
"Get it Now!": "احصل عليه الآن!",
|
||||
"before": "قبل",
|
||||
'SEFER': 'سفر',
|
||||
"Code not approved": "الرمز غير موافق عليه",
|
||||
"3000 LE": "3000 جنيه مصري",
|
||||
"Do you have an invitation code from another driver?":
|
||||
@@ -1086,6 +1088,16 @@ Store your money with us and receive it in your bank as a monthly salary.''':
|
||||
"Warning: Speeding detected!": "تحذير: تم اكتشاف السرعة الزائدة!",
|
||||
"Please help! Contact me as soon as possible.":
|
||||
"من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.",
|
||||
"Email": "البريد الإلكتروني",
|
||||
"Please enter your Email.": "يرجى إدخال بريدك الإلكتروني",
|
||||
"Email must be correct.": "البريد الإلكتروني يجب أن يكون صحيحاً",
|
||||
"Password": "كلمة المرور",
|
||||
"Please enter your Password.": "يرجى إدخال كلمة المرور",
|
||||
"Password must be at least 6 characters.":
|
||||
"يجب أن تكون كلمة المرور مكونة من 6 أحرف على الأقل",
|
||||
"Phone Number": "رقم الهاتف",
|
||||
"Please enter your phone number.": "يرجى إدخال رقم هاتفك",
|
||||
"Phone number must be valid.": "يجب أن يكون رقم الهاتف صحيحاً",
|
||||
"Share Trip Details": "شارك تفاصيل الرحلة",
|
||||
"Car Plate is": "لوحة السيارة",
|
||||
'L.E': 'ج.م',
|
||||
|
||||
Reference in New Issue
Block a user