From 5a4664ed674d37f3f20cd8ed14cb4ecac53eab6f Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 8 Mar 2025 19:35:09 +0300 Subject: [PATCH] 25-3/8/1 --- .env | 6 +- .../kotlin/com/sefer_driver/MainActivity.kt | 2 +- ios/Runner/AppDelegate.swift | 24 ++- ios/Runner/Info.plist | 199 +++++++++--------- .../auth/captin/login_captin_controller.dart | 39 +++- .../captin/register_captin_controller.dart | 6 +- lib/controller/auth/google_sign.dart | 8 +- lib/controller/auth/login_controller.dart | 7 +- lib/controller/functions/crud.dart | 30 ++- lib/controller/functions/encrypt_decrypt.dart | 4 +- lib/controller/functions/face_detect.dart | 56 ++++- lib/controller/functions/gemeni.dart | 37 +++- .../functions/location_controller.dart | 15 +- lib/controller/functions/package_info.dart | 7 +- lib/controller/functions/secure_storage.dart | 8 +- .../functions/sms_egypt_controller.dart | 3 +- lib/controller/local/translations.dart | 5 + .../payment/payment_controller.dart | 132 ++++++------ lib/controller/payment/paymob.dart | 3 +- .../payment/paymob/paymob_response.dart | 3 +- .../payment/paymob/paymob_wallet.dart | 3 +- lib/controller/rate/rate_app_controller.dart | 4 +- lib/main.dart | 6 +- .../auth/captin/cards/egypt_card_a_i.dart | 16 +- lib/views/auth/captin/login_captin.dart | 14 +- .../Captin/home_captain/drawer_captain.dart | 6 +- .../widget/left_menu_map_captain.dart | 74 ++++--- .../home/my_wallet/card_wallet_widget.dart | 2 +- pubspec.lock | 16 +- pubspec.yaml | 4 +- 30 files changed, 433 insertions(+), 306 deletions(-) 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> links = []; Future initializeApp() async { - 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(); } @@ -73,7 +70,6 @@ class AppInitializer { try { var res = await CRUD().get(link: AppLink.getLocationAreaLinks, payload: {}); - // Log.print('res: ${res}'); if (res != 'failure') { links = List>.from(jsonDecode(res)['message']); await box.remove(BoxName.locationName); @@ -93,8 +89,6 @@ class AppInitializer { await box.write(BoxName.paymentLink, EncryptionHelper.instance.decryptData(links[4]['server_link'])); } - } catch (e) { - print('Error fetching or decoding location data: $e'); - } + } catch (e) {} } } diff --git a/lib/controller/functions/sms_egypt_controller.dart b/lib/controller/functions/sms_egypt_controller.dart index 9ce8a3d..f542698 100644 --- a/lib/controller/functions/sms_egypt_controller.dart +++ b/lib/controller/functions/sms_egypt_controller.dart @@ -57,7 +57,8 @@ class SmsEgyptController extends GetxController { await Get.put(LoginDriverController()).loginWithGoogleCredential( box.read(BoxName.driverID).toString(), - box.read(BoxName.emailDriver).toString(), + EncryptionHelper.instance + .encryptData(box.read(BoxName.emailDriver).toString()), ); } else { Get.defaultDialog( diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index d16c78a..1cae2c9 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -65,6 +65,7 @@ class MyTranslation extends Translations { "Order Applied": "تم تطبيق الطلب", //firebase above + "cancel": "إلغاء", 'please order now': " ‏الرجاء الطلب مرة أخرى", 'Session expired. Please log in again.': 'انتهت الجلسة. يرجى تسجيل الدخول مرة أخرى.', @@ -209,6 +210,10 @@ class MyTranslation extends Translations { "How much longer will you be?": "‏قدامك قد إيه", "Phone number is verified before": "تم التحقق من رقم الهاتف مسبقاً", "Change Ride": "تغيير الرحلة", + "Authentication failed": "فشل المصادقة", + "Biometric Authentication": "المصادقة البيومترية", + "You should use Touch ID or Face ID to confirm payment": + "يجب عليك استخدام Touch ID أو Face ID لتأكيد الدفع", "Cost Of Trip IS": "تكلفة الرحلة هي", "You must be recharge your Account": "رصيد حسابك غير كافٍ. يرجى إعادة الشحن للمتابعة", diff --git a/lib/controller/payment/payment_controller.dart b/lib/controller/payment/payment_controller.dart index 31f95c3..6846f38 100644 --- a/lib/controller/payment/payment_controller.dart +++ b/lib/controller/payment/payment_controller.dart @@ -11,6 +11,7 @@ import 'package:flutter_paypal/flutter_paypal.dart'; import 'package:flutter_stripe/flutter_stripe.dart'; import 'package:get/get.dart'; import 'package:local_auth/local_auth.dart'; +import 'package:sefer_driver/views/widgets/mydialoug.dart'; import '../../constant/box_name.dart'; import '../../constant/colors.dart'; @@ -158,8 +159,7 @@ class PaymentController extends GetxController { billingDetails: BillingDetails( name: EncryptionHelper.instance .decryptData(box.read(BoxName.nameDriver)), - email: EncryptionHelper.instance - .decryptData(box.read(BoxName.emailDriver)), + email: (box.read(BoxName.emailDriver)), phone: EncryptionHelper.instance .decryptData(box.read(BoxName.phoneDriver)), address: Address( @@ -578,6 +578,9 @@ class PaymentController extends GetxController { // Authenticate the user bool didAuthenticate = await LocalAuthentication().authenticate( localizedReason: 'Use Touch ID or Face ID to confirm payment', + options: const AuthenticationOptions( + biometricOnly: true, // Only biometrics (no fallback to PIN/pattern) + ), ); if (didAuthenticate) { final PaymobResponseWallet? response = @@ -589,32 +592,10 @@ class PaymentController extends GetxController { billingData: PaymobBillingDataWallet(), onPayment: (PaymobResponseWallet response) {}, ); - // Log.print('message: ${response!.message}'); - // Log.print('responseCode: ${response.responseCode}'); - // Log.print('success: ${response.success}'); - // Log.print('transactionID: ${response.transactionID}'); if (response!.success == true && response.message.toString() == 'Approved') { - // Log.print('transactionID wewer: ${response.transactionID}'); Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor); method(); - // Get.defaultDialog( - // barrierDismissible: false, - // title: 'Payment Successful'.tr, - // titleStyle: AppStyle.title, - // content: Text( - // 'The payment was approved.'.tr, - // style: AppStyle.title, - // ), - // confirm: MyElevatedButton( - // title: 'OK'.tr, - // kolor: AppColor.greenColor, - // onPressed: () async { - // Get.back(); - // method(); - // }, - // ), - // ); } else { Get.defaultDialog( barrierDismissible: false, @@ -653,57 +634,64 @@ class PaymentController extends GetxController { } } else { // Authentication failed, handle accordingly + MyDialog().getDialog('Authentication failed'.tr, ''.tr, () { + Get.back(); + }); } } else { - final PaymobResponse? response = await PaymobPayment.instance.pay( - context: context, - currency: currency, //"EGP", - amountInCents: newAmount, // 19.00 EGP - billingData: PaymobBillingData(), - onPayment: (PaymobResponse response) {}, - ); + MyDialog().getDialog('Biometric Authentication'.tr, + 'You should use Touch ID or Face ID to confirm payment'.tr, () { + Get.back(); + }); + // final PaymobResponse? response = await PaymobPayment.instance.pay( + // context: context, + // currency: currency, //"EGP", + // amountInCents: newAmount, // 19.00 EGP + // billingData: PaymobBillingData(), + // onPayment: (PaymobResponse response) {}, + // ); - // if (response!.responseCode == 'APPROVED') { - if (response!.responseCode == '200' && response.success == true) { - Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor); - method(); - // Get.defaultDialog( - // barrierDismissible: false, - // title: 'Payment Successful'.tr, - // titleStyle: AppStyle.title, - // // backgroundColor: AppColor.greenColor, - // content: Text( - // 'The payment was approved.'.tr, - // style: AppStyle.title, - // ), - // confirm: MyElevatedButton( - // kolor: AppColor.greenColor, - // title: 'OK'.tr, - // onPressed: () async { - // Get.back(); - // method(); - // }, - // ), - // ); - } else { - Get.defaultDialog( - barrierDismissible: false, - // backgroundColor: AppColor.redColor, - title: 'Payment Failed'.tr, - content: Text( - 'The payment was not approved. Please try again.'.tr, - textAlign: TextAlign.center, - style: AppStyle.title, - ), - confirm: MyElevatedButton( - title: 'OK'.tr, - kolor: AppColor.redColor, - onPressed: () async { - Get.back(); - }, - ), - ); - } + // // if (response!.responseCode == 'APPROVED') { + // if (response!.responseCode == '200' && response.success == true) { + // Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor); + // method(); + // Get.defaultDialog( + // barrierDismissible: false, + // title: 'Payment Successful'.tr, + // titleStyle: AppStyle.title, + // // backgroundColor: AppColor.greenColor, + // content: Text( + // 'The payment was approved.'.tr, + // style: AppStyle.title, + // ), + // confirm: MyElevatedButton( + // kolor: AppColor.greenColor, + // title: 'OK'.tr, + // onPressed: () async { + // Get.back(); + // method(); + // }, + // ), + // ); + // } else { + // Get.defaultDialog( + // barrierDismissible: false, + // // backgroundColor: AppColor.redColor, + // title: 'Payment Failed'.tr, + // content: Text( + // 'The payment was not approved. Please try again.'.tr, + // textAlign: TextAlign.center, + // style: AppStyle.title, + // ), + // confirm: MyElevatedButton( + // title: 'OK'.tr, + // kolor: AppColor.redColor, + // onPressed: () async { + // Get.back(); + // }, + // ), + // ); + // } } } catch (e) { Get.defaultDialog( diff --git a/lib/controller/payment/paymob.dart b/lib/controller/payment/paymob.dart index ef40213..e94845a 100644 --- a/lib/controller/payment/paymob.dart +++ b/lib/controller/payment/paymob.dart @@ -137,8 +137,7 @@ class PaymobManager extends GetxController { EncryptionHelper.instance.decryptData(box.read(BoxName.nameDriver)), "last_name": EncryptionHelper.instance .decryptData(box.read(BoxName.lastNameDriver)), - "email": EncryptionHelper.instance - .decryptData(box.read(BoxName.emailDriver)), + "email": (box.read(BoxName.emailDriver)), "phone_number": EncryptionHelper.instance .decryptData(box.read(BoxName.phoneDriver)), "apartment": "NA", diff --git a/lib/controller/payment/paymob/paymob_response.dart b/lib/controller/payment/paymob/paymob_response.dart index b60c2f0..10e5634 100644 --- a/lib/controller/payment/paymob/paymob_response.dart +++ b/lib/controller/payment/paymob/paymob_response.dart @@ -224,8 +224,7 @@ class PaymobBillingData { Map toJson() { return { - "email": - EncryptionHelper.instance.decryptData(box.read(BoxName.emailDriver)), + "email": (box.read(BoxName.emailDriver)), "first_name": box.read(BoxName.nameDriver), "last_name": box.read(BoxName.nameDriver), "phone_number": diff --git a/lib/controller/payment/paymob/paymob_wallet.dart b/lib/controller/payment/paymob/paymob_wallet.dart index 0316ec5..25437cb 100644 --- a/lib/controller/payment/paymob/paymob_wallet.dart +++ b/lib/controller/payment/paymob/paymob_wallet.dart @@ -267,8 +267,7 @@ class PaymobBillingDataWallet { Map toJson() { return { - "email": - EncryptionHelper.instance.decryptData(box.read(BoxName.emailDriver)), + "email": (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)), diff --git a/lib/controller/rate/rate_app_controller.dart b/lib/controller/rate/rate_app_controller.dart index 8e4de0a..72e9b27 100644 --- a/lib/controller/rate/rate_app_controller.dart +++ b/lib/controller/rate/rate_app_controller.dart @@ -42,9 +42,7 @@ class RatingController extends GetxController { "name": box.read(BoxName.driverID) != null ? box.read(BoxName.nameDriver) : box.read(BoxName.name), - "email": EncryptionHelper.instance - .decryptData(box.read(BoxName.emailDriver)) - .toString(), + "email": (box.read(BoxName.emailDriver)).toString(), "phone": EncryptionHelper.instance .decryptData(box.read(BoxName.phoneDriver)) .toString(), diff --git a/lib/main.dart b/lib/main.dart index 2b8a1da..059615a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -135,9 +135,9 @@ void main() async { Stripe.publishableKey = AK.publishableKeyStripe; PermissionStatus status1 = await Permission.location.status; - if (status1.isGranted) { - await LocationController().startLocationUpdates(); - } + // if (status1.isGranted) { + await LocationController().startLocationUpdates(); + // } if (Platform.isAndroid || Platform.isIOS) { NotificationController notificationController = diff --git a/lib/views/auth/captin/cards/egypt_card_a_i.dart b/lib/views/auth/captin/cards/egypt_card_a_i.dart index 9a01ab0..b2427e4 100644 --- a/lib/views/auth/captin/cards/egypt_card_a_i.dart +++ b/lib/views/auth/captin/cards/egypt_card_a_i.dart @@ -1,19 +1,19 @@ -import 'package:sefer_driver/constant/box_name.dart'; -import 'package:sefer_driver/controller/functions/gemeni.dart'; -import 'package:sefer_driver/controller/functions/tts.dart'; -import 'package:sefer_driver/views/widgets/elevated_btn.dart'; -import 'package:sefer_driver/views/widgets/my_circular_indicator_timer.dart'; -import 'package:sefer_driver/views/widgets/mydialoug.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../../../constant/box_name.dart'; import '../../../../constant/colors.dart'; import '../../../../constant/links.dart'; import '../../../../constant/style.dart'; import '../../../../controller/functions/encrypt_decrypt.dart'; +import '../../../../controller/functions/gemeni.dart'; import '../../../../controller/functions/package_info.dart'; +import '../../../../controller/functions/tts.dart'; import '../../../../main.dart'; +import '../../../widgets/elevated_btn.dart'; +import '../../../widgets/my_circular_indicator_timer.dart'; import '../../../widgets/my_scafold.dart'; +import '../../../widgets/mydialoug.dart'; class EgyptCardAI extends StatelessWidget { EgyptCardAI({super.key}); @@ -172,7 +172,7 @@ class EgyptCardAI extends StatelessWidget { ), const SizedBox(height: 8), Text( - 'To become a ride-sharing driver on the Sefer app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Sefer app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.' + 'To become a ride-sharing driver on the Tripz app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Tripz app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.' .tr, style: AppStyle.title, textAlign: TextAlign.center, @@ -184,7 +184,7 @@ class EgyptCardAI extends StatelessWidget { onPressed: () async { controller.startTimer(); await textToSpeechController.speakText( - 'To become a ride-sharing driver on the Sefer app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Sefer app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.' + 'To become a ride-sharing driver on the Tripz app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Tripz app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.' .tr); }, icon: const Icon( diff --git a/lib/views/auth/captin/login_captin.dart b/lib/views/auth/captin/login_captin.dart index f7fee6e..7a0878a 100644 --- a/lib/views/auth/captin/login_captin.dart +++ b/lib/views/auth/captin/login_captin.dart @@ -325,11 +325,8 @@ class LoginCaptin extends StatelessWidget { User? user = await authController .signInWithApple(); if (user != null) { - box.write( - BoxName.emailDriver, - EncryptionHelper.instance - .encryptData( - user.email.toString())); + box.write(BoxName.emailDriver, + (user.email.toString())); box.write( BoxName.driverID, user.uid); @@ -339,9 +336,10 @@ class LoginCaptin extends StatelessWidget { box .read(BoxName.driverID) .toString(), - box - .read(BoxName.emailDriver) - .toString(), + EncryptionHelper.instance + .encryptData(box + .read(BoxName.emailDriver) + .toString()), ); // Navigate to another screen or perform other actions } else {} diff --git a/lib/views/home/Captin/home_captain/drawer_captain.dart b/lib/views/home/Captin/home_captain/drawer_captain.dart index 20712b9..2ca67f6 100644 --- a/lib/views/home/Captin/home_captain/drawer_captain.dart +++ b/lib/views/home/Captin/home_captain/drawer_captain.dart @@ -1,7 +1,5 @@ -import 'package:sefer_driver/constant/api_key.dart'; import 'package:sefer_driver/constant/links.dart'; import 'package:sefer_driver/constant/style.dart'; -import 'package:sefer_driver/controller/functions/encrypt_decrypt.dart'; import 'package:sefer_driver/controller/home/captin/home_captain_controller.dart'; import 'package:sefer_driver/views/Rate/rate_app_page.dart'; import 'package:sefer_driver/views/auth/captin/contact_us_page.dart'; @@ -536,9 +534,7 @@ class UserAccountHeader extends StatelessWidget { ), const SizedBox(height: 4), Text( - EncryptionHelper.instance.decryptData( - box.read(BoxName.emailDriver), - ), + box.read(BoxName.emailDriver), style: TextStyle( color: Colors.white.withOpacity(0.9), fontSize: 14, diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart index b3172ee..125f461 100644 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart @@ -1,10 +1,13 @@ import 'dart:convert'; +import 'dart:math'; +import 'package:crypto/crypto.dart'; +import 'package:location/location.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:sefer_driver/constant/box_name.dart'; import 'package:sefer_driver/controller/firebase/local_notification.dart'; -import 'package:sefer_driver/controller/functions/crud.dart'; +import 'package:sefer_driver/controller/functions/encrypt_decrypt.dart'; import 'package:sefer_driver/main.dart'; -import 'package:sefer_driver/views/auth/captin/cards/sms_signup.dart'; import 'package:sefer_driver/views/home/Captin/orderCaptin/vip_order_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; @@ -12,7 +15,8 @@ import 'package:get/get.dart'; import 'package:sefer_driver/controller/home/captin/home_captain_controller.dart'; import '../../../../../constant/colors.dart'; -import '../../../../../controller/functions/encrypt_decrypt.dart'; +import '../../../../../controller/functions/face_detect.dart'; +import '../../../../../controller/functions/location_controller.dart'; import '../../../../../print.dart'; import '../../../../Rate/ride_calculate_driver.dart'; @@ -96,27 +100,49 @@ GetBuilder leftMainMenuCaptainIcons() { ) : const SizedBox(), // : const SizedBox(), - // AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: controller.widthMapTypeAndTraffic, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(color: AppColor.blueColor), - // borderRadius: BorderRadius.circular(15)), - // child: Builder(builder: (context) { - // return IconButton( - // onPressed: () async { - // await storage.deleteAll(); - // box.erase(); - // }, - // icon: const Icon( - // FontAwesome5.grin_tears, - // size: 29, - // color: AppColor.blueColor, - // ), - // ); - // }), - // ), + AnimatedContainer( + duration: const Duration(microseconds: 200), + width: controller.widthMapTypeAndTraffic, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + border: Border.all(color: AppColor.blueColor), + borderRadius: BorderRadius.circular(15)), + child: Builder(builder: (context) { + return IconButton( + onPressed: () async { + // String shortHash(String password) { + // var bytes = utf8.encode(password); + // var digest = sha256.convert(bytes); + // return base64UrlEncode(digest.bytes); + // } + + // String password = + // '${EncryptionHelper.instance.decryptData(box.read(BoxName.emailDriver))}${box.read(BoxName.driverID)}'; + // String hashedPassword = shortHash(password); + // Log.print('password: ${password}'); + // print("Hashed Password: $hashedPassword"); + Location location = Location(); + LocationData _locationData = await location.getLocation(); + Log.print('location: ${_locationData}'); + print( + 'Location: ${controller.myLocation.latitude}, ${controller.myLocation.longitude}'); + var status1 = await Permission.location.status; + Log.print('status1: ${status1}'); + // if (status1.isGranted) { + await LocationController().startLocationUpdates(); + // } else { + // // openAppSettings(); + // await Permission.locationAlways.request(); + // } + }, + icon: const Icon( + FontAwesome5.grin_tears, + size: 29, + color: AppColor.blueColor, + ), + ); + }), + ), const SizedBox( height: 5, diff --git a/lib/views/home/my_wallet/card_wallet_widget.dart b/lib/views/home/my_wallet/card_wallet_widget.dart index f22ca84..71d6af6 100644 --- a/lib/views/home/my_wallet/card_wallet_widget.dart +++ b/lib/views/home/my_wallet/card_wallet_widget.dart @@ -171,7 +171,7 @@ class CardSeferWalletDriver extends StatelessWidget { children: [ Text( // '${AppInformation.appName} Wallet', - 'Sovo Wallet', + 'Tripz Wallet', style: AppStyle.headTitle.copyWith( color: AppColor.writeColor, fontSize: 26), ), diff --git a/pubspec.lock b/pubspec.lock index 7ad7382..e438776 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1064,10 +1064,10 @@ packages: dependency: "direct main" description: name: google_maps_flutter - sha256: "209856c8e5571626afba7182cf634b2910069dc567954e76ec3e3fb37f5e9db3" + sha256: "621125e35e81ca39ef600e45243d2be93167e61def72bc7207b0c4a635c58506" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.10.1" google_maps_flutter_android: dependency: transitive description: @@ -1456,26 +1456,26 @@ packages: dependency: "direct main" description: name: location - sha256: ee57923720163324416ce0306b701db6d845d2c1a3bf44d25b607cbddbaa3973 + sha256: c2c4304071ec860525d5c50d142410072f8620c1d9f74874811af2e804e1a9c8 url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "8.0.0" location_platform_interface: dependency: transitive description: name: location_platform_interface - sha256: "1e535ccc8b4a9612de4e4319871136b45d2b5d1fb0c2a8bf99687242bf7ca5f7" + sha256: a3404ea6d74e89b121630be62ed8edcc7b39fd108bd19805d0ae55c397135dd7 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.0" location_web: dependency: transitive description: name: location_web - sha256: e6435cfd175b0f6e94d6fdc43c104d13cec7e27b21a8cee00bd9516a3d6a4c81 + sha256: "744bdff53dc455a2dc9a34474c49cde364d4fbef2aee009f8b0b4b68570c27a1" url: "https://pub.dev" source: hosted - version: "5.0.4" + version: "6.0.0" logging: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 50fb3ce..269fe25 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: firebase_messaging: ^15.0.3 firebase_core: ^3.2.0 flutter_local_notifications: ^18.0.1 - google_maps_flutter: ^2.5.0 + google_maps_flutter: ^2.10.1 sqflite: ^2.3.0 path: ^1.8.3 # lottie: ^2.5.0 @@ -31,7 +31,7 @@ dependencies: get: ^4.6.5 get_storage: ^2.1.1 url_launcher: ^6.1.12 - location: ^7.0.0 + location: ^8.0.0 google_polyline_algorithm: ^3.1.0 # custom_searchable_dropdown: ^2.1.1 animated_text_kit: ^4.2.2