diff --git a/.env b/.env
index b4f9388..858a0d1 100644
--- a/.env
+++ b/.env
@@ -44,16 +44,14 @@ anthropicAIkeySeferNew=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf
llama3Key=kzg_uTXy3e9DBbCQ1FnMGxYwTKysx9US1burxJj4fFwOje4LZBUFKJS1XrXlBl
payMobOutPassword='D2zJFxkE#LN3vz38z2dYxpNfWXrXlBl'
payMobOutUserName='zjujl_qvo_fwjfgjlXrXlBl'
-keyOfApp=nqryjp@1737wqnmqqsjyzjujljksvceiXrXlBl
-initializationVector=abcdefghijklmnop
+keyOfApp=nqryjjjhgjp@1bCQ1FnMGxYwsjyzjujljksvceiXrXlBl
+initializationVector=ujljkdelkjlXrXlBlfghijkl
sss_pass=wqnmqqsjyvwv:nqrYJP@17378XrXlBl
sss_encryptionSalt=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl
addd=BlBlNl
allowed=TripzDriver:
passnpassenger=hbgbitbXrXrBr
newId=new
-
-
a=q
b=x
c=f
diff --git a/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt b/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
index c726bc5..6eb4ba2 100644
--- a/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
@@ -55,7 +55,7 @@ class MainActivity : FlutterFragmentActivity() {
// Log.d("DEBUG", "isNotTrust: $isNotTrust")
// Log.d("DEBUG", "checkForIssues: $checkForIssues")
- if (isRooted || isTampered || !isRealDevice || isOnExternalStorage || isNotTrust) {
+ if (isRooted || isTampered || !isRealDevice) {
// Log.e("DEBUG", "Security issue detected! Showing dialog.")
showSecurityWarningDialog()
} else {
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index a5f250b..c4d7510 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -2,9 +2,12 @@ import UIKit
import Flutter
import FirebaseCore
import GoogleMaps
+import CoreLocation // ✅ استيراد CoreLocation لتحديث الموقع
@main
-@objc class AppDelegate: FlutterAppDelegate {
+@objc class AppDelegate: FlutterAppDelegate, CLLocationManagerDelegate {
+ var locationManager: CLLocationManager?
+
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
@@ -19,9 +22,28 @@ import GoogleMaps
}
}
+ // ✅ تفعيل تحديث الموقع فور تشغيل التطبيق
+// startLocationUpdates()
+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
+ func startLocationUpdates() {
+ locationManager = CLLocationManager()
+ locationManager?.delegate = self
+ locationManager?.desiredAccuracy = kCLLocationAccuracyBest
+ locationManager?.allowsBackgroundLocationUpdates = true
+ locationManager?.pausesLocationUpdatesAutomatically = false
+
+ locationManager?.requestAlwaysAuthorization() // ✅ طلب إذن الموقع
+ locationManager?.startUpdatingLocation() // ✅ بدء التحديث
+ }
+
+ func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
+ guard let location = locations.last else { return }
+ print("📍 Location updated: \(location.coordinate.latitude), \(location.coordinate.longitude)")
+ }
+
func showJailbreakAlert() {
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else { return }
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 711ea95..bdfc332 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -1,109 +1,110 @@
-
- LSMinimumSystemVersion
- 12.0
- UIBackgroundModes
-
- fetch
- location
- remote-notification
-
- BGTaskSchedulerPermittedIdentifiers
-
+
+
+ LSMinimumSystemVersion
+ 12.0
+ UIBackgroundModes
+
+ fetch
+ location
+ remote-notification
+
+ BGTaskSchedulerPermittedIdentifiers
+
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+
+ NSContactsUsageDescription
+ This app requires contacts access to function properly.
+ CADisableMinimumFrameDurationOnPhone
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleDisplayName
+ Tripz Driver
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleGetInfoString
+
+ CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
-
- NSContactsUsageDescription
- This app requires contacts access to function properly.
- CADisableMinimumFrameDurationOnPhone
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleDisplayName
- Tripz Driver
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleGetInfoString
-
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- Tripz Driver
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- 94
- CFBundleSignature
- ????
- CFBundleURLTypes
-
-
- CFBundleTypeRole
- Editor
- CFBundleURLSchemes
-
- com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto
-
-
-
- CFBundleVersion
- 5.0.94
- FirebaseAppDelegateProxyEnabled
- NO
- GMSApiKey
- YOUR_API_KEY
- LSApplicationCategoryType
-
- LSApplicationQueriesSchemes
-
- googlechromes
- comgooglemaps
-
- LSRequiresIPhoneOS
-
- NSCameraUsageDescription
- This app requires access to your camera in order to scan QR codes and capture images
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ Tripz Driver
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 94
+ CFBundleSignature
+ ????
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Editor
+ CFBundleURLSchemes
+
+ com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto
+
+
+
+ CFBundleVersion
+ 5.0.94
+ FirebaseAppDelegateProxyEnabled
+ NO
+ GMSApiKey
+ YOUR_API_KEY
+ LSApplicationCategoryType
+
+ LSApplicationQueriesSchemes
+
+ googlechromes
+ comgooglemaps
+
+ LSRequiresIPhoneOS
+
+ NSCameraUsageDescription
+ This app requires access to your camera in order to scan QR codes and capture images
for uploading and access to connect to a call.
- NSFaceIDUsageDescription
- Use Face ID to securely authenticate payment accounts.
- NSLocationAlwaysAndWhenInUseUsageDescription
- This app needs access to your location to provide you with the best ride experience.
+ NSFaceIDUsageDescription
+ Use Face ID to securely authenticate payment accounts.
+ NSLocationAlwaysAndWhenInUseUsageDescription
+ This app needs access to your location to provide you with the best ride experience.
Your location data will be used to find the nearest available cars and connect you with
the closest captain for efficient and convenient rides.
- NSLocationAlwaysUsageDescription
- This app needs access to location.
- NSLocationWhenInUseUsageDescription
- This app needs access to your location to provide you with the best ride experience.
+ NSLocationAlwaysUsageDescription
+ This app needs access to location.
+ NSLocationWhenInUseUsageDescription
+ This app needs access to your location to provide you with the best ride experience.
Your location data will be used to find the nearest available cars and connect you with
the closest captain for efficient and convenient rides.
- NSMicrophoneUsageDescription
- This app requires access to your microphone to record audio, allowing you to add
+ NSMicrophoneUsageDescription
+ This app requires access to your microphone to record audio, allowing you to add
voice recordings to your photos and videos and access to connect to a call.
- NSPhotoLibraryUsageDescription
- Explanation of why your app needs access to the photo library.
- UIApplicationSupportsIndirectInputEvents
-
- UILaunchStoryboardName
- LaunchScreen
- UIMainStoryboardFile
- Main
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UIViewControllerBasedStatusBarAppearance
-
-
-
+ NSPhotoLibraryUsageDescription
+ Explanation of why your app needs access to the photo library.
+ UIApplicationSupportsIndirectInputEvents
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+
+
\ No newline at end of file
diff --git a/lib/controller/auth/captin/login_captin_controller.dart b/lib/controller/auth/captin/login_captin_controller.dart
index 18ebfa3..a9722ea 100644
--- a/lib/controller/auth/captin/login_captin_controller.dart
+++ b/lib/controller/auth/captin/login_captin_controller.dart
@@ -1,5 +1,7 @@
import 'dart:convert';
import 'dart:io';
+import 'package:crypto/crypto.dart';
+
import 'dart:math';
import 'package:http/http.dart' as http;
import 'package:secure_string_operations/secure_string_operations.dart';
@@ -109,14 +111,21 @@ class LoginDriverController extends GetxController {
return jsonDecode(response1.body)['jwt'].toString();
}
+ String shortHash(String password) {
+ var bytes = utf8.encode(password);
+ var digest = sha256.convert(bytes);
+ return base64UrlEncode(digest.bytes);
+ }
+
getJWT() async {
- // await SecurityHelper.performSecurityChecks();
dev = Platform.isAndroid ? 'android' : 'ios';
+ Log.print(
+ 'box.read(BoxName.firstTimeLoadKey): ${box.read(BoxName.firstTimeLoadKey)}');
if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
var response0 = await http.post(
Uri.parse(AppLink.loginFirstTimeDriver),
body: {
- 'id': box.read(BoxName.passengerID) ?? AK.newId,
+ 'id': box.read(BoxName.driverID) ?? AK.newId,
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
},
@@ -139,20 +148,26 @@ class LoginDriverController extends GetxController {
} else {}
} else {
await EncryptionHelper.initialize();
-
+ var emailDecrypted = (box.read(BoxName.emailDriver));
+ var pass = passwordController.text.isEmpty
+ ? '$emailDecrypted${box.read(BoxName.driverID)}'
+ : '${emailController.text.toString()}${box.read(BoxName.driverID)}';
+ String hashedPassword = shortHash(pass);
var payload = {
- 'id': box.read(BoxName.passengerID),
- 'password': AK.passnpassenger,
+ 'id': box.read(BoxName.driverID),
+ 'password': hashedPassword,
'aud': '${AK.allowed}$dev',
};
var response1 = await http.post(
Uri.parse(AppLink.loginJwtDriver),
body: payload,
);
-
+ print(response1.request);
+ print(response1.body);
+ print(payload);
if (response1.statusCode == 200) {
final decodedResponse1 = jsonDecode(response1.body);
- Log.print('decodedResponse1: ${decodedResponse1}');
+ // Log.print('decodedResponse1: ${decodedResponse1}');
final jwt = decodedResponse1['jwt'];
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
@@ -196,14 +211,18 @@ class LoginDriverController extends GetxController {
loginWithGoogleCredential(String driverID, email) async {
isloading = true;
update();
+ await SecurityHelper.performSecurityChecks();
+ Log.print('(BoxName.emailDriver): ${box.read(BoxName.emailDriver)}');
+
var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: {
'email': email.toString().contains('@')
+ // ? (box.read(BoxName.emailDriver))
? EncryptionHelper.instance.encryptData(email)
: email,
'id': driverID,
});
- print(res);
+ print('res is $res');
if (res == 'failure') {
//Failure
if (box.read(BoxName.phoneVerified).toString() == '1') {
@@ -221,6 +240,7 @@ class LoginDriverController extends GetxController {
if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'].toString() == '1') {
box.write(BoxName.emailDriver, (jsonDecoeded['data'][0]['email']));
+ box.write(BoxName.firstTimeLoadKey, 'false');
box.write(BoxName.driverID, (jsonDecoeded['data'][0]['id']));
box.write(BoxName.isTest, '1');
box.write(BoxName.gender, (jsonDecoeded['data'][0]['gender']));
@@ -345,8 +365,7 @@ class LoginDriverController extends GetxController {
'email': EncryptionHelper.instance.encryptData(email),
'password': password,
});
- box.write(BoxName.emailDriver,
- EncryptionHelper.instance.encryptData(email).toString());
+ box.write(BoxName.emailDriver, (email).toString());
print(res);
if (res == 'failure') {
//Failure
diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart
index bc1473b..47cfe35 100644
--- a/lib/controller/auth/captin/register_captin_controller.dart
+++ b/lib/controller/auth/captin/register_captin_controller.dart
@@ -123,7 +123,8 @@ class RegisterCaptainController extends GetxController {
.encryptData('+2${phoneController.text}'));
await Get.put(LoginDriverController()).loginWithGoogleCredential(
box.read(BoxName.driverID).toString(),
- box.read(BoxName.emailDriver).toString(),
+ EncryptionHelper.instance
+ .encryptData(box.read(BoxName.emailDriver).toString()),
);
} else {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
@@ -132,7 +133,8 @@ class RegisterCaptainController extends GetxController {
'token_code': EncryptionHelper.instance
.encryptData(randomNumber.toString()),
"driverId": box.read(BoxName.driverID),
- "email": box.read(BoxName.emailDriver),
+ "email": EncryptionHelper.instance
+ .encryptData(box.read(BoxName.emailDriver)),
});
await smsEgyptController.sendSmsEgypt(
diff --git a/lib/controller/auth/google_sign.dart b/lib/controller/auth/google_sign.dart
index 59cf9de..6db6442 100644
--- a/lib/controller/auth/google_sign.dart
+++ b/lib/controller/auth/google_sign.dart
@@ -94,8 +94,9 @@ class GoogleSignInHelper {
// Retrieve driverID and emailDriver with added validation
final driverID =
(box.read(BoxName.driverID)!.toString()) ?? 'Unknown ID';
- final emailDriver =
- (box.read(BoxName.emailDriver)!.toString()) ?? 'Unknown Email';
+ final emailDriver = EncryptionHelper.instance
+ .encryptData(box.read(BoxName.emailDriver)!.toString()) ??
+ 'Unknown Email';
// Debug print statements
print('Driver ID: $driverID');
@@ -125,8 +126,7 @@ class GoogleSignInHelper {
// Store driver information
box.write(BoxName.driverID,
(user.id) ?? 'Unknown ID'); // Ensure there's a fallback value
- box.write(BoxName.emailDriver,
- EncryptionHelper.instance.encryptData(user.email) ?? 'Unknown Email');
+ box.write(BoxName.emailDriver, (user.email) ?? 'Unknown Email');
}
// Method to handle Google Sign-Out
diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart
index ce29352..8da9a09 100644
--- a/lib/controller/auth/login_controller.dart
+++ b/lib/controller/auth/login_controller.dart
@@ -12,6 +12,8 @@ import 'package:sefer_driver/controller/functions/secure_storage.dart';
import 'package:sefer_driver/main.dart';
import 'package:sefer_driver/views/auth/verify_email_page.dart';
+import '../functions/encrypt_decrypt.dart';
+
class LoginController extends GetxController {
final formKey = GlobalKey();
final formKeyAdmin = GlobalKey();
@@ -58,7 +60,10 @@ class LoginController extends GetxController {
if (jsonDecoeded['status'] == 'success') {
if (jsonDecoeded['data'][0]['verified'] == 1) {
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
- box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
+ box.write(
+ BoxName.emailDriver,
+ EncryptionHelper.instance
+ .encryptData(jsonDecoeded['data'][0]['email']));
box.write(
BoxName.nameDriver,
jsonDecoeded['data'][0]['first_name'] +
diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart
index 6987f5d..fd17001 100644
--- a/lib/controller/functions/crud.dart
+++ b/lib/controller/functions/crud.dart
@@ -1,4 +1,5 @@
import 'dart:convert';
+import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/constant/links.dart';
@@ -22,6 +23,16 @@ class CRUD {
required String link,
Map? payload,
}) async {
+ 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 Get.put(LoginDriverController()).getJWT();
var url = Uri.parse(
link,
);
@@ -34,6 +45,9 @@ class CRUD {
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
},
);
+ print(response.request);
+ print(response.body);
+ print(payload);
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
@@ -48,7 +62,7 @@ class CRUD {
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginDriverController()).getJWT();
- mySnackbarSuccess('please order now'.tr);
+ // mySnackbarSuccess('please order now'.tr);
return 'token_expired'; // Return a specific value for token expiration
} else {
@@ -92,7 +106,7 @@ class CRUD {
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
- await Get.put(LoginDriverController()).getJwtWallet();
+ // await Get.put(LoginDriverController()).getJwtWallet();
return 'token_expired'; // Return a specific value for token expiration
} else {
@@ -111,6 +125,13 @@ class CRUD {
{required String link, Map? payload}) async {
var url = Uri.parse(link);
try {
+ bool isTokenExpired = JwtDecoder.isExpired(X
+ .r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
+ .toString()
+ .split(AppInformation.addd)[0]);
+ if (isTokenExpired) {
+ await LoginDriverController().getJWT();
+ }
var response = await http.post(
url,
body: payload,
@@ -121,6 +142,9 @@ class CRUD {
// 'Authorization': 'Bearer ${box.read(BoxName.jwt)}'
},
);
+ print(response.request);
+ print(response.body);
+ print(payload);
if (response.statusCode == 200) {
try {
var jsonData = jsonDecode(response.body);
@@ -139,7 +163,7 @@ class CRUD {
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
- await Get.put(LoginDriverController()).getJWT();
+ // await Get.put(LoginDriverController()).getJWT();
// MyDialog().getDialog(
// 'Session expired. Please log in again.'.tr,
// '',
diff --git a/lib/controller/functions/encrypt_decrypt.dart b/lib/controller/functions/encrypt_decrypt.dart
index 4a97641..a82e2fd 100644
--- a/lib/controller/functions/encrypt_decrypt.dart
+++ b/lib/controller/functions/encrypt_decrypt.dart
@@ -43,8 +43,8 @@ class EncryptionHelper {
/// Encrypts a string
String encryptData(String plainText) {
try {
- final encrypter =
- encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
+ final encrypter = encrypt.Encrypter(
+ encrypt.AES(key, mode: encrypt.AESMode.cbc)); // AES-GCM
final encrypted = encrypter.encrypt(plainText, iv: iv);
return encrypted.base64;
} catch (e) {
diff --git a/lib/controller/functions/face_detect.dart b/lib/controller/functions/face_detect.dart
index e310dc7..777ec31 100644
--- a/lib/controller/functions/face_detect.dart
+++ b/lib/controller/functions/face_detect.dart
@@ -1,8 +1,10 @@
import 'dart:convert';
+import 'dart:io';
import 'package:sefer_driver/constant/api_key.dart';
import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/main.dart';
import 'package:http/http.dart' as http;
+import 'package:http/io_client.dart';
import '../../constant/links.dart';
import 'encrypt_decrypt.dart';
@@ -13,14 +15,16 @@ Future faceDetector() async {
await Future.delayed(const Duration(seconds: 2));
var headers = {
- 'Authorization': 'Basic ${AK.basicCompareFaces}',
+ // 'Authorization': 'Basic ${AK.basicCompareFaces}',
+ 'Authorization': 'Basic hamza:12345678',
'Content-Type': 'application/json'
};
+ // var request = http.Request('POST', Uri.parse(//Todo
+ // 'https://face-detect-f6924392c4c7.herokuapp.com/compare_faces'));
+
var request = http.Request(
- 'POST',
- Uri.parse(
- 'https://face-detect-f6924392c4c7.herokuapp.com/compare_faces'));
+ 'POST', Uri.parse('https://mohkh.online:5000/compare_faces'));
request.body = json.encode({
"url1":
@@ -32,7 +36,9 @@ Future faceDetector() async {
request.headers.addAll(headers);
try {
- http.StreamedResponse response = await request.send();
+ http.Client client = await createHttpClient();
+ http.StreamedResponse response = await client.send(request);
+ // http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
String result = await response.stream.bytesToString();
@@ -47,3 +53,43 @@ Future faceDetector() async {
return 'Error: $e';
}
}
+
+Future createHttpClient() async {
+ final SecurityContext securityContext = SecurityContext();
+ HttpClient httpClient = HttpClient(context: securityContext);
+ httpClient.badCertificateCallback =
+ (X509Certificate cert, String host, int port) => true; // Bypass SSL
+ return IOClient(httpClient);
+}
+
+Future faceDetector2(String url1, String url2) async {
+ var headers = {
+ 'Authorization': 'Basic hamza:12345678',
+ 'Content-Type': 'application/json'
+ };
+
+ var request = http.Request(
+ 'POST', Uri.parse('https://mohkh.online:5000/compare_faces'));
+
+ request.body = json.encode({"url1": url1, "url2": url2});
+ request.headers.addAll(headers);
+
+ try {
+ http.Client client = await createHttpClient(); // Use custom client
+ DateTime startTime = DateTime.now();
+ http.StreamedResponse response = await client.send(request);
+ DateTime endTime = DateTime.now();
+ Duration duration = endTime.difference(startTime);
+ if (response.statusCode == 200) {
+ print(await response.stream.bytesToString());
+ print(duration.inSeconds);
+
+ return await response.stream.bytesToString();
+ } else {
+ print(await response.stream.bytesToString());
+ return 'Error: ${response.reasonPhrase}';
+ }
+ } catch (e) {
+ return 'Exception: $e';
+ }
+}
diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart
index 70448a1..5715239 100644
--- a/lib/controller/functions/gemeni.dart
+++ b/lib/controller/functions/gemeni.dart
@@ -2,6 +2,9 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
+import 'dart:convert';
+import 'package:crypto/crypto.dart';
+
import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/constant/info.dart';
import 'package:sefer_driver/constant/links.dart';
@@ -400,7 +403,10 @@ class AI extends GetxController {
'last_name': EncryptionHelper.instance.encryptData(
responseNonIdCardFront['full_name'].toString().split(' ').last) ??
'Not specified',
- 'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
+ 'email': EncryptionHelper.instance
+ .encryptData(box.read(BoxName.emailDriver))
+ ?.toString() ??
+ 'Not specified',
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
'password':
@@ -494,9 +500,21 @@ class AI extends GetxController {
}
}
+ String shortHash(String password) {
+ var bytes = utf8.encode(password);
+ var digest = sha256.convert(bytes);
+ return base64UrlEncode(digest.bytes);
+ }
+
Future addDriverEgypt() async {
isLoading = true;
update();
+ final loginDriverController = Get.put(LoginDriverController());
+
+ var pass = loginDriverController.passwordController.text.isEmpty
+ ? '${box.read(BoxName.emailDriver)}${box.read(BoxName.driverID)}'
+ : '${loginDriverController.emailController.text.toString()}${box.read(BoxName.driverID)}';
+ String hashedPassword = shortHash(pass);
var payload = {
'first_name': EncryptionHelper.instance.encryptData(
@@ -505,16 +523,13 @@ class AI extends GetxController {
'last_name': EncryptionHelper.instance.encryptData(
responseIdEgyptDriverLicense['lastName'].toString()) ??
'Not specified',
- 'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
+ 'email': EncryptionHelper.instance
+ .encryptData(box.read(BoxName.emailDriver))
+ .toString() ??
+ 'Not specified',
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
- 'password':
- Get.put(LoginDriverController()).passwordController.text.isEmpty
- ? box.read(BoxName.emailDriver).toString()
- : Get.find()
- .passwordController
- .text
- .toString(),
+ 'password': hashedPassword.toString(),
'gender': EncryptionHelper.instance
.encryptData(responseIdEgyptBack['gender'].toString()) ??
'Not specified',
@@ -825,7 +840,7 @@ class AI extends GetxController {
var json = jsonDecode(extractedString);
// Log.print('extractedString: ${extractedString}');
var textValues = CRUD().extractTextFromLines(json);
- Log.print('textValues: ${textValues}');
+ Log.print('textValues: $textValues');
// Log.print('json: ${json}');
DocumentType detectedType = checkDocumentType(textValues);
@@ -1141,7 +1156,7 @@ class AI extends GetxController {
jsonDecode(responseData['content'][0]['text']);
} else if (idType == 'non_id_front') {
responseNonIdCardFront = jsonDecode(responseData['content'][0]['text']);
- Log.print('responseNonIdCardFront: ${responseNonIdCardFront}');
+ Log.print('responseNonIdCardFront: $responseNonIdCardFront');
} else if (idType == 'non_id_back') {
responseNonIdCardBack = jsonDecode(responseData['content'][0]['text']);
}
diff --git a/lib/controller/functions/location_controller.dart b/lib/controller/functions/location_controller.dart
index 74e60e6..16323a6 100644
--- a/lib/controller/functions/location_controller.dart
+++ b/lib/controller/functions/location_controller.dart
@@ -37,8 +37,12 @@ class LocationController extends GetxController {
void onInit() async {
super.onInit();
location = Location(); // Initialize the location object
+ await location.changeSettings(
+ accuracy: LocationAccuracy.high,
+ interval: 5000, // 5 seconds
+ distanceFilter: 0);
await getLocation(); // Fetch the location immediately
- startLocationUpdates(); // Start periodic location updates
+ await startLocationUpdates(); // Start periodic location updates
totalPoints = Get.put(CaptainWalletController()).totalPoints.toString();
isActive = Get.put(HomeCaptainController()).isActive;
@@ -70,7 +74,6 @@ class LocationController extends GetxController {
final locationData = location as Map;
// Debugging: Print location data
- print('Location Data: $locationData');
// Convert string values to double
final minLatitude =
@@ -83,7 +86,6 @@ class LocationController extends GetxController {
double.tryParse(locationData['max_longitude'].toString()) ?? 0.0;
// Debugging: Print converted values
- // print(
// 'Converted Values: minLatitude=$minLatitude, maxLatitude=$maxLatitude, minLongitude=$minLongitude, maxLongitude=$maxLongitude');
if (latitude >= minLatitude &&
@@ -92,7 +94,6 @@ class LocationController extends GetxController {
longitude <= maxLongitude) {
box.write(BoxName.serverChosen,
EncryptionHelper.instance.decryptData(locationData['server_link']));
- // Log.print(
// 'locationData----server_link: ${locationData['server_link']}');
return locationData['name'];
}
@@ -122,12 +123,10 @@ class LocationController extends GetxController {
if (myLocation == null) {
return;
}
- // print(
// 'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
String area =
getLocationArea(myLocation.latitude, myLocation.longitude);
- print('Determined Area: $area');
if (box.read(BoxName.driverID) != null) {
await CRUD().post(
@@ -160,9 +159,7 @@ class LocationController extends GetxController {
}
}
}
- } catch (e) {
- Log.print('Error during location update: $e');
- }
+ } catch (e) {}
});
}
}
diff --git a/lib/controller/functions/package_info.dart b/lib/controller/functions/package_info.dart
index 1517464..14d7bc6 100644
--- a/lib/controller/functions/package_info.dart
+++ b/lib/controller/functions/package_info.dart
@@ -235,12 +235,7 @@ class SecurityHelper {
// debugPrint("Bundle ID: $bundleId"); // Print the bundle ID
// Check for security risks and potentially show a warning
- if (isNotTrust ||
- isJailBroken ||
- isTampered ||
- isDevMode ||
- isOnExternalStorage ||
- !isRealDevice) {
+ if (isJailBroken || isNotTrust || !isRealDevice || isTampered) {
// print("security_warning".tr); //using easy_localization
// Use a more robust approach to show a warning, like a dialog:
_showSecurityWarning();
diff --git a/lib/controller/functions/secure_storage.dart b/lib/controller/functions/secure_storage.dart
index 6f618f8..41ace3d 100644
--- a/lib/controller/functions/secure_storage.dart
+++ b/lib/controller/functions/secure_storage.dart
@@ -39,16 +39,13 @@ class AppInitializer {
List