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

View File

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

View File

@@ -1074,7 +1074,8 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId);
// print(res);
// var decod = jsonDecode(res);
print(' 0000000000000000000000000000000000000000000000000');
print(
' 000000000000000000delayAndFetchRideStatus0000000000000000000000000000000');
print(res);
if (res.toString() == 'Apply') {
// getUpdatedRideForDriverApply(rideId);
@@ -1107,7 +1108,7 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId);
print(res);
// var decod = jsonDecode(res);
// print(' 0000000000000000000000000000000000000000000000000');
print('--------delayAndFetchRideStatusForAllDriverAvailable----');
// print(decod['data']);
if (res.toString() == 'Apply') {
getUpdatedRideForDriverApply(rideId);
@@ -1256,6 +1257,7 @@ class MapPassengerController extends GetxController {
),
);
driversToken.add(json['token']);
// driversToken = json['token'];
} else {
carLocationsModels[i] = model;
markers[i] = Marker(
@@ -1267,7 +1269,8 @@ class MapPassengerController extends GetxController {
rotation: double.parse(json['heading']),
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
"status": 'Cancel'
});
FirebaseMessagesController().sendNotificationToDriverMAP(
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
}
rideConfirm = false;
shouldFetch = false;
@@ -2507,7 +2508,8 @@ class MapPassengerController extends GetxController {
link: AppLink.getPassengerRate,
payload: {'passenger_id': box.read(BoxName.passengerID)});
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(
builder: (BuildContext context) => UsePaypal(
sandboxMode: true,
clientId: AK.payPalClientIdLive,
secretKey: AK.payPalSecretLive,
clientId: AK.payPalClientId,
secretKey: AK.payPalSecret,
returnURL: AppInformation.website,
cancelURL: "${AppInformation.website}/cancel",
transactions: [
@@ -636,10 +636,10 @@ class PaymentController extends GetxController {
billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) {
print('Success: ${response.success}');
print('Transaction ID: ${response.transactionID}');
print('Response Code: ${response.responseCode}');
print('Message: ${response.message}');
// 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));

View File

@@ -30,7 +30,7 @@ class PaymobResponseWallet {
class PaymobPaymentWallet {
static PaymobPaymentWallet instance = PaymobPaymentWallet();
bool _isInitialized = false;
bool _isInitializedWallet = false;
final Dio _dio = Dio();
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)
int userTokenExpiration = 300,
}) async {
if (_isInitialized) {
if (_isInitializedWallet) {
return true;
}
_dio.options.baseUrl = _baseURL;
@@ -65,9 +65,9 @@ class PaymobPaymentWallet {
_iFrameID = iFrameID;
_iFrameURL =
'https://accept.paymobsolutions.com/api/acceptance/iframes/$_iFrameID?payment_token=';
_isInitialized = true;
_isInitializedWallet = true;
_userTokenExpiration = userTokenExpiration;
return _isInitialized;
return _isInitializedWallet;
}
/// 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.
PaymobBillingDataWallet? billingData}) async {
if (!_isInitialized) {
if (!_isInitializedWallet) {
throw Exception(
'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/style.dart';
import '../../controller/firebase/firbase_messge.dart';
import '../../controller/payment/payment_controller.dart';
import '../../controller/rate/rate_conroller.dart';
import '../../main.dart';
import '../widgets/elevated_btn.dart';
@@ -86,14 +88,24 @@ class RateDriverFromPassenger extends StatelessWidget {
const SizedBox(
height: 10,
),
Text(
'Exclusive offers and discounts always with the Sefer app'
.tr,
style: AppStyle.title.copyWith(
color: AppColor.redColor,
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
'Exclusive offers and discounts always with the Sefer app'
.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/controller/functions/crud.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -22,9 +23,16 @@ class CallController extends GetxController {
@override
void onInit() {
super.onInit();
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone);
uid = int.parse(box.read(BoxName.phoneDriver));
channelName = box.read(BoxName.driverID) != null
? Get.find<MapDriverController>().rideId
: 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();
}

View File

@@ -8,9 +8,6 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import '../../../../../constant/box_name.dart';
import '../../../../../main.dart';
class CallPage extends StatelessWidget {
const CallPage({super.key});
@@ -33,10 +30,13 @@ GetBuilder<HomeCaptainController> callPage() {
padding: const EdgeInsets.all(15),
child: Container(
decoration: AppStyle.boxDecoration1,
child: Text(
'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.'
.tr,
style: AppStyle.title,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'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/material.dart';
import 'package:get/get.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 Are Stopped For this Day !'.tr,
titleStyle: AppStyle.title,
content: 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,
content: Column(
children: [
IconButton(
onPressed: () async {
double.parse(
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:
double.parse(captainWalletController.totalPoints) <
@@ -60,7 +83,10 @@ class ConnectWidget extends StatelessWidget {
}));
},
color: CupertinoColors.destructiveRed,
child: Text('You are Stopped'.tr),
child: Text(
'You are Stopped'.tr,
style: AppStyle.title,
),
)
: CupertinoButton(
onPressed: homeCaptainController.onButtonSelected,

View File

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