25-5-30/1

This commit is contained in:
Hamza-Ayed
2025-05-30 16:57:40 +03:00
parent f3ada31b3b
commit ce3ae01a75
64 changed files with 857 additions and 939 deletions

View File

@@ -45,9 +45,8 @@ class HistoryCaptainController extends GetxController {
getHistoryDetails(String orderId) async {
isloading = true;
var res = await CRUD().get(
link: AppLink.getRideOrderID,
payload: {'id': EncryptionHelper.instance.encryptData(orderId)});
var res = await CRUD()
.get(link: AppLink.getRideOrderID, payload: {'id': (orderId)});
historyDetailsData = jsonDecode(res);
isloading = false;
update();

View File

@@ -150,9 +150,9 @@ Download the Tripz app now and enjoy your ride!
void onSelectDriverInvitation(int index) async {
MyDialog().getDialog(
int.parse((driverInvitationData[index]['countOfInvitDriver'])) < 100
? '${'When'.tr} ${EncryptionHelper.instance.decryptData(driverInvitationData[index]['invitorName'])} ${"complete, you can claim your gift".tr} '
? '${'When'.tr} ${(driverInvitationData[index]['invitorName'])} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${EncryptionHelper.instance.decryptData(driverInvitationData[index]['invitorName'])} ${(driverInvitationData[index]['countOfInvitDriver'])} / 100 ${'Trip'.tr}',
'${(driverInvitationData[index]['invitorName'])} ${(driverInvitationData[index]['countOfInvitDriver'])} / 100 ${'Trip'.tr}',
() async {
bool isAvailable = await LocalAuthentication().isDeviceSupported();
if (int.parse((driverInvitationData[index]['countOfInvitDriver'])) <
@@ -173,10 +173,9 @@ Download the Tripz app now and enjoy your ride!
if ((driverInvitationData[index]['isGiftToken']).toString() ==
'0') {
Get.back();
await CRUD().post(link: AppLink.updateInviteDriver, payload: {
'id': EncryptionHelper.instance
.encryptData(driverInvitationData[index]['id'])
});
await CRUD().post(
link: AppLink.updateInviteDriver,
payload: {'id': (driverInvitationData[index]['id'])});
await Get.find<CaptainWalletController>().addDriverPayment(
'paymentMethod',
('500'),
@@ -186,8 +185,7 @@ Download the Tripz app now and enjoy your ride!
await Get.find<CaptainWalletController>()
.addDriverWalletToInvitor(
'paymentMethod',
EncryptionHelper.instance.encryptData(
driverInvitationData[index]['driverInviterId']),
(driverInvitationData[index]['driverInviterId']),
('500'),
);
await Get.find<CaptainWalletController>()
@@ -231,9 +229,9 @@ Download the Tripz app now and enjoy your ride!
int.parse(driverInvitationDataToPassengers[index]['countOfInvitDriver']
.toString()) <
3
? '${'When'.tr} ${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
? '${'When'.tr} ${(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 3 ${'Trip'.tr}',
'${(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 3 ${'Trip'.tr}',
() async {
if (int.parse(driverInvitationDataToPassengers[index]
['countOfInvitDriver']
@@ -342,7 +340,7 @@ Download the Tripz app now and enjoy your ride!
});
if (response != 'failure') {
var d = jsonDecode(response);
var d = (response);
mySnackbarSuccess('Invite sent successfully'.tr);
String message = '${'*Tripz DRIVER CODE*'.tr}\n\n'
'${"Use this code in registration".tr}\n'

View File

@@ -98,11 +98,12 @@ class LoginDriverController extends GetxController {
final random = Random();
if (random.nextBool()) {
await SecurityHelper.performSecurityChecks();
// await SecurityHelper.performSecurityChecks();
} else {
await SecurityChecks.isDeviceRootedFromNative(Get.context!);
}
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
// print('fingerPrint: ${fingerPrint}');
dev = Platform.isAndroid ? 'android' : 'ios';
var payload = {
'id': box.read(BoxName.driverID),
@@ -118,7 +119,7 @@ class LoginDriverController extends GetxController {
// Log.print('response.body: ${response1.body}');
// print(payload);
// Log.print(
// 'jsonDecode(response1.body)["jwt"]: ${jsonDecode(response1.body)['jwt']}');
// 'jsonDecode(response1.body)["jwt"]: ${jsonDecode(response1.body)['jwt']}');
await box.write(BoxName.hmac, jsonDecode(response1.body)['hmac']);
return jsonDecode(response1.body)['jwt'].toString();
}
@@ -144,9 +145,11 @@ class LoginDriverController extends GetxController {
);
if (response0.statusCode == 200) {
final decodedResponse1 = jsonDecode(response0.body);
// Log.print('decodedResponse1: ${decodedResponse1}');
final jwt = decodedResponse1['jwt'];
box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
// await box.write(BoxName.hmac, decodedResponse1['hmac']);
await AppInitializer().getAIKey(Driver.keyOfApp);
await AppInitializer().getAIKey(Driver.initializationVector);
@@ -183,6 +186,7 @@ class LoginDriverController extends GetxController {
// Log.print('decodedResponse1: ${decodedResponse1}');
final jwt = decodedResponse1['jwt'];
// await box.write(BoxName.hmac, decodedResponse1['hmac']);
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
await AppInitializer().getKey();
}
@@ -230,7 +234,7 @@ class LoginDriverController extends GetxController {
var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: {
'email': email.toString().contains('@')
// ? (box.read(BoxName.emailDriver))
? EncryptionHelper.instance.encryptData(email)
? (email)
: email,
'id': driverID,
});
@@ -252,10 +256,7 @@ class LoginDriverController extends GetxController {
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'].toString() == '1') {
box.write(
BoxName.emailDriver,
EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['email']));
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
box.write(BoxName.firstTimeLoadKey, 'false');
box.write(BoxName.driverID, (jsonDecoeded['data'][0]['id']));
box.write(BoxName.isTest, '1');
@@ -276,16 +277,13 @@ class LoginDriverController extends GetxController {
(jsonDecoeded['data'][0]['accountBank']));
box.write(
BoxName.nameDriver,
'${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['last_name'])}');
'${(jsonDecoeded['data'][0]['first_name'])}'
' ${(jsonDecoeded['data'][0]['last_name'])}');
if (((jsonDecoeded['data'][0]['model'])
.toString()
.contains('دراجه') ||
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
if (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() ==
'Male') {
if ((jsonDecoeded['data'][0]['gender']).toString() == 'Male') {
box.write(BoxName.carTypeOfDriver, 'Scooter');
} else {
box.write(BoxName.carTypeOfDriver, 'Pink Bike');
@@ -311,8 +309,9 @@ class LoginDriverController extends GetxController {
link: AppLink.getDriverToken,
payload: {'captain_id': (box.read(BoxName.driverID)).toString()});
String? fingerPrint = await DeviceHelper.getDeviceFingerprint();
await storage.write(key: BoxName.fingerPrint, value: fingerPrint);
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
await storage.write(
key: BoxName.fingerPrint, value: fingerPrint.toString());
if (token != 'failure') {
if ((jsonDecode(token)['data'][0]['token']) !=
@@ -320,9 +319,7 @@ class LoginDriverController extends GetxController {
Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
'token change'.tr,
'change device'.tr,
EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token'])
.toString(),
(jsonDecode(token)['data'][0]['token']).toString(),
[],
'promo.wav');
await Get.defaultDialog(
@@ -337,9 +334,10 @@ class LoginDriverController extends GetxController {
'captain_id': (box.read(BoxName.driverID)).toString(),
'fingerPrint': (fingerPrint).toString()
});
// to save in payment server fingerprint
await CRUD().post(
link:
"${AppLink.seferAlexandriaServer}/ride/firebase/addDriver.php",
"${AppLink.seferPaymentServer}/ride/firebase/addDriver.php",
payload: {
'token': (box.read(BoxName.tokenDriver)),
'captain_id':
@@ -381,7 +379,7 @@ class LoginDriverController extends GetxController {
update();
var res = await CRUD()
.get(link: AppLink.loginUsingCredentialsWithoutGoogle, payload: {
'email': EncryptionHelper.instance.encryptData(email),
'email': (email),
'password': password,
});
box.write(BoxName.emailDriver, (email).toString());
@@ -409,33 +407,25 @@ class LoginDriverController extends GetxController {
jsonDecoeded['data'][0]['is_verified'].toString());
box.write(BoxName.phoneDriver, (jsonDecoeded['data'][0]['phone']));
box.write(
BoxName.nameArabic,
EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['name_arabic']));
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,
'${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['last_name'])}');
'${(jsonDecoeded['data'][0]['first_name'])}'
' ${(jsonDecoeded['data'][0]['last_name'])}');
if ((jsonDecoeded['data'][0]['model'].toString().contains('دراجه') ||
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
if (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() ==
'Male') {
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 (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() !=
'Male') {
if ((jsonDecoeded['data'][0]['gender']).toString() != 'Male') {
box.write(BoxName.carTypeOfDriver, 'Lady');
} else {
box.write(BoxName.carTypeOfDriver, 'Comfort');
@@ -463,9 +453,7 @@ class LoginDriverController extends GetxController {
Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
'token change'.tr,
'change device'.tr,
EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token'])
.toString(),
(jsonDecode(token)['data'][0]['token']).toString(),
[],
'ding.wav');
Get.defaultDialog(

View File

@@ -100,7 +100,6 @@ class RegisterCaptainController extends GetxController {
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
isLoading = true;
update();
int randomNumber = Random().nextInt(100000) + 1;
isLoading = true;
update();
if (formKey3.currentState!.validate()) {
@@ -108,8 +107,7 @@ class RegisterCaptainController extends GetxController {
if (isValidEgyptianPhoneNumber(phoneController.text)) {
var responseCheker = await CRUD()
.post(link: AppLink.checkPhoneNumberISVerfiedDriver, payload: {
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
'phone_number': ('+2${phoneController.text}'),
});
if (responseCheker != 'failure') {
var d = jsonDecode(responseCheker);
@@ -117,29 +115,18 @@ class RegisterCaptainController extends GetxController {
Get.snackbar('Phone number is verified before'.tr, '',
backgroundColor: AppColor.greenColor);
box.write(BoxName.phoneVerified, '1');
box.write(
BoxName.phone,
EncryptionHelper.instance
.encryptData('+2${phoneController.text}'));
box.write(BoxName.phone, ('+2${phoneController.text}'));
await Get.put(LoginDriverController()).loginWithGoogleCredential(
box.read(BoxName.driverID).toString(),
EncryptionHelper.instance
.encryptData(box.read(BoxName.emailDriver).toString()),
(box.read(BoxName.emailDriver).toString()),
);
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
'token_code': EncryptionHelper.instance
.encryptData(randomNumber.toString()),
'phone_number': ('+2${phoneController.text}'),
"driverId": box.read(BoxName.driverID),
"email": EncryptionHelper.instance
.encryptData(box.read(BoxName.emailDriver)),
"email": (box.read(BoxName.emailDriver)),
});
await smsEgyptController.sendSmsEgypt(
phoneController.text.toString(), randomNumber.toString());
isSent = true;
isLoading = false;
@@ -147,17 +134,11 @@ class RegisterCaptainController extends GetxController {
}
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
'token_code': EncryptionHelper.instance
.encryptData(randomNumber.toString()),
'phone_number': ('+2${phoneController.text}'),
"driverId": box.read(BoxName.driverID),
"email": box.read(BoxName.emailDriver),
});
await smsEgyptController.sendSmsEgypt(
phoneController.text.toString(), randomNumber.toString());
isSent = true;
isLoading = false;
@@ -250,8 +231,7 @@ class RegisterCaptainController extends GetxController {
_handleAlreadyVerified() {
mySnackbarSuccess('Phone number is already verified'.tr);
box.write(BoxName.phoneVerified, '1');
box.write(BoxName.phone,
EncryptionHelper.instance.encryptData('+2${phoneController.text}'));
box.write(BoxName.phone, ('+2${phoneController.text}'));
Get.put(LoginDriverController()).loginWithGoogleCredential(
box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(),
@@ -266,15 +246,14 @@ class RegisterCaptainController extends GetxController {
await CRUD().post(
link: AppLink.sendVerifyOtpMessage,
payload: {
'phone_number': EncryptionHelper.instance.encryptData('+2$phoneNumber'),
'token_code':
EncryptionHelper.instance.encryptData(randomNumber.toString()),
'phone_number': ('+2$phoneNumber'),
'token_code': (randomNumber.toString()),
'driverId': box.read(BoxName.driverID),
'email': box.read(BoxName.emailDriver),
},
);
await smsEgyptController.sendSmsEgypt(phoneNumber, randomNumber.toString());
await smsEgyptController.sendSmsEgypt(phoneNumber);
lastOtpSentTime = DateTime.now(); // Update the last OTP sent time
isSent = true;
@@ -286,15 +265,12 @@ class RegisterCaptainController extends GetxController {
// var loginDriverController = Get.put(LoginDriverController());
if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpDriver, payload: {
'phone_number':
EncryptionHelper.instance.encryptData('+2${phoneController.text}'),
'token_code':
EncryptionHelper.instance.encryptData(verifyCode.text.toString()),
'phone_number': ('+2${phoneController.text}'),
'token_code': (verifyCode.text.toString()),
});
if (res != 'failure') {
// var dec = jsonDecode(res);
box.write(BoxName.phoneDriver,
EncryptionHelper.instance.encryptData('+2${phoneController.text}'));
box.write(BoxName.phoneDriver, ('+2${phoneController.text}'));
box.write(BoxName.phoneVerified, '1');
// loginDriverController.isGoogleLogin == true
@@ -319,10 +295,9 @@ class RegisterCaptainController extends GetxController {
sendVerifications() async {
var res = await CRUD().post(link: AppLink.verifyEmail, payload: {
'email': emailController.text.isEmpty
? EncryptionHelper.instance.encryptData(
Get.find<LoginDriverController>().emailController.text.toString())
: EncryptionHelper.instance.encryptData(emailController.text),
'token': EncryptionHelper.instance.encryptData(verifyCode.text),
? (Get.find<LoginDriverController>().emailController.text.toString())
: (emailController.text),
'token': (verifyCode.text),
});
if (res != 'failure') {

View File

@@ -94,9 +94,8 @@ class GoogleSignInHelper {
// Retrieve driverID and emailDriver with added validation
final driverID =
(box.read(BoxName.driverID)!.toString()) ?? 'Unknown ID';
final emailDriver = EncryptionHelper.instance
.encryptData(box.read(BoxName.emailDriver)!.toString()) ??
'Unknown Email';
final emailDriver =
(box.read(BoxName.emailDriver)!.toString()) ?? 'Unknown Email';
// Debug print statements
print('Driver ID: $driverID');

View File

@@ -60,10 +60,7 @@ class LoginController extends GetxController {
if (jsonDecoeded['status'] == 'success') {
if (jsonDecoeded['data'][0]['verified'] == 1) {
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(
BoxName.emailDriver,
EncryptionHelper.instance
.encryptData(jsonDecoeded['data'][0]['email']));
box.write(BoxName.emailDriver, (jsonDecoeded['data'][0]['email']));
box.write(
BoxName.nameDriver,
jsonDecoeded['data'][0]['first_name'] +