This commit is contained in:
Hamza Aleghwairyeen
2024-04-22 14:19:38 +03:00
parent 3a0ca74961
commit b9c9a8a12f
10 changed files with 113 additions and 60 deletions

View File

@@ -197,16 +197,16 @@ class FirebaseMessagesController extends GetxController {
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr, 'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
'tone1'); 'tone1');
Get.find<MapPassengerController>().tripFinishedFromDriver(); Get.find<MapPassengerController>().tripFinishedFromDriver();
if (Get.find<PaymentController>().isCashChecked == false && // if (Get.find<PaymentController>().isCashChecked == false &&
Get.find<PaymentController>().isWalletChecked == true) { // Get.find<PaymentController>().isWalletChecked == true) {
driverFinishTripDialoge(driverList); // // driverFinishTripDialoge(driverList);
} else { // } else {
Get.to(() => RateDriverFromPassenger(), arguments: { Get.to(() => RateDriverFromPassenger(), arguments: {
'driverId': driverList[0].toString(), 'driverId': driverList[0].toString(),
'rideId': driverList[1].toString(), 'rideId': driverList[1].toString(),
'price': driverList[3].toString() 'price': driverList[3].toString()
}); });
} // }
} else if (message.notification!.title! == 'Call Income') { } else if (message.notification!.title! == 'Call Income') {
try { try {
var myListString = message.data['passengerList']; var myListString = message.data['passengerList'];
@@ -254,7 +254,7 @@ class FirebaseMessagesController extends GetxController {
'Driver Cancel Your Trip'.tr, 'Driver Cancel Your Trip'.tr,
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet' 'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
.tr, .tr,
'order'); 'cancel');
} }
Get.find<MapPassengerController>().restCounter(); Get.find<MapPassengerController>().restCounter();

View File

@@ -241,10 +241,14 @@ class HomeCaptainController extends GetxController {
var res = await CRUD().get( var res = await CRUD().get(
link: AppLink.getDriverpaymentToday, link: AppLink.getDriverpaymentToday,
payload: {'driverID': box.read(BoxName.driverID).toString()}); payload: {'driverID': box.read(BoxName.driverID).toString()});
data = jsonDecode(res); if (res != 'failure') {
totalMoneyToday = data['message'][0]['todayAmount']; data = jsonDecode(res);
totalMoneyToday = data['message'][0]['todayAmount'];
update(); update();
} else {
print(res);
}
} }
getKazanPercent() async { getKazanPercent() async {

View File

@@ -1074,7 +1074,8 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId); var res = await getRideStatus(rideId);
// print(res); // print(res);
// var decod = jsonDecode(res); // var decod = jsonDecode(res);
print(' 0000000000000000000000000000000000000000000000000'); print(
' 000000000000000000delayAndFetchRideStatus0000000000000000000000000000000');
print(res); print(res);
if (res.toString() == 'Apply') { if (res.toString() == 'Apply') {
// getUpdatedRideForDriverApply(rideId); // getUpdatedRideForDriverApply(rideId);
@@ -1107,7 +1108,7 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId); var res = await getRideStatus(rideId);
print(res); print(res);
// var decod = jsonDecode(res); // var decod = jsonDecode(res);
// print(' 0000000000000000000000000000000000000000000000000'); print('--------delayAndFetchRideStatusForAllDriverAvailable----');
// print(decod['data']); // print(decod['data']);
if (res.toString() == 'Apply') { if (res.toString() == 'Apply') {
getUpdatedRideForDriverApply(rideId); getUpdatedRideForDriverApply(rideId);
@@ -1256,6 +1257,7 @@ class MapPassengerController extends GetxController {
), ),
); );
driversToken.add(json['token']); driversToken.add(json['token']);
// driversToken = json['token'];
} else { } else {
carLocationsModels[i] = model; carLocationsModels[i] = model;
markers[i] = Marker( markers[i] = Marker(
@@ -1267,7 +1269,8 @@ class MapPassengerController extends GetxController {
rotation: double.parse(json['heading']), rotation: double.parse(json['heading']),
icon: carIcon, icon: carIcon,
); );
driversToken[i] = json['token']; // driversToken = json['token'];
driversToken.add(json['token']);
} }
} }
@@ -1411,8 +1414,6 @@ class MapPassengerController extends GetxController {
"order_id": rideId.toString(), // Convert to String "order_id": rideId.toString(), // Convert to String
"status": 'Cancel' "status": 'Cancel'
}); });
FirebaseMessagesController().sendNotificationToDriverMAP(
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
} }
rideConfirm = false; rideConfirm = false;
shouldFetch = false; shouldFetch = false;
@@ -2507,7 +2508,8 @@ class MapPassengerController extends GetxController {
link: AppLink.getPassengerRate, link: AppLink.getPassengerRate,
payload: {'passenger_id': box.read(BoxName.passengerID)}); payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res != 'failure') { if (res != 'failure') {
passengerRate = double.parse(jsonDecode(res)['message']['rating']) ?? 5; print(jsonDecode(res)['message']['rating']);
passengerRate = jsonDecode(res)['message']['rating'];
} }
} }

View File

@@ -254,8 +254,8 @@ class PaymentController extends GetxController {
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => UsePaypal( builder: (BuildContext context) => UsePaypal(
sandboxMode: true, sandboxMode: true,
clientId: AK.payPalClientIdLive, clientId: AK.payPalClientId,
secretKey: AK.payPalSecretLive, secretKey: AK.payPalSecret,
returnURL: AppInformation.website, returnURL: AppInformation.website,
cancelURL: "${AppInformation.website}/cancel", cancelURL: "${AppInformation.website}/cancel",
transactions: [ transactions: [
@@ -636,10 +636,10 @@ class PaymentController extends GetxController {
billingData: PaymobBillingDataWallet(), billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) { onPayment: (PaymobResponseWallet response) {
print('Success: ${response.success}'); // print('Success: ${response.success}');
print('Transaction ID: ${response.transactionID}'); // print('Transaction ID: ${response.transactionID}');
print('Response Code: ${response.responseCode}'); // print('Response Code: ${response.responseCode}');
print('Message: ${response.message}'); // print('Message: ${response.message}');
// print(box.read(BoxName.passengerWalletTotal));// // print(box.read(BoxName.passengerWalletTotal));//
// print(box.read(BoxName.name)); // print(box.read(BoxName.name));

View File

@@ -30,7 +30,7 @@ class PaymobResponseWallet {
class PaymobPaymentWallet { class PaymobPaymentWallet {
static PaymobPaymentWallet instance = PaymobPaymentWallet(); static PaymobPaymentWallet instance = PaymobPaymentWallet();
bool _isInitialized = false; bool _isInitializedWallet = false;
final Dio _dio = Dio(); final Dio _dio = Dio();
final _baseURL = 'https://accept.paymob.com/api/'; final _baseURL = 'https://accept.paymob.com/api/';
@@ -55,7 +55,7 @@ class PaymobPaymentWallet {
/// The expiration time of this payment token in seconds. (The maximum is 3600 seconds which is an hour) /// The expiration time of this payment token in seconds. (The maximum is 3600 seconds which is an hour)
int userTokenExpiration = 300, int userTokenExpiration = 300,
}) async { }) async {
if (_isInitialized) { if (_isInitializedWallet) {
return true; return true;
} }
_dio.options.baseUrl = _baseURL; _dio.options.baseUrl = _baseURL;
@@ -65,9 +65,9 @@ class PaymobPaymentWallet {
_iFrameID = iFrameID; _iFrameID = iFrameID;
_iFrameURL = _iFrameURL =
'https://accept.paymobsolutions.com/api/acceptance/iframes/$_iFrameID?payment_token='; 'https://accept.paymobsolutions.com/api/acceptance/iframes/$_iFrameID?payment_token=';
_isInitialized = true; _isInitializedWallet = true;
_userTokenExpiration = userTokenExpiration; _userTokenExpiration = userTokenExpiration;
return _isInitialized; return _isInitializedWallet;
} }
/// Get authentication token, which is valid for one hour from the creation time. /// Get authentication token, which is valid for one hour from the creation time.
@@ -196,7 +196,7 @@ class PaymobPaymentWallet {
/// The billing data related to the customer related to this payment. /// The billing data related to the customer related to this payment.
PaymobBillingDataWallet? billingData}) async { PaymobBillingDataWallet? billingData}) async {
if (!_isInitialized) { if (!_isInitializedWallet) {
throw Exception( throw Exception(
'PaymobPayment is not initialized call:`PaymobPayment.instance.initialize`'); 'PaymobPayment is not initialized call:`PaymobPayment.instance.initialize`');
} }

View File

@@ -6,6 +6,8 @@ import 'package:get/get.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../constant/style.dart'; import '../../constant/style.dart';
import '../../controller/firebase/firbase_messge.dart';
import '../../controller/payment/payment_controller.dart';
import '../../controller/rate/rate_conroller.dart'; import '../../controller/rate/rate_conroller.dart';
import '../../main.dart'; import '../../main.dart';
import '../widgets/elevated_btn.dart'; import '../widgets/elevated_btn.dart';
@@ -86,14 +88,24 @@ class RateDriverFromPassenger extends StatelessWidget {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Text( Padding(
'Exclusive offers and discounts always with the Sefer app' padding: const EdgeInsets.all(4.0),
.tr, child: Text(
style: AppStyle.title.copyWith( 'Exclusive offers and discounts always with the Sefer app'
color: AppColor.redColor, .tr,
style: AppStyle.title.copyWith(
color: AppColor.redColor,
),
textAlign: TextAlign.center,
), ),
textAlign: TextAlign.center, ),
) (Get.find<PaymentController>().isCashChecked ==
false &&
Get.find<PaymentController>()
.isWalletChecked ==
true)
? const DriverTipWidget()
: const SizedBox()
], ],
), ),
)), )),

View File

@@ -1,5 +1,6 @@
import 'package:SEFER/constant/api_key.dart'; import 'package:SEFER/constant/api_key.dart';
import 'package:SEFER/controller/functions/crud.dart'; import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@@ -22,9 +23,16 @@ class CallController extends GetxController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; // channelName = box.read(BoxName.driverID) != null
remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone); ? Get.find<MapDriverController>().rideId
uid = int.parse(box.read(BoxName.phoneDriver)); : Get.find<MapPassengerController>().rideId; // 'sefer300'; //
remoteUid = box.read(BoxName.driverID) != null
? int.parse(box.read(BoxName.phoneDriver))
: int.parse(box.read(BoxName.phone));
uid = box.read(BoxName.driverID) == null
? int.parse(box.read(BoxName.phoneDriver))
: int.parse(box.read(BoxName.phone));
initAgoraFull(); initAgoraFull();
} }

View File

@@ -8,9 +8,6 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import '../../../../../constant/box_name.dart';
import '../../../../../main.dart';
class CallPage extends StatelessWidget { class CallPage extends StatelessWidget {
const CallPage({super.key}); const CallPage({super.key});
@@ -33,10 +30,13 @@ GetBuilder<HomeCaptainController> callPage() {
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
child: Container( child: Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
child: Text( child: Padding(
'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.' padding: const EdgeInsets.all(8.0),
.tr, child: Text(
style: AppStyle.title, 'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.'
.tr,
style: AppStyle.title,
),
), ),
), ),
), ),

View File

@@ -1,4 +1,6 @@
import 'package:SEFER/controller/functions/tts.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart'; import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
@@ -36,12 +38,33 @@ class ConnectWidget extends StatelessWidget {
? 'You dont have Points'.tr ? 'You dont have Points'.tr
: 'You Are Stopped For this Day !'.tr, : 'You Are Stopped For this Day !'.tr,
titleStyle: AppStyle.title, titleStyle: AppStyle.title,
content: Text( content: Column(
double.parse(captainWalletController.totalPoints) < -300 children: [
? 'You must be recharge your Account'.tr IconButton(
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' onPressed: () async {
.tr, double.parse(
style: AppStyle.title, captainWalletController.totalPoints) <
-300
? await Get.find<TextToSpeechController>()
.speakText(
'You must be recharge your Account'
.tr)
: await Get.find<TextToSpeechController>()
.speakText(
'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
.tr);
},
icon: const Icon(Icons.headphones),
),
Text(
double.parse(captainWalletController.totalPoints) <
-300
? 'You must be recharge your Account'.tr
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
.tr,
style: AppStyle.title,
),
],
), ),
confirm: confirm:
double.parse(captainWalletController.totalPoints) < double.parse(captainWalletController.totalPoints) <
@@ -60,7 +83,10 @@ class ConnectWidget extends StatelessWidget {
})); }));
}, },
color: CupertinoColors.destructiveRed, color: CupertinoColors.destructiveRed,
child: Text('You are Stopped'.tr), child: Text(
'You are Stopped'.tr,
style: AppStyle.title,
),
) )
: CupertinoButton( : CupertinoButton(
onPressed: homeCaptainController.onButtonSelected, onPressed: homeCaptainController.onButtonSelected,

View File

@@ -166,12 +166,13 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
Widget _status() { Widget _status() {
String statusText; String statusText;
if (!_isJoined) if (!_isJoined) {
statusText = 'Join a channel'; statusText = 'Join a channel'.tr;
else if (_remoteUid == null) } else if (_remoteUid == null) {
statusText = 'Waiting for a remote user to join...'; statusText = 'Waiting for a remote user to join...'.tr;
else } else {
statusText = 'Connected to remote user, uid:$_remoteUid'; statusText = 'Connected to remote user, uid:$_remoteUid';
}
return Text( return Text(
statusText, statusText,