diff --git a/.env b/.env
index 723b079..15f2477 100644
--- a/.env
+++ b/.env
@@ -13,6 +13,15 @@ keyOfApp=nqryjp@1737wqnmqqsjyzjujljksvceiXrXlBl
emailService=seferservice@sefer.live
anthropicAIkeySeferNew=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl
anthropicAIkeySeferNewHamzaayedpython=zg-qbc-qvo39-vCB-WnzEwFNArO0YlTapvfhtmguKWsXJSKqg_NZSjHBYVXMZK1yUK88SobdckV0KuPaBh0c_WHtGsRO_439PBk-e2QqgkQQXrXlBl
+keyOfApp=nqryjjjhgjp@1bCQ1FnMGxYwsjyzjujljksvceiXrXlBl
+initializationVector=ujljkdelkjlXrXlBlfghijkl
+sss_pass=wqnmqqsjyvwv:nqrYJP@17378XrXlBl
+sss_encryptionSalt=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl
+addd=BlBlNl
+allowed=Tripz:
+passnpassenger=hbgbitbXrXrBr
+newId=new
+getapiKey=https://server.sefer.live/sefer.click/sefer/ride/apiKey/get.php
a=q
b=x
diff --git a/.gitignore b/.gitignore
index 29a3a50..79c113f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
+.build/
.buildlog/
.history
.svn/
+.swiftpm/
migrate_working_dir/
# IntelliJ related
diff --git a/android/app/build.gradle b/android/app/build.gradle
index a720919..36d5606 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -43,8 +43,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23
targetSdk = flutter.targetSdkVersion
- versionCode = 12
- versionName = '1.12'
+ versionCode = 13
+ versionName = '1.13'
}
buildTypes {
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index f2af316..45228cc 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -9,11 +9,14 @@
android:maxSdkVersion="28" />
+
+
11.0.0)
- - Firebase/CoreOnly (11.0.0):
- - FirebaseCore (= 11.0.0)
- - Firebase/Messaging (11.0.0):
+ - FirebaseAuth (~> 11.8.0)
+ - Firebase/CoreOnly (11.8.0):
+ - FirebaseCore (~> 11.8.0)
+ - Firebase/Messaging (11.8.0):
- Firebase/CoreOnly
- - FirebaseMessaging (~> 11.0.0)
- - firebase_auth (5.2.0):
- - Firebase/Auth (= 11.0.0)
+ - FirebaseMessaging (~> 11.8.0)
+ - firebase_auth (5.5.1):
+ - Firebase/Auth (= 11.8.0)
- firebase_core
- Flutter
- - firebase_core (3.4.0):
- - Firebase/CoreOnly (= 11.0.0)
+ - firebase_core (3.12.1):
+ - Firebase/CoreOnly (= 11.8.0)
- Flutter
- - firebase_messaging (15.1.0):
- - Firebase/Messaging (= 11.0.0)
+ - firebase_messaging (15.2.4):
+ - Firebase/Messaging (= 11.8.0)
- firebase_core
- Flutter
- - FirebaseAppCheckInterop (11.2.0)
- - FirebaseAuth (11.0.0):
+ - FirebaseAppCheckInterop (11.9.0)
+ - FirebaseAuth (11.8.1):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseAuthInterop (~> 11.0)
- - FirebaseCore (~> 11.0)
- - FirebaseCoreExtension (~> 11.0)
+ - FirebaseCore (~> 11.8.0)
+ - FirebaseCoreExtension (~> 11.8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/Environment (~> 8.0)
- - GTMSessionFetcher/Core (~> 3.4)
+ - GTMSessionFetcher/Core (< 5.0, >= 3.4)
- RecaptchaInterop (~> 100.0)
- - FirebaseAuthInterop (11.2.0)
- - FirebaseCore (11.0.0):
- - FirebaseCoreInternal (~> 11.0)
+ - FirebaseAuthInterop (11.9.0)
+ - FirebaseCore (11.8.1):
+ - FirebaseCoreInternal (~> 11.8.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- - FirebaseCoreExtension (11.2.0):
- - FirebaseCore (~> 11.0)
- - FirebaseCoreInternal (11.2.0):
+ - FirebaseCoreExtension (11.8.0):
+ - FirebaseCore (~> 11.8.0)
+ - FirebaseCoreInternal (11.8.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- - FirebaseInstallations (11.2.0):
- - FirebaseCore (~> 11.0)
+ - FirebaseInstallations (11.8.0):
+ - FirebaseCore (~> 11.8.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- - FirebaseMessaging (11.0.0):
- - FirebaseCore (~> 11.0)
+ - FirebaseMessaging (11.8.0):
+ - FirebaseCore (~> 11.8.0)
- FirebaseInstallations (~> 11.0)
- GoogleDataTransport (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
@@ -140,6 +142,8 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
+ - permission_handler_apple (9.3.0):
+ - Flutter
- PromisesObjC (2.4.0)
- RecaptchaInterop (100.0.0)
- SDWebImage (5.19.7):
@@ -150,16 +154,17 @@ PODS:
- SDWebImage/Core (~> 5.17)
- share (0.0.1):
- Flutter
- - sqflite (0.0.3):
+ - sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- TOCropViewController (2.7.4)
- url_launcher_ios (0.0.1):
- Flutter
- - vibration (1.7.5):
+ - vibration (3.0.0):
- Flutter
DEPENDENCIES:
+ - contacts_service (from `.symlinks/plugins/contacts_service/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
@@ -171,8 +176,9 @@ DEPENDENCIES:
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
+ - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share (from `.symlinks/plugins/share/ios`)
- - sqflite (from `.symlinks/plugins/sqflite/darwin`)
+ - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- vibration (from `.symlinks/plugins/vibration/ios`)
@@ -203,6 +209,8 @@ SPEC REPOS:
- TOCropViewController
EXTERNAL SOURCES:
+ contacts_service:
+ :path: ".symlinks/plugins/contacts_service/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_auth:
@@ -225,10 +233,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
+ permission_handler_apple:
+ :path: ".symlinks/plugins/permission_handler_apple/ios"
share:
:path: ".symlinks/plugins/share/ios"
- sqflite:
- :path: ".symlinks/plugins/sqflite/darwin"
+ sqflite_darwin:
+ :path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
vibration:
@@ -236,44 +246,46 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
- device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
- Firebase: 9f574c08c2396885b5e7e100ed4293d956218af9
- firebase_auth: 16ac5db3d064db837ecd845080d7e18e4be7c66d
- firebase_core: ceec591a66629daaee82d3321551692c4a871493
- firebase_messaging: 15d8b557010f3bb7b98d0302e1c7c8fbcd244425
- FirebaseAppCheckInterop: ea21450529cf0ebd132788dd8916a0269abc684f
- FirebaseAuth: d5cf28be74d7e82257f6a3f717509eff70d3cf4a
- FirebaseAuthInterop: 47c09558af5d1b31f16fb352387c72d4804f4a24
- FirebaseCore: 3cf438f431f18c12cdf2aaf64434648b63f7e383
- FirebaseCoreExtension: cda74ddfb001224bd8fd1d6e74698b4ed07803de
- FirebaseCoreInternal: 0c569513412da9f3b31bd0b340013bbee8f295c5
- FirebaseInstallations: 771177d89d6c451dc6e50085ec82e2fc77ed0a4a
- FirebaseMessaging: d2d1d9c62c46dd2db49a952f7deb5b16ad2c9742
+ contacts_service: 849e1f84281804c8bfbec1b4c3eedcb23c5d3eca
+ device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
+ Firebase: d80354ed7f6df5f9aca55e9eb47cc4b634735eaf
+ firebase_auth: 3d848b9b866b201e5c8e0c06d8b2cec272fd8825
+ firebase_core: ac395f994af4e28f6a38b59e05a88ca57abeb874
+ firebase_messaging: 7e223f4ee7ca053bf4ce43748e84a6d774ec9728
+ FirebaseAppCheckInterop: 9226f7217b43e99dfa0bc9f674ad8108cef89feb
+ FirebaseAuth: ad59a1a7b161e75f74c39f70179d2482d40e2737
+ FirebaseAuthInterop: 2a26ee1bea6d47df8048683cfa071e7da657798f
+ FirebaseCore: 99fe0c4b44a39f37d99e6404e02009d2db5d718d
+ FirebaseCoreExtension: 3d3f2017a00d06e09ab4ebe065391b0bb642565e
+ FirebaseCoreInternal: df24ce5af28864660ecbd13596fc8dd3a8c34629
+ FirebaseInstallations: 6c963bd2a86aca0481eef4f48f5a4df783ae5917
+ FirebaseMessaging: 487b634ccdf6f7b7ff180fdcb2a9935490f764e8
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
- google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
+ google_sign_in_ios: 4111e87aa5e24a4404f00ea13479f35e571969cc
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
- image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
+ image_cropper: e0bb0042e4404ff2ef134e5cf0492cbd892156cd
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
+ permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
- sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
+ sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
- vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241
+ vibration: 3797858f8cbf53d841e189ef8bd533d96e4ca93c
PODFILE CHECKSUM: 1959d098c91d8a792531a723c4a9d7e9f6a01e38
-COCOAPODS: 1.15.2
+COCOAPODS: 1.16.2
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index d97d7fa..c3bcdc2 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -161,7 +161,6 @@
3B75F912CE561168513C16DB /* Pods-RunnerTests.release.xcconfig */,
8ED99976D90689BACE52971F /* Pods-RunnerTests.profile.xcconfig */,
);
- name = Pods;
path = Pods;
sourceTree = "";
};
@@ -492,10 +491,12 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ INFOPLIST_KEY_CFBundleDisplayName = "Tripz service";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
+ MARKETING_VERSION = 1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.service;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -675,10 +676,12 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ INFOPLIST_KEY_CFBundleDisplayName = "Tripz service";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
+ MARKETING_VERSION = 1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.service;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -698,10 +701,12 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ INFOPLIST_KEY_CFBundleDisplayName = "Tripz service";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
+ MARKETING_VERSION = 1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.service;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
diff --git a/lib/constant/api_key.dart b/lib/constant/api_key.dart
index 8e89f04..7603d84 100644
--- a/lib/constant/api_key.dart
+++ b/lib/constant/api_key.dart
@@ -15,6 +15,12 @@ class AK {
static final String anthropicAIkeySeferNewHamzaayedpython =
X.r(X.r(X.r(Env.anthropicAIkeySeferNewHamzaayedpython, cn), cC), cs);
static final String emailService = (Env.emailService);
+ 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 keyOfApp = X.r(X.r(X.r(Env.keyOfApp, cn), cC), cs);
diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart
index 0e98b58..a37d864 100644
--- a/lib/constant/box_name.dart
+++ b/lib/constant/box_name.dart
@@ -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 tokenParent = "tokenParent";
static const String lang = "lang";
static const String gender = "gender";
@@ -77,3 +83,11 @@ class BoxName {
static const String tripData = 'tripData';
static const String parentTripSelected = 'parentTripSelected';
}
+
+class Service {
+ 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';
+}
diff --git a/lib/constant/info.dart b/lib/constant/info.dart
index 5a41e7b..b1d2f97 100644
--- a/lib/constant/info.dart
+++ b/lib/constant/info.dart
@@ -8,6 +8,7 @@ class AppInformation {
static const String email = 'hamzaayed@mobile-app.store';
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 = '''
diff --git a/lib/constant/links.dart b/lib/constant/links.dart
index 5fa86cd..03c8bd4 100644
--- a/lib/constant/links.dart
+++ b/lib/constant/links.dart
@@ -10,9 +10,12 @@ class AppLink {
static final String seferCairoServer = Env.seferCairoServer;
static final String seferGizaServer = Env.seferGizaServer;
// static final String server = Env.serverPHP;
+ static String getBestDriver = "$server/Admin/driver/getBestDriver.php";
+ static const String server = 'https://server.sefer.live/sefer.click/sefer';
+ static const String jwtService = '$server/jwtService.php';
static final String endPoint = box.read(BoxName.serverChosen);
- static final String server = Env.seferCairoServer;
+ // static final String server = Env.seferCairoServer;
// static const String server = "https://sefer.click/sefer/sefer";
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
static String llama = 'https://api.llama-api.com/chat/completions';
@@ -55,8 +58,14 @@ class AppLink {
static String addNotesDriver = "$serviceApp/addNotesDriver.php";
static String getCarPlateNotEdit = "$serviceApp/getCarPlateNotEdit.php";
static String getdriverWithoutCar = "$serviceApp/getdriverWithoutCar.php";
+ static String getBestDriverGiza =
+ "https://gizasefer.online/sefer/Admin/driver/getBestDriver.php";
+ static String getBestDriverAlexandria =
+ "$seferAlexandriaServer/Admin/driver/getBestDriver.php";
static String addNotesPassenger = "$serviceApp/addNotesPassenger.php";
static String editCarPlate = "$serviceApp/editCarPlate.php";
+ static String addDriverWantWork = "$serviceApp/work/addDriverWantWork.php";
+ static String addCarWantWork = "$serviceApp/work/addCarWantWork.php";
static String getComplaintAllData = "$serviceApp/getComplaintAllData.php";
static String getComplaintAllDataForDriver =
"$serviceApp/getComplaintAllDataForDriver.php";
diff --git a/lib/constant/style.dart b/lib/constant/style.dart
index 78c3e3d..131f5bf 100644
--- a/lib/constant/style.dart
+++ b/lib/constant/style.dart
@@ -1,30 +1,39 @@
import 'package:flutter/material.dart';
-
+import 'package:google_fonts/google_fonts.dart';
import '../main.dart';
import 'box_name.dart';
import 'colors.dart';
class AppStyle {
- static TextStyle headTitle = const TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 40,
- color: AppColor.accentColor,
- );
- static TextStyle headTitle2 = const TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 26,
- color: AppColor.writeColor,
- );
+ static TextStyle headTitle = TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 36,
+ color: AppColor.accentColor,
+ fontFamily: box.read(BoxName.lang) == 'ar'
+ // ?GoogleFonts.markaziText().fontFamily
+ ? GoogleFonts.markaziText().fontFamily
+ : GoogleFonts.inter().fontFamily);
+ static TextStyle headTitle2 = TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 24,
+ color: AppColor.writeColor,
+ fontFamily: box.read(BoxName.lang) == 'ar'
+ ? GoogleFonts.markaziText().fontFamily
+ : GoogleFonts.inter().fontFamily);
static TextStyle title = TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: box.read(BoxName.lang) == 'ar' ? 14 : 16,
- color: AppColor.writeColor,
- );
- static TextStyle subtitle = const TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 13,
- color: AppColor.writeColor,
- );
+ fontWeight: FontWeight.normal,
+ fontSize: 16,
+ color: AppColor.writeColor,
+ fontFamily: box.read(BoxName.lang) == 'ar'
+ ? GoogleFonts.markaziText().fontFamily
+ : GoogleFonts.inter().fontFamily);
+ static TextStyle subtitle = TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 12,
+ color: AppColor.writeColor,
+ fontFamily: box.read(BoxName.lang) == 'ar'
+ ? GoogleFonts.markaziText().fontFamily
+ : GoogleFonts.inter().fontFamily);
static TextStyle number = const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
diff --git a/lib/controller/best_driver_controllers.dart b/lib/controller/best_driver_controllers.dart
new file mode 100644
index 0000000..c1da2a8
--- /dev/null
+++ b/lib/controller/best_driver_controllers.dart
@@ -0,0 +1,71 @@
+import 'dart:convert';
+
+import 'package:get/get.dart';
+
+import '../../constant/colors.dart';
+import '../../constant/links.dart';
+import '../print.dart';
+import 'functions/crud.dart';
+
+class Driverthebest extends GetxController {
+ bool isLoading = false;
+ List driver = [];
+ getBestDriver() async {
+ var res = await CRUD().get(link: AppLink.getBestDriver, payload: {});
+ if (res != 'failure') {
+ driver = jsonDecode(res)['message'];
+ // Log.print('driver: ${driver}');
+ update();
+ } else {
+ Get.snackbar('error', '', backgroundColor: AppColor.redColor);
+ }
+ }
+
+ @override
+ void onInit() {
+ getBestDriver();
+ super.onInit();
+ }
+}
+
+class DriverTheBestGizaController extends GetxController {
+ bool isLoading = false;
+ List driver = [];
+ getBestDriver() async {
+ var res = await CRUD().get(link: AppLink.getBestDriverGiza, payload: {});
+ if (res != 'failure') {
+ driver = jsonDecode(res)['message'];
+
+ update();
+ } else {
+ Get.snackbar('error', '', backgroundColor: AppColor.redColor);
+ }
+ }
+
+ @override
+ void onInit() {
+ getBestDriver();
+ super.onInit();
+ }
+}
+
+class DriverTheBestAlexandriaController extends GetxController {
+ bool isLoading = false;
+ List driver = [];
+ getBestDriver() async {
+ var res =
+ await CRUD().get(link: AppLink.getBestDriverAlexandria, payload: {});
+ if (res != 'failure') {
+ driver = jsonDecode(res)['message'];
+ update();
+ } else {
+ Get.snackbar('error', '', backgroundColor: AppColor.redColor);
+ }
+ }
+
+ @override
+ void onInit() {
+ getBestDriver();
+ super.onInit();
+ }
+}
diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart
index e87f75a..51d6f68 100644
--- a/lib/controller/functions/crud.dart
+++ b/lib/controller/functions/crud.dart
@@ -1,14 +1,52 @@
import 'dart:convert';
+import 'dart:io';
import 'package:http/http.dart' as http;
+import 'package:jwt_decoder/jwt_decoder.dart';
+import 'package:secure_string_operations/secure_string_operations.dart';
+import 'package:service/constant/char_map.dart';
import '../../constant/api_key.dart';
import '../../constant/box_name.dart';
+import '../../constant/info.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../../print.dart';
+import 'encrypt_decrypt.dart';
+import 'initilize.dart';
class CRUD {
+ var dev;
+ getJWT() async {
+ var dev = Platform.isAndroid ? 'android' : 'ios';
+ var payload = {
+ 'password': AK.passnpassenger,
+ // 'email': box.read(BoxName.email),
+ 'aud': '${AK.allowed}$dev',
+ };
+ // if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
+ var response0 = await http.post(
+ Uri.parse(AppLink.jwtService),
+ body: payload,
+ );
+
+ 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(Service.keyOfApp);
+ await AppInitializer().getAIKey(Service.initializationVector);
+ await Future.delayed(Duration.zero);
+ await EncryptionHelper.initialize();
+
+ await AppInitializer().getAIKey(Service.FCM_PRIVATE_KEY);
+ box.write(BoxName.firstTimeLoadKey, 'false');
+ // await AppInitializer().getKey();
+ } else {}
+ }
+
Future get({
required String link,
Map? payload,
@@ -16,18 +54,24 @@ class CRUD {
var url = Uri.parse(
link,
);
+ 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 getJWT();
+ }
var response = await http.post(
url,
body: payload,
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('response: ${response.body}');
- Log.print('response: ${response.request}');
- Log.print('payload: $payload');
+ print(response.body);
// if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
@@ -49,18 +93,14 @@ class CRUD {
String imagePathFull =
'${AppLink.server}/card_image/$imagePath-$driverID.jpg';
- Log.print('imagePathFull: $imagePathFull');
var request = http.Request(
'POST',
Uri.parse(
'https://eastus.api.cognitive.microsoft.com/computervision/imageanalysis:analyze?features=caption,read&model-version=latest&language=en&api-version=2024-02-01'));
request.body = json.encode({"url": imagePathFull});
- Log.print('request.body: ${request.body}');
request.headers.addAll(headers);
- Log.print('request.headers: ${request.headers}');
http.StreamedResponse response = await request.send();
- Log.print('response: ${response}');
if (response.statusCode == 200) {
return await response.stream.bytesToString();
@@ -131,27 +171,29 @@ class CRUD {
var url = Uri.parse(
link,
);
+ 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 getJWT();
+ }
var response = await http.post(
url,
body: payload,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
- 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
+ 'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
},
);
- Log.print('payload: ${payload}');
- Log.print('response.request: ${response.request}');
- Log.print('response.body: ${response.body}');
- Log.print('response.reasonPhrase: ${response.reasonPhrase}');
- // print(response.statusCode);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
return response.body;
} else {
String errorMessage = jsonData['message'];
- Log.print('errorMessage: ${errorMessage}');
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
return (jsonData['status']);
diff --git a/lib/controller/functions/encrypt_decrypt.dart b/lib/controller/functions/encrypt_decrypt.dart
new file mode 100644
index 0000000..4a97641
--- /dev/null
+++ b/lib/controller/functions/encrypt_decrypt.dart
@@ -0,0 +1,68 @@
+import 'package:encrypt/encrypt.dart' as encrypt;
+import 'package:flutter/foundation.dart';
+
+import '../../constant/box_name.dart';
+import '../../main.dart';
+
+class EncryptionHelper {
+ static EncryptionHelper? _instance;
+
+ late final encrypt.Key key;
+ late final encrypt.IV iv;
+
+ 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!;
+ }
+
+ /// Initializes and stores the instance globally
+ static Future 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));
+ final encrypted = encrypter.encrypt(plainText, iv: iv);
+ return encrypted.base64;
+ } catch (e) {
+ debugPrint('Encryption Error: $e');
+ return '';
+ }
+ }
+
+ /// Decrypts a string
+ String decryptData(String encryptedText) {
+ try {
+ final encrypter =
+ encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
+ final encrypted = encrypt.Encrypted.fromBase64(encryptedText);
+ return encrypter.decrypt(encrypted, iv: iv);
+ } catch (e) {
+ debugPrint('Decryption Error: $e');
+ return '';
+ }
+ }
+}
diff --git a/lib/controller/functions/initilize.dart b/lib/controller/functions/initilize.dart
new file mode 100644
index 0000000..26b1f25
--- /dev/null
+++ b/lib/controller/functions/initilize.dart
@@ -0,0 +1,44 @@
+import 'dart:convert';
+
+import 'package:jwt_decoder/jwt_decoder.dart';
+import 'package:secure_string_operations/secure_string_operations.dart';
+import 'package:service/controller/functions/crud.dart';
+
+import '../../constant/box_name.dart';
+import '../../constant/char_map.dart';
+import '../../constant/info.dart';
+import '../../constant/links.dart';
+import '../../env/env.dart';
+import '../../main.dart';
+import '../../print.dart';
+
+class AppInitializer {
+ List