This commit is contained in:
Hamza-Ayed
2024-06-22 13:12:35 +03:00
parent 1cc0156cfd
commit 3c5321f70b
67 changed files with 91 additions and 740 deletions

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode 32
versionName '1.5.32'
versionCode 35
versionName '1.5.35'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 KiB

After

Width:  |  Height:  |  Size: 4.6 MiB

View File

@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>33</string>
<string>35</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.0.33</string>
<string>4.0.35</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
<key>GMSApiKey</key>

View File

@@ -24,7 +24,6 @@ class AuthController extends GetxController {
await _auth.signInWithCredential(credential);
return userCredential.user;
} catch (error) {
print("Error during Apple sign-in: $error");
return null;
}
}

View File

@@ -26,7 +26,6 @@ class HistoryCaptainController extends GetxController {
payload: {'driver_id': box.read(BoxName.driverID)});
if (res != 'failure') {
historyData = jsonDecode(res);
print(historyData);
isloading = false;
update();
} else {
@@ -48,7 +47,6 @@ class HistoryCaptainController extends GetxController {
var res = await CRUD()
.get(link: AppLink.getRideOrderID, payload: {'id': orderId});
historyDetailsData = jsonDecode(res);
print(historyDetailsData);
isloading = false;
update();
Get.to(() => HistoryDetailsPage());

View File

@@ -4,7 +4,6 @@ import 'dart:math';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/controller/functions/location_background_controller.dart';
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
import 'package:SEFER/views/auth/captin/register_captin.dart';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:get/get.dart';
@@ -30,7 +29,6 @@ class LoginCaptinController extends GetxController {
final location = Location();
void changeAgreeTerm() {
isAgreeTerms = !isAgreeTerms;
print(isAgreeTerms);
update();
}
@@ -58,7 +56,6 @@ class LoginCaptinController extends GetxController {
'phone': phoneController.text,
'password': passwordController.text
});
print(res);
if (res == 'failure') {
//Failure
isloading = false;
@@ -66,10 +63,8 @@ class LoginCaptinController extends GetxController {
Get.snackbar('Failure', '', backgroundColor: Colors.red);
} else {
var jsonDecoeded = jsonDecode(res);
// print(jsonDecoeded);
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success') {
print(jsonDecoeded['data'][0]['verified']);
if (jsonDecoeded['data'][0]['verified'] == 1) {
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
@@ -81,12 +76,10 @@ class LoginCaptinController extends GetxController {
Get.offAll(() => HomeCaptain());
isloading = false;
update();
print(box.read(BoxName.driverID).toString());
print(box.read(BoxName.tokenDriver));
await CRUD().post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
}).then((value) => print('cccc'));
});
} else {
isloading = false;
update();
@@ -99,7 +92,7 @@ class LoginCaptinController extends GetxController {
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
'email': emailController.text,
'token': randomNumber.toString(),
}).then((value) => print(value));
});
Get.to(() => VerifyEmailCaptainPage());
},
);
@@ -111,7 +104,6 @@ class LoginCaptinController extends GetxController {
update();
}
} else {
print('res is null');
isloading = false;
update();
}
@@ -125,7 +117,6 @@ class LoginCaptinController extends GetxController {
'email': email,
'id': driverID,
});
print(res);
if (res == 'Failure') {
//Failure
Get.offAll(() => SmsSignupEgypt());
@@ -134,7 +125,6 @@ class LoginCaptinController extends GetxController {
// Get.snackbar('Failure', '', backgroundColor: Colors.red);
} else {
var jsonDecoeded = jsonDecode(res);
// print(jsonDecoeded['data'][0]['is_verified']);
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'] == 1) {
@@ -147,12 +137,10 @@ class LoginCaptinController extends GetxController {
'${jsonDecoeded['data'][0]['first_name']}'
' ${jsonDecoeded['data'][0]['last_name']}');
print(box.read(BoxName.tokenDriver));
var token = await CRUD().get(
link: AppLink.getDriverToken,
payload: {'captain_id': box.read(BoxName.driverID).toString()});
print(token);
print(box.read(BoxName.tokenDriver));
if (token != 'failure') {
if (jsonDecode(token)['data'][0]['token'] !=
box.read(BoxName.tokenDriver)) {
@@ -165,7 +153,7 @@ class LoginCaptinController extends GetxController {
await CRUD().post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
}).then((value) => print('cccc'));
});
}
}
@@ -178,7 +166,6 @@ class LoginCaptinController extends GetxController {
update();
}
} else {
print('res is null');
Get.snackbar('failure'.tr, '', backgroundColor: AppColor.redColor);
isloading = false;
update();

View File

@@ -85,19 +85,15 @@ class CarRegistrationRecognizerController extends GetxController {
}
String result = lines.map((map) => map.values.first.toString()).join(' ');
// print(result.length);
if (result.length > 2200) {
result = result.substring(0, 2200);
}
// print('jsonOutput------------------------------');
// print(result);
Map result2 = await LlamaAi().getCarRegistrationData(result,
'vin,make,made,year,expiration_date,color,owner,registration_date'); //
// Assign the result to the extracted variable
extracted = result2;
print('extracted is ' + extracted.toString());
update();
}
}

View File

@@ -178,7 +178,6 @@ class RegisterCaptainController extends GetxController {
'expireDate': expireDate,
'dateOfBirth': dob,
});
print(jsonDecode(res));
isLoading = false;
update();
if (jsonDecode(res)['status'] == 'success') {
@@ -199,7 +198,6 @@ class RegisterCaptainController extends GetxController {
'owner': owner,
'registrationDate': registrationDate,
});
print(jsonDecode(res));
box.write(BoxName.vin, vin);
box.write(BoxName.make, make);
box.write(BoxName.model, model);
@@ -243,7 +241,7 @@ class RegisterCaptainController extends GetxController {
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
'email': emailController.text,
'token': randomNumber.toString(),
}).then((value) => print(value));
});
Get.to(() => VerifyEmailCaptainPage());
}
}

View File

@@ -30,7 +30,6 @@ class GoogleSignInHelper {
}
return googleUser;
} catch (error) {
print('Google Sign-In error: $error');
return null;
}
}
@@ -51,7 +50,6 @@ class GoogleSignInHelper {
}
return googleUser;
} catch (error) {
print('Google Sign-In error: $error');
return null;
}
}
@@ -61,10 +59,7 @@ class GoogleSignInHelper {
try {
await _googleSignIn.signOut();
await _handleSignOut();
print('User signed out.');
} catch (error) {
print('Google Sign-Out error: $error');
}
} catch (error) {}
}
static Future<void> _handleSignOut() async {
@@ -88,8 +83,6 @@ class GoogleSignInHelper {
Get.offAll(OnBoardingPage());
// Perform any additional sign-out tasks or API calls here
// For example, you can notify your server about the user sign-out
print('User data cleared.');
}
// Method to get the current signed-in user
@@ -107,10 +100,5 @@ class GoogleSignInHelper {
// Perform any additional sign-up tasks or API calls here
// For example, you can send the user data to your server for registration
print('driverID = ${box.read(BoxName.driverID)}');
print('emailDriver = ${box.read(BoxName.emailDriver)}');
// print('nameDriver = ${box.read(BoxName.nameDriver)}');
// print('driverPhotoUrl = ${box.read(BoxName.driverPhotoUrl)}');
}
}

View File

@@ -1,5 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:flutter/material.dart';
@@ -12,8 +11,6 @@ import 'package:SEFER/controller/functions/secure_storage.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/verify_email_page.dart';
import '../functions/device_info.dart';
class LoginController extends GetxController {
final formKey = GlobalKey<FormState>();
final formKeyAdmin = GlobalKey<FormState>();
@@ -28,7 +25,6 @@ class LoginController extends GetxController {
void changeAgreeTerm() {
isAgreeTerms = !isAgreeTerms;
print(isAgreeTerms);
update();
}
@@ -56,12 +52,9 @@ class LoginController extends GetxController {
//Failure
Get.snackbar('Failure', '', backgroundColor: Colors.red);
} else {
// print(res);
var jsonDecoeded = jsonDecode(res);
// print(jsonDecoeded);
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success') {
print(jsonDecoeded['data'][0]['verified']);
if (jsonDecoeded['data'][0]['verified'] == 1) {
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
@@ -75,12 +68,10 @@ class LoginController extends GetxController {
// Get.offAll(() => const MapPagePassenger());
isloading = false;
update();
print(box.read(BoxName.passengerID).toString());
print(box.read(BoxName.tokenFCM));
await CRUD().post(link: AppLink.addTokens, payload: {
'token': box.read(BoxName.tokenFCM),
'passengerID': box.read(BoxName.passengerID).toString()
}).then((value) => print('cccc'));
});
} else {
isloading = false;
update();
@@ -93,7 +84,7 @@ class LoginController extends GetxController {
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
'email': emailController.text,
'token': randomNumber.toString(),
}).then((value) => print(value));
});
Get.to(() => const VerifyEmailPage());
},
);
@@ -105,7 +96,6 @@ class LoginController extends GetxController {
update();
}
} else {
print('res is null');
isloading = false;
update();
}

View File

@@ -83,14 +83,12 @@ class RegisterController extends GetxController {
'site': siteController.text,
'birthdate': birthDate,
});
print(jsonDecode(res));
if (jsonDecode(res)['status'] == 'success') {
print('sdfffffffffff');
int randomNumber = Random().nextInt(100000) + 1;
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
'email': emailController.text,
'token': randomNumber.toString(),
}).then((value) => print(value));
});
Get.to(() => const VerifyEmailPage());
}
}

View File

@@ -29,10 +29,7 @@ class TokenController extends GetxController {
isloading = false;
update();
print(res.request);
print(res.body);
var jsonToken = jsonDecode(res.body);
// print(jsonToken);
if (jsonToken['status'] == 'The token has been updated successfully.') {
Get.snackbar('token updated'.tr, '');
}

View File

@@ -32,8 +32,7 @@ class FirebaseMessagesController extends GetxController {
// Get the current notification settings
NotificationSettings? notificationSettings =
await FirebaseMessaging.instance.getNotificationSettings();
print(
'Notification authorization status: ${notificationSettings.authorizationStatus}');
'Notification authorization status: ${notificationSettings.authorizationStatus}';
// Call the update function if needed
update();
@@ -57,7 +56,6 @@ class FirebaseMessagesController extends GetxController {
provisional: false,
sound: true,
);
print('User granted permission: ${settings.authorizationStatus}');
messaging.setForegroundNotificationPresentationOptions(
alert: true, badge: true, sound: true);
}
@@ -66,8 +64,6 @@ class FirebaseMessagesController extends GetxController {
Future getToken() async {
fcmToken.getToken().then((token) {
box.write(BoxName.tokenDriver, token);
print(token);
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
@@ -82,14 +78,12 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
// Handle background message
if (message.data.isNotEmpty && message.notification != null) {
print(message.notification?.title);
fireBaseTitles(message);
}
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
if (message.data.isNotEmpty && message.notification != null) {
print(message.notification?.title);
fireBaseTitles(message);
}
});
@@ -109,7 +103,6 @@ class FirebaseMessagesController extends GetxController {
// This is for location using and uploading status
Get.put(HomeCaptainController()).changeRideId();
update();
// print('driverToken==============$driverToken');
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'DriverList': myList,
@@ -153,9 +146,7 @@ class FirebaseMessagesController extends GetxController {
// token: driverList[0].toString(),
// remoteID: driverList[2].toString(),
// ));
} catch (e) {
print('Error navigating to PassengerCallPage: $e');
}
} catch (e) {}
} else if (message.notification!.title! == 'Call Income from Passenger') {
try {
var myListString = message.data['passengerList'];
@@ -173,9 +164,7 @@ class FirebaseMessagesController extends GetxController {
// token: driverList[0].toString(),
// remoteID: driverList[2].toString(),
));
} catch (e) {
print('Error navigating to PassengerCallPage: $e');
}
} catch (e) {}
} else if (message.notification!.title! == 'Call End') {
try {
var myListString = message.data['passengerList'];
@@ -189,9 +178,7 @@ class FirebaseMessagesController extends GetxController {
}
// Assuming GetMaterialApp is initialized and context is valid for navigation
Get.off(const CallPage());
} catch (e) {
print('Error navigating to PassengerCallPage: $e');
}
} catch (e) {}
} else if (message.notification!.title! == 'Order Applied') {
Get.snackbar(
"The order has been accepted by another driver."
@@ -209,7 +196,6 @@ class FirebaseMessagesController extends GetxController {
// var myPoints = jsonDecode(points) as List<dynamic>;
driverToken = myList[14].toString();
update();
// print('driverToken==============$driverToken');
Get.to(() => OrderSpeedRequest(), arguments: {
'myListString': myListString,
'DriverList': myList,
@@ -364,7 +350,6 @@ class FirebaseMessagesController extends GetxController {
// Save the list of tokens back to the box.
// box.write(BoxName.tokens, tokens);
tokens = box.read(BoxName.tokens);
// print(tokens);
for (var i = 0; i < tokens.length; i++) {
http
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -387,9 +372,7 @@ class FirebaseMessagesController extends GetxController {
'to': tokens[i],
}))
.whenComplete(() {})
.catchError((e) {
print('sendNotification() error: $e');
});
.catchError((e) {});
}
}
@@ -416,7 +399,6 @@ class FirebaseMessagesController extends GetxController {
// }))
// .whenComplete(() {})
// .catchError((e) {
// print('sendNotification() error: $e');
// });
// }
// }
@@ -446,15 +428,12 @@ class FirebaseMessagesController extends GetxController {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
'Failed to send notification. Status code: ${response.statusCode}';
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
@@ -483,15 +462,12 @@ class FirebaseMessagesController extends GetxController {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
'Failed to send notification. Status code: ${response.statusCode}';
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
@@ -522,15 +498,12 @@ class FirebaseMessagesController extends GetxController {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
'Failed to send notification. Status code: ${response.statusCode}';
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
@@ -560,15 +533,12 @@ class FirebaseMessagesController extends GetxController {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
'Failed to send notification. Status code: ${response.statusCode}';
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
@@ -599,15 +569,12 @@ class FirebaseMessagesController extends GetxController {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
'Failed to send notification. Status code: ${response.statusCode}';
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
}

View File

@@ -31,9 +31,6 @@ class CallController extends GetxController {
}
initAgoraFull() async {
print('channelName is $channelName');
print('remoteid is $remoteUid');
print('uid is $uid');
await fetchToken();
// Set up an instance of Agora engine
setupVoiceSDKEngine();
@@ -65,8 +62,6 @@ class CallController extends GetxController {
//create an instance of the Agora engine
agoraEngine = createAgoraRtcEngine();
await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
print('eeeeeeeeeeeeeeeeeeee');
print(agoraEngine);
// Register the event handler
agoraEngine.registerEventHandler(
RtcEngineEventHandler(
@@ -129,7 +124,6 @@ class CallController extends GetxController {
var res = await CRUD()
.getAgoraToken(channelName: channelName, uid: uid.toString());
token = res;
print('token is $token');
update();
}
}

View File

@@ -91,10 +91,7 @@ class CameraClassController extends GetxController {
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<String> uploadImage(File imageFile) async {
@@ -164,12 +161,9 @@ class CameraClassController extends GetxController {
update();
// Print the JSON output
print(jsonOutput);
// Get.back();
} catch (e) {
print('Error capturing image: $e');
}
} catch (e) {}
}
String getTextAsJSON(String text) {
@@ -228,11 +222,8 @@ class CameraClassController extends GetxController {
// textBlocks.toString(); // Convert the extracted text to JSON.
// // Print the JSON to the console.
// print(jsonText);
// update();
// // print(text);
// } catch (e) {
// print('Error during text extraction: $e');
// scannedText = '';
// }
// }

View File

@@ -27,15 +27,9 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
},
);
print("-----request----" + response.request.toString());
// print("-----headers-----" + response.headers.toString());
print("-----payload-----" + payload.toString());
// if (response.statusCode == 200) {
// print(response.body);
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
print(jsonData);
return response.body;
}
@@ -55,11 +49,8 @@ class CRUD {
if (res.statusCode == 200) {
var response = jsonDecode(res.body);
print(await response);
return response['token'];
} else {
print(res.reasonPhrase);
}
} else {}
}
Future<dynamic> getLlama({
@@ -105,10 +96,8 @@ class CRUD {
Future.delayed(const Duration(seconds: 2));
var extractedString =
await arabicTextExtractByVisionAndAI(imagePath: imagePath);
// print(extractedString);
var json = jsonDecode(extractedString);
var textValues = extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
}
@@ -152,11 +141,8 @@ class CRUD {
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
// print(await response.stream.bytesToString());
return await response.stream.bytesToString();
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<dynamic> getChatGPT({
@@ -210,12 +196,8 @@ class CRUD {
},
);
if (response.statusCode == 200) {
print(response);
return response.body;
} else {
print('eeeeeeeeerrrrorrrr ${response.statusCode}');
print(response.body);
}
} else {}
}
Future<dynamic> post({
@@ -236,11 +218,8 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
print(response.request);
print(payload);
var jsonData = jsonDecode(response.body);
print(jsonData);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
return response.body;
@@ -248,7 +227,6 @@ class CRUD {
String errorMessage = jsonData['message'];
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
print(errorMessage.tr);
return (jsonData['status']);
}
} else {
@@ -267,11 +245,8 @@ class CRUD {
);
var response = await http.post(url,
body: payload, headers: {'Content-Type': 'application/json'});
print(response.request);
print(payload);
var jsonData = jsonDecode(response.body);
// print(jsonData);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
return response.body;
@@ -297,13 +272,8 @@ class CRUD {
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
// print(request.body);
// print(response);
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<dynamic> postFromDialogue({
@@ -324,9 +294,6 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
//print(response.request);
//print('body=========================');
//print(response.body);
if (response.body.isNotEmpty) {
var jsonData = jsonDecode(response.body);
@@ -368,10 +335,7 @@ class CRUD {
);
if (response.statusCode == 201) {
print('Verification request sent');
} else {
print('Failed to send verification request');
}
} else {}
// Prompt the user to enter the OTP
final otpCode = "123456"; // Replace with user input
@@ -394,10 +358,7 @@ class CRUD {
);
if (checkResponse.statusCode == 201) {
print('Verification successful');
} else {
print('Verification failed');
}
} else {}
}
Future<dynamic> getGoogleApi({
@@ -411,9 +372,7 @@ class CRUD {
url,
body: payload,
);
print(response.request);
var jsonData = jsonDecode(response.body);
// //print(jsonData);
if (jsonData['status'] == 'OK') {
return jsonData;
}

View File

@@ -20,6 +20,5 @@ class DeviceController {
deviceSerialNumber = iosInfo.identifierForVendor!;
box.write(BoxName.deviceInfo, deviceSerialNumber.toString());
}
print(deviceSerialNumber);
}
}

View File

@@ -208,20 +208,6 @@ class AI extends GetxController {
Future<void> addDriverEgypt() async {
try {
print(box.read(BoxName.driverID).toString());
print(box.read(BoxName.phoneDriver)?.toString() ?? '');
print(responseIdEgyptBack['gender']);
print(responseIdEgyptDriverLicense['license_type']);
print(responseIdEgyptBack['nationalID']);
print(responseIdEgyptDriverLicense['issue_date']);
print(responseIdEgyptDriverLicense['expiry_date']);
print(responseIdEgyptDriverLicense['license_categories']);
print(responseIdEgyptFront['card_id']);
print(responseIdEgyptDriverLicense['issue_date']);
print(responseIdEgyptFront['dob'] != null
? responseIdEgyptFront['dob'] + '-01-01'.toString()
: '');
// Extract values from box or set defaults
var firstName = responseIdEgyptDriverLicense['firstName'] ?? '';
var lastName = responseIdEgyptDriverLicense['lastName'] ?? '';
@@ -282,7 +268,6 @@ class AI extends GetxController {
'site': site,
'employmentType': employmentType,
};
print(payload);
isLoading = true;
update();
// Make POST request
@@ -292,7 +277,6 @@ class AI extends GetxController {
update();
// Handle response
print(status1);
if (status1['status'] == 'success') {
isDriverSaved = true;
Get.snackbar('Success', 'Driver data saved successfully',
@@ -302,7 +286,6 @@ class AI extends GetxController {
backgroundColor: Colors.red);
}
} catch (e) {
print('Error: $e');
Get.snackbar('Error', 'An error occurred while saving driver data',
backgroundColor: Colors.red);
}
@@ -338,9 +321,7 @@ class AI extends GetxController {
Get.snackbar('Success', 'message',
backgroundColor: AppColor.greenColor);
}
} catch (e) {
print('error is $e');
}
} catch (e) {}
}
final picker = ImagePicker();
@@ -414,10 +395,8 @@ class AI extends GetxController {
Future.delayed(const Duration(seconds: 2));
var extractedString =
await CRUD().arabicTextExtractByVisionAndAI(imagePath: imagePath);
// print(extractedString);
var json = jsonDecode(extractedString);
var textValues = CRUD().extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues, imagePath);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
isLoading = false;
@@ -473,7 +452,6 @@ class AI extends GetxController {
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -485,13 +463,9 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -499,19 +473,11 @@ class AI extends GetxController {
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
print(jsonString);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<dynamic> anthropicAI(
@@ -533,9 +499,6 @@ class AI extends GetxController {
"messages": messagesData,
});
print('requestBody');
print(requestBody);
final response = await http.post(
Uri.parse('https://api.anthropic.com/v1/messages'),
headers: {
@@ -549,29 +512,22 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(utf8.decode(response.bodyBytes));
// Process the responseData as needed
print(utf8.decode(response.bodyBytes));
if (idType == 'car_back') {
responseIdCardDriverEgyptBack =
jsonDecode(responseData['content'][0]['text']);
print(responseIdCardDriverEgyptBack);
} else if (idType == 'car_front') {
responseIdCardDriverEgyptFront =
jsonDecode(responseData['content'][0]['text']);
print(responseIdCardDriverEgyptFront);
} else if (idType == 'id_front') {
responseIdEgyptFront = jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptFront);
} else if (idType == 'id_back') {
responseIdEgyptBack = jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptBack);
} else if (idType == 'driver_license') {
responseIdEgyptDriverLicense =
jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptDriverLicense);
} else if (idType == 'criminalRecord') {
responseCriminalRecordEgypt =
jsonDecode(responseData['content'][0]['text']);
print(responseCriminalRecordEgypt);
}
update();
@@ -615,7 +571,6 @@ class AI extends GetxController {
}
]
});
// print(requestBody);
final response = await http.post(
Uri.parse(
@@ -629,12 +584,8 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -645,33 +596,24 @@ class AI extends GetxController {
if (idType == 'car_back') {
responseIdCardDriverEgyptBack = jsonDecode(jsonString);
print(responseIdCardDriverEgyptBack);
} else if (idType == 'car_front') {
responseIdCardDriverEgyptFront = jsonDecode(jsonString);
print(responseIdCardDriverEgyptFront);
} else if (idType == 'id_front') {
responseIdEgyptFront = jsonDecode(jsonString);
print(responseIdEgyptFront);
} else if (idType == 'id_back') {
responseIdEgyptBack = jsonDecode(jsonString);
print(responseIdEgyptBack);
} else if (idType == 'driver_license') {
responseIdEgyptDriverLicense = jsonDecode(jsonString);
print(responseIdEgyptDriverLicense);
}
update();
} else {
print("JSON string not found");
Get.snackbar('Error', "JSON string not found",
backgroundColor: AppColor.redColor);
}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {}
}
Future<void> getDriverLicenseJordanContent() async {
@@ -725,7 +667,6 @@ class AI extends GetxController {
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -738,13 +679,9 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -753,21 +690,11 @@ class AI extends GetxController {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseMap = jsonDecode(jsonString);
print(jsonString);
print(responseMap);
print(responseMap['dob']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> getCarLicenseJordanContent() async {
@@ -826,7 +753,6 @@ Output the extracted information in the following JSON format''',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -840,13 +766,9 @@ Output the extracted information in the following JSON format''',
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -855,21 +777,11 @@ Output the extracted information in the following JSON format''',
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> jordanID() async {
@@ -928,7 +840,6 @@ Output the extracted information in the following JSON format''',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -941,13 +852,9 @@ Output the extracted information in the following JSON format''',
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -956,21 +863,11 @@ Output the extracted information in the following JSON format''',
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> carLicenseJordan() async {
@@ -1038,7 +935,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1051,13 +947,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1066,21 +958,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future getTextFromCard(String prompt) async {
@@ -1133,7 +1015,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1146,13 +1027,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1161,21 +1038,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseBackCarLicenseMap = jsonDecode(jsonString);
// print(jsonString);
print(responseBackCarLicenseMap);
// print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> generateBackCarLicenseJordanContent() async {
@@ -1229,7 +1096,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1242,13 +1108,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1257,21 +1119,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseBackCarLicenseMap = jsonDecode(jsonString);
// print(jsonString);
print(responseBackCarLicenseMap);
// print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> getFromCarRegistration() async {
@@ -1323,7 +1175,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1337,7 +1188,6 @@ Output the extracted information in the following JSON formate and make date for
// Process the responseData as needed
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
print(result);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1345,19 +1195,11 @@ Output the extracted information in the following JSON formate and make date for
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
print(jsonString);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
@override

View File

@@ -4,9 +4,7 @@ import 'dart:io';
void showInBrowser(String url) async {
if (await canLaunchUrl(Uri.parse(url))) {
launchUrl(Uri.parse(url));
} else {
print('Could not launch $url');
}
} else {}
}
void launchCommunication(
@@ -30,7 +28,6 @@ void launchCommunication(
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
break;
default:
print('Method not supported on iOS');
return;
}
} else if (Platform.isAndroid) {
@@ -49,7 +46,6 @@ void launchCommunication(
url =
'whatsapp://send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
} else {
print('WhatsApp is not installed on this device.');
// Provide an alternative action, such as opening the WhatsApp Web API
url =
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
@@ -60,19 +56,13 @@ void launchCommunication(
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
break;
default:
print('Method not supported on Android');
return;
}
} else {
print('Platform not supported');
return;
}
print('Launching URL: $url');
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
print('Could not launch $url');
}
} else {}
}

View File

@@ -6,21 +6,15 @@ import 'package:SEFER/controller/functions/gemeni.dart';
class LlamaAi {
Future<Map> getCarRegistrationData(String input, prompt) async {
print(true);
Map exrtatDataFinal = {};
String oneLine = input.replaceAll('\n', ' ');
// print(oneLine);
// var res = await CRUD().getLlama(link: AppLink.gemini, payload: oneLine);
var res = await CRUD()
.getLlama(link: AppLink.llama, payload: oneLine, prompt: prompt);
print(res);
var decod = jsonDecode(res.toString());
print(decod);
// exrtatDataFinal = jsonDecode(extractDataFromJsonString(decod['choices']));
extractDataFromJsonString(decod['choices'][0]['message']['content']);
print(jsonEncode(exrtatDataFinal));
print(false);
return exrtatDataFinal;
}
@@ -38,7 +32,6 @@ class LlamaAi {
// Return the extracted data
// print(jsonEncode(jsonData));
return jsonEncode(jsonData);
}
}

View File

@@ -29,7 +29,6 @@ class LocationBackgroundController extends GetxController {
BackgroundLocation.startLocationService();
BackgroundLocation.getLocationUpdates((location) {
// Handle location updates here
print("New location: ${location.latitude}, ${location.longitude}");
});
}
@@ -47,21 +46,9 @@ class LocationBackgroundController extends GetxController {
BackgroundLocation.setAndroidConfiguration(
Duration.microsecondsPerSecond); // Set interval to 5 seconds
BackgroundLocation.getLocationUpdates((location1) {
print('''\n
Latitude: ${location1.latitude.toString()}
Longitude: ${location1.longitude.toString()}
Altitude: ${location1.altitude.toString()}
Accuracy: ${location1.accuracy.toString()}
Bearing: ${location1.bearing.toString()}
Speed: ${location1.speed.toString()}
''');
});
BackgroundLocation.getLocationUpdates((location1) {});
} else {
await Permission.locationAlways.request();
print('Location permission not granted');
}
}
}

View File

@@ -49,12 +49,8 @@ class LocationController extends GetxController {
try {
totalPoints = Get.find<CaptainWalletController>().totalPoints;
isActive = Get.find<HomeCaptainController>().isActive;
print('isActive $isActive');
print(totalPoints);
if (isActive) {
if (double.parse(totalPoints) > -300) {
print('total point is $totalPoints');
await getLocation();
// if (box.read(BoxName.driverID) != null) {
@@ -110,7 +106,6 @@ class LocationController extends GetxController {
// }
} catch (e) {
// Handle the error gracefully
print('Error during location updates: $e');
}
});
}
@@ -162,21 +157,12 @@ class LocationController extends GetxController {
if (previousTime > 0) {
double distance = calculateDistanceInKmPerHour(
previousTime, _locationData.time, speed);
print('distance $distance');
totalDistance += distance;
}
// print('totalDistance: $totalDistance');
previousTime = _locationData.time!;
}
// Print location details
// print('myLocation: ${myLocation}');
// print('Accuracy: ${_locationData.accuracy}');
// print('Latitude: ${_locationData.latitude}');
// print('Longitude: ${_locationData.longitude}');
// print('Time: ${_locationData.time}');
print('speed: ${_locationData.speed}');
// print('Heading: ${_locationData.heading}');
// isLoading = false;
update();
}

View File

@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
@@ -83,11 +82,8 @@ import 'launch.dart';
// // textBlocks.toString(); // Convert the extracted text to JSON.
//
// // // Print the JSON to the console.
// // print(jsonText);
// // update();
// // // print(text);
// // } catch (e) {
// // print('Error during text extraction: $e');
// // extractedText = '';
// // }
// // }
@@ -214,8 +210,6 @@ import 'launch.dart';
// decode = jsonDecode(jsonOutput!);
//
// update();
// print('jsonOutput------------------------------');
// print(scannedText);
// }
// }
@@ -287,7 +281,6 @@ class ScanDocumentsByApi extends GetxController {
// String? visionApi = await storage.read(key: BoxName.visionApi);
// String? visionApi = AK.visionApi;
// Pick an image from the camera or gallery
// print(visionApi);
image = await imagePicker.pickImage(source: ImageSource.camera); //
// If no image was picked, return
@@ -351,12 +344,9 @@ class ScanDocumentsByApi extends GetxController {
// Handle error or provide a default value
}
// print(responseMap);
isLoading = false;
update();
} else {
print(response.reasonPhrase);
}
} else {}
}
late int times;
@@ -425,13 +415,9 @@ class ScanDocumentsByApi extends GetxController {
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
print('Request: ${request.toString()}');
print('Response Status Code: ${response.statusCode}');
print('Response Reason Phrase: ${response.reasonPhrase}');
if (response.statusCode == 200) {
res = jsonDecode(await response.stream.bytesToString());
print(res);
update();
res['data']['result'].toString().contains('No face detected in image')
@@ -494,9 +480,7 @@ class ScanDocumentsByApi extends GetxController {
// },
kolor: AppColor.greenColor,
));
} else {
print(response.reasonPhrase);
}
} else {}
}
// Todo upload images and fields
@@ -529,7 +513,6 @@ class ScanDocumentsByApi extends GetxController {
update();
// Print the response string
print(responseString);
return responseString;
}
@@ -540,9 +523,7 @@ class ScanDocumentsByApi extends GetxController {
// initializeCamera(0);
sql.getAllData(TableName.faceDetectTimes).then((value) {
if (value.isEmpty) {
print(value);
times = 0;
print(times);
update();
// sql.insertData({'faceDetectTimes': 1}, TableName.faceDetectTimes);
} else {
@@ -620,7 +601,6 @@ class ScanDocumentsByApi extends GetxController {
//
// extractedData['extractedTextWithCoordinates'] =
// extractedTextWithCoordinates;
// print(jsonEncode(extractedData));
// return extractedData;
// }
// }
@@ -636,9 +616,7 @@ class ScanDocumentsByApi extends GetxController {
// extractedTextWithCoordinates =
// extractedData['extractedTextWithCoordinates'];
// update(); // Notify GetX that the state has changed
// print(extractedTextWithCoordinates);
// } catch (e) {
// print('Passport data extraction failed: $e');
// }
// }
// }

View File

@@ -28,10 +28,6 @@ class SmsEgyptController extends GetxController {
headers: headers,
);
print(res.reasonPhrase);
print(res.request);
print(res.body);
print(body);
if (res.statusCode == 200) {
Get.defaultDialog(
title: 'You will recieve code in sms message'.tr,
@@ -53,7 +49,6 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
Future sendSmsWithValidaty(String phone, otp) async {
@@ -71,7 +66,6 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
Future sendSmsStatus(String smsid) async {
@@ -84,6 +78,5 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
}

View File

@@ -47,7 +47,6 @@ class TextToSpeechController extends GetxController {
} catch (error) {
// Handle error gracefully, e.g., show a message
Get.snackbar('Error', 'Failed to speak text: $error');
print('Failed to speak text: $error');
}
}
}

View File

@@ -17,7 +17,6 @@
// messageBody: message,
// );
// } catch (e) {
// print(e); // Print the exception to the console.
// }
// }
// }

View File

@@ -54,7 +54,6 @@ class ImageController extends GetxController {
update();
// Save the cropped image
File savedCroppedImage = File(croppedFile!.path);
print('link =$link');
try {
await uploadImage(
savedCroppedImage,
@@ -68,7 +67,6 @@ class ImageController extends GetxController {
} catch (e) {
Get.snackbar('Image Upload Failed'.tr, e.toString(),
backgroundColor: AppColor.redColor);
print(e);
} finally {
isloading = false;
update();

View File

@@ -40,12 +40,10 @@ class DurationController extends GetxController {
payload: {'driverID': box.read(BoxName.driverID)});
if (res == 'failure') {
monthlyList = [];
print('monthlyList $monthlyList');
isLoading = false;
update();
} else {
monthlyList = jsonDecode(res)['message'];
print(monthlyList);
isLoading = false;
update();
}
@@ -62,7 +60,6 @@ class DurationController extends GetxController {
jsonData1 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideData = jsonData.map<MonthlyDataModel>((item) {
return MonthlyDataModel.fromJson(item);
@@ -90,7 +87,6 @@ class DurationController extends GetxController {
jsonData2 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideCountData = jsonData.map<MonthlyRideModel>((item) {
return MonthlyRideModel.fromJson(item);

View File

@@ -33,7 +33,6 @@ class HelpController extends GetxController {
'helpQuestion': helpQuestionController.text
});
var d = jsonDecode(res);
// print(d);
isLoading = false;
update();
if (d['status'].toString() == 'success') {
@@ -51,7 +50,6 @@ class HelpController extends GetxController {
'driverID': box.read(BoxName.driverID).toString(),
});
if (res == "failure") {
// print(res);
isLoading = false;
update();
Get.defaultDialog(
@@ -76,7 +74,6 @@ class HelpController extends GetxController {
var res = await CRUD().get(link: AppLink.getByIdhelpCenter, payload: {
'id': id,
});
print(res);
if (res == "failure") {
status = 'not yet';
isLoading = false;

View File

@@ -124,7 +124,6 @@ class HomeCaptainController extends GetxController {
countRefuse = results[0]['count'].toString();
update();
if (int.parse(countRefuse) > 3 || double.parse(totalPoints) <= -300) {
print('total point is $totalPoints');
locationController.stopLocationUpdates();
activeStartTime = null;
activeTimer?.cancel();
@@ -148,9 +147,7 @@ class HomeCaptainController extends GetxController {
Get.back();
}));
}
} catch (e) {
print('Error executing custom query: $e');
}
} catch (e) {}
}
void changeMapType() {
@@ -207,13 +204,11 @@ class HomeCaptainController extends GetxController {
}
void stopTimer() {
print('Stopping timer');
timer?.cancel();
}
getlocation() async {
isLoading = true;
print('isLoading $isLoading');
update();
await Get.find<LocationController>().getLocation();
isLoading = false;
@@ -244,7 +239,7 @@ class HomeCaptainController extends GetxController {
await CRUD().post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
}).then((value) => print('Token Added'));
});
MapDriverController().driverCallPassenger();
// box.write(BoxName.statusDriverLocation, 'off');
}
@@ -258,9 +253,7 @@ class HomeCaptainController extends GetxController {
totalMoneyToday = data['message'][0]['todayAmount'];
update();
} else {
print(res);
}
} else {}
}
getKazanPercent() async {
@@ -279,7 +272,6 @@ class HomeCaptainController extends GetxController {
deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
mashwariPrice = double.parse(json['message'][0]['freePrice']);
fuelPrice = double.parse(json['message'][0]['fuelPrice']);
print(json);
}
}
@@ -295,7 +287,6 @@ class HomeCaptainController extends GetxController {
data = jsonDecode(res);
countRideToday = data['message'][0]['count'].toString();
// print(countRideToday);
update();
}

View File

@@ -173,11 +173,8 @@ class MapDriverController extends GetxController {
remainingTimeToPassenger = int.parse(durationToPassenger) - i;
if (remainingTimeToPassenger == 0) {
isBtnRideBegin = true;
print(isBtnRideBegin);
update();
}
print(isBtnRideBegin);
print(remainingTimeToPassenger);
int minutes = (remainingTimeToPassenger / 60).floor();
int seconds = remainingTimeToPassenger % 60;
@@ -205,12 +202,9 @@ class MapDriverController extends GetxController {
}
if (remainingTimeInPassengerLocatioWait == 0) {
isdriverWaitTimeEnd = true;
print(isdriverWaitTimeEnd);
update();
}
print(isdriverWaitTimeEnd);
print(
'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait');
'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait';
int minutes = (remainingTimeInPassengerLocatioWait / 60).floor();
int seconds = remainingTimeInPassengerLocatioWait % 60;
@@ -267,13 +261,10 @@ class MapDriverController extends GetxController {
'driverID': box.read(BoxName.driverID),
});
if (res == 'failure') {
print('Scam is failure');
box.write(BoxName.statusDriverLocation, 'off');
return '0';
}
var d = jsonDecode(res);
print('Scam is ');
print(d['message'][0]['count']);
return d['message'][0]['count'];
}
@@ -411,7 +402,6 @@ class MapDriverController extends GetxController {
'token': paymentTokenWait1,
'driverID': box.read(BoxName.driverID).toString(),
});
print(res1);
if (res != 'failure') {
Get.snackbar(
'You will get cost of your work for this trip'.tr,
@@ -458,7 +448,6 @@ class MapDriverController extends GetxController {
'amount': amount.toString(),
});
var d = jsonDecode(res);
print('paymentToken ${d['message']}');
return d['message'];
}
@@ -470,7 +459,6 @@ class MapDriverController extends GetxController {
'amount': amount.toString(),
});
var d = jsonDecode(res);
print('paymentToken ${d['message']}');
return d['message'];
}
@@ -504,7 +492,6 @@ class MapDriverController extends GetxController {
'status': 'Finished',
'price': totalCost,
});
print('walletChecked is $walletChecked');
if (walletChecked == 'true') {
paymentToken = await generateTokenPassenger(
((-1) * double.parse(paymentAmount)).toString());
@@ -524,7 +511,6 @@ class MapDriverController extends GetxController {
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
});
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
if (double.parse(passengerWalletBurc) < 0) {
// for zero passenger
var paymentToken1 = await generateTokenPassenger(
@@ -534,7 +520,6 @@ class MapDriverController extends GetxController {
'token': paymentToken1,
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
});
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
}
double pointsSubtraction = 0;
@@ -551,7 +536,6 @@ class MapDriverController extends GetxController {
'token': paymentToken2,
'driverID': box.read(BoxName.driverID).toString(),
});
print(res);
Future.delayed(const Duration(milliseconds: 300));
FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Finish Trip',
@@ -581,10 +565,8 @@ class MapDriverController extends GetxController {
var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: {
'order_id': rideId,
}); //.then((value) {
print('Cancel fetch--------------------');
var response = jsonDecode(res);
canelString = response['data']['status'];
print('cancel is $canelString');
update();
if (canelString == 'Cancel') {
remainingTimeTimerRideBegin = 0;
@@ -613,8 +595,6 @@ class MapDriverController extends GetxController {
int rideTimerFromBegin = 0;
double price = 0;
void rideIsBeginPassengerTimer() async {
// print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm');
// print(durationOfRideValue);
int durationOfRide = int.parse(durationOfRideValue);
update();
int infinity = 40000;
@@ -764,7 +744,6 @@ class MapDriverController extends GetxController {
var response = await CRUD().getGoogleApi(link: url, payload: {});
data = response['routes'][0]['legs'];
print(data);
distanceBetweenDriverAndPassengerWhenConfirm =
(data[0]['distance']['value']) / 1000;
final points =
@@ -824,7 +803,6 @@ class MapDriverController extends GetxController {
var response = await CRUD().getGoogleApi(link: url, payload: {});
dataDestination = response['routes'][0]['legs'];
// print(data);
final points =
decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
for (int i = 0; i < points.length; i++) {
@@ -892,14 +870,10 @@ class MapDriverController extends GetxController {
argumentLoading() async {
passengerLocation = Get.arguments['passengerLocation'];
print(passengerLocation);
passengerDestination = Get.arguments['passengerDestination'];
print(passengerDestination);
duration = Get.arguments['Duration'];
totalCost = Get.arguments['totalCost'];
passengerId = Get.arguments['passengerId'];
print('passengerID argument =${Get.arguments['passengerId']} ');
print('passengerID =$passengerId ');
driverId = Get.arguments['driverId'];
distance = Get.arguments['Distance'];
passengerName = Get.arguments['name'];
@@ -933,8 +907,6 @@ class MapDriverController extends GetxController {
String lat = Get.find<LocationController>().myLocation.latitude.toString();
String lng = Get.find<LocationController>().myLocation.longitude.toString();
String origin = '$lat,$lng';
print('latLngpassengerLocation $latLngPassengerLocation');
print('latLngPassengerDestination $latLngPassengerDestination');
// Set the origin and destination coordinates for the Google Maps directions request.
Future.delayed(const Duration(seconds: 1));
getMap(origin, passengerLocation);
@@ -952,7 +924,6 @@ class MapDriverController extends GetxController {
latlng(String passengerLocation, passengerDestination) {
double latPassengerLocation =
double.parse(passengerLocation.toString().split(',')[0]);
print('latPassengerLocation $latPassengerLocation');
double lngPassengerLocation =
double.parse(passengerLocation.toString().split(',')[1]);
double latPassengerDestination =

View File

@@ -77,9 +77,7 @@ class OrderRequestController extends GetxController {
} else {
box.write(BoxName.statusDriverLocation, 'off');
}
} catch (e) {
print('Error executing custom query: $e');
}
} catch (e) {}
}
void getSQL() async {
@@ -95,7 +93,6 @@ class OrderRequestController extends GetxController {
AND created_at LIKE '%$todayDay%'
''';
List<Map<String, dynamic>> results = await sql.getCustomQuery(customQuery);
print(results);
}
void startTimer(String driverID, orderID) async {
@@ -108,8 +105,6 @@ class OrderRequestController extends GetxController {
}
if (remainingTime == 0) {
if (applied == false) {
print('applied=========================');
print(applied);
refuseOrder(orderID);
}
}
@@ -125,8 +120,6 @@ class OrderRequestController extends GetxController {
}
if (remainingTimeSpeed == 0) {
if (applied == false) {
print('applied=========================');
print(applied);
Get.back();
// refuseOrder(box.read(BoxName.driverID), orderID);
}

View File

@@ -9,7 +9,6 @@ class MyMenuController extends GetxController {
} else {
isDrawerOpen = true;
}
print(isDrawerOpen);
update();
}
}

View File

@@ -98,14 +98,12 @@ class CaptainWalletController extends GetxController {
if (res != 'failure') {
walletDate = jsonDecode(res);
totalAmount = walletDate['message'][0]['total_amount'] ?? '0';
print(totalAmount);
var res1 = await CRUD().get(
link: AppLink.getAllPaymentVisa,
payload: {'driverID': box.read(BoxName.driverID)});
walletDateVisa = jsonDecode(res1);
totalAmountVisa = walletDateVisa['message'][0]['diff'] ?? '0';
print(totalAmountVisa);
update();
}
@@ -141,7 +139,6 @@ class CaptainWalletController extends GetxController {
'amount': amount.toString(),
});
var d = jsonDecode(res);
print('paymentToken ${d['message']}');
return d['message'];
}
@@ -155,7 +152,6 @@ class CaptainWalletController extends GetxController {
});
var d = jsonDecode(res);
paymentID = d['message'].toString();
print('paymentID $paymentID');
return paymentID;
}

View File

@@ -44,11 +44,6 @@ class CreditCardController extends GetxController {
// String? expiryDate = await SecureStorage().readData(BoxName.expiryDate);
// String? cvvCode = await SecureStorage().readData(BoxName.cvvCode);
// print('cardNumber: $cardNumber');
// print('cardHolderName: $cardHolderName');
// print('expiryDate: $expiryDate');
// print('cvvCode: $cvvCode');
// if (cvvCode != null && cvvCode.isNotEmpty) {
// final maskedCardNumber = DigitObscuringFormatter()
// .formatEditUpdate(
@@ -57,8 +52,6 @@ class CreditCardController extends GetxController {
// )
// .text;
// print('maskedCardNumber: $maskedCardNumber');
// cardNumberController.text = maskedCardNumber;
// cardHolderNameController.text = cardHolderName ?? '';
// expiryDateController.text = expiryDate ?? '';

View File

@@ -39,7 +39,6 @@ class PaymobPayout extends GetxController {
var decode = jsonDecode(res.body);
token = decode['access_token'];
}
print('token = $token');
return token;
}
@@ -55,15 +54,12 @@ class PaymobPayout extends GetxController {
"issuer": issuer, //"vodafone",
"msisdn": msisdn, // "01023456789"
});
print(body);
var res = await http.post(
Uri.parse(
'https://stagingpayouts.paymobsolutions.com/api/secure/disburse/'),
headers: headers,
body: body,
);
print(jsonDecode(res.body));
print('-----');
var dec = jsonDecode(res.body);
if (dec['disbursement_status'] == 'successful') {
var paymentToken = await Get.find<CaptainWalletController>()
@@ -108,14 +104,12 @@ class PaymobPayout extends GetxController {
};
var res = await http
.post(
Uri.parse(
'https://stagingpayouts.paymobsolutions.com/api/secure/disburse/'),
headers: headers,
body: body,
)
.then((value) {
print(value);
});
Uri.parse(
'https://stagingpayouts.paymobsolutions.com/api/secure/disburse/'),
headers: headers,
body: body,
)
.then((value) {});
}
Future payToWalletDriverAll(

View File

@@ -25,7 +25,6 @@ class PointsForRiderController extends GetxController {
}
void removeLocation(int index) {
print(index);
locations.removeAt(index);
update();
}
@@ -95,25 +94,18 @@ class WayPointController extends GetxController {
}
void updatePlace(int index, String input) async {
print(myLocation);
print(index);
print(input);
var url =
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=$input&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
print(url);
var response = await CRUD().getGoogleApi(link: url, payload: {});
// final place = input;
// print(response);
// if (index == 0) {
List<dynamic> newList = [];
placeListResponse.add(newList);
newList = response['results'];
print(newList);
placeListResponse[index].add(newList);
update();
// }
print(placeListResponse[index]);
update();
}

View File

@@ -23,7 +23,6 @@ class FeedBackController extends GetxController {
'feedBack': feedbackController.text
});
var d = jsonDecode(res);
// print(d);
if (d['status'].toString() == 'success') {
Get.defaultDialog(
title: 'Success'.tr,

View File

@@ -28,7 +28,6 @@ class OrderHistoryController extends GetxController {
var jsonDecoded = jsonDecode(res);
orderHistoryListPassenger = jsonDecoded['data'];
// print(orderHistoryListPassenger);
isloading = false;
update();
}

View File

@@ -37,7 +37,6 @@ class PromosController extends GetxController {
promoList = jsonDecoded['message'];
isLoading = false;
update();
print(promoList);
}
}
}

View File

@@ -20,7 +20,6 @@ class NotificationCaptainController extends GetxController {
link: AppLink.getNotificationCaptain,
payload: {'driverID': box.read(BoxName.driverID)});
if (res == "failure") {
// print(res);
Get.defaultDialog(
title: 'There is no notification yet'.tr,
titleStyle: AppStyle.title,
@@ -35,7 +34,6 @@ class NotificationCaptainController extends GetxController {
notificationData = jsonDecode(res);
// sql.insertData(notificationData['message'], TableName.captainNotification);
// print(notificationData);
isLoading = false;
update();
}

View File

@@ -21,7 +21,6 @@ class PassengerNotificationController extends GetxController {
link: AppLink.getNotificationPassenger,
payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res == "failure") {
// print(res);
Get.defaultDialog(
title: 'There is no notification yet'.tr,
titleStyle: AppStyle.title,
@@ -36,7 +35,6 @@ class PassengerNotificationController extends GetxController {
notificationData = jsonDecode(res);
// sql.insertData(notificationData['message'], TableName.captainNotification);
// print(notificationData);
isloading = false;
update();
}

View File

@@ -15,7 +15,6 @@ class RideAvailableController extends GetxController {
var res = await CRUD().get(link: AppLink.getRideWaiting, payload: {});
if (res != 'failure') {
rideAvailableMap = jsonDecode(res);
print(rideAvailableMap);
isLoading = false;
update();
} else {

View File

@@ -32,7 +32,6 @@ class DriverWalletHistoryController extends GetxController {
));
}
archive = jsonDecode(res)['message'];
print(archive);
isLoading = false;
update();
}
@@ -43,7 +42,6 @@ class DriverWalletHistoryController extends GetxController {
var res = await CRUD().get(
link: AppLink.getDriverWeekPaymentMove,
payload: {'driverID': box.read(BoxName.driverID)});
print(res);
if (res == 'failure') {
Get.defaultDialog(
barrierDismissible: false,
@@ -58,7 +56,6 @@ class DriverWalletHistoryController extends GetxController {
));
}
weeklyList = jsonDecode(res)['message'];
print(archive);
isLoading = false;
update();
}

View File

@@ -20,7 +20,6 @@ class PassengerWalletHistoryController extends GetxController {
payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res != 'failure') {
archive = jsonDecode(res)['message'];
print(archive);
isLoading = false;
update();
} else {

View File

@@ -131,7 +131,6 @@ class PaymentController extends GetxController {
method();
} else {
// Authentication failed, handle accordingly
print('Authentication failed');
}
} else {
// Local authentication not available, proceed with payment without authentication
@@ -202,7 +201,6 @@ class PaymentController extends GetxController {
// Convert the res object to a JSON object
final jsonResponse = jsonDecode(res);
print(jsonResponse);
// Check if the client_secret property exists and is not null
if (jsonResponse.containsKey('client_secret') &&
jsonResponse['client_secret'] != null) {
@@ -230,7 +228,6 @@ class PaymentController extends GetxController {
// User authenticated successfully, proceed with payment
if (selectedAmount != 0) {
print(selectedAmount);
changePromoSheetDialogue();
Navigator.of(context).push(
MaterialPageRoute(
@@ -285,17 +282,14 @@ class PaymentController extends GetxController {
],
note: "Contact us for any questions on your order.".tr,
onSuccess: (Map params) async {
print("onSuccess: $params");
addPassengerWallet();
changePromoSheetDialogue();
await getPassengerWallet();
},
onError: (error) {
print("onError: $error");
Toast.show(context, ' $error'.tr, AppColor.redColor);
},
onCancel: (params) {
print('cancelled: $params');
Toast.show(context, 'Pyament Cancelled .'.tr,
AppColor.yellowColor);
}),
@@ -307,7 +301,6 @@ class PaymentController extends GetxController {
}
} else {
// Authentication failed, handle accordingly
print('Authentication failed');
}
}
} catch (e) {
@@ -321,7 +314,6 @@ class PaymentController extends GetxController {
link: AppLink.getLicense,
payload: {'driverID': box.read(BoxName.driverID)});
licenseDetailsMap = jsonDecode(res);
// print(licenseDetailsMap['message'][0]['name']);
}
Future createConnectAccount() async {
@@ -331,7 +323,6 @@ class PaymentController extends GetxController {
DateTime.parse(licenseDetailsMap['message'][0]['dateOfBirth']);
int currentTimestamp =
(DateTime.now().millisecondsSinceEpoch / 1000).round();
print('Current Unix timestamp: $currentTimestamp');
int day = dob.day;
int month = dob.month;
int year = dob.year;
@@ -392,11 +383,9 @@ class PaymentController extends GetxController {
payload: body,
);
final responseData = jsonDecode(response);
// print(responseData);
final accountId = responseData['id'];
box.write(BoxName.accountIdStripeConnect, accountId);
await updateCaptainAccountBank();
print('accountId = $accountId');
return accountId;
}
@@ -425,10 +414,8 @@ class PaymentController extends GetxController {
payload: body,
);
final responseData = jsonDecode(response);
print(responseData);
final transactionId = responseData['id'];
print('transactionId = $transactionId');
return transactionId;
}
@@ -439,10 +426,7 @@ class PaymentController extends GetxController {
if (response.statusCode == 200) {
ip = jsonDecode(response.body)['ip'];
print(ip);
} else {
print('Request failed with status: ${response.statusCode}');
}
} else {}
}
// 'https://accept.paymob.com/unifiedcheckout/?publicKey=egy_pk_live_mbjDC9Ni6FSHKmsz8sOHiVk2xd7oWRve&clientSecret=egy_sk_live_c0904e9cf04506ae64f818d4e075b4a957e3713fdf7a22cb7da30a29e72442b5'
@@ -464,16 +448,7 @@ class PaymentController extends GetxController {
amountInCents: newAmount, // 19.00 EGP
billingData: PaymobBillingData(),
onPayment: (PaymobResponse response) {
print('Success: ${response.success}');
print('Transaction ID: ${response.transactionID}');
print('Response Code: ${response.responseCode}');
// print('Message: ${response.message}');
print(box.read(BoxName.passengerWalletTotal));
print(box.read(BoxName.name));
print(box.read(BoxName.phone));
// print();
},
onPayment: (PaymobResponse response) {},
);
if (response!.responseCode == 'APPROVED') {
@@ -515,7 +490,6 @@ class PaymentController extends GetxController {
}
} else {
// Authentication failed, handle accordingly
print('Authentication failed');
}
} else {
final PaymobResponse? response = await PaymobPayment.instance.pay(
@@ -523,12 +497,7 @@ class PaymentController extends GetxController {
currency: currency, //"EGP",
amountInCents: newAmount, // 19.00 EGP
billingData: PaymobBillingData(),
onPayment: (PaymobResponse response) {
// print('Success: ${response.success}');
// print('Transaction ID: ${response.transactionID}');
// print('Response Code: ${response.responseCode}');
// print('Message: ${response.message}');
},
onPayment: (PaymobResponse response) {},
);
if (response!.responseCode == 'APPROVED') {
@@ -617,17 +586,7 @@ class PaymentController extends GetxController {
amountInCents: newAmount, // 19.00 EGP
billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) {
// print('Success: ${response.success}');
// print('Transaction ID: ${response.transactionID}');
// print('Response Code: ${response.responseCode}');
// print('Message: ${response.message}');
// print(box.read(BoxName.passengerWalletTotal));//
// print(box.read(BoxName.name));
// print(box.read(BoxName.phone));
// print();
},
onPayment: (PaymobResponseWallet response) {},
);
if (response!.success == true && response.responseCode == '200') {
@@ -686,7 +645,6 @@ class PaymentController extends GetxController {
}
} else {
// Authentication failed, handle accordingly
print('Authentication failed');
}
} else {
final PaymobResponse? response = await PaymobPayment.instance.pay(
@@ -694,12 +652,7 @@ class PaymentController extends GetxController {
currency: currency, //"EGP",
amountInCents: newAmount, // 19.00 EGP
billingData: PaymobBillingData(),
onPayment: (PaymobResponse response) {
// print('Success: ${response.success}');
// print('Transaction ID: ${response.transactionID}');
// print('Response Code: ${response.responseCode}');
// print('Message: ${response.message}');
},
onPayment: (PaymobResponse response) {},
);
if (response!.responseCode == 'APPROVED') {

View File

@@ -33,8 +33,6 @@ class PaymobManager extends GetxController {
update();
return paymentKey;
} catch (e) {
print("Exc==========================================");
print(e.toString());
throw Exception();
}
}
@@ -46,7 +44,6 @@ class PaymobManager extends GetxController {
paymentToken = await PaymobManager().getPaymentKey(amount, currency);
} on Exception catch (e) {
// Handle errors gracefully, e.g., display error message to user
print("Error fetching payment key: $e");
return;
}
@@ -71,23 +68,17 @@ class PaymobManager extends GetxController {
if (response.statusCode == 200) {
final paymentData = response.data; // Assuming JSON response
print("redirection_url: ${paymentData['iframe_redirection_url']}");
// Navigate to success screen or display success message
launchUrl(Uri.parse(paymentData['iframe_redirection_url']));
} else {
// Payment failed: Handle errors (e.g., display error message)
print("Payment failed: ${response.statusCode} - ${response.data}");
}
} on DioError catch (e) {
// Handle network or Dio-related errors
print("Error making payment request: $e");
}
}
Future<String> _getStatusAfterPaid() async {
print(authanticationToken1);
print(orderId1);
final dio.Response response = await Dio().post(
"https://accept.paymob.com/api/ecommerce/orders/transaction_inquiry",
data: {
@@ -95,8 +86,6 @@ class PaymobManager extends GetxController {
"merchant_order_id": "970960",
"order_id": orderId1
});
print(response.data);
print(response.data['success']);
return response.data["success"];
}
@@ -123,8 +112,6 @@ class PaymobManager extends GetxController {
"delivery_needed": "false",
"items": [],
});
print('id is');
print(response.data["id"]);
return response.data["id"];
}

View File

@@ -79,7 +79,6 @@ class PaymobPayment {
'api_key': _apiKey,
},
);
print(response.data['token']);
return response.data['token'];
} catch (e) {
@@ -105,7 +104,6 @@ class PaymobPayment {
"items": items,
},
);
print(response.data['id']);
return response.data['id'];
} catch (e) {
@@ -138,7 +136,6 @@ class PaymobPayment {
if (message != null) {
throw Exception(message);
}
print(response.data['token']);
return response.data['token'];
}

View File

@@ -79,7 +79,6 @@ class PaymobPaymentWallet {
'api_key': _apiKey,
},
);
print(response.data['token']);
return response.data['token'];
} catch (e) {
rethrow;
@@ -104,7 +103,6 @@ class PaymobPaymentWallet {
"items": items,
},
);
print(response.data['id']);
return response.data['id'];
} catch (e) {
rethrow;
@@ -136,7 +134,6 @@ class PaymobPaymentWallet {
// if (message != null) {
// throw Exception(message);
// }
print(response.data['token']);
return response.data['token'];
}
@@ -161,16 +158,13 @@ class PaymobPaymentWallet {
if (response.statusCode == 200) {
final paymentData = response.data; // Assuming JSON response
print("redirection_url: ${paymentData['iframe_redirection_url']}");
return paymentData['iframe_redirection_url'];
// Navigate to success screen or display success message
} else {
// Payment failed: Handle errors (e.g., display error message)
print("Payment failed: ${response.statusCode} - ${response.data}");
}
} on DioError catch (e) {
// Handle network or Dio-related errors
print("Error making payment request: $e");
}
return '';
}

View File

@@ -71,7 +71,6 @@ class CaptainProfileController extends GetxController {
var d = jsonDecode(res);
captainProfileData = d['message'];
update();
print(captainProfileData);
box.write(BoxName.sexDriver, d['message']['gender']);
box.write(BoxName.dobDriver, d['message']['birthdate']);
box.write(BoxName.vin, d['message']['vin']);

View File

@@ -27,7 +27,7 @@ import 'views/home/Captin/orderCaptin/order_request_page.dart';
final box = GetStorage();
const storage = FlutterSecureStorage();
// final PaymobPayment paymobPayment = PaymobPayment();
final PaymobPayment paymobPayment = PaymobPayment();
final PaymobPaymentWallet paymobPaymentWallet = PaymobPaymentWallet();
@@ -36,13 +36,11 @@ DbSql sql = DbSql.instance;
Future<void> backgroundMessageHandler(RemoteMessage message) async {
await Firebase.initializeApp();
if (message.data.isNotEmpty && message.notification != null) {
print(message.notification?.title);
FirebaseMessagesController().fireBaseTitles(message);
}
}
Future<void> handleBackgroundNotificationClick(RemoteMessage message) async {
// Perform any necessary setup or initialization
await Firebase.initializeApp();
var myListString = message.data['DriverList'];
@@ -51,7 +49,6 @@ Future<void> handleBackgroundNotificationClick(RemoteMessage message) async {
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'DriverList': myList,
// 'PolylineJson': myPoints,
'body': message.notification?.body,
});
}
@@ -65,15 +62,11 @@ void main() async {
}
await GetStorage.init();
// Get.put(DriverCallController());
await AC().gAK();
print(
'local is ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}');
print(Get.deviceLocale!.countryCode);
await AC().gAK();
Stripe.publishableKey = AK.publishableKey;
// await LocationBackgroundController().requestLocationPermission();
if (Platform.isAndroid || Platform.isIOS) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
@@ -86,30 +79,22 @@ void main() async {
FirebaseMessagesController().getNotificationSettings(),
FirebaseMessagesController().getToken(),
];
// cameras = await availableCameras();
await Future.wait(initializationTasks);
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
// PaymobPayment.instance.initialize(
// apiKey: AK
// .payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
// integrationID: int.parse(AK.integrationIdPayMob),
// userTokenExpiration: 200,
// iFrameID: 837992,
// );
PaymobPayment.instance.initialize(
apiKey: AK
.payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
apiKey: AK.payMobApikey,
integrationID: int.parse(AK.integrationIdPayMob),
userTokenExpiration: 200,
iFrameID: 837992,
);
PaymobPaymentWallet.instance.initialize(
apiKey: AK
.payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
apiKey: AK.payMobApikey,
integrationID: int.parse(AK.integrationIdPayMobWallet),
userTokenExpiration: 200,
iFrameID: 837992,
@@ -121,8 +106,6 @@ void main() async {
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
LocaleController localController = Get.put(LocaleController());
@@ -134,13 +117,6 @@ class MyApp extends StatelessWidget {
locale: localController.language,
theme: localController.appTheme,
key: UniqueKey(),
// routes: {'/':const HomePage()},
// home: LoginCaptin());
// getPages: [
// GetPage(name: '/', page: () => SplashScreen()),
// GetPage(
// name: '/OrderRequestPage/:id', page: () => OrderRequestPage()),
// ],
initialRoute: '/',
home: SplashScreen());
}

View File

@@ -645,7 +645,6 @@ Output the extracted information in the following JSON formate and make date for
// sql
// .getAllData(
// TableName.faceDetectTimes)
// .then((value) => print(
// value[0]['faceDetectTimes']));
// },
// ),
@@ -865,8 +864,7 @@ Output the extracted information in the following JSON formate and make date for
kolor: AppColor.yellowColor,
onPressed: () {
sql.deleteAllData(TableName.faceDetectTimes);
sql.getAllData(TableName.faceDetectTimes).then(
(value) => print(value[0]['faceDetectTimes']));
sql.getAllData(TableName.faceDetectTimes);
},
)
],

View File

@@ -34,7 +34,6 @@ class CarLicensePage extends StatelessWidget {
//3vQRyaYYSWpmv69A58ZOkxmeK6M1mgwEDlXrXlBl
//0pALdqDDYHvzp73Q59SIgbzjG7Z2zkhJXr
// String? visionApi = AK.serverPHP;
// print(AK.visionApi);
await carRegistrationRecognizerController.scanText();
},
)),

View File

@@ -90,7 +90,6 @@ class EgyptCardAI extends StatelessWidget {
right: 30,
left: 30,
child: GetBuilder<AI>(builder: (controller) {
print(controller.approved);
return controller.approved == false
? Container(
decoration: AppStyle.boxDecoration1,
@@ -641,8 +640,6 @@ class EgyptCardAI extends StatelessWidget {
return GetBuilder<AI>(
builder: (ai) {
if (ai.responseIdCardDriverEgyptBack.isNotEmpty) {
// print(ai.responseIdCardDriverEgyptBack);
// Get the tax expiry date from the response
final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry'];

View File

@@ -46,7 +46,6 @@ class GeminiEgypt extends GetxController {
},
]
});
// print(requestBody);
final response = await http.post(
Uri.parse(
@@ -59,12 +58,8 @@ class GeminiEgypt extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -72,22 +67,14 @@ class GeminiEgypt extends GetxController {
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
// print(jsonString);
responseIdCardDriverEgypt1 = jsonString;
// print(jsonDecode(responseIdCardDriverEgypt1!));
responseIdCardDriverEgypt = jsonDecode(responseIdCardDriverEgypt1!);
print(responseIdCardDriverEgypt);
update();
return responseIdCardDriverEgypt;
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {}
}
}

View File

@@ -218,10 +218,6 @@ class LoginCaptin extends StatelessWidget {
User? user = await authController
.signInWithApple();
if (user != null) {
print(
"Successfully signed in: ${user.email}");
print(
"Successfully signed in: ${user.uid}");
box.write(BoxName.driverID, user.uid);
box.write(
BoxName.emailDriver, user.email);
@@ -233,9 +229,7 @@ class LoginCaptin extends StatelessWidget {
.toString(),
);
// Navigate to another screen or perform other actions
} else {
print("Sign-in failed");
}
} else {}
},
kolor: AppColor.primaryColor,
)
@@ -243,9 +237,6 @@ class LoginCaptin extends StatelessWidget {
// MyElevatedButton(
// title: 'Sign In by Google'.tr,
// onPressed: () async {
// print(box.read(BoxName.emailDriver));
// print(box.read(BoxName.phoneDriver));
// print(box.read(BoxName.phoneVerified));
// },
// kolor: AppColor.redColor,
// ),
@@ -277,16 +268,13 @@ class LoginCaptin extends StatelessWidget {
// String apiKey = AK.payMobApikey;
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
// print('Converted v: $convertedStringN');
//
// String retrievedStringS = credentials.r(
// credentials.r(
// credentials.r(convertedStringN, cn), cC),
// cs);
// print('Retrieved String: $retrievedStringS');
// //
// if (retrievedStringS == apiKey) {
// print('same');
// }
// },
// icon: const Icon(

View File

@@ -39,7 +39,6 @@ class HistoryDetailsPage extends StatelessWidget {
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
print(mapUrl);
showInBrowser(mapUrl);
},
child: Column(

View File

@@ -50,7 +50,6 @@ class _DriverCallPageState extends State<DriverCallPage> {
.getAgoraToken(channelName: channelName, uid: uid.toString());
setState(() {
token = res;
print('token is $token');
});
}
@@ -63,8 +62,6 @@ class _DriverCallPageState extends State<DriverCallPage> {
uid = box.read(BoxName.phoneDriver) != null
? int.parse(box.read(BoxName.phoneDriver))
: int.parse(box.read(BoxName.phone));
print('remoteid is $_remoteUid');
print('uid is $uid');
// Set up an instance of Agora engine
initAgora();
}
@@ -76,8 +73,6 @@ class _DriverCallPageState extends State<DriverCallPage> {
//create an instance of the Agora engine
agoraEngine = createAgoraRtcEngine();
await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
print('eeeeeeeeeeeeeeeeeeee');
print(agoraEngine);
// Register the event handler
agoraEngine.registerEventHandler(
RtcEngineEventHandler(

View File

@@ -125,7 +125,6 @@ class HelpCaptain extends StatelessWidget {
// color: AppColor.greenColor,
child: GestureDetector(
onTap: () {
print(list['id']);
helpController.getindex(
list['id'], list['helpQuestion']);
helpController.getHelpRepley(

View File

@@ -31,15 +31,12 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// String apiKey = 'seferface:malDev@2101';
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
// print('Converted v: $convertedStringN');
//
// String retrievedStringS = credentials.r(
// credentials.r(credentials.r(convertedStringN, cn), cC),
// cs);
// print('Retrieved String: $retrievedStringS');
// //
// if (retrievedStringS == apiKey) {
// print('same');
// }
// },
// icon: const Icon(

View File

@@ -12,8 +12,6 @@ class ZonesController extends GetxController {
final double width = (southEast.longitude - southwest.longitude) * 100;
final double height = (northeast.latitude - southEast.latitude) * 100;
final double totalArea = width * height;
print(width);
print(height);
// final int numZones = (totalArea / desiredZoneArea).ceil();
@@ -23,8 +21,6 @@ class ZonesController extends GetxController {
((northeast.latitude - southwest.latitude) / zoneHeight).ceil();
final numCols =
((southEast.longitude - southwest.longitude) / zoneWidth).ceil();
print('zoneWidth = $zoneWidth');
print('zoneHeight = $zoneHeight');
List<String> zoneNames = [];
List<LatLng> zoneCoordinates = [];
@@ -67,7 +63,5 @@ class ZonesController extends GetxController {
Map<String, List<LatLng>> zoneMap =
generateZoneMap(southwest, southEast, northeast);
String jsonMap = json.encode(zoneMap);
print(jsonMap);
}
}

View File

@@ -147,7 +147,6 @@ class OrderRequestPage extends StatelessWidget {
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
print(mapUrl);
showInBrowser(mapUrl);
},
icon: const Icon(Icons.map),
@@ -319,7 +318,6 @@ class OrderRequestPage extends StatelessWidget {
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
// print(bodyToPassenger);
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride', 'your ride is applied'.tr,
@@ -365,8 +363,7 @@ class OrderRequestPage extends StatelessWidget {
'startNameLocation': myList[29].toString(),
'endNameLocation': myList[30].toString(),
});
print(
'passengerID =${box.read(BoxName.rideArguments)}');
'passengerID =${box.read(BoxName.rideArguments)}';
Get.to(() => PassengerLocationMapPage(),
arguments: box.read(BoxName.rideArguments));
},

View File

@@ -153,7 +153,6 @@ class OrderSpeedRequest extends StatelessWidget {
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
print(mapUrl);
showInBrowser(mapUrl);
},
icon: const Icon(Icons.map),
@@ -318,7 +317,6 @@ class OrderSpeedRequest extends StatelessWidget {
});
// .then((value) {
// var json = jsonDecode(res);
print('res $res');
if (res == "failure") {
Get.defaultDialog(
title:
@@ -350,7 +348,6 @@ class OrderSpeedRequest extends StatelessWidget {
'order_id': body.toString(),
'status': 'Apply'
});
// print(bodyToPassenger);
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride', 'your ride is applied'.tr,
@@ -361,38 +358,8 @@ class OrderSpeedRequest extends StatelessWidget {
);
Get.back();
// print(
// 'Arguments passed to PassengerLocationMapPage:');
// print('Passenger Location: ${myList[0]}');
// print('Passenger Destination: ${myList[1]}');
// print('Duration: ${myList[4]}');
// print('Total Cost: ${myList[26]}');
// print('Distance: ${myList[5]}');
// print('Name: ${myList[8]}');
// print('Phone: ${myList[10]}');
// print('Email: ${myList[28]}');
// print('Wallet Checked: ${myList[13]}');
// print('Token Passenger: ${myList[9]}');
// print('Direction: ${myList[29]}');
// print('Duration To Passenger: ${myList[15]}');
// print('Ride ID: ${myList[16]}');
// print('Passenger ID: ${myList[7]}');
// print('Driver ID: ${myList[18]}');
// print('Duration Of Ride Value: ${myList[19]}');
// print('Payment Amount: ${myList[2]}');
// print(
// 'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}');
// print('Is Have Steps: ${myList[20]}');
// print('Step 0: ${myList[21]}');
// print('Step 1: ${myList[22]}');
// print('Step 2: ${myList[23]}');
// print('Step 3: ${myList[24]}');
// print('Step 4: ${myList[25]}');
// print('Passenger Wallet Burc: ${myList[26]}');
// print('Time Of Order: ${myList[30]}');
// print('Total Passenger: ${myList[2]}');
// print('Car Type: ${myList[31]}');
// print('Kazan: ${myList[32]}');
box.write(BoxName.rideArguments, {
'passengerLocation': myList[0].toString(),
'passengerDestination': myList[1].toString(),

View File

@@ -103,10 +103,8 @@ class CardSeferWalletDriver extends StatelessWidget {
.totalAmountVisa) -
5)
.toStringAsFixed(0);
// print(Get.find<PaymobPayout>()
// .dropdownValue
// .toString());
// print(captainWalletController.phoneWallet.text
// .toString());
await Get.put(PaymobPayout()).payToWalletDriverAll(
amountAfter5LE,

View File

@@ -1,5 +1,4 @@
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/controller/home/payment/paymob_payout.dart';
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:flutter/material.dart';
@@ -14,7 +13,6 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:path/path.dart';
import '../../../controller/payment/driver_payment_controller.dart';
import '../../widgets/my_scafold.dart';

View File

@@ -70,9 +70,7 @@ class PromosPassengerPage extends StatelessWidget {
textStyle: AppStyle.title),
],
isRepeatingAnimation: true,
onTap: () {
print("Tap Event");
},
onTap: () {},
),
Text(
rides['description'],

View File

@@ -106,7 +106,6 @@ class AvailableRidesPage extends StatelessWidget {
});
// .then((value) {
// var json = jsonDecode(res);
print('res $res');
if (res == "failure") {
Get.defaultDialog(
title:
@@ -156,7 +155,6 @@ class AvailableRidesPage extends StatelessWidget {
'status': 'Applied'
});
// print(bodyToPassenger);
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',