This commit is contained in:
Hamza-Ayed
2024-06-30 12:35:55 +03:00
parent 6fb79baab4
commit d423cc0831
27 changed files with 517 additions and 452 deletions

2
.env
View File

@@ -30,7 +30,7 @@ passwordPayMob='g@nkD2#99!hD_.wXrXlBl'
integrationIdPayMob=0237730XrXlBl integrationIdPayMob=0237730XrXlBl
payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=XrXlBl' payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=XrXlBl'
integrationIdPayMobWallet=0237739XrXlBl integrationIdPayMobWallet=0237739XrXlBl
ocpApimSubscriptionKey=17373j50x53u07q0830634f512j731yuXrXlBl ocpApimSubscriptionKey=0f5dacccdbce4131b1a5f952996302e3
smsPasswordEgypt="J)Vh=qb/@MXrXlBl" smsPasswordEgypt="J)Vh=qb/@MXrXlBl"
chatGPTkeySeferNew4=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl chatGPTkeySeferNew4=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl
anthropicAIkeySeferNew=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl anthropicAIkeySeferNew=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl

View File

@@ -32,7 +32,7 @@ def keystorePropertiesFile = rootProject.file('key.properties')
android { android {
namespace "com.sefer_driver" namespace "com.sefer_driver"
compileSdkVersion 34 compileSdkVersion 33
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
compileOptions { compileOptions {
@@ -54,9 +54,9 @@ android {
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion targetSdkVersion 33
versionCode 40 versionCode 43
versionName '1.5.40' versionName '1.5.43'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
} }

Binary file not shown.

View File

@@ -21,6 +21,7 @@
C624C4682BD56D34002834AF /* cancel.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4602BD56D34002834AF /* cancel.wav */; }; C624C4682BD56D34002834AF /* cancel.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4602BD56D34002834AF /* cancel.wav */; };
C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4612BD56D34002834AF /* iphone_ringtone.wav */; }; C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4612BD56D34002834AF /* iphone_ringtone.wav */; };
C624C46A2BD56D34002834AF /* order1.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4622BD56D34002834AF /* order1.wav */; }; C624C46A2BD56D34002834AF /* order1.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4622BD56D34002834AF /* order1.wav */; };
C628BC3F2C31427000E4D33B /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = C628BC3E2C31427000E4D33B /* ding.wav */; };
C690B4752A80554500E1D66E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C690B4742A80554500E1D66E /* GoogleService-Info.plist */; }; C690B4752A80554500E1D66E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C690B4742A80554500E1D66E /* GoogleService-Info.plist */; };
C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; }; C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; };
C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; }; C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; };
@@ -78,6 +79,7 @@
C624C4602BD56D34002834AF /* cancel.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = cancel.wav; path = ../../android/app/src/main/res/raw/cancel.wav; sourceTree = "<group>"; }; C624C4602BD56D34002834AF /* cancel.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = cancel.wav; path = ../../android/app/src/main/res/raw/cancel.wav; sourceTree = "<group>"; };
C624C4612BD56D34002834AF /* iphone_ringtone.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = iphone_ringtone.wav; path = ../../android/app/src/main/res/raw/iphone_ringtone.wav; sourceTree = "<group>"; }; C624C4612BD56D34002834AF /* iphone_ringtone.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = iphone_ringtone.wav; path = ../../android/app/src/main/res/raw/iphone_ringtone.wav; sourceTree = "<group>"; };
C624C4622BD56D34002834AF /* order1.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = order1.wav; path = ../../android/app/src/main/res/raw/order1.wav; sourceTree = "<group>"; }; C624C4622BD56D34002834AF /* order1.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = order1.wav; path = ../../android/app/src/main/res/raw/order1.wav; sourceTree = "<group>"; };
C628BC3E2C31427000E4D33B /* ding.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ding.wav; path = ../../android/app/src/main/res/raw/ding.wav; sourceTree = "<group>"; };
C690B4742A80554500E1D66E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; C690B4742A80554500E1D66E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; }; C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; }; C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; };
@@ -167,6 +169,7 @@
C6B15AA02B5FB24600746405 /* tone2.wav */, C6B15AA02B5FB24600746405 /* tone2.wav */,
C624C4602BD56D34002834AF /* cancel.wav */, C624C4602BD56D34002834AF /* cancel.wav */,
C624C4612BD56D34002834AF /* iphone_ringtone.wav */, C624C4612BD56D34002834AF /* iphone_ringtone.wav */,
C628BC3E2C31427000E4D33B /* ding.wav */,
C624C4622BD56D34002834AF /* order1.wav */, C624C4622BD56D34002834AF /* order1.wav */,
C624C45F2BD56D34002834AF /* promo.wav */, C624C45F2BD56D34002834AF /* promo.wav */,
C624C45D2BD56D34002834AF /* start.wav */, C624C45D2BD56D34002834AF /* start.wav */,
@@ -297,6 +300,7 @@
C624C4682BD56D34002834AF /* cancel.wav in Resources */, C624C4682BD56D34002834AF /* cancel.wav in Resources */,
C6B15AA12B5FB24600746405 /* order.wav in Resources */, C6B15AA12B5FB24600746405 /* order.wav in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
C628BC3F2C31427000E4D33B /* ding.wav in Resources */,
C690B4752A80554500E1D66E /* GoogleService-Info.plist in Resources */, C690B4752A80554500E1D66E /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */, C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */,

View File

@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>37</string> <string>40</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.0.37</string> <string>4.0.40</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -54,8 +54,7 @@ class AK {
a.r(a.r(a.r(Env.integrationIdPayMobWallet, cn), cC), cs); a.r(a.r(a.r(Env.integrationIdPayMobWallet, cn), cC), cs);
static final String smsPasswordEgypt = static final String smsPasswordEgypt =
a.r(a.r(a.r(Env.smsPasswordEgypt, cn), cC), cs); a.r(a.r(a.r(Env.smsPasswordEgypt, cn), cC), cs);
static final String ocpApimSubscriptionKey = static final String ocpApimSubscriptionKey = Env.ocpApimSubscriptionKey;
a.r(a.r(a.r(Env.ocpApimSubscriptionKey, cn), cC), cs);
static final String chatGPTkeySeferNew4 = static final String chatGPTkeySeferNew4 =
a.r(a.r(a.r(Env.chatGPTkeySeferNew4, cn), cC), cs); a.r(a.r(a.r(Env.chatGPTkeySeferNew4, cn), cC), cs);
static final String anthropicAIkeySeferNew = static final String anthropicAIkeySeferNew =

View File

@@ -4,6 +4,7 @@ class BoxName {
static const String googlaMapApp = "googlaMapApp"; static const String googlaMapApp = "googlaMapApp";
static const String lang = "lang"; static const String lang = "lang";
static const String gender = "gender";
static const String carType = "carType"; static const String carType = "carType";
static const String deviceInfo = "deviceInfo"; static const String deviceInfo = "deviceInfo";
static const String phoneVerified = "phoneVerified"; static const String phoneVerified = "phoneVerified";

View File

@@ -96,6 +96,8 @@ class AppLink {
//-----------------Driver NotificationCaptain------------------ //-----------------Driver NotificationCaptain------------------
static String addNotificationCaptain = "$ride/notificationCaptain/add.php"; static String addNotificationCaptain = "$ride/notificationCaptain/add.php";
static String addWaitingRide = "$ride/notificationCaptain/addWaitingRide.php"; static String addWaitingRide = "$ride/notificationCaptain/addWaitingRide.php";
static String updateWaitingRide =
"$ride/notificationCaptain/updateWaitingTrip.php";
static String getRideWaiting = "$ride/notificationCaptain/getRideWaiting.php"; static String getRideWaiting = "$ride/notificationCaptain/getRideWaiting.php";
static String getNotificationCaptain = "$ride/notificationCaptain/get.php"; static String getNotificationCaptain = "$ride/notificationCaptain/get.php";
static String updateNotificationCaptain = static String updateNotificationCaptain =

View File

@@ -4,6 +4,7 @@ import 'dart:math';
import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/controller/functions/location_background_controller.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/cards/sms_signup.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -48,68 +49,6 @@ class LoginDriverController extends GetxController {
update(); update();
} }
void login() async {
isloading = true;
update();
var res = await CRUD().get(link: AppLink.loginCaptin, payload: {
'email': emailController.text,
'phone': phoneController.text,
'password': passwordController.text
});
if (res == 'failure') {
//Failure
isloading = false;
update();
Get.snackbar('Failure', '', backgroundColor: Colors.red);
} else {
var jsonDecoeded = jsonDecode(res);
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success') {
if (jsonDecoeded['data'][0]['verified'] == 1) {
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
box.write(
BoxName.nameDriver, jsonDecoeded['data'][0]['first_name']);
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
SecureStorage()
.saveData(BoxName.passwordDriver, passwordController.text);
Get.offAll(() => HomeCaptain());
isloading = false;
update();
await CRUD().post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
});
} else {
isloading = false;
update();
Get.defaultDialog(
title: 'You must Verify email !.'.tr,
middleText: '',
backgroundColor: Colors.yellow[300],
onConfirm: () async {
int randomNumber = Random().nextInt(100000) + 1;
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
'email': emailController.text,
'token': randomNumber.toString(),
});
Get.to(() => VerifyEmailCaptainPage());
},
);
}
} else if (jsonDecoeded['status'] == 'Failure') {
Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
backgroundColor: Colors.redAccent);
isloading = false;
update();
}
} else {
isloading = false;
update();
}
}
}
loginUsingCredentials(String driverID, email) async { loginUsingCredentials(String driverID, email) async {
isloading = true; isloading = true;
update(); update();
@@ -129,6 +68,7 @@ class LoginDriverController extends GetxController {
if (jsonDecoeded['status'] == 'success' && if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'] == 1) { jsonDecoeded['data'][0]['is_verified'] == 1) {
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']); box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']);
box.write(BoxName.phoneVerified, box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString()); jsonDecoeded['data'][0]['is_verified'].toString());
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']); box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
@@ -150,14 +90,23 @@ class LoginDriverController extends GetxController {
box.read(BoxName.tokenDriver)) { box.read(BoxName.tokenDriver)) {
Get.put(FirebaseMessagesController()) Get.put(FirebaseMessagesController())
.sendNotificationToAnyWithoutData( .sendNotificationToAnyWithoutData(
'token change', 'token change'.tr,
'change device', 'change device'.tr,
jsonDecode(token)['data'][0]['token'].toString(), jsonDecode(token)['data'][0]['token'].toString(),
); 'promo.wav');
await CRUD().post(link: AppLink.addTokensDriver, payload: { Get.defaultDialog(
'token': box.read(BoxName.tokenDriver), title: 'you will use this device?'.tr,
'captain_id': box.read(BoxName.driverID).toString() middleText: '',
}); confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () async {
await CRUD()
.post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
});
Get.back();
}));
} }
} }
@@ -184,13 +133,4 @@ class LoginDriverController extends GetxController {
'captain_id': box.read(BoxName.driverID).toString() 'captain_id': box.read(BoxName.driverID).toString()
}); });
} }
@override
void onInit() async {
super.onInit();
// if (box.read(BoxName.driverID).toString() != null) {
// loginByBoxData();
// }
}
} }

View File

@@ -111,12 +111,14 @@ class RegisterCaptainController extends GetxController {
box.write(BoxName.phoneDriver, '+2${phoneController.text}'); box.write(BoxName.phoneDriver, '+2${phoneController.text}');
box.write(BoxName.phoneVerified, 1); box.write(BoxName.phoneVerified, 1);
var res1 = await CRUD().post( // var res1 = await CRUD().post(
link: AppLink.updateAccountBank, // link: AppLink.updateAccountBank,
payload: {'phone': '+2${phoneController.text}'}); // payload: {'phone': '+2${phoneController.text}'});
if (jsonDecode(res1)['status'] == 'success') { // if (res1 != 'failure') {
Get.to(EgyptCardAI()); Get.to(EgyptCardAI());
} // } else {
// Get.snackbar('title', 'message');
// }
} }
} }
} }

View File

@@ -90,9 +90,9 @@ class FirebaseMessagesController extends GetxController {
} }
void fireBaseTitles(RemoteMessage message) { void fireBaseTitles(RemoteMessage message) {
if (message.notification!.title! == 'Order') { if (message.notification!.title! == 'Order'.tr) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification('Order', '', 'order'); NotificationController().showNotification('Order'.tr, '', 'order');
} }
var myListString = message.data['DriverList']; var myListString = message.data['DriverList'];
// var points = message.data['PolylineJson']; // var points = message.data['PolylineJson'];
@@ -109,27 +109,27 @@ class FirebaseMessagesController extends GetxController {
// 'PolylineJson': myPoints, // 'PolylineJson': myPoints,
'body': message.notification!.body 'body': message.notification!.body
}); });
} else if (message.notification!.title == 'Cancel Trip') { } else if (message.notification!.title == 'Cancel Trip'.tr) {
NotificationController().showNotification( NotificationController().showNotification(
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel'); 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel');
cancelTripDialog(); cancelTripDialog();
} else if (message.notification!.title! == 'token change') { } else if (message.notification!.title! == 'token change'.tr) {
NotificationController() NotificationController()
.showNotification('token change', 'token change', 'cancel'); .showNotification('token change'.tr, 'token change', 'cancel');
GoogleSignInHelper.signOut(); GoogleSignInHelper.signOut();
} else if (message.notification!.title! == 'message From passenger') { } else if (message.notification!.title! == 'message From passenger'.tr) {
NotificationController() NotificationController()
.showNotification('message From passenger'.tr, ''.tr, 'tone2'); .showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!); passengerDialog(message.notification!.body!);
update(); update();
} else if (message.notification!.title! == 'Hi ,I will go now') { } else if (message.notification!.title! == 'Hi ,I will go now'.tr) {
// Get.snackbar('Hi ,I will go now', '', // Get.snackbar('Hi ,I will go now', '',
// backgroundColor: AppColor.greenColor); // backgroundColor: AppColor.greenColor);
NotificationController().showNotification( NotificationController().showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2'); 'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
update(); update();
} else if (message.notification!.title! == 'Call Income') { } else if (message.notification!.title! == 'Call Income'.tr) {
try { try {
var myListString = message.data['passengerList']; var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
@@ -147,7 +147,8 @@ class FirebaseMessagesController extends GetxController {
// remoteID: driverList[2].toString(), // remoteID: driverList[2].toString(),
// )); // ));
} catch (e) {} } catch (e) {}
} else if (message.notification!.title! == 'Call Income from Passenger') { } else if (message.notification!.title! ==
'Call Income from Passenger'.tr) {
try { try {
var myListString = message.data['passengerList']; var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
@@ -165,7 +166,7 @@ class FirebaseMessagesController extends GetxController {
// remoteID: driverList[2].toString(), // remoteID: driverList[2].toString(),
)); ));
} catch (e) {} } catch (e) {}
} else if (message.notification!.title! == 'Call End') { } else if (message.notification!.title! == 'Call End'.tr) {
try { try {
var myListString = message.data['passengerList']; var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
@@ -179,7 +180,7 @@ class FirebaseMessagesController extends GetxController {
// Assuming GetMaterialApp is initialized and context is valid for navigation // Assuming GetMaterialApp is initialized and context is valid for navigation
Get.off(const CallPage()); Get.off(const CallPage());
} catch (e) {} } catch (e) {}
} else if (message.notification!.title! == 'Order Applied') { } else if (message.notification!.title! == 'Order Applied'.tr) {
Get.snackbar( Get.snackbar(
"The order has been accepted by another driver." "The order has been accepted by another driver."
.tr, // Corrected grammar .tr, // Corrected grammar
@@ -202,7 +203,7 @@ class FirebaseMessagesController extends GetxController {
// 'PolylineJson': myPoints, // 'PolylineJson': myPoints,
'body': message.notification!.body 'body': message.notification!.body
}); });
} else if (message.notification!.title! == 'Order Applied') { } else if (message.notification!.title! == 'Order Applied'.tr) {
NotificationController().showNotification( NotificationController().showNotification(
'The order Accepted by another Driver'.tr, 'The order Accepted by another Driver'.tr,
'We regret to inform you that another driver has accepted this order.' 'We regret to inform you that another driver has accepted this order.'
@@ -361,7 +362,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'start.wav' 'sound': 'ding.wav'
}, },
'priority': 'high', 'priority': 'high',
'data': <String, dynamic>{ 'data': <String, dynamic>{
@@ -404,7 +405,7 @@ class FirebaseMessagesController extends GetxController {
// } // }
//android/app/src/main/res/raw/iphone_ringtone.wav //android/app/src/main/res/raw/iphone_ringtone.wav
void sendNotificationToPassengerToken( void sendNotificationToPassengerToken(
String title, body, token, List<String> map) async { String title, body, token, List<String> map, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -416,7 +417,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'tone2.wav' 'sound': tone
}, },
'data': { 'data': {
'passengerList': map, 'passengerList': map,
@@ -472,7 +473,7 @@ class FirebaseMessagesController extends GetxController {
} }
void sendNotificationToAnyWithoutData( void sendNotificationToAnyWithoutData(
String title, String body, String token) async { String title, String body, String token, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -484,7 +485,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'promo.wav' 'sound': tone
}, },
'data': <String, dynamic>{ 'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK', 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
@@ -507,8 +508,8 @@ class FirebaseMessagesController extends GetxController {
} }
} }
void sendNotificationToDriverMAP( void sendNotificationToDriverMAP(String title, String body, String token,
String title, String body, String token, List<String> data) async { List<String> data, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -521,7 +522,7 @@ class FirebaseMessagesController extends GetxController {
'title': title, 'title': title,
'body': body, 'body': body,
// 'sound': 'tone2.wav', // 'sound': 'tone2.wav',
'sound': 'order.wav' 'sound': tone
}, },
'data': { 'data': {
'DriverList': data, 'DriverList': data,

View File

@@ -98,6 +98,7 @@ class CRUD {
await arabicTextExtractByVisionAndAI(imagePath: imagePath); await arabicTextExtractByVisionAndAI(imagePath: imagePath);
var json = jsonDecode(extractedString); var json = jsonDecode(extractedString);
var textValues = extractTextFromLines(json); var textValues = extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues); // await Get.put(AI()).geminiAiExtraction(prompt, textValues);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath); await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
} }
@@ -129,8 +130,9 @@ class CRUD {
}; };
String imagePathFull = String imagePathFull =
'${AppLink.server}card_image/$imagePath-${box.read(BoxName.driverID)}.jpg'; '${AppLink.server}/card_image/$imagePath-${box.read(BoxName.driverID)}.jpg';
// print(box.read(BoxName.driverID));
// print(imagePathFull);
var request = http.Request('POST', Uri.parse( var request = http.Request('POST', Uri.parse(
// 'https://ocrhamza.cognitiveservices.azure.com/vision/v2.1/ocr?language=ar')); // 'https://ocrhamza.cognitiveservices.azure.com/vision/v2.1/ocr?language=ar'));
// 'https://eastus.api.cognitive.microsoft.com/vision/v3.2/ocr' // 'https://eastus.api.cognitive.microsoft.com/vision/v3.2/ocr'
@@ -141,6 +143,7 @@ class CRUD {
http.StreamedResponse response = await request.send(); http.StreamedResponse response = await request.send();
if (response.statusCode == 200) { if (response.statusCode == 200) {
// print(await response.stream.bytesToString());
return await response.stream.bytesToString(); return await response.stream.bytesToString();
} else {} } else {}
} }
@@ -218,7 +221,9 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}', 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
}, },
); );
print(response.request);
print(response.body);
print(response.statusCode);
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {

View File

@@ -393,10 +393,13 @@ class AI extends GetxController {
update(); update();
await ImageController().choosImage(linkPHP, imagePath); await ImageController().choosImage(linkPHP, imagePath);
Future.delayed(const Duration(seconds: 2)); Future.delayed(const Duration(seconds: 2));
// print(imagePath);
var extractedString = var extractedString =
await CRUD().arabicTextExtractByVisionAndAI(imagePath: imagePath); await CRUD().arabicTextExtractByVisionAndAI(imagePath: imagePath);
print(extractedString);
var json = jsonDecode(extractedString); var json = jsonDecode(extractedString);
var textValues = CRUD().extractTextFromLines(json); var textValues = CRUD().extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues, imagePath); // await Get.put(AI()).geminiAiExtraction(prompt, textValues, imagePath);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath); await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
isLoading = false; isLoading = false;

View File

@@ -7,6 +7,14 @@ void showInBrowser(String url) async {
} else {} } else {}
} }
Future<void> makePhoneCall(String phoneNumber) async {
final Uri launchUri = Uri(
scheme: 'tel',
path: phoneNumber,
);
await launchUrl(launchUri);
}
void launchCommunication( void launchCommunication(
String method, String contactInfo, String message) async { String method, String contactInfo, String message) async {
String url; String url;

View File

@@ -54,6 +54,7 @@ class ImageController extends GetxController {
update(); update();
// Save the cropped image // Save the cropped image
File savedCroppedImage = File(croppedFile!.path); File savedCroppedImage = File(croppedFile!.path);
print('link =$link');
try { try {
await uploadImage( await uploadImage(
savedCroppedImage, savedCroppedImage,

View File

@@ -222,7 +222,8 @@ class MapDriverController extends GetxController {
FirebaseMessagesController().sendNotificationToAnyWithoutData( FirebaseMessagesController().sendNotificationToAnyWithoutData(
'DriverIsGoingToPassenger', 'DriverIsGoingToPassenger',
box.read(BoxName.name).toString(), box.read(BoxName.name).toString(),
tokenPassenger); tokenPassenger,
'start.wav');
if (box.read(BoxName.googlaMapApp) == true) { if (box.read(BoxName.googlaMapApp) == true) {
await openGoogleMapFromDriverToPassenger(); await openGoogleMapFromDriverToPassenger();
} }
@@ -288,7 +289,10 @@ class MapDriverController extends GetxController {
}); });
FirebaseMessagesController().sendNotificationToAnyWithoutData( FirebaseMessagesController().sendNotificationToAnyWithoutData(
'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger); 'RideIsBegin',
box.read(BoxName.name).toString(),
tokenPassenger,
'start.wav');
rideIsBeginPassengerTimer(); rideIsBeginPassengerTimer();
// var d = jsonDecode(res); // var d = jsonDecode(res);
@@ -352,6 +356,7 @@ class MapDriverController extends GetxController {
} }
calculateDistanceBetweenDriverAndPassengerLocation() { calculateDistanceBetweenDriverAndPassengerLocation() {
Get.put(LocationController());
double distance2 = Geolocator.distanceBetween( double distance2 = Geolocator.distanceBetween(
latLngPassengerLocation.latitude, latLngPassengerLocation.latitude,
latLngPassengerLocation.longitude, latLngPassengerLocation.longitude,
@@ -533,19 +538,19 @@ class MapDriverController extends GetxController {
}); });
Future.delayed(const Duration(milliseconds: 300)); Future.delayed(const Duration(milliseconds: 300));
FirebaseMessagesController().sendNotificationToPassengerToken( FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Finish Trip', 'Driver Finish Trip',
'${'you will pay to Driver'.tr} $paymentAmount \$', '${'you will pay to Driver'.tr} $paymentAmount \$',
tokenPassenger, tokenPassenger,
[ [
box.read(BoxName.driverID), box.read(BoxName.driverID),
rideId, rideId,
box.read(BoxName.tokenDriver), box.read(BoxName.tokenDriver),
// carType == 'Comfort' || carType == 'Mashwari' // carType == 'Comfort' || carType == 'Mashwari'
// ? price.toStringAsFixed(2) // ? price.toStringAsFixed(2)
// : totalPassenger // : totalPassenger
paymentAmount.toString() paymentAmount.toString()
], ],
); 'ding.wav');
Get.to(() => RatePassenger(), arguments: { Get.to(() => RatePassenger(), arguments: {
'passengerId': passengerId, 'passengerId': passengerId,
'rideId': rideId, 'rideId': rideId,

View File

@@ -95,21 +95,29 @@ class OrderRequestController extends GetxController {
List<Map<String, dynamic>> results = await sql.getCustomQuery(customQuery); List<Map<String, dynamic>> results = await sql.getCustomQuery(customQuery);
} }
void startTimer(String driverID, orderID) async { bool _timerActive = false;
for (int i = 0; i <= duration; i++) {
Future<void> startTimer(String driverID, String orderID) async {
_timerActive = true;
for (int i = 0; i <= duration && _timerActive; i++) {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
progress = i / duration; progress = i / duration;
remainingTime = duration - i; remainingTime = duration - i;
update(); update();
} }
if (remainingTime == 0) { if (remainingTime == 0 && _timerActive) {
if (applied == false) { if (applied == false) {
endTimer();
refuseOrder(orderID); refuseOrder(orderID);
} }
} }
} }
void endTimer() {
_timerActive = false;
}
void startTimerSpeed(String driverID, orderID) async { void startTimerSpeed(String driverID, orderID) async {
for (int i = 0; i <= durationSpeed; i++) { for (int i = 0; i <= durationSpeed; i++) {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
@@ -144,15 +152,16 @@ class OrderRequestController extends GetxController {
}); });
// applied = true; // applied = true;
sql.insertData({ if (box.read(BoxName.gender).toString() != 'Female') {
'order_id': orderID, sql.insertData({
'created_at': DateTime.now().toString(), 'order_id': orderID,
'driver_id': box.read(BoxName.driverID).toString(), 'created_at': DateTime.now().toString(),
}, TableName.driverOrdersRefuse); 'driver_id': box.read(BoxName.driverID).toString(),
getRefusedOrderByCaptain(); }, TableName.driverOrdersRefuse);
getRefusedOrderByCaptain();
}
update(); update();
Get.back(); // Get.back();
// Get.offAll(HomeCaptain()); // Get.offAll(HomeCaptain());
} }

View File

@@ -223,12 +223,12 @@ class CaptainWalletController extends GetxController {
}); });
if (res1 != 'failure') { if (res1 != 'failure') {
FirebaseMessagesController().sendNotificationToDriverMAP( FirebaseMessagesController().sendNotificationToDriverMAP(
'Transfer', 'Transfer',
'${'You have transfer to your wallet from'.tr}' '${'You have transfer to your wallet from'.tr}'
'${box.read(BoxName.nameDriver)}', '${box.read(BoxName.nameDriver)}',
amountToNewDriverMap[0]['token'].toString(), amountToNewDriverMap[0]['token'].toString(),
[], [],
); 'order1.wav');
await addSeferWallet('payout fee', '5'); await addSeferWallet('payout fee', '5');
Get.defaultDialog( Get.defaultDialog(

View File

@@ -4,7 +4,16 @@ class MyTranslation extends Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "ar": {
'Add Question': '', "Heading your way now. Please be ready.":
"في طريقي إليك الآن. يرجى الاستعداد.",
"Approaching your area. Should be there in 3 minutes.":
"اقترب من منطقتك. يجب أن أكون هناك خلال 3 دقائق.",
"There's heavy traffic here. Can you suggest an alternate pickup point?":
"هناك حركة مرور كثيفة هنا. هل يمكنك اقتراح نقطة استلام بديلة؟",
"This ride is already taken by another driver.":
"تم حجز هذه الرحلة من قبل سائق آخر.",
'Price: ': 'السعر ',
'Add Question': "أضف سؤالاً",
"Please enter a valid card 16-digit number.": "Please enter a valid card 16-digit number.":
"الرجاء إدخال رقم بطاقة صحيح مكون من 16 رقمًا.", "الرجاء إدخال رقم بطاقة صحيح مكون من 16 رقمًا.",
"Insert card number": "أدخل رقم البطاقة", "Insert card number": "أدخل رقم البطاقة",
@@ -199,7 +208,7 @@ class MyTranslation extends Translations {
"Invalid OTP": "رمز التحقق غير صالح", "Invalid OTP": "رمز التحقق غير صالح",
"Enter your email address": "أدخل عنوان بريدك الإلكتروني", "Enter your email address": "أدخل عنوان بريدك الإلكتروني",
"Please enter Your Email.": "يُرجى إدخال...", "Please enter Your Email.": "يُرجى إدخال...",
"Enter your phone number": "أدخلي رقم هاتفك", "Enter your phone number": "أدخل رقم هاتفك",
"Please enter your phone number.": "الرجاء إدخال رقم هاتفك.", "Please enter your phone number.": "الرجاء إدخال رقم هاتفك.",
"Please enter Your Password.": "إدخال كلمة المرور الخاصة بك", "Please enter Your Password.": "إدخال كلمة المرور الخاصة بك",
"Submit": "إرسال", "Submit": "إرسال",
@@ -284,7 +293,7 @@ class MyTranslation extends Translations {
"Send Verfication Code": "إرسال رمز التحقق", "Send Verfication Code": "إرسال رمز التحقق",
"End Ride": "‏إنهاء الرحلة", "End Ride": "‏إنهاء الرحلة",
"Minute": "الدقيقة", "Minute": "الدقيقة",
"Go to passenger Location now": "انتقل إلى موقع الراكب الآن", "Go to passenger Location": "انتقل إلى موقع الراكب ",
"Duration of the Ride is": "مدة المشوار هي", "Duration of the Ride is": "مدة المشوار هي",
"Distance of the Ride is": "مسافة المشوار هي", "Distance of the Ride is": "مسافة المشوار هي",
"Name of the Passenger is": "اسم الراكب هو", "Name of the Passenger is": "اسم الراكب هو",
@@ -375,7 +384,7 @@ class MyTranslation extends Translations {
"Driver Applied the Ride for You": "سائق قدم الرحلة من أجلك", "Driver Applied the Ride for You": "سائق قدم الرحلة من أجلك",
"Show latest promo": "أظهر أحدث عرض ترويجي", "Show latest promo": "أظهر أحدث عرض ترويجي",
"Cancel Trip": "إلغاء الرحلة", "Cancel Trip": "إلغاء الرحلة",
"Passenger Cancel Trip": "راكب يلغي الرحلة", "Passenger Cancel Trip": "الرحلة ألغيت من قبل المسافر",
"Please stay on the picked point.": "يرجى البقاء على النقطة المحددة.", "Please stay on the picked point.": "يرجى البقاء على النقطة المحددة.",
"Trip is Begin": "الرحلة بدأت", "Trip is Begin": "الرحلة بدأت",
"Hi ,I will go now": "مرحبًا، سأذهب الآن", "Hi ,I will go now": "مرحبًا، سأذهب الآن",

View File

@@ -54,7 +54,7 @@ class PassengerNotificationController extends GetxController {
'body': body, 'body': body,
}); });
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToPassengerToken(title, body, 'token', []); .sendNotificationToPassengerToken(title, body, 'token', [], 'ding.wav');
} }
@override @override

View File

@@ -83,13 +83,14 @@ class RateController extends GetxController {
'token': paymentToken4, 'token': paymentToken4,
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
}); });
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Wallet Added'.tr,
'Wallet Added${(pointsSubtraction).toStringAsFixed(0)}'.tr,
Get.find<MapDriverController>().tokenPassenger,
'tone2.wav');
walletChecked = 'true';
} }
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Wallet Added',
'Wallet Added'.tr,
Get.find<MapDriverController>().tokenPassenger);
walletChecked = 'true';
update(); update();
} }
}); });

View File

@@ -56,11 +56,11 @@ GetBuilder<HomeCaptainController> callPage() {
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
FirebaseMessagesController().sendNotificationToPassengerToken( FirebaseMessagesController().sendNotificationToPassengerToken(
'Call End'.tr, 'Call End'.tr,
'Call End', 'Call End',
Get.find<MapDriverController>().tokenPassenger, Get.find<MapDriverController>().tokenPassenger,
[], [],
); 'iphone_ringtone.wav');
callController.leave(); callController.leave();
Get.back(); Get.back();
}, },

View File

@@ -10,6 +10,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../../../constant/char_map.dart'; import '../../../../../constant/char_map.dart';
import '../../../../../constant/colors.dart'; import '../../../../../constant/colors.dart';
import '../../../../../constant/credential.dart'; import '../../../../../constant/credential.dart';
import '../../../../../controller/functions/launch.dart';
import '../../../../Rate/ride_calculate_driver.dart'; import '../../../../Rate/ride_calculate_driver.dart';
import '../../../../../controller/functions/location_controller.dart'; import '../../../../../controller/functions/location_controller.dart';
@@ -166,8 +167,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// borderRadius: BorderRadius.circular(15)), // borderRadius: BorderRadius.circular(15)),
// child: IconButton( // child: IconButton(
// onPressed: () { // onPressed: () {
// Get.to(() => PassengerLocationMapPage(), // launchCommunication('phone', '+201023248456', '');
// arguments: box.read(BoxName.rideArguments));
// }, // },
// icon: const Icon( // icon: const Icon(
// FontAwesome5.grin_tears, // FontAwesome5.grin_tears,

View File

@@ -47,7 +47,7 @@ class PassengerInfoWindow extends StatelessWidget {
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'Go to passenger Location now'.tr, 'Go to passenger Location'.tr,
style: AppStyle.title style: AppStyle.title
.copyWith(color: AppColor.greenColor), .copyWith(color: AppColor.greenColor),
), ),
@@ -63,10 +63,16 @@ class PassengerInfoWindow extends StatelessWidget {
true; true;
await controller await controller
.driverCallPassenger(); // to check from scam .driverCallPassenger(); // to check from scam
Get.to( // Get.to(
() => const CallPage()); // () => const CallPage());
// launchCommunication('phone', makePhoneCall(controller
// controller.phone.toString(), ''); .passengerPhone
.toString());
// launchCommunication(
// 'phone',
// controller.passengerPhone
// ,
// '');
}, },
child: const Icon( child: const Icon(
Icons.phone, Icons.phone,
@@ -76,17 +82,113 @@ class PassengerInfoWindow extends StatelessWidget {
width: 25, width: 25,
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () async {
controller.isSocialPressed = Get.defaultDialog(
true; title:
launchCommunication( 'Select one message'
'email', .tr,
controller.passengerPhone titleStyle:
.toString(), AppStyle.title,
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}'); content: SizedBox(
height: Get.height * .5,
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
"There's heavy traffic here. Can you suggest an alternate pickup point?"
.tr,
controller
.tokenPassenger,
'ding.wav');
Get.back();
},
child: Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(
10),
child: Text(
"There's heavy traffic here. Can you suggest an alternate pickup point?"
.tr,
style: AppStyle
.title,
),
),
),
),
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
"Heading your way now. Please be ready."
.tr,
controller
.tokenPassenger,
'ding.wav');
Get.back();
},
child: Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(
10),
child: Text(
"Heading your way now. Please be ready."
.tr,
style: AppStyle
.title,
),
),
),
),
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
'Approaching your area. Should be there in 3 minutes.'
.tr,
controller
.tokenPassenger,
'ding.wav');
Get.back();
},
child: Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(
10),
child: Text(
'Approaching your area. Should be there in 3 minutes.'
.tr,
style: AppStyle
.title,
),
),
),
),
],
),
));
}, },
child: const Icon( child: const Icon(
Icons.email, Icons.message,
color: AppColor.redColor, color: AppColor.redColor,
)), )),
const SizedBox( const SizedBox(
@@ -269,7 +371,8 @@ class PassengerInfoWindow extends StatelessWidget {
.tr, .tr,
controller controller
.tokenPassenger, .tokenPassenger,
[]); [],
'start.wav');
controller controller
.startTimerToShowDriverWaitPassengerDuration(); .startTimerToShowDriverWaitPassengerDuration();
controller controller
@@ -356,7 +459,8 @@ class PassengerInfoWindow extends StatelessWidget {
.tr, .tr,
controller controller
.tokenPassenger, .tokenPassenger,
[]); [],
'cancel.wav');
await controller await controller
.addWaitingTimeCostFromPassengerToDriverWallet(); .addWaitingTimeCostFromPassengerToDriverWallet();
controller controller

View File

@@ -296,6 +296,7 @@ class OrderRequestPage extends StatelessWidget {
onPressed: () async { onPressed: () async {
box.write(BoxName.statusDriverLocation, 'on'); box.write(BoxName.statusDriverLocation, 'on');
orderRequestController.endTimer();
orderRequestController.changeApplied(); orderRequestController.changeApplied();
await CRUD().postFromDialogue( await CRUD().postFromDialogue(
link: AppLink.addDriverOrder, link: AppLink.addDriverOrder,
@@ -320,12 +321,13 @@ class OrderRequestPage extends StatelessWidget {
]; ];
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToPassengerToken( .sendNotificationToPassengerToken(
'Apply Ride', 'your ride is applied'.tr, 'Apply Ride',
// arguments['DriverList'][9].toString(), 'your ride is applied'.tr,
arguments['DriverList'][9].toString(), // arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(), arguments['DriverList'][9].toString(),
bodyToPassenger, // box.read(BoxName.tokenDriver).toString(),
); bodyToPassenger,
'start.wav');
Get.back(); Get.back();
box.write(BoxName.rideArguments, { box.write(BoxName.rideArguments, {
'passengerLocation': myList[0].toString(), 'passengerLocation': myList[0].toString(),
@@ -392,6 +394,7 @@ class OrderRequestPage extends StatelessWidget {
MyElevatedButton( MyElevatedButton(
title: 'Refuse Order'.tr, title: 'Refuse Order'.tr,
onPressed: () async { onPressed: () async {
orderRequestController.endTimer();
List<String> bodyToPassenger = [ List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(), box.read(BoxName.nameDriver).toString(),
@@ -400,12 +403,12 @@ class OrderRequestPage extends StatelessWidget {
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToPassengerToken( .sendNotificationToPassengerToken(
'Refused Ride', 'Refused Ride'.tr,
'${box.read(BoxName.nameDriver)} ${'reject your order.'.tr}', '${box.read(BoxName.nameDriver)} ${'reject your order.'.tr}',
arguments['DriverList'][9].toString(), arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(), // box.read(BoxName.tokenDriver).toString(),
bodyToPassenger, bodyToPassenger,
); 'cancel.wav');
orderRequestController.refuseOrder( orderRequestController.refuseOrder(
myList[16].toString(), myList[16].toString(),
); );

View File

@@ -350,12 +350,13 @@ class OrderSpeedRequest extends StatelessWidget {
}); });
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToPassengerToken( .sendNotificationToPassengerToken(
'Apply Ride', 'your ride is applied'.tr, 'Apply Ride',
// arguments['DriverList'][9].toString(), 'your ride is applied'.tr,
arguments['DriverList'][9].toString(), // arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(), arguments['DriverList'][9].toString(),
bodyToPassenger, // box.read(BoxName.tokenDriver).toString(),
); bodyToPassenger,
'start.wav');
Get.back(); Get.back();
// 'Arguments passed to PassengerLocationMapPage:'); // 'Arguments passed to PassengerLocationMapPage:');
@@ -397,42 +398,7 @@ class OrderSpeedRequest extends StatelessWidget {
'endNameLocation': myList[30].toString(), 'endNameLocation': myList[30].toString(),
}); });
Get.to(() => PassengerLocationMapPage(), Get.to(() => PassengerLocationMapPage(),
arguments: box.read(BoxName.rideArguments) arguments: box.read(BoxName.rideArguments));
// {
// 'passengerLocation': myList[0].toString(),
// 'passengerDestination': myList[1].toString(),
// 'Duration': myList[4].toString(),
// 'totalCost': myList[26].toString(),
// 'Distance': myList[5].toString(),
// 'name': myList[8].toString(),
// 'phone': myList[10].toString(),
// 'email': myList[28].toString(),
// 'WalletChecked': myList[13].toString(),
// 'tokenPassenger': myList[9].toString(),
// 'direction':
// 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
// 'DurationToPassenger': myList[15].toString(),
// 'rideId': myList[16].toString(),
// 'passengerId': myList[7].toString(),
// 'driverId': myList[18].toString(),
// 'durationOfRideValue': myList[19].toString(),
// 'paymentAmount': myList[2].toString(),
// 'paymentMethod': myList[13].toString() == 'true'
// ? 'visa'
// : 'cash',
// 'isHaveSteps': myList[20].toString(),
// 'step0': myList[21].toString(),
// 'step1': myList[22].toString(),
// 'step2': myList[23].toString(),
// 'step3': myList[24].toString(),
// 'step4': myList[25].toString(),
// 'passengerWalletBurc': myList[26].toString(),
// 'timeOfOrder': DateTime.now().toString(),
// 'totalPassenger': myList[2].toString(),
// 'carType': myList[31].toString(),
// 'kazan': myList[32].toString(),
// }
);
} }
// }); // });
// Get.back(); // Get.back();

View File

@@ -30,233 +30,235 @@ class AvailableRidesPage extends StatelessWidget {
body: [ body: [
rideAvailableController.isLoading rideAvailableController.isLoading
? const MyCircularProgressIndicator() ? const MyCircularProgressIndicator()
: Padding( : ListView.builder(
padding: const EdgeInsets.all(8.0), itemCount: rideAvailableController
child: ListView.builder( .rideAvailableMap['message'].length,
itemCount: rideAvailableController itemBuilder: (BuildContext context, int index) {
.rideAvailableMap['message'].length, var list = rideAvailableController
itemBuilder: (BuildContext context, int index) { .rideAvailableMap['message'][index];
var list = rideAvailableController return Padding(
.rideAvailableMap['message'][index]; padding: const EdgeInsets.all(8.0),
return Container( child: Container(
width: Get.width * .9, width: Get.width * .9,
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'🟢 ', '🟢 ',
style: AppStyle.subtitle,
),
SizedBox(
height: Get.height * .06,
width: Get.width * .8,
child: Text(
'${list['startName']}',
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
SizedBox( ),
height: Get.height * .06, ],
width: Get.width * .8, ),
child: Text( Row(
'${list['startName']}', mainAxisAlignment:
style: AppStyle.subtitle, MainAxisAlignment.spaceBetween,
), children: [
), Text(
], '🔴 ',
), style: AppStyle.subtitle,
Row( ),
mainAxisAlignment: SizedBox(
MainAxisAlignment.spaceBetween, height: Get.height * .06,
children: [ width: Get.width * .8,
Text( child: Text(
'🔴 ', '${list['endName']}',
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
SizedBox( ),
height: Get.height * .06, ],
width: Get.width * .8, ),
child: Text( const SizedBox(height: 4),
'${list['endName']}', Row(
style: AppStyle.subtitle, mainAxisAlignment:
), MainAxisAlignment.spaceAround,
), children: [
], Text('${'Price: '.tr}${list['price']} \$'),
), const SizedBox(height: 4),
const SizedBox(height: 4), Text(
Row( '${list['carType']}',
mainAxisAlignment: style: AppStyle.title
MainAxisAlignment.spaceAround, .copyWith(color: AppColor.greenColor),
children: [ ),
Text('${'Price: '.tr}${list['price']} \$'), ],
const SizedBox(height: 4), ),
Text( Row(
'${list['carType']}', mainAxisAlignment:
style: AppStyle.title MainAxisAlignment.spaceAround,
.copyWith(color: AppColor.greenColor), children: [
), Text('📈 ${list['passengerRate']}',
], style: AppStyle.title),
), MyElevatedButton(
Row( title: 'Accept'.tr,
mainAxisAlignment: onPressed: () async {
MainAxisAlignment.spaceAround, box.write(
children: [ BoxName.statusDriverLocation, 'on');
Text('📈 ${list['passengerRate']}',
style: AppStyle.title),
MyElevatedButton(
title: 'Accept'.tr,
onPressed: () async {
box.write(
BoxName.statusDriverLocation, 'on');
var res = await CRUD().post( var res = await CRUD().post(
link: AppLink.updateStausFromSpeed, link: AppLink.updateStausFromSpeed,
payload: {
'id': list['id'],
'rideTimeStart':
DateTime.now().toString(),
'status': 'Apply',
'driver_id':
box.read(BoxName.driverID),
});
// .then((value) {
// var json = jsonDecode(res);
if (res == "failure") {
Get.defaultDialog(
title:
"This ride is already taken by another driver."
.tr,
middleText: '',
titleStyle: AppStyle.title,
middleTextStyle: AppStyle.title,
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
// Get.back();
// Get.back();
}));
} else if (jsonDecode(res)['status'] ==
"success") {
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box
.read(BoxName.nameDriver)
.toString(),
box
.read(BoxName.tokenDriver)
.toString(),
];
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: { payload: {
'id': list['id'],
'rideTimeStart':
DateTime.now().toString(),
'status': 'Apply',
'driver_id': 'driver_id':
box.read(BoxName.driverID), box.read(BoxName.driverID),
// box.read(BoxName.driverID).toString(),
'order_id': list['id'],
'status': 'Apply'
});
await CRUD().post(
link: AppLink.updateRides,
payload: {
'id': list['id'],
'DriverIsGoingToPassenger':
DateTime.now().toString(),
'status': 'Applied'
});
await CRUD().post(
link: AppLink.updateWaitingRide,
payload: {
'id': list['id'],
'status': 'Applied'
}); });
// .then((value) {
// var json = jsonDecode(res);
if (res == "failure") {
Get.defaultDialog(
title:
"This ride is already taken by another driver."
.tr,
middleText: '',
titleStyle: AppStyle.title,
middleTextStyle: AppStyle.title,
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
Get.back();
Get.back();
}));
} else if (jsonDecode(res)['status'] ==
"success") {
List<String> bodyToPassenger = [
box
.read(BoxName.driverID)
.toString(),
box
.read(BoxName.nameDriver)
.toString(),
box
.read(BoxName.tokenDriver)
.toString(),
];
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id':
box.read(BoxName.driverID),
// box.read(BoxName.driverID).toString(),
'order_id': list['id'],
'status': 'Apply'
});
await CRUD().post(
link: AppLink.updateRides,
payload: {
'id': list['id'],
'DriverIsGoingToPassenger':
DateTime.now().toString(),
'status': 'Applied'
});
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToPassengerToken( .sendNotificationToPassengerToken(
'Apply Ride', 'Apply Ride',
'your ride is applied'.tr, 'your ride is applied'.tr,
// arguments['DriverList'][9].toString(), // arguments['DriverList'][9].toString(),
list['passengerToken'].toString(), list['passengerToken']
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
);
Get.back();
Get.to(
() => PassengerLocationMapPage(),
arguments: {
'passengerLocation':
list['start_location']
.toString(),
'passengerDestination':
list['end_location']
.toString(),
'Duration':
list['duration'].toString(),
'totalCost':
list['price'].toString(),
'Distance':
list['distance'].toString(),
'name': list['first_name']
.toString(), .toString(),
'phone': // box.read(BoxName.tokenDriver).toString(),
list['phone'].toString(), bodyToPassenger,
'email': 'start.wav');
list['email'].toString(), Get.back();
'WalletChecked': Get.to(() => PassengerLocationMapPage(),
list['payment_method'] arguments: {
.toString(), 'passengerLocation':
'tokenPassenger': list['start_location']
list['passengerToken'] .toString(),
.toString(), 'passengerDestination':
'direction': list['end_location']
'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/', .toString(),
'DurationToPassenger': 'Duration':
list['duration'].toString(), list['duration'].toString(),
'rideId': list['id'].toString(), 'totalCost':
'passengerId': list['price'].toString(),
list['passenger_id'] 'Distance':
.toString(), list['distance'].toString(),
'driverId': box 'name':
.read(BoxName.driverID) list['first_name'].toString(),
.toString(), 'phone': list['phone'].toString(),
'durationOfRideValue': 'email': list['email'].toString(),
list['duration'].toString(), 'WalletChecked':
'paymentAmount': list['payment_method']
list['price'].toString(), .toString(),
'paymentMethod': 'tokenPassenger':
'cash'.toString() == //todo fix payment method list['passengerToken']
'true' .toString(),
? 'visa' 'direction':
: 'cash', 'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/',
'isHaveSteps': 'DurationToPassenger':
'startEnd'.toString(), list['duration'].toString(),
'step0': ''.toString(), 'rideId': list['id'].toString(),
'step1': ''.toString(), 'passengerId':
'step2': ''.toString(), list['passenger_id']
'step3': ''.toString(), .toString(),
'step4': ''.toString(), 'driverId': box
'passengerWalletBurc': .read(BoxName.driverID)
list['bruc'].toString(), .toString(),
'timeOfOrder': 'durationOfRideValue':
DateTime.now().toString(), list['duration'].toString(),
'totalPassenger': 'paymentAmount':
list['price'].toString(), list['price'].toString(),
'carType': 'paymentMethod':
list['carType'].toString(), 'cash'.toString() == //todo fix payment method
'kazan': Get.find< 'true'
HomeCaptainController>() ? 'visa'
.kazan : 'cash',
.toString(), 'isHaveSteps':
}); 'startEnd'.toString(),
} 'step0': ''.toString(),
}, 'step1': ''.toString(),
kolor: AppColor.greenColor, 'step2': ''.toString(),
), 'step3': ''.toString(),
Text( 'step4': ''.toString(),
'📍 ${list['distance']} ${'KM'.tr}', 'passengerWalletBurc':
style: AppStyle.title list['bruc'].toString(),
.copyWith(color: AppColor.greenColor), 'timeOfOrder':
), DateTime.now().toString(),
], 'totalPassenger':
) list['price'].toString(),
], 'carType':
), list['carType'].toString(),
); 'kazan': Get.find<
}), HomeCaptainController>()
) .kazan
.toString(),
});
}
},
kolor: AppColor.greenColor,
),
Text(
'📍 ${list['distance']} ${'KM'.tr}',
style: AppStyle.title
.copyWith(color: AppColor.greenColor),
),
],
)
],
),
),
);
})
], ],
isleading: true); isleading: true);
}); });