25-2/24/1

This commit is contained in:
Hamza-Ayed
2025-02-24 23:38:01 +03:00
parent 5f53461b34
commit d41314cfed
64 changed files with 1180 additions and 494 deletions

View File

@@ -4,6 +4,16 @@ import '../env/env.dart';
import 'char_map.dart';
class AK {
static final String sss_pass = X.r(X.r(X.r(Env.sss_pass, cn), cC), cs);
static final String allowed = Env.allowed;
static final String passnpassenger = X
.r(X.r(X.r(Env.passnpassenger, cn), cC), cs)
.toString()
.split(Env.addd)[0];
static final String newId = Env.newId;
static final String sss_encryptionSalt =
X.r(X.r(X.r(Env.sss_encryptionSalt, cn), cC), cs);
static final String publishableKeyStripe =
X.r(X.r(X.r(Env.stripePublishableKe, cn), cC), cs);
static final String secretKeyStripe =
@@ -65,7 +75,7 @@ class AK {
static final String payMobOutPassword =
X.r(X.r(X.r(Env.payMobOutPassword, cn), cC), cs);
static final String privateKeyFCM = Env.privateKeyFCM;
// static final String privateKeyFCM = Env.privateKeyFCM;
static final String payMobOutUserName =
X.r(X.r(X.r(Env.payMobOutUserName, cn), cC), cs);

View File

@@ -2,7 +2,13 @@ class BoxName {
static const String driverID = "driverID";
static const String countryCode = "countryCode";
static const String googlaMapApp = "googlaMapApp";
static const String keyOfApp = 'keyOfApp';
static const String initializationVector = 'initializationVector';
static const String firstTimeLoadKey = 'firstTimeLoadKey';
static const String jwt = "jwt";
static const String fingerPrint = "fingerPrint";
static const String payMobApikey = "payMobApikey";
static const String refreshToken = "refreshToken";
static const String lang = "lang";
static const String isvibrate = "isvibrate";
static const String myListString = "myListString";

View File

@@ -9,7 +9,7 @@ class AppInformation {
static const String email = 'hamzaayed@Sefer.live';
static const String complaintPrompt =
'for this data for complaint from driver or passenger i collect all data i want you analyze this complaint and show what is reason and what is solution .this data collected from many table to find solution if payment in visa not complete and if ride status is finished it will be paymnet in payment table if ride status is not finished there is no need to pay and payment table is null for this ride and if paymentFromPaymentTable not null and visa type not cash the payment sucssessed . if ratingpassenger is low or passengr rating drivers low grade then dont mine of this passenger ,look at driver too like passengerratingdriver with rating or ratingtopassenger .in json add status of complaint and message to passenger and message to driver and message to call center write in arabic in json output with key in english .for output please just json i want';
static const String addd = 'BlBlNl';
static const String privacyPolicy = '''
<body monica-version="2.4.0" monica-id="ofpnmcalabcbjgholdjcjblkibolbppb">

View File

@@ -1,5 +1,7 @@
// import 'package:sefer_driver/env/env.dart';
import 'package:sefer_driver/env/env.dart';
import '../main.dart';
import 'box_name.dart';
@@ -29,6 +31,12 @@ class AppLink {
static String seferAlexandriaServer = box.read('Alexandria');
// static final String server = Env.serverPHP;
static String loginJwtDriver = "$server/loginJwtDriver.php";
static String loginJwtWalletDriver =
"$seferPaymentServer/loginJwtWalletDriver.php";
static String loginFirstTimeDriver =
"https://server.sefer.live/sefer.click/sefer/loginFirstTimeDriver.php";
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
static String llama = 'https://api.llama-api.com/chat/completions';
static String gemini =
@@ -93,7 +101,8 @@ class AppLink {
static String getTripCountByCaptain = "$ride/rides/getTripCountByCaptain.php";
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
static String getRideStatus = "$ride/rides/getRideStatus.php";
static String getapiKey = "$ride/apiKey/get.php";
static String getapiKey = Env.getapiKey;
static String getapiKeySefer =
"https://api.sefer.live/sefer/ride/apiKey/get.php";
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";

View File

@@ -8,3 +8,11 @@ class TableName {
static const String captainNotification = "captainNotification";
static const String applyRideFromOverLay = "applyRideFromOverLay";
}
class Driver {
static const String driverPass = 'MG6DEJZSczBT6Rx0jOlehQ==';
static const String payMobApikey = 'payMobApikey';
static const String initializationVector = 'initializationVector';
static const String keyOfApp = 'keyOfApp';
static const String FCM_PRIVATE_KEY = 'FCM_PRIVATE_KEY';
}

View File

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

View File

@@ -149,9 +149,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.decryptData(driverInvitationData[index]['invitorName'])} ${"complete, you can claim your gift".tr} '
? '${'When'.tr} ${EncryptionHelper.instance.decryptData(driverInvitationData[index]['invitorName'])} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${encryptionHelper.decryptData(driverInvitationData[index]['invitorName'])} ${(driverInvitationData[index]['countOfInvitDriver'])} / 100 ${'Trip'.tr}',
'${EncryptionHelper.instance.decryptData(driverInvitationData[index]['invitorName'])} ${(driverInvitationData[index]['countOfInvitDriver'])} / 100 ${'Trip'.tr}',
() async {
if (int.parse((driverInvitationData[index]['countOfInvitDriver'])) <
100) {
@@ -161,23 +161,24 @@ 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
'id': EncryptionHelper.instance
.encryptData(driverInvitationData[index]['id'])
});
await Get.find<CaptainWalletController>().addDriverPayment(
'paymentMethod',
encryptionHelper.encryptData('500'),
EncryptionHelper.instance.encryptData('500'),
'',
);
// add for invitor too
await Get.find<CaptainWalletController>().addDriverWalletToInvitor(
'paymentMethod',
encryptionHelper
EncryptionHelper.instance
.encryptData(driverInvitationData[index]['driverInviterId']),
encryptionHelper.encryptData('500'),
EncryptionHelper.instance.encryptData('500'),
);
await Get.find<CaptainWalletController>().addSeferWallet(
'giftInvitation', encryptionHelper.encryptData('-1000'));
'giftInvitation',
EncryptionHelper.instance.encryptData('-1000'));
NotificationCaptainController().addNotificationCaptain(
driverInvitationData[index]['driverInviterId'].toString(),
"You have got a gift for invitation".tr,
@@ -205,9 +206,9 @@ Download the Tripz app now and enjoy your ride!
int.parse(driverInvitationDataToPassengers[index]['countOfInvitDriver']
.toString()) <
3
? '${'When'.tr} ${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
? '${'When'.tr} ${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 3 ${'Trip'.tr}',
'${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 3 ${'Trip'.tr}',
() async {
if (int.parse(driverInvitationDataToPassengers[index]
['countOfInvitDriver']

View File

@@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:http/http.dart' as http;
import 'package:secure_string_operations/secure_string_operations.dart';
import 'package:sefer_driver/controller/functions/location_background_controller.dart';
import 'package:sefer_driver/views/auth/captin/cards/sms_signup.dart';
import 'package:sefer_driver/views/widgets/elevated_btn.dart';
@@ -15,10 +17,16 @@ import 'package:sefer_driver/main.dart';
import 'package:sefer_driver/views/home/Captin/home_captain/home_captin.dart';
import 'package:location/location.dart';
import '../../../constant/api_key.dart';
import '../../../constant/char_map.dart';
import '../../../constant/info.dart';
import '../../../constant/table_names.dart';
import '../../../print.dart';
import '../../../views/auth/captin/cards/egypt_card_a_i.dart';
import '../../firebase/firbase_messge.dart';
import '../../functions/encrypt_decrypt.dart';
import '../../functions/package_info.dart';
import '../../functions/secure_storage.dart';
class LoginDriverController extends GetxController {
final formKey = GlobalKey<FormState>();
@@ -82,6 +90,77 @@ class LoginDriverController extends GetxController {
update();
}
var dev = '';
getJwtWallet() async {
await SecurityHelper.performSecurityChecks();
String fingerPrint = await getDeviceFingerprint();
dev = Platform.isAndroid ? 'android' : 'ios';
var payload = {
'id': box.read(BoxName.passengerID),
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
'fingerPrint': fingerPrint
};
var response1 = await http.post(
Uri.parse(AppLink.loginJwtWalletDriver),
body: payload,
);
return jsonDecode(response1.body)['jwt'].toString();
}
getJWT() async {
// await SecurityHelper.performSecurityChecks();
dev = Platform.isAndroid ? 'android' : 'ios';
if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
var response0 = await http.post(
Uri.parse(AppLink.loginFirstTimeDriver),
body: {
'id': box.read(BoxName.passengerID) ?? AK.newId,
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
},
);
if (response0.statusCode == 200) {
final decodedResponse1 = jsonDecode(response0.body);
final jwt = decodedResponse1['jwt'];
box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
await AppInitializer().getAIKey(Driver.keyOfApp);
await AppInitializer().getAIKey(Driver.initializationVector);
await Future.delayed(Duration.zero);
await EncryptionHelper.initialize();
await AppInitializer().getAIKey(Driver.payMobApikey);
await AppInitializer().getAIKey(Driver.FCM_PRIVATE_KEY);
await AppInitializer().getKey();
} else {}
} else {
await EncryptionHelper.initialize();
var payload = {
'id': box.read(BoxName.passengerID),
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
};
var response1 = await http.post(
Uri.parse(AppLink.loginJwtDriver),
body: payload,
);
if (response1.statusCode == 200) {
final decodedResponse1 = jsonDecode(response1.body);
Log.print('decodedResponse1: ${decodedResponse1}');
final jwt = decodedResponse1['jwt'];
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
await AppInitializer().getKey();
}
}
}
Future<void> getLocationPermission() async {
Get.put(LocationBackgroundController()).requestLocationPermission();
@@ -119,7 +198,7 @@ class LoginDriverController extends GetxController {
update();
var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: {
'email': email.toString().contains('@')
? encryptionHelper.encryptData(email)
? EncryptionHelper.instance.encryptData(email)
: email,
'id': driverID,
});
@@ -161,13 +240,13 @@ class LoginDriverController extends GetxController {
(jsonDecoeded['data'][0]['accountBank']));
box.write(
BoxName.nameDriver,
'${encryptionHelper.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${encryptionHelper.decryptData(jsonDecoeded['data'][0]['last_name'])}');
'${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['last_name'])}');
if (((jsonDecoeded['data'][0]['model'])
.toString()
.contains('دراجه') ||
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
if (encryptionHelper
if (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() ==
'Male') {
@@ -197,13 +276,14 @@ class LoginDriverController extends GetxController {
payload: {'captain_id': (box.read(BoxName.driverID)).toString()});
if (token != 'failure') {
if (encryptionHelper
if (EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token']) !=
encryptionHelper.decryptData(box.read(BoxName.tokenDriver))) {
EncryptionHelper.instance
.decryptData(box.read(BoxName.tokenDriver))) {
Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
'token change'.tr,
'change device'.tr,
encryptionHelper
EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token'])
.toString(),
[],
@@ -262,11 +342,11 @@ class LoginDriverController extends GetxController {
update();
var res = await CRUD()
.get(link: AppLink.loginUsingCredentialsWithoutGoogle, payload: {
'email': encryptionHelper.encryptData(email),
'email': EncryptionHelper.instance.encryptData(email),
'password': password,
});
box.write(
BoxName.emailDriver, encryptionHelper.encryptData(email).toString());
box.write(BoxName.emailDriver,
EncryptionHelper.instance.encryptData(email).toString());
print(res);
if (res == 'failure') {
//Failure
@@ -292,7 +372,7 @@ class LoginDriverController extends GetxController {
box.write(BoxName.phoneDriver, (jsonDecoeded['data'][0]['phone']));
box.write(
BoxName.nameArabic,
encryptionHelper
EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['name_arabic']));
box.write(
BoxName.bankCodeDriver, (jsonDecoeded['data'][0]['bankCode']));
@@ -300,11 +380,11 @@ class LoginDriverController extends GetxController {
jsonDecoeded['data'][0]['accountBank']);
box.write(
BoxName.nameDriver,
'${encryptionHelper.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${encryptionHelper.decryptData(jsonDecoeded['data'][0]['last_name'])}');
'${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['first_name'])}'
' ${EncryptionHelper.instance.decryptData(jsonDecoeded['data'][0]['last_name'])}');
if ((jsonDecoeded['data'][0]['model'].toString().contains('دراجه') ||
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
if (encryptionHelper
if (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() ==
'Male') {
@@ -314,7 +394,7 @@ class LoginDriverController extends GetxController {
}
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) >
2017) {
if (encryptionHelper
if (EncryptionHelper.instance
.decryptData(jsonDecoeded['data'][0]['gender'])
.toString() !=
'Male') {
@@ -337,13 +417,14 @@ class LoginDriverController extends GetxController {
payload: {'captain_id': box.read(BoxName.driverID).toString()});
if (token != 'failure') {
if (encryptionHelper
if (EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token']) !=
encryptionHelper.decryptData(box.read(BoxName.tokenDriver))) {
EncryptionHelper.instance
.decryptData(box.read(BoxName.tokenDriver))) {
Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
'token change'.tr,
'change device'.tr,
encryptionHelper
EncryptionHelper.instance
.decryptData(jsonDecode(token)['data'][0]['token'])
.toString(),
[],

View File

@@ -108,8 +108,8 @@ class RegisterCaptainController extends GetxController {
if (isValidEgyptianPhoneNumber(phoneController.text)) {
var responseCheker = await CRUD()
.post(link: AppLink.checkPhoneNumberISVerfiedDriver, payload: {
'phone_number':
encryptionHelper.encryptData('+2${phoneController.text}'),
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
});
if (responseCheker != 'failure') {
var d = jsonDecode(responseCheker);
@@ -117,18 +117,20 @@ 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.encryptData('+2${phoneController.text}'));
box.write(
BoxName.phone,
EncryptionHelper.instance
.encryptData('+2${phoneController.text}'));
await Get.put(LoginDriverController()).loginWithGoogleCredential(
box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(),
);
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number':
encryptionHelper.encryptData('+2${phoneController.text}'),
'token_code':
encryptionHelper.encryptData(randomNumber.toString()),
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
'token_code': EncryptionHelper.instance
.encryptData(randomNumber.toString()),
"driverId": box.read(BoxName.driverID),
"email": box.read(BoxName.emailDriver),
});
@@ -143,10 +145,10 @@ class RegisterCaptainController extends GetxController {
}
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number':
encryptionHelper.encryptData('+2${phoneController.text}'),
'token_code':
encryptionHelper.encryptData(randomNumber.toString()),
'phone_number': EncryptionHelper.instance
.encryptData('+2${phoneController.text}'),
'token_code': EncryptionHelper.instance
.encryptData(randomNumber.toString()),
"driverId": box.read(BoxName.driverID),
"email": box.read(BoxName.emailDriver),
});
@@ -247,7 +249,7 @@ class RegisterCaptainController extends GetxController {
mySnackbarSuccess('Phone number is already verified'.tr);
box.write(BoxName.phoneVerified, '1');
box.write(BoxName.phone,
encryptionHelper.encryptData('+2${phoneController.text}'));
EncryptionHelper.instance.encryptData('+2${phoneController.text}'));
Get.put(LoginDriverController()).loginWithGoogleCredential(
box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(),
@@ -262,8 +264,9 @@ class RegisterCaptainController extends GetxController {
await CRUD().post(
link: AppLink.sendVerifyOtpMessage,
payload: {
'phone_number': encryptionHelper.encryptData('+2$phoneNumber'),
'token_code': encryptionHelper.encryptData(randomNumber.toString()),
'phone_number': EncryptionHelper.instance.encryptData('+2$phoneNumber'),
'token_code':
EncryptionHelper.instance.encryptData(randomNumber.toString()),
'driverId': box.read(BoxName.driverID),
'email': box.read(BoxName.emailDriver),
},
@@ -282,13 +285,14 @@ class RegisterCaptainController extends GetxController {
if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpDriver, payload: {
'phone_number':
encryptionHelper.encryptData('+2${phoneController.text}'),
'token_code': encryptionHelper.encryptData(verifyCode.text.toString()),
EncryptionHelper.instance.encryptData('+2${phoneController.text}'),
'token_code':
EncryptionHelper.instance.encryptData(verifyCode.text.toString()),
});
if (res != 'failure') {
// var dec = jsonDecode(res);
box.write(BoxName.phoneDriver,
encryptionHelper.encryptData('+2${phoneController.text}'));
EncryptionHelper.instance.encryptData('+2${phoneController.text}'));
box.write(BoxName.phoneVerified, '1');
// loginDriverController.isGoogleLogin == true
@@ -313,10 +317,10 @@ class RegisterCaptainController extends GetxController {
sendVerifications() async {
var res = await CRUD().post(link: AppLink.verifyEmail, payload: {
'email': emailController.text.isEmpty
? encryptionHelper.encryptData(
? EncryptionHelper.instance.encryptData(
Get.find<LoginDriverController>().emailController.text.toString())
: encryptionHelper.encryptData(emailController.text),
'token': encryptionHelper.encryptData(verifyCode.text),
: EncryptionHelper.instance.encryptData(emailController.text),
'token': EncryptionHelper.instance.encryptData(verifyCode.text),
});
if (res != 'failure') {

View File

@@ -126,7 +126,7 @@ class GoogleSignInHelper {
box.write(BoxName.driverID,
(user.id) ?? 'Unknown ID'); // Ensure there's a fallback value
box.write(BoxName.emailDriver,
encryptionHelper.encryptData(user.email) ?? 'Unknown Email');
EncryptionHelper.instance.encryptData(user.email) ?? 'Unknown Email');
}
// Method to handle Google Sign-Out

View File

@@ -71,7 +71,8 @@ class FirebaseMessagesController extends GetxController {
Future getToken() async {
fcmToken.getToken().then((token) {
// Log.print('token: ${token}');
box.write(BoxName.tokenDriver, encryptionHelper.encryptData(token!));
box.write(
BoxName.tokenDriver, EncryptionHelper.instance.encryptData(token!));
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
@@ -400,6 +401,25 @@ class FirebaseMessagesController extends GetxController {
}));
}
late String serviceAccountKeyJson;
@override
Future<void> onInit() async {
super.onInit();
try {
var encryptedKey = await storage.read(key: 'FCM_PRIVATE_KEY');
// Log.print('encryptedKey: ${encryptedKey}');
if (encryptedKey != null) {
serviceAccountKeyJson =
EncryptionHelper.instance.decryptData(encryptedKey);
// Log.print('serviceAccountKeyJson: ${serviceAccountKeyJson}');
} else {
print('🔴 Error: FCM_PRIVATE_KEY not found in Secure Storage');
}
} catch (e) {
print('🔴 Error decrypting FCM key: $e');
}
}
void sendNotificationAll(String title, body, tone) async {
// Get the token you want to subtract.
String token = box.read(BoxName.tokenFCM);
@@ -411,26 +431,16 @@ class FirebaseMessagesController extends GetxController {
// box.write(BoxName.tokens, tokens);
tokens = box.read(BoxName.tokens);
for (var i = 0; i < tokens.length; i++) {
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
if (serviceAccountKeyJson.isEmpty) {
print("🔴 Error: Service Account Key is empty");
return;
}
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http
@@ -479,26 +489,16 @@ class FirebaseMessagesController extends GetxController {
String title, body, token, List<String> map, String tone,
{int retryCount = 2}) async {
try {
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
if (serviceAccountKeyJson.isEmpty) {
print("🔴 Error: Service Account Key is empty");
return;
}
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http.post(
@@ -571,26 +571,16 @@ class FirebaseMessagesController extends GetxController {
String title, body, token, List<String> map, String tone,
{int retryCount = 2}) async {
try {
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
if (serviceAccountKeyJson.isEmpty) {
print("🔴 Error: Service Account Key is empty");
return;
}
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http.post(
@@ -666,26 +656,16 @@ class FirebaseMessagesController extends GetxController {
{int retryCount = 2}) async {
try {
final privateKey = await storage.read(key: 'FCM_PRIVATE_KEY');
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
if (serviceAccountKeyJson.isEmpty) {
print("🔴 Error: Service Account Key is empty");
return;
}
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http.post(

View File

@@ -1,12 +1,18 @@
import 'dart:convert';
import 'package:secure_string_operations/secure_string_operations.dart';
import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/constant/links.dart';
import 'package:sefer_driver/controller/auth/captin/login_captin_controller.dart';
import 'package:sefer_driver/controller/functions/add_error.dart';
import 'package:sefer_driver/main.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:sefer_driver/env/env.dart';
import 'package:sefer_driver/views/widgets/error_snakbar.dart';
import '../../constant/api_key.dart';
import '../../constant/char_map.dart';
import '../../constant/info.dart';
import '../../print.dart';
import 'gemeni.dart';
import 'upload_image.dart';
@@ -25,28 +31,43 @@ class CRUD {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
},
);
Log.print('request: ${response.request}');
Log.print('response: ${response.body}');
Log.print('payload: ${payload}');
// if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
return response.body;
}
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
return response.body;
}
return jsonData['status'];
return jsonData['status'];
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginDriverController()).getJWT();
mySnackbarSuccess('please order now'.tr);
return 'token_expired'; // Return a specific value for token expiration
} else {
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
}
} else {
addError('Non-200 response code: ${response.statusCode}',
'crud().post - Other');
return 'failure';
}
}
// }
Future<dynamic> post({
Future<dynamic> getWallet({
required String link,
Map<String, dynamic>? payload,
}) async {
// String? basicAuthCredentials =
// await storage.read(key: BoxName.basicAuthCredentials);
var s = await LoginDriverController().getJwtWallet();
var url = Uri.parse(
link,
);
@@ -55,25 +76,94 @@ class CRUD {
body: payload,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
'Authorization': 'Bearer $s'
},
);
Log.print('request: ${response.request}');
Log.print('response: ${response.body}');
Log.print('payload: ${payload}');
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
return response.body;
}
return jsonData['status'];
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginDriverController()).getJwtWallet();
return 'token_expired'; // Return a specific value for token expiration
} else {
// String errorMessage = jsonData['message'];
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
return (jsonData['status']);
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
}
} else {
return response.statusCode;
addError('Non-200 response code: ${response.statusCode}',
'crud().post - Other');
return 'failure';
}
}
Future<dynamic> post(
{required String link, Map<String, dynamic>? payload}) async {
var url = Uri.parse(link);
try {
var response = await http.post(
url,
body: payload,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
// 'Authorization': 'Bearer ${box.read(BoxName.jwt)}'
},
);
if (response.statusCode == 200) {
try {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
return jsonData;
} else {
return jsonData['status'];
}
} catch (e) {
addError(e.toString(), 'crud().post - JSON decoding');
return 'failure';
}
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginDriverController()).getJWT();
// MyDialog().getDialog(
// 'Session expired. Please log in again.'.tr,
// '',
// () {
// Get.put(LoginController()).loginUsingCredentials(
// box.read(BoxName.passengerID), box.read(BoxName.email));
// Get.back();
// },
// );
return 'token_expired'; // Return a specific value for token expiration
} else {
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
}
} else {
addError('Non-200 response code: ${response.statusCode}',
'crud().post - Other');
return 'failure';
}
} catch (e) {
addError('HTTP request error: $e', 'crud().post - HTTP');
return 'failure';
}
}

View File

@@ -1,34 +1,50 @@
import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:flutter/foundation.dart';
import '../../env/env.dart';
var secretKey = Env.keyOfApp
.toString()
.split('XrXlBl')[0]; // Must be 16 characters for AES-128
String initializationVector = Env.initializationVector; // Must be 16 characters
final encryptionHelper = EncryptionHelper(
secretKey: secretKey,
initializationVector: initializationVector,
);
import '../../constant/box_name.dart';
import '../../main.dart';
class EncryptionHelper {
final encrypt.Key key;
final encrypt.IV iv;
static EncryptionHelper? _instance;
EncryptionHelper(
{required String secretKey, required String initializationVector})
: key = encrypt.Key.fromUtf8(secretKey),
iv = encrypt.IV.fromUtf8(initializationVector);
late final encrypt.Key key;
late final encrypt.IV iv;
// Initialize the helper
EncryptionHelper._(this.key, this.iv);
static EncryptionHelper get instance {
if (_instance == null) {
throw Exception(
"EncryptionHelper is not initialized. Call `await EncryptionHelper.initialize()` in main.");
}
return _instance!;
}
/// Encrypts the given plain text
/// Initializes and stores the instance globally
static Future<void> initialize() async {
if (_instance != null) {
debugPrint("EncryptionHelper is already initialized.");
return; // Prevent re-initialization
}
debugPrint("Initializing EncryptionHelper...");
// Read stored keys
String? keyOfApp = await storage.read(key: BoxName.keyOfApp);
// Log.print('keyOfApp: ${keyOfApp}');
String? initializationVector =
await storage.read(key: BoxName.initializationVector);
// Log.print('initializationVector: ${initializationVector}');
// Set the global instance
_instance = EncryptionHelper._(
encrypt.Key.fromUtf8(keyOfApp!),
encrypt.IV.fromUtf8(initializationVector!),
);
debugPrint("EncryptionHelper initialized successfully.");
}
/// Encrypts a string
String encryptData(String plainText) {
try {
final encrypter = encrypt.Encrypter(encrypt.AES(key,
mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode
final encrypter =
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
final encrypted = encrypter.encrypt(plainText, iv: iv);
return encrypted.base64;
} catch (e) {
@@ -37,14 +53,13 @@ class EncryptionHelper {
}
}
/// Decrypts the given encrypted text
/// Decrypts a string
String decryptData(String encryptedText) {
try {
final encrypter = encrypt.Encrypter(encrypt.AES(key,
mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode
final encrypter =
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
final encrypted = encrypt.Encrypted.fromBase64(encryptedText);
final decrypted = encrypter.decrypt(encrypted, iv: iv);
return decrypted;
return encrypter.decrypt(encrypted, iv: iv);
} catch (e) {
debugPrint('Decryption Error: $e');
return '';

View File

@@ -24,9 +24,9 @@ Future<String> faceDetector() async {
request.body = json.encode({
"url1":
"${AppLink.seferCairoServer}/card_image/id_front-${encryptionHelper.decryptData(box.read(BoxName.driverID))}.jpg",
"${AppLink.seferCairoServer}/card_image/id_front-${EncryptionHelper.instance.decryptData(box.read(BoxName.driverID))}.jpg",
"url2":
"https://api.sefer.live/sefer/card_image/face_detect-${encryptionHelper.decryptData(box.read(BoxName.driverID))}.jpg"
"https://api.sefer.live/sefer/card_image/face_detect-${EncryptionHelper.instance.decryptData(box.read(BoxName.driverID))}.jpg"
});
print('request.body: ${request.body}');
request.headers.addAll(headers);

View File

@@ -394,10 +394,10 @@ class AI extends GetxController {
update();
var payload = {
'first_name': encryptionHelper.encryptData(
'first_name': EncryptionHelper.instance.encryptData(
responseNonIdCardFront['full_name'].toString().split(' ')[0]) ??
'Not specified',
'last_name': encryptionHelper.encryptData(
'last_name': EncryptionHelper.instance.encryptData(
responseNonIdCardFront['full_name'].toString().split(' ').last) ??
'Not specified',
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
@@ -410,14 +410,14 @@ class AI extends GetxController {
.passwordController
.text
.toString(),
'gender': encryptionHelper
'gender': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['gender'].toString()) ??
'Not specified',
'license_type': 'Foreign',
'national_number': encryptionHelper
'national_number': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['passport_no'].toString()) ??
'Not specified',
'name_arabic': encryptionHelper
'name_arabic': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['full_name'].toString()) ??
'Not specified',
'name_english': 'Not specified',
@@ -431,30 +431,30 @@ class AI extends GetxController {
? responseIdEgyptDriverLicense['license_categories'].join(', ')
: responseIdEgyptDriverLicense['license_categories']?.toString() ??
'Not specified',
'address': encryptionHelper
'address': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['address'].toString()) ??
'Not specified',
'card_id': encryptionHelper
'card_id': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['card_id'].toString()) ??
'Not specified',
'occupation': encryptionHelper
'occupation': EncryptionHelper.instance
.encryptData(responseNonIdCardBack['workStatus'].toString()) ??
'Not specified',
'education': 'Not specified',
'licenseIssueDate':
responseNonIdCardBack['issueDate']?.toString() ?? 'Not specified',
'religion': encryptionHelper
'religion': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['country'].toString()) ??
'Not specified',
'status': 'yet',
'birthdate': encryptionHelper
'birthdate': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['birthdate'].toString()) ??
'Not specified',
'maritalStatus': 'Not specified',
'site': encryptionHelper
'site': EncryptionHelper.instance
.encryptData(responseNonIdCardFront['address'].toString()) ??
'Not specified',
'employmentType': encryptionHelper
'employmentType': EncryptionHelper.instance
.encryptData(responseNonIdCardBack['residencyType'].toString()) ??
'Not specified',
};
@@ -499,10 +499,10 @@ class AI extends GetxController {
update();
var payload = {
'first_name': encryptionHelper.encryptData(
'first_name': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['firstName'].toString()) ??
'Not specified',
'last_name': encryptionHelper.encryptData(
'last_name': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['lastName'].toString()) ??
'Not specified',
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
@@ -515,18 +515,18 @@ class AI extends GetxController {
.passwordController
.text
.toString(),
'gender': encryptionHelper
'gender': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['gender'].toString()) ??
'Not specified',
'license_type': encryptionHelper.encryptData(
'license_type': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['license_type'].toString()) ??
'Not specified',
'national_number': encryptionHelper
'national_number': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['nationalID'].toString()) ??
'Not specified',
'name_arabic': encryptionHelper
'name_arabic': EncryptionHelper.instance
.encryptData(responseIdEgyptDriverLicense['name_arabic'].toString()),
'name_english': encryptionHelper
'name_english': EncryptionHelper.instance
.encryptData(responseIdEgyptDriverLicense['name_english'].toString()),
'issue_date': responseIdEgyptDriverLicense['issue_date']?.toString() ??
'Not specified',
@@ -537,34 +537,34 @@ class AI extends GetxController {
? responseIdEgyptDriverLicense['license_categories'].join(', ')
: responseIdEgyptDriverLicense['license_categories']?.toString() ??
'Not specified',
'address': encryptionHelper
'address': EncryptionHelper.instance
.encryptData(responseIdEgyptFront['address'].toString()) ??
'Not specified',
'card_id': encryptionHelper
'card_id': EncryptionHelper.instance
.encryptData(responseIdEgyptFront['card_id'].toString()) ??
'Not specified',
'occupation': encryptionHelper
'occupation': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['occupation'].toString()) ??
'Not specified',
'education': encryptionHelper
'education': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['occupation'].toString()) ??
'Not specified',
'licenseIssueDate':
responseIdEgyptDriverLicense['issue_date'].toString() ??
'Not specified',
'religion': encryptionHelper
'religion': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['religion'].toString()) ??
'Not specified',
'status': 'yet',
'birthdate': encryptionHelper.encryptData(extractDOB(
'birthdate': EncryptionHelper.instance.encryptData(extractDOB(
responseIdEgyptDriverLicense['national_number'].toString())),
'maritalStatus': encryptionHelper
'maritalStatus': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['maritalStatus'].toString()) ??
'Not specified',
'site': encryptionHelper.encryptData(
'site': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['address'].toString()) ??
'Not specified',
'employmentType': encryptionHelper.encryptData(
'employmentType': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['employmentType'].toString()) ??
'Not specified',
};
@@ -609,7 +609,7 @@ class AI extends GetxController {
var res = await CRUD().post(link: AppLink.addCriminalDocuments, payload: {
"driverId": box.read(BoxName.driverID),
"IssueDate": responseCriminalRecordEgypt['IssueDate'],
"InspectionResult": encryptionHelper
"InspectionResult": EncryptionHelper.instance
.encryptData(responseCriminalRecordEgypt['InspectionResult']),
});
if (res != 'failure') {
@@ -624,7 +624,7 @@ class AI extends GetxController {
var res = await CRUD().post(link: AppLink.addRegisrationCar, payload: {
'driverID': box.read(BoxName.driverID),
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate': encryptionHelper.encryptData(
'car_plate': EncryptionHelper.instance.encryptData(
responseIdCardDriverEgyptFront['car_plate'].toString()),
'make': (responseIdCardDriverEgyptBack['make'].toString()),
'model': (responseIdCardDriverEgyptBack['model']),
@@ -632,10 +632,10 @@ class AI extends GetxController {
'expiration_date':
responseIdCardDriverEgyptFront['LicenseExpirationDate'].toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': encryptionHelper
'owner': EncryptionHelper.instance
.encryptData(responseIdCardDriverEgyptFront['owner']),
'color_hex': responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': encryptionHelper
'address': EncryptionHelper.instance
.encryptData(responseIdCardDriverEgyptFront['address'].toString()),
'displacement': responseIdCardDriverEgyptBack['engine'].toString(),
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
@@ -654,7 +654,7 @@ class AI extends GetxController {
payload: {
'driverID': box.read(BoxName.driverID),
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate': encryptionHelper.encryptData(
'car_plate': EncryptionHelper.instance.encryptData(
responseIdCardDriverEgyptFront['car_plate'].toString()),
'make': (responseIdCardDriverEgyptBack['make'].toString()),
'model': (responseIdCardDriverEgyptBack['model']),
@@ -663,11 +663,11 @@ class AI extends GetxController {
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': encryptionHelper
'owner': EncryptionHelper.instance
.encryptData(responseIdCardDriverEgyptFront['owner']),
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': encryptionHelper.encryptData(
'address': EncryptionHelper.instance.encryptData(
responseIdCardDriverEgyptFront['address'].toString()),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),
@@ -680,7 +680,7 @@ class AI extends GetxController {
payload: {
'driverID': box.read(BoxName.driverID),
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate': encryptionHelper.encryptData(
'car_plate': EncryptionHelper.instance.encryptData(
responseIdCardDriverEgyptFront['car_plate'].toString()),
'make': (responseIdCardDriverEgyptBack['make'].toString()),
'model': (responseIdCardDriverEgyptBack['model']),
@@ -689,11 +689,11 @@ class AI extends GetxController {
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': encryptionHelper
'owner': EncryptionHelper.instance
.encryptData(responseIdCardDriverEgyptFront['owner']),
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': encryptionHelper.encryptData(
'address': EncryptionHelper.instance.encryptData(
responseIdCardDriverEgyptFront['address'].toString()),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),

View File

@@ -91,7 +91,7 @@ class LocationController extends GetxController {
longitude >= minLongitude &&
longitude <= maxLongitude) {
box.write(BoxName.serverChosen,
encryptionHelper.decryptData(locationData['server_link']));
EncryptionHelper.instance.decryptData(locationData['server_link']));
// Log.print(
// 'locationData----server_link: ${locationData['server_link']}');
return locationData['name'];

View File

@@ -76,7 +76,8 @@ class LogOutController extends GetxController {
title: 'Delete'.tr,
onPressed: () async {
if (checkTxtController.text ==
encryptionHelper.decryptData(box.read(BoxName.nameDriver))) {
EncryptionHelper.instance
.decryptData(box.read(BoxName.nameDriver))) {
// deletecaptainAccount();
var id = await checkBeforeDelete();
@@ -101,23 +102,10 @@ class LogOutController extends GetxController {
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(AppColor.redColor),
),
onPressed: () {
onPressed: () async {
// box.remove(BoxName.agreeTerms);
box.remove(BoxName.driverID);
box.remove(BoxName.email);
box.remove(BoxName.lang);
box.remove(BoxName.name);
box.remove(BoxName.passengerID);
box.remove(BoxName.phone);
box.remove(BoxName.tokenFCM);
box.remove(BoxName.tokens);
box.remove(BoxName.addHome);
box.remove(BoxName.addWork);
box.remove(BoxName.agreeTerms);
box.remove(BoxName.apiKeyRun);
box.remove(BoxName.countryCode);
box.remove(BoxName.accountIdStripeConnect);
box.remove(BoxName.passengerWalletTotal);
await box.erase();
await storage.deleteAll();
Get.offAll(OnBoardingPage());
},
child: Text(
@@ -144,27 +132,10 @@ class LogOutController extends GetxController {
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(AppColor.redColor),
),
onPressed: () {
onPressed: () async {
// box.remove(BoxName.agreeTerms);
box.remove(BoxName.driverID);
box.remove(BoxName.sexDriver);
box.remove(BoxName.dobDriver);
box.remove(BoxName.nameDriver);
box.remove(BoxName.emailDriver);
box.remove(BoxName.phoneDriver);
box.remove(BoxName.statusDriverLocation);
box.remove(BoxName.cvvCodeDriver);
box.remove(BoxName.lastNameDriver);
box.remove(BoxName.passwordDriver);
box.remove(BoxName.cardNumberDriver);
box.remove(BoxName.expiryDateDriver);
box.remove(BoxName.cardHolderNameDriver);
box.remove(BoxName.vin);
box.remove(BoxName.make);
box.remove(BoxName.year);
box.remove(BoxName.owner);
box.remove(BoxName.onBoarding);
box.remove(BoxName.agreeTerms);
await box.erase();
await storage.deleteAll();
Get.offAll(OnBoardingPage());
},
child: Text(

View File

@@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/constant/colors.dart';
import 'package:sefer_driver/constant/links.dart';
@@ -12,6 +14,7 @@ import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../constant/info.dart';
import '../../main.dart';
import 'encrypt_decrypt.dart';
Future<void> checkForUpdate(BuildContext context) async {
final packageInfo = await PackageInfo.fromPlatform();
@@ -159,3 +162,122 @@ void showUpdateDialog(BuildContext context) {
},
);
}
getDeviceFingerprint() async {
final deviceInfo = await DeviceInfoPlugin().deviceInfo;
var deviceData;
if (Platform.isAndroid) {
deviceData = deviceInfo.data;
} else if (Platform.isIOS) {
deviceData = deviceInfo.data;
}
final String deviceId =
deviceData['androidId'] ?? deviceData['identifierForVendor'];
final String deviceModel = deviceData['model'];
final String osVersion = deviceData['systemVersion'];
return EncryptionHelper.instance
.encryptData('${deviceId}_${deviceModel}_$osVersion');
}
class SecurityHelper {
/// Performs security checks and handles potential risks
static Future<void> performSecurityChecks() async {
bool isNotTrust = false;
bool isJailBroken = false;
bool isRealDevice = true;
bool isOnExternalStorage = false;
bool checkForIssues = false;
bool isDevMode = false;
bool isTampered = false;
String bundleId = "";
try {
isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
isOnExternalStorage =
await JailbreakRootDetection.instance.isOnExternalStorage;
List<JailbreakIssue> issues =
await JailbreakRootDetection.instance.checkForIssues;
checkForIssues = issues.isNotEmpty;
isDevMode = await JailbreakRootDetection.instance.isDevMode;
// Get Bundle ID
PackageInfo packageInfo = await PackageInfo.fromPlatform();
bundleId = packageInfo.packageName;
if (bundleId.isNotEmpty) {
// Pass the CORRECT bundle ID to isTampered
isTampered = await JailbreakRootDetection.instance.isTampered(bundleId);
}
} catch (e) {
debugPrint("Error during security checks: $e");
// Consider handling specific exceptions, not just general errors.
}
// Save values to storage (using GetStorage)
await box.write('isNotTrust', isNotTrust); // Use await for write operations
await box.write('isTampered', isTampered); // Use await
await box.write('isJailBroken', isJailBroken); // Use await
// debugPrint("Security Check Results:");
// debugPrint("isNotTrust: $isNotTrust");
// debugPrint("isJailBroken: $isJailBroken");
// debugPrint("isRealDevice: $isRealDevice");
// debugPrint("isOnExternalStorage: $isOnExternalStorage");
// debugPrint("checkForIssues: $checkForIssues");
// debugPrint("isDevMode: $isDevMode");
// debugPrint("isTampered: $isTampered");
// debugPrint("Bundle ID: $bundleId"); // Print the bundle ID
// Check for security risks and potentially show a warning
if (isNotTrust ||
isJailBroken ||
isTampered ||
isDevMode ||
isOnExternalStorage ||
!isRealDevice) {
// print("security_warning".tr); //using easy_localization
// Use a more robust approach to show a warning, like a dialog:
_showSecurityWarning();
}
}
/// Deletes all app data
static Future<void> clearAllData() async {
//await storage.deleteAll(); // What's 'storage'? Be specific. Likely GetStorage as well.
await box.erase(); // Clear GetStorage data
exit(0); // This will terminate the app. Be VERY careful with this.
}
static void _showSecurityWarning() {
// Show a dialog, navigate to an error screen, etc.
// Example using Get.dialog (if you use GetX):
Get.dialog(
AlertDialog(
title: Text("Security Warning".tr), // Or use localized string
content: Text(
"Potential security risks detected. The application may not function correctly."
.tr), //Or use localized string
actions: [
TextButton(
onPressed: () async {
await storage.deleteAll();
await box.erase();
Get.back(); // Close the dialog
// Or, if you really must, exit the app (but give the user a chance!)
exit(0);
},
child: Text("OK"), // Or use a localized string
),
],
),
barrierDismissible: false, // Prevent closing by tapping outside
);
}
}

View File

@@ -1,9 +1,14 @@
import 'dart:convert';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import 'package:sefer_driver/controller/auth/captin/login_captin_controller.dart';
import 'package:sefer_driver/controller/functions/encrypt_decrypt.dart';
import '../../constant/box_name.dart';
import '../../constant/char_map.dart';
import '../../constant/info.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../../print.dart';
@@ -34,24 +39,41 @@ class AppInitializer {
List<Map<String, dynamic>> links = [];
Future<void> initializeApp() async {
await getKey();
await getAIKey('FCM_PRIVATE_KEY');
Log.print('box.read("jwt"): ${box.read(BoxName.jwt)}');
if (box.read(BoxName.jwt) == null) {
await LoginDriverController().getJWT();
} else {
print('firstTimeLoadKey ${box.read(BoxName.firstTimeLoadKey)}');
bool isTokenExpired = JwtDecoder.isExpired(X
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
.toString()
.split(AppInformation.addd)[0]);
Log.print('isTokenExpired: $isTokenExpired');
if (isTokenExpired) {
await LoginDriverController().getJWT();
}
}
// await getKey();
}
getAIKey(String key) async {
var res =
await CRUD().get(link: AppLink.getapiKey, payload: {"keyName": key});
if (res != 'failure') {
var d = jsonDecode(res)['message'];
storage.write(key: 'FCM_PRIVATE_KEY', value: d[key].toString());
// return d[key].toString();
} else {}
getAIKey(String key1) async {
if (box.read(BoxName.firstTimeLoadKey) == null) {
var res =
await CRUD().get(link: AppLink.getapiKey, payload: {"keyName": key1});
if (res != 'failure') {
var d = jsonDecode(res)['message'];
await storage.write(key: key1, value: d[key1].toString());
await Future.delayed(Duration.zero);
} else {}
}
}
Future<void> getKey() async {
try {
var res =
await CRUD().get(link: AppLink.getLocationAreaLinks, payload: {});
// Log.print('res: ${res}');
if (res != 'failure') {
links = List<Map<String, dynamic>>.from(jsonDecode(res)['message']);
await box.remove(BoxName.locationName);
@@ -61,14 +83,18 @@ class AppInitializer {
await box.remove(links[2]['name']);
await box.write(BoxName.locationName, links);
await box.write(BoxName.basicLink,
encryptionHelper.decryptData(links[0]['server_link']));
EncryptionHelper.instance.decryptData(links[0]['server_link']));
await box.write(links[2]['name'],
encryptionHelper.decryptData(links[2]['server_link']));
EncryptionHelper.instance.decryptData(links[2]['server_link']));
await box.write(links[1]['name'],
encryptionHelper.decryptData(links[1]['server_link']));
EncryptionHelper.instance.decryptData(links[3]['server_link']));
await box.write(links[3]['name'],
EncryptionHelper.instance.decryptData(links[1]['server_link']));
await box.write(BoxName.paymentLink,
encryptionHelper.decryptData(links[4]['server_link']));
EncryptionHelper.instance.decryptData(links[4]['server_link']));
}
} catch (e) {}
} catch (e) {
print('Error fetching or decoding location data: $e');
}
}
}

View File

@@ -46,12 +46,12 @@ class SmsEgyptController extends GetxController {
if (jsonDecode(res.body)['message'].toString() != "Success") {
await CRUD().post(link: AppLink.updatePhoneInvalidSMS, payload: {
"phone_number": encryptionHelper.encryptData(
"phone_number": EncryptionHelper.instance.encryptData(
'+2${Get.find<RegisterCaptainController>().phoneController.text}')
});
box.write(
BoxName.phoneDriver,
encryptionHelper.encryptData(
EncryptionHelper.instance.encryptData(
'+2${Get.find<RegisterCaptainController>().phoneController.text}'));
box.write(BoxName.phoneVerified, '1');

View File

@@ -419,9 +419,10 @@ class ImageController extends GetxController {
await uploadImage(
compressedImage,
{
'driverID':
encryptionHelper.decryptData(box.read(BoxName.driverID)) ??
encryptionHelper.decryptData(box.read(BoxName.passengerID)),
'driverID': EncryptionHelper.instance
.decryptData(box.read(BoxName.driverID)) ??
EncryptionHelper.instance
.decryptData(box.read(BoxName.passengerID)),
'imageType': imageType
},
link,
@@ -461,7 +462,7 @@ class ImageController extends GetxController {
stream,
length,
filename:
'${encryptionHelper.decryptData(box.read(BoxName.driverID))}.jpg',
'${EncryptionHelper.instance.decryptData(box.read(BoxName.driverID))}.jpg',
),
);
data.forEach((key, value) {

View File

@@ -31,7 +31,8 @@ class HelpController extends GetxController {
update();
var res = await CRUD().post(link: AppLink.addhelpCenter, payload: {
'driverID': box.read(BoxName.driverID).toString(),
'helpQuestion': encryptionHelper.encryptData(helpQuestionController.text)
'helpQuestion':
EncryptionHelper.instance.encryptData(helpQuestionController.text)
});
var d = jsonDecode(res);
isLoading = false;

View File

@@ -183,7 +183,7 @@ class MapDriverController extends GetxController {
await CRUD().post(
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
payload: {
"id": encryptionHelper
"id": EncryptionHelper.instance
.encryptData(rideId)
.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply'
@@ -193,24 +193,26 @@ class MapDriverController extends GetxController {
payload: {
'driver_id': box.read(BoxName.driverID).toString(),
// box.read(BoxName.driverID).toString(),
'order_id': encryptionHelper.encryptData(rideId).toString(),
'order_id':
EncryptionHelper.instance.encryptData(rideId).toString(),
'status': 'CancelFromDriverAfterApply'
});
await CRUD().post(
link:
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
payload: {
"order_id": encryptionHelper.encryptData(rideId).toString(),
"order_id":
EncryptionHelper.instance.encryptData(rideId).toString(),
"driver_id": box.read(BoxName.driverID).toString(),
"status": 'reject After Applied',
"notes": encryptionHelper
"notes": EncryptionHelper.instance
.encryptData(cancelTripCotroller.text)
.toString()
});
if (AppLink.endPoint != AppLink.seferCairoServer) {
CRUD()
.post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
"id": encryptionHelper
"id": EncryptionHelper.instance
.encryptData(rideId)
.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply'
@@ -220,24 +222,26 @@ class MapDriverController extends GetxController {
payload: {
'driver_id': box.read(BoxName.driverID).toString(),
// box.read(BoxName.driverID).toString(),
'order_id': encryptionHelper.encryptData(rideId).toString(),
'order_id':
EncryptionHelper.instance.encryptData(rideId).toString(),
'status': 'CancelFromDriverAfterApply'
});
CRUD().post(
link:
"${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
payload: {
"order_id": encryptionHelper.encryptData(rideId).toString(),
"order_id":
EncryptionHelper.instance.encryptData(rideId).toString(),
"driver_id": box.read(BoxName.driverID).toString(),
"status": 'reject After Applied',
"notes": encryptionHelper
"notes": EncryptionHelper.instance
.encryptData(cancelTripCotroller.text)
.toString()
});
}
sql.insertData({
'order_id': encryptionHelper.encryptData(rideId),
'order_id': EncryptionHelper.instance.encryptData(rideId),
'created_at': DateTime.now().toString(),
'driver_id': box.read(BoxName.driverID).toString(),
}, TableName.driverOrdersRefuse);
@@ -308,13 +312,13 @@ class MapDriverController extends GetxController {
await CRUD().post(
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
payload: {
'id': encryptionHelper.encryptData(rideId),
'id': EncryptionHelper.instance.encryptData(rideId),
'driverGoToPassengerTime': DateTime.now().toString(),
'status': 'Applied'
});
if (AppLink.endPoint != AppLink.seferCairoServer) {
CRUD().post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
'id': encryptionHelper.encryptData(rideId),
'id': EncryptionHelper.instance.encryptData(rideId),
'driverGoToPassengerTime': DateTime.now().toString(),
'status': 'Applied'
});
@@ -529,35 +533,35 @@ class MapDriverController extends GetxController {
: (distanceBetweenDriverAndPassengerWhenConfirm * .06) +
(5 * .06); //for Eygpt other like jordan .06 per minute
await CRUD().post(link: AppLink.updateRides, payload: {
'id': encryptionHelper.encryptData(rideId),
'id': EncryptionHelper.instance.encryptData(rideId),
'rideTimeStart': DateTime.now().toString(),
'status': 'CancelAfterWait',
});
CRUD().post(link: AppLink.addDriverOrder, payload: {
'driver_id': box.read(BoxName.driverID).toString(),
'order_id': encryptionHelper.encryptData(rideId).toString(),
'order_id': EncryptionHelper.instance.encryptData(rideId).toString(),
'status': 'CancelAfterWait'
});
if (AppLink.endPoint != AppLink.seferCairoServer) {
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
'id': encryptionHelper.encryptData(rideId),
'id': EncryptionHelper.instance.encryptData(rideId),
'rideTimeStart': DateTime.now().toString(),
'status': 'CancelAfterWait',
});
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
'driver_id': box.read(BoxName.driverID).toString(),
'order_id': encryptionHelper.encryptData(rideId).toString(),
'order_id': EncryptionHelper.instance.encryptData(rideId).toString(),
'status': 'CancelAfterWait'
});
}
var paymentTokenWait =
await generateTokenDriver(costOfWaiting5Minute.toString());
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': encryptionHelper.encryptData(rideId),
'rideId': EncryptionHelper.instance.encryptData(rideId),
'amount': (costOfWaiting5Minute.toString()),
'payment_method': 'wait-cancel',
'passengerID': encryptionHelper.encryptData(passengerId),
'passengerID': EncryptionHelper.instance.encryptData(passengerId),
'token': paymentTokenWait,
'driverID': box.read(BoxName.driverID).toString(),
});
@@ -565,7 +569,7 @@ class MapDriverController extends GetxController {
await generateTokenDriver(costOfWaiting5Minute.toString());
var res1 =
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'paymentID': 'rideId${encryptionHelper.encryptData(rideId)}',
'paymentID': 'rideId${EncryptionHelper.instance.encryptData(rideId)}',
'amount': (costOfWaiting5Minute).toStringAsFixed(0),
'paymentMethod': 'wait',
'token': paymentTokenWait1,
@@ -581,7 +585,7 @@ class MapDriverController extends GetxController {
var paymentTokenWaitPassenger1 =
await generateTokenPassenger((costOfWaiting5Minute * -1).toString());
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
'passenger_id': encryptionHelper.encryptData(passengerId),
'passenger_id': EncryptionHelper.instance.encryptData(passengerId),
'balance': (costOfWaiting5Minute * -1).toString(),
'token': paymentTokenWaitPassenger1,
});
@@ -667,13 +671,13 @@ class MapDriverController extends GetxController {
// Prepare data for API calls
final nowString = DateTime.now().toString();
final basePayload = {
'id': encryptionHelper.encryptData(rideId),
'id': EncryptionHelper.instance.encryptData(rideId),
'rideTimeFinish': nowString,
'status': 'Finished',
'price': totalCost,
};
final driverOrderPayload = {
'order_id': encryptionHelper.encryptData(rideId.toString()),
'order_id': EncryptionHelper.instance.encryptData(rideId.toString()),
'status': 'Finished'
};
@@ -706,7 +710,7 @@ class MapDriverController extends GetxController {
paymentToken = await generateTokenPassenger(
((-1) * double.parse(paymentAmount)).toString());
futures.add(CRUD().post(link: AppLink.addPassengersWallet, payload: {
'passenger_id': encryptionHelper.encryptData(passengerId),
'passenger_id': EncryptionHelper.instance.encryptData(passengerId),
'balance': ((-1) * double.parse(paymentAmount)).toString(),
'token': paymentToken,
}));
@@ -714,11 +718,11 @@ class MapDriverController extends GetxController {
paymentToken = await generateTokenDriver(paymentAmount.toString());
futures.add(CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': encryptionHelper.encryptData(rideId),
'rideId': EncryptionHelper.instance.encryptData(rideId),
'amount': paymentAmount,
'payment_method':
walletChecked == 'true' ? "${paymentMethod}Ride" : paymentMethod,
'passengerID': encryptionHelper.encryptData(passengerId),
'passengerID': EncryptionHelper.instance.encryptData(passengerId),
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
}));
@@ -727,7 +731,7 @@ class MapDriverController extends GetxController {
final paymentToken1 = await generateTokenPassenger(
((-1) * double.parse(passengerWalletBurc)).toString());
futures.add(CRUD().post(link: AppLink.addPassengersWallet, payload: {
'passenger_id': encryptionHelper.encryptData(passengerId),
'passenger_id': EncryptionHelper.instance.encryptData(passengerId),
'token': paymentToken1,
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
}));
@@ -737,7 +741,7 @@ class MapDriverController extends GetxController {
final paymentToken2 =
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
futures.add(CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'paymentID': 'rideId${encryptionHelper.encryptData(rideId)}',
'paymentID': 'rideId${EncryptionHelper.instance.encryptData(rideId)}',
'amount': (pointsSubtraction).toStringAsFixed(0),
'paymentMethod': paymentMethod,
'token': paymentToken2,
@@ -894,7 +898,7 @@ class MapDriverController extends GetxController {
var res = await CRUD().get(
link: "${AppLink.endPoint}/ride/driver_order/getOrderCancelStatus.php",
payload: {
'order_id': encryptionHelper.encryptData(rideId),
'order_id': EncryptionHelper.instance.encryptData(rideId),
}); //.then((value) {
var response = jsonDecode(res);
canelString = response['data']['status'];

View File

@@ -65,6 +65,12 @@ class MyTranslation extends Translations {
"Order Applied": "تم تطبيق الطلب",
//firebase above
'please order now': " ‏الرجاء الطلب مرة أخرى",
'Session expired. Please log in again.':
'انتهت الجلسة. يرجى تسجيل الدخول مرة أخرى.',
"Security Warning": "⚠️ تحذير أمني",
"Potential security risks detected. The application may not function correctly.":
"تم اكتشاف ثغرات أمنية على هذا الجهاز. للحفاظ على أمان بياناتك، سيتم حذف جميع البيانات وإغلاق التطبيق.",
"I will go now": "هروح دلوقتي",
"Yes": "أيوة",

View File

@@ -156,9 +156,12 @@ class PaymentController extends GetxController {
paymentIntentClientSecret: clientSecret,
merchantDisplayName: AppInformation.appName,
billingDetails: BillingDetails(
name: encryptionHelper.decryptData(box.read(BoxName.nameDriver)),
email: encryptionHelper.decryptData(box.read(BoxName.emailDriver)),
phone: encryptionHelper.decryptData(box.read(BoxName.phoneDriver)),
name: EncryptionHelper.instance
.decryptData(box.read(BoxName.nameDriver)),
email: EncryptionHelper.instance
.decryptData(box.read(BoxName.emailDriver)),
phone: EncryptionHelper.instance
.decryptData(box.read(BoxName.phoneDriver)),
address: Address(
city: 'city',
country: box.read(BoxName.countryCode), //'United States'

View File

@@ -134,12 +134,13 @@ class PaymobManager extends GetxController {
"currency": currency,
"billing_data": {
"first_name":
encryptionHelper.decryptData(box.read(BoxName.nameDriver)),
"last_name":
encryptionHelper.decryptData(box.read(BoxName.lastNameDriver)),
"email": encryptionHelper.decryptData(box.read(BoxName.emailDriver)),
"phone_number":
encryptionHelper.decryptData(box.read(BoxName.phoneDriver)),
EncryptionHelper.instance.decryptData(box.read(BoxName.nameDriver)),
"last_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.lastNameDriver)),
"email": EncryptionHelper.instance
.decryptData(box.read(BoxName.emailDriver)),
"phone_number": EncryptionHelper.instance
.decryptData(box.read(BoxName.phoneDriver)),
"apartment": "NA",
"floor": "NA",
"street": "NA",

View File

@@ -224,11 +224,12 @@ class PaymobBillingData {
Map<String, dynamic> toJson() {
return {
"email": encryptionHelper.decryptData(box.read(BoxName.emailDriver)),
"email":
EncryptionHelper.instance.decryptData(box.read(BoxName.emailDriver)),
"first_name": box.read(BoxName.nameDriver),
"last_name": box.read(BoxName.nameDriver),
"phone_number":
encryptionHelper.decryptData(box.read(BoxName.phoneDriver)),
EncryptionHelper.instance.decryptData(box.read(BoxName.phoneDriver)),
"apartment": apartment ?? "NA",
"floor": floor ?? "NA",
"building": building ?? "NA",

View File

@@ -267,7 +267,8 @@ class PaymobBillingDataWallet {
Map<String, dynamic> toJson() {
return {
"email": encryptionHelper.decryptData(box.read(BoxName.emailDriver)),
"email":
EncryptionHelper.instance.decryptData(box.read(BoxName.emailDriver)),
"first_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver),
"last_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver),
"phone_number": (box.read(BoxName.phoneWallet)),

View File

@@ -42,10 +42,10 @@ class RatingController extends GetxController {
"name": box.read(BoxName.driverID) != null
? box.read(BoxName.nameDriver)
: box.read(BoxName.name),
"email": encryptionHelper
"email": EncryptionHelper.instance
.decryptData(box.read(BoxName.emailDriver))
.toString(),
"phone": encryptionHelper
"phone": EncryptionHelper.instance
.decryptData(box.read(BoxName.phoneDriver))
.toString(),
"userId": box.read(BoxName.driverID),

View File

@@ -22,6 +22,7 @@ import 'constant/info.dart';
import 'constant/notification.dart';
import 'controller/firebase/firbase_messge.dart';
import 'controller/firebase/local_notification.dart';
import 'controller/functions/encrypt_decrypt.dart';
import 'controller/functions/location_controller.dart';
import 'controller/functions/secure_storage.dart';
import 'controller/home/payment/captain_wallet_controller.dart';
@@ -124,9 +125,15 @@ void main() async {
await WakelockPlus.enable();
await GetStorage.init();
Stripe.publishableKey = AK.publishableKeyStripe;
final AppInitializer initializer = AppInitializer();
await initializer.initializeApp();
await Future.delayed(Duration.zero);
await EncryptionHelper.initialize();
Stripe.publishableKey = AK.publishableKeyStripe;
PermissionStatus status1 = await Permission.location.status;
if (status1.isGranted) {
await LocationController().startLocationUpdates();
@@ -141,11 +148,6 @@ void main() async {
await FirebaseMessagesController().requestFirebaseMessagingPermission();
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
// NotificationController1().initNotifications();
// NotificationController().initNotifications();
// if (Platform.isAndroid) {
// await Get.put(NotificationController()).initNotifications();
// }
await notificationController.initNotifications();
@@ -171,17 +173,19 @@ void main() async {
]);
}
String? key = (await storage.read(key: BoxName.payMobApikey));
String? apiKey = EncryptionHelper.instance.decryptData(key!);
PaymobPayment.instance.initialize(
apiKey: AK.payMobApikey,
// integrationID: 4556055,
apiKey: apiKey,
integrationID: int.parse(AK.integrationIdPayMob),
userTokenExpiration: 200,
iFrameID: 837992,
);
PaymobPaymentWallet.instance.initialize(
apiKey: AK.payMobApikey,
apiKey: apiKey,
integrationID: int.parse(AK.integrationIdPayMobWallet),
// integrationID: 4556056,
userTokenExpiration: 200,
iFrameID: 837992,
);

View File

@@ -95,17 +95,17 @@ class AiPage extends StatelessWidget {
Row(
children: [
Text(
'${'Name'.tr} :${encryptionHelper.decryptData(contentController.responseMap['first_name'])}',
'${'Name'.tr} :${EncryptionHelper.instance.decryptData(contentController.responseMap['first_name'])}',
style: AppStyle.subtitle,
),
Text(
' ${encryptionHelper.decryptData(contentController.responseMap['last_name'])}',
' ${EncryptionHelper.instance.decryptData(contentController.responseMap['last_name'])}',
style: AppStyle.subtitle,
),
],
),
Text(
'${'Name in arabic'.tr}: ${encryptionHelper.decryptData(contentController.responseMap['name_in_arabic'])}',
'${'Name in arabic'.tr}: ${EncryptionHelper.instance.decryptData(contentController.responseMap['name_in_arabic'])}',
style: AppStyle.title,
),
Text(
@@ -121,7 +121,7 @@ class AiPage extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
'${'National Number'.tr}: ${encryptionHelper.decryptData(contentController.responseMap['id'])}',
'${'National Number'.tr}: ${EncryptionHelper.instance.decryptData(contentController.responseMap['id'])}',
style: AppStyle.title,
),
// Image.memory(
@@ -131,7 +131,7 @@ class AiPage extends StatelessWidget {
// ),
]),
Text(
'${'Address'.tr}: ${encryptionHelper.decryptData(contentController.responseMap['address'])}',
'${'Address'.tr}: ${EncryptionHelper.instance.decryptData(contentController.responseMap['address'])}',
style: AppStyle.title,
),
Row(

View File

@@ -322,7 +322,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[0]['prompt'].toString()),
AppLink.uploadEgypt,
'driver_license'); //egypt
@@ -335,32 +335,32 @@ class EgyptCardAI extends StatelessWidget {
const Divider(color: AppColor.accentColor),
const SizedBox(height: 8.0),
Text(
'${'License Type'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptDriverLicense['license_type'])}',
'${'License Type'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptDriverLicense['license_type'])}',
style: AppStyle.title,
),
const SizedBox(height: 8.0),
Text(
'${'National Number'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptDriverLicense['national_number'])}',
'${'National Number'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptDriverLicense['national_number'])}',
style: AppStyle.title.copyWith(
color: encryptionHelper.decryptData(
color: EncryptionHelper.instance.decryptData(
ai.responseIdEgyptDriverLicense[
'national_number']) ==
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.responseIdEgyptBack['nationalID'])
? AppColor.greenColor
: AppColor.redColor),
),
const SizedBox(height: 8.0),
Text(
'${'Name (Arabic)'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptDriverLicense['name_arabic'])}',
'${'Name (Arabic)'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptDriverLicense['name_arabic'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Name (English)'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptDriverLicense['name_english'])}',
'${'Name (English)'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptDriverLicense['name_english'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Address'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptDriverLicense['address'])}',
'${'Address'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptDriverLicense['address'])}',
),
const SizedBox(height: 8.0),
Text(
@@ -387,7 +387,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[0]['prompt'].toString()),
AppLink.uploadEgypt,
'driver_license'); //egypt
@@ -443,7 +443,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[1]['prompt'].toString()),
AppLink.uploadEgypt,
'id_back'); //egypt
@@ -457,12 +457,12 @@ class EgyptCardAI extends StatelessWidget {
const SizedBox(height: 8.0),
// Assuming these keys exist in ai.responseIdEgyptFront
Text(
'${'National ID'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptBack['nationalID'])}',
'${'National ID'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptBack['nationalID'])}',
style: AppStyle.title.copyWith(
color: encryptionHelper.decryptData(
color: EncryptionHelper.instance.decryptData(
ai.responseIdEgyptDriverLicense[
'national_number']) ==
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.responseIdEgyptBack['nationalID'])
? AppColor.greenColor
: AppColor.redColor),
@@ -470,7 +470,7 @@ class EgyptCardAI extends StatelessWidget {
const SizedBox(height: 8.0),
Text(
'${'Occupation'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptBack['occupation'])}', // Assuming 'occupation' exists
'${'Occupation'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptBack['occupation'])}', // Assuming 'occupation' exists
),
const SizedBox(height: 8.0),
Row(
@@ -480,7 +480,7 @@ class EgyptCardAI extends StatelessWidget {
'${'Issue Date'.tr}: ${ai.responseIdEgyptBack['issueDate']}', // Assuming 'issueDate' exists
),
Text(
'${'Gender'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptBack['gender'])}', // Assuming 'gender' exists
'${'Gender'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptBack['gender'])}', // Assuming 'gender' exists
),
],
),
@@ -517,7 +517,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[1]['prompt'].toString()),
AppLink.uploadEgypt,
'id_back'); //egypt
@@ -571,7 +571,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[7]['prompt'].toString()),
AppLink.uploadEgypt,
'non_id_back');
@@ -584,16 +584,16 @@ class EgyptCardAI extends StatelessWidget {
const Divider(color: AppColor.accentColor),
const SizedBox(height: 8.0),
Text(
'${'Country'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardBack['country'])}',
'${'Country'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardBack['country'])}',
style: AppStyle.title,
),
const SizedBox(height: 8.0),
Text(
'${'Residency Type'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardBack['residencyType'])}',
'${'Residency Type'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardBack['residencyType'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Work Status'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardBack['workStatus'])}',
'${'Work Status'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardBack['workStatus'])}',
),
const SizedBox(height: 8.0),
Row(
@@ -603,7 +603,7 @@ class EgyptCardAI extends StatelessWidget {
'${'Issue Date'.tr}: ${ai.responseNonIdCardBack['issueDate']}',
),
Text(
'${'Birth Date'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardBack['birthDate'])}',
'${'Birth Date'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardBack['birthDate'])}',
),
],
),
@@ -624,7 +624,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[7]['prompt'].toString()),
AppLink.uploadEgypt,
'non_id_back');
@@ -670,7 +670,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[2]['id_front'].toString()),
AppLink.uploadEgypt,
'id_front'); //egypt
@@ -688,10 +688,10 @@ class EgyptCardAI extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${'First Name'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptFront['first_name'])}',
'${'First Name'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptFront['first_name'])}',
),
Text(
'${'CardID'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptFront['card_id'])}',
'${'CardID'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptFront['card_id'])}',
),
],
),
@@ -700,16 +700,16 @@ class EgyptCardAI extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${'Full Name'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptFront['full_name'])}',
'${'Full Name'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptFront['full_name'])}',
),
Text(
'${'DOB'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptFront['dob'])}',
'${'DOB'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptFront['dob'])}',
),
],
),
const SizedBox(height: 8.0),
Text(
'${'Address'.tr}: ${encryptionHelper.decryptData(ai.responseIdEgyptFront['address'])}',
'${'Address'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdEgyptFront['address'])}',
),
const SizedBox(height: 8.0),
// Text(
@@ -727,7 +727,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[2]['prompt'].toString()),
AppLink.uploadEgypt,
'id_front'); //egypt
@@ -773,7 +773,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[6]['prompt'].toString()),
AppLink.uploadEgypt,
'non_id_front');
@@ -786,7 +786,7 @@ class EgyptCardAI extends StatelessWidget {
const Divider(color: AppColor.accentColor),
const SizedBox(height: 8.0),
Text(
'${'Full Name'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['full_name'])}',
'${'Full Name'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['full_name'])}',
style: AppStyle.title,
),
const SizedBox(height: 8.0),
@@ -794,10 +794,10 @@ class EgyptCardAI extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${'Passport No'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['passport_no'])}',
'${'Passport No'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['passport_no'])}',
),
Text(
'${'Card ID'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['card_id'])}',
'${'Card ID'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['card_id'])}',
),
],
),
@@ -806,20 +806,20 @@ class EgyptCardAI extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${'Country'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['country'])}',
'${'Country'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['country'])}',
),
Text(
'${'Gender'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['gender'])}',
'${'Gender'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['gender'])}',
),
],
),
const SizedBox(height: 8.0),
Text(
'${'Birth Date'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['birthdate'])}',
'${'Birth Date'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['birthdate'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Address'.tr}: ${encryptionHelper.decryptData(ai.responseNonIdCardFront['address'])}',
'${'Address'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseNonIdCardFront['address'])}',
),
],
),
@@ -830,7 +830,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[6]['prompt'].toString()),
AppLink.uploadEgypt,
'non_id_front');
@@ -884,7 +884,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[3]['prompt'].toString()),
AppLink.uploadEgypt,
'car_front');
@@ -899,15 +899,15 @@ class EgyptCardAI extends StatelessWidget {
// Removed Make, Model, etc. as they are not available
Text(
'${'Plate Number'.tr}: ${encryptionHelper.decryptData(ai.responseIdCardDriverEgyptFront['car_plate'])}',
'${'Plate Number'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdCardDriverEgyptFront['car_plate'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Owner Name'.tr}: ${encryptionHelper.decryptData(ai.responseIdCardDriverEgyptFront['owner'])}',
'${'Owner Name'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdCardDriverEgyptFront['owner'])}',
),
const SizedBox(height: 8.0),
Text(
'${'Address'.tr}: ${encryptionHelper.decryptData(ai.responseIdCardDriverEgyptFront['address'])}',
'${'Address'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseIdCardDriverEgyptFront['address'])}',
),
const SizedBox(height: 8.0),
Row(
@@ -932,7 +932,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[3]['prompt'].toString()),
AppLink.uploadEgypt,
'car_front');
@@ -1003,7 +1003,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[4]['prompt'].toString()),
AppLink.uploadEgypt,
'car_back');
@@ -1077,7 +1077,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[4]['prompt'].toString()),
AppLink.uploadEgypt,
'car_back');
@@ -1123,7 +1123,7 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[5]['prompt'].toString()),
AppLink.uploadEgypt,
'criminalRecord',
@@ -1140,11 +1140,11 @@ class EgyptCardAI extends StatelessWidget {
'${'InspectionResult'.tr}: ${ai.responseCriminalRecordEgypt['InspectionResult']}'),
const SizedBox(height: 8.0),
Text(
'${'FullName'.tr}: ${encryptionHelper.decryptData(ai.responseCriminalRecordEgypt['FullName'])}',
'${'FullName'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseCriminalRecordEgypt['FullName'])}',
style: AppStyle.title.copyWith(
color: encryptionHelper.decryptData(ai
color: EncryptionHelper.instance.decryptData(ai
.responseCriminalRecordEgypt['FullName']) ==
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.responseIdEgyptDriverLicense[
'name_arabic'])
? AppColor.greenColor
@@ -1152,7 +1152,7 @@ class EgyptCardAI extends StatelessWidget {
),
const SizedBox(height: 8.0),
Text(
'${'NationalID'.tr}: ${encryptionHelper.decryptData(ai.responseCriminalRecordEgypt['NationalID'])}'),
'${'NationalID'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseCriminalRecordEgypt['NationalID'])}'),
const SizedBox(height: 8.0),
Text(
'${'IssueDate'.tr}: ${ai.responseCriminalRecordEgypt['IssueDate']}'),
@@ -1165,7 +1165,7 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[5]['prompt'].toString()),
AppLink.uploadEgypt,
'criminalRecord',

View File

@@ -21,9 +21,9 @@ class ContactUsPage extends StatelessWidget {
body: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: AppStyle.boxDecoration1,
@@ -35,7 +35,7 @@ class ContactUsPage extends StatelessWidget {
IconButton(
onPressed: () async {
Get.put(TextToSpeechController()).speakText(
'Swifti is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
'Tripz is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
.tr);
},
icon: const Icon(Icons.headphones),
@@ -43,7 +43,7 @@ class ContactUsPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Swifti is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
'Tripz is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
.tr,
style: AppStyle.title,
textAlign: TextAlign.center,

View File

@@ -36,7 +36,7 @@ class CriminalDocumemtPage extends StatelessWidget {
? MyElevatedButton(
title: 'Next'.tr,
onPressed: () async {
if (encryptionHelper.decryptData(controller
if (EncryptionHelper.instance.decryptData(controller
.responseCriminalRecordEgypt['FullName']) !=
box.read(BoxName.nameArabic)) //todo get from server
{
@@ -141,14 +141,14 @@ Please fill in the JSON object with the extracted information, following these g
const Divider(color: AppColor.accentColor),
const SizedBox(height: 8.0),
Text(
'${'InspectionResult'.tr}: ${encryptionHelper.decryptData(ai.responseCriminalRecordEgypt['InspectionResult'])}'),
'${'InspectionResult'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseCriminalRecordEgypt['InspectionResult'])}'),
const SizedBox(height: 8.0),
Text(
'${'FullName'.tr}: ${encryptionHelper.decryptData(ai.responseCriminalRecordEgypt['FullName'])}',
'${'FullName'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseCriminalRecordEgypt['FullName'])}',
style: AppStyle.title.copyWith(
color: encryptionHelper.decryptData(ai
color: EncryptionHelper.instance.decryptData(ai
.responseCriminalRecordEgypt['FullName']) ==
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.responseIdEgyptDriverLicense[
'name_arabic'])
? AppColor.greenColor
@@ -156,7 +156,7 @@ Please fill in the JSON object with the extracted information, following these g
),
const SizedBox(height: 8.0),
Text(
'${'NationalID'.tr}: ${encryptionHelper.decryptData(ai.responseCriminalRecordEgypt['NationalID'])}'),
'${'NationalID'.tr}: ${EncryptionHelper.instance.decryptData(ai.responseCriminalRecordEgypt['NationalID'])}'),
const SizedBox(height: 8.0),
Text(
'${'IssueDate'.tr}: ${ai.responseCriminalRecordEgypt['IssueDate']}'),

View File

@@ -390,7 +390,7 @@ class InviteScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
controller.driverInvitationData[index]['invitorName']),
style: const TextStyle(
fontSize: 17,
@@ -447,7 +447,7 @@ class InviteScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
encryptionHelper
EncryptionHelper.instance
.decryptData(invitation['passengerName'])
.toString(), // Handle null or missing data
style: const TextStyle(
@@ -510,7 +510,7 @@ class InviteScreen extends StatelessWidget {
_buildStatItem(
context,
"Active Users".tr,
encryptionHelper
EncryptionHelper.instance
.decryptData(controller.driverInvitationDataToPassengers[0]
['passengerName'])
.toString(),

View File

@@ -327,8 +327,9 @@ class LoginCaptin extends StatelessWidget {
if (user != null) {
box.write(
BoxName.emailDriver,
encryptionHelper.encryptData(
user.email.toString()));
EncryptionHelper.instance
.encryptData(
user.email.toString()));
box.write(
BoxName.driverID, user.uid);
@@ -386,6 +387,19 @@ class LoginCaptin extends StatelessWidget {
style: AppStyle.subtitle,
),
),
// GestureDetector(
// onTap: () async {
// await storage.deleteAll();
// box.erase();
// },
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(
// 'erase'.tr, // Improved wording
// style: AppStyle.subtitle,
// ),
// ),
// ),
],
),
)

View File

@@ -80,7 +80,7 @@ class HistoryCaptain extends StatelessWidget {
.navTitleTextStyle,
),
Text(
encryptionHelper
EncryptionHelper.instance
.decryptData(list['order_id']),
style: CupertinoTheme.of(context)
.textTheme
@@ -108,8 +108,9 @@ class HistoryCaptain extends StatelessWidget {
),
Text(
list['status'],
style: encryptionHelper.decryptData(
list['status']) ==
style: EncryptionHelper.instance
.decryptData(
list['status']) ==
'Apply'
? CupertinoTheme.of(context)
.textTheme
@@ -117,7 +118,7 @@ class HistoryCaptain extends StatelessWidget {
.copyWith(
color: CupertinoColors
.systemGreen)
: encryptionHelper.decryptData(
: EncryptionHelper.instance.decryptData(
list['status']) ==
'Refused'
? CupertinoTheme.of(context)

View File

@@ -46,7 +46,7 @@ class HistoryDetailsPage extends StatelessWidget {
CupertinoButton(
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${encryptionHelper.decryptData(res['start_location'])}/${encryptionHelper.decryptData(res['end_location'])}/';
'https://www.google.com/maps/dir/${EncryptionHelper.instance.decryptData(res['start_location'])}/${EncryptionHelper.instance.decryptData(res['end_location'])}/';
showInBrowser(mapUrl);
},
child: Container(
@@ -79,24 +79,28 @@ class HistoryDetailsPage extends StatelessWidget {
polylineId: const PolylineId('route'),
points: [
LatLng(
double.parse(encryptionHelper
double.parse(EncryptionHelper
.instance
.decryptData(
res['start_location'])
.toString()
.split(',')[0]),
double.parse(encryptionHelper
double.parse(EncryptionHelper
.instance
.decryptData(
res['start_location'])
.toString()
.split(',')[1]),
),
LatLng(
double.parse(encryptionHelper
double.parse(EncryptionHelper
.instance
.decryptData(
res['end_location'])
.toString()
.split(',')[0]),
double.parse(encryptionHelper
double.parse(EncryptionHelper
.instance
.decryptData(
res['end_location'])
.toString()
@@ -115,7 +119,7 @@ class HistoryDetailsPage extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
'${'Order ID'.tr} ${encryptionHelper.decryptData(res['id'])}',
'${'Order ID'.tr} ${EncryptionHelper.instance.decryptData(res['id'])}',
style: CupertinoTheme.of(context)
.textTheme
.navActionTextStyle,
@@ -145,13 +149,13 @@ class HistoryDetailsPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${'Price is'.tr} ${encryptionHelper.decryptData(res['price_for_driver'])}',
'${'Price is'.tr} ${EncryptionHelper.instance.decryptData(res['price_for_driver'])}',
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
),
Text(
'${'Distance is'.tr} ${encryptionHelper.decryptData(res['distance'])} KM',
'${'Distance is'.tr} ${EncryptionHelper.instance.decryptData(res['distance'])} KM',
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
@@ -210,7 +214,7 @@ class HistoryDetailsPage extends StatelessWidget {
),
child: Center(
child: Text(
'${'Passenger Name is'.tr} ${encryptionHelper.decryptData(res['first_name'])} ${encryptionHelper.decryptData(res['last_name'])}',
'${'Passenger Name is'.tr} ${EncryptionHelper.instance.decryptData(res['first_name'])} ${EncryptionHelper.instance.decryptData(res['last_name'])}',
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
@@ -229,7 +233,7 @@ class HistoryDetailsPage extends StatelessWidget {
),
child: Center(
child: Text(
'${'Status is'.tr} ${encryptionHelper.decryptData(res['status'])}',
'${'Status is'.tr} ${EncryptionHelper.instance.decryptData(res['status'])}',
style: CupertinoTheme.of(context)
.textTheme
.textStyle,

View File

@@ -536,7 +536,7 @@ class UserAccountHeader extends StatelessWidget {
),
const SizedBox(height: 4),
Text(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
box.read(BoxName.emailDriver),
),
style: TextStyle(

View File

@@ -125,7 +125,7 @@ class HelpCaptain extends StatelessWidget {
.helpQuestionDate['message'][index];
return CupertinoListTile(
title: Text(
encryptionHelper
EncryptionHelper.instance
.decryptData(list['helpQuestion']),
overflow: TextOverflow.ellipsis,
),
@@ -143,9 +143,9 @@ class HelpCaptain extends StatelessWidget {
),
onTap: () {
helpController.getIndex(
int.parse(encryptionHelper
int.parse(EncryptionHelper.instance
.decryptData(list['id'])),
encryptionHelper
EncryptionHelper.instance
.decryptData(list['helpQuestion']));
helpController
.getHelpRepley(list['id'].toString());

View File

@@ -54,7 +54,7 @@ class HelpDetailsReplayPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: helpController.status ==
'not yet' ||
encryptionHelper
EncryptionHelper.instance
.decryptData(helpController
.helpQuestionRepleyDate[
'message']['replay'])
@@ -65,7 +65,7 @@ class HelpDetailsReplayPage extends StatelessWidget {
style: AppStyle.title,
)
: Text(
encryptionHelper
EncryptionHelper.instance
.decryptData(helpController
.helpQuestionRepleyDate[
'message']['replay'])

View File

@@ -106,7 +106,8 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// child: Builder(builder: (context) {
// return IconButton(
// onPressed: () async {
// Get.to(SmsSignupEgypt());
// await storage.deleteAll();
// box.erase();
// },
// icon: const Icon(
// FontAwesome5.grin_tears,

View File

@@ -376,7 +376,7 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
'notification.wav');
controller.refuseOrder(
encryptionHelper.encryptData(
EncryptionHelper.instance.encryptData(
controller.myList[16].toString()),
);
controller.addRideToNotificationDriverString(

View File

@@ -74,8 +74,9 @@ class CaptainsCars extends StatelessWidget {
padding: const EdgeInsets.symmetric(
horizontal: 4),
child: Text(
encryptionHelper.decryptData(
car['car_plate']),
EncryptionHelper.instance
.decryptData(
car['car_plate']),
style: AppStyle.title,
),
),

View File

@@ -95,7 +95,7 @@ GetBuilder<AI> egyptCarLicenceFront() {
IconButton(
onPressed: () async {
ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[3]['prompt'].toString()),
AppLink.uploadEgypt,
'car_front');
@@ -143,7 +143,7 @@ GetBuilder<AI> egyptCarLicenceFront() {
child: InkWell(
onTap: () async {
ai.allMethodForAINewCar(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[3]['prompt'].toString()),
AppLink.uploadEgypt1,
'car_front',
@@ -214,7 +214,7 @@ GetBuilder<AI> egyptCarLicenceBack() {
IconButton(
onPressed: () async {
ai.allMethodForAI(
encryptionHelper.decryptData(
EncryptionHelper.instance.decryptData(
ai.prompts[4]['prompt'].toString()),
AppLink.uploadEgypt,
'car_back');
@@ -287,7 +287,7 @@ GetBuilder<AI> egyptCarLicenceBack() {
child: InkWell(
onTap: () async {
ai.allMethodForAI(
encryptionHelper
EncryptionHelper.instance
.decryptData(ai.prompts[4]['prompt'].toString()),
AppLink.uploadEgypt,
'car_back');

View File

@@ -73,34 +73,41 @@ class ProfileCaptain extends StatelessWidget {
driverId:
controller.captainProfileData['driverID'] ??
'',
name: encryptionHelper.decryptData((controller
.captainProfileData['first_name']) ??
'') +
name: EncryptionHelper.instance.decryptData(
(controller.captainProfileData[
'first_name']) ??
'') +
' ' +
encryptionHelper.decryptData((controller
.captainProfileData['last_name']) ??
''),
phoneNumber: encryptionHelper.decryptData(
controller.captainProfileData['phone']) ??
EncryptionHelper.instance.decryptData(
(controller.captainProfileData[
'last_name']) ??
''),
phoneNumber: EncryptionHelper.instance
.decryptData(controller
.captainProfileData['phone']) ??
'',
email: encryptionHelper.decryptData(
email: EncryptionHelper.instance.decryptData(
controller.captainProfileData['email']) ??
'',
birthdate: encryptionHelper.decryptData(controller
.captainProfileData['birthdate']) ??
birthdate: EncryptionHelper.instance.decryptData(
controller
.captainProfileData['birthdate']) ??
'',
gender: encryptionHelper.decryptData(controller
.captainProfileData['gender']) ??
gender: EncryptionHelper.instance.decryptData(
controller
.captainProfileData['gender']) ??
'',
education: encryptionHelper.decryptData(controller
.captainProfileData['education']) ??
education: EncryptionHelper.instance.decryptData(
controller
.captainProfileData['education']) ??
'',
carMake:
controller.captainProfileData['make'] ?? '',
carModel:
controller.captainProfileData['model'] ?? '',
carPlate: encryptionHelper.decryptData(controller
.captainProfileData['car_plate']) ??
carPlate: EncryptionHelper.instance.decryptData(
controller
.captainProfileData['car_plate']) ??
'',
carColor:
controller.captainProfileData['color'] ?? '',