This commit is contained in:
Hamza-Ayed
2024-10-02 23:47:52 +03:00
parent 6f95dafd0b
commit 79b14ab9cc
9 changed files with 298 additions and 291 deletions

View File

@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23
targetSdk = flutter.targetSdkVersion
versionCode = 101
versionName = '1.5.01'
versionCode = 103
versionName = '1.5.03'
multiDexEnabled =true
}

View File

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

View File

@@ -83,7 +83,7 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
// if (message.notification!.title! == 'Order'.tr) {
// if (Platform.isAndroid) {
// NotificationController()
// NotificationController1()
// .showNotification('Order'.tr, '', 'order', 'order_page_payload');
// }
// // await FirebaseMessagesController().showOverlayNotification(message);
@@ -115,7 +115,7 @@ class FirebaseMessagesController extends GetxController {
Future<void> fireBaseTitles(RemoteMessage message) async {
if (message.notification!.title! == 'Order'.tr) {
if (Platform.isAndroid) {
NotificationController().showNotification('Order'.tr, '', 'order', '');
NotificationController1().showNotification('Order'.tr, '', 'order', '');
}
// await FirebaseMessagesController().showOverlayNotification(message);
var myListString = message.data['DriverList'];
@@ -159,21 +159,22 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title == 'Cancel') {
cancelTripDialog1();
} else if (message.notification!.title! == 'token change') {
NotificationController1()
.showNotification('token change'.tr, 'token change', 'cancel', '');
// NotificationController1()
// .showNotification('token change'.tr, 'token change', 'cancel');
// GoogleSignInHelper.signOut();
GoogleSignInHelper.signOut();
} else if (message.notification!.title! == 'message From passenger') {
if (Platform.isAndroid) {
NotificationController1()
.showNotification('message From passenger'.tr, ''.tr, 'tone2', '');
}
// print('sdfd');
// if (Platform.isAndroid) {
// NotificationController1()
// .showNotification('message From passenger'.tr, ''.tr, 'tone2', '');
// }
passengerDialog(message.notification!.body!);
update();
} else if (message.notification!.title! == 'face detect') {
if (Platform.isAndroid) {
NotificationController()
NotificationController1()
.showNotification('face detect'.tr, ''.tr, 'tone2', '');
}
String result0 = await faceDetector();
@@ -203,7 +204,7 @@ class FirebaseMessagesController extends GetxController {
// Get.snackbar('Hi ,I will go now', '',
// backgroundColor: AppColor.greenColor);
if (Platform.isAndroid) {
NotificationController().showNotification(
NotificationController1().showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2', '');
}
update();
@@ -213,7 +214,7 @@ class FirebaseMessagesController extends GetxController {
var driverList = jsonDecode(myListString) as List<dynamic>;
// if (Platform.isAndroid) {
if (Platform.isAndroid) {
NotificationController().showNotification('Call Income'.tr,
NotificationController1().showNotification('Call Income'.tr,
message.notification!.body!, 'iphone_ringtone', '');
}
// }
@@ -231,7 +232,7 @@ class FirebaseMessagesController extends GetxController {
var driverList = jsonDecode(myListString) as List<dynamic>;
// if (Platform.isAndroid) {
if (Platform.isAndroid) {
NotificationController().showNotification('Call Income'.tr,
NotificationController1().showNotification('Call Income'.tr,
message.notification!.body!, 'iphone_ringtone', '');
}
// }
@@ -245,7 +246,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! ==
"Criminal Document Required".tr) {
if (Platform.isAndroid) {
NotificationController().showNotification(
NotificationController1().showNotification(
"Criminal Document Required".tr,
message.notification!.body!,
'tone2',
@@ -262,7 +263,7 @@ class FirebaseMessagesController extends GetxController {
var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>;
if (Platform.isAndroid) {
NotificationController().showNotification(
NotificationController1().showNotification(
'Call End'.tr, message.notification!.body!, 'tone2', '');
}
// Assuming GetMaterialApp is initialized and context is valid for navigation
@@ -293,7 +294,7 @@ class FirebaseMessagesController extends GetxController {
});
} else if (message.notification!.title! == 'Order Applied'.tr) {
if (Platform.isAndroid) {
NotificationController().showNotification(
NotificationController1().showNotification(
'The order Accepted by another Driver'.tr,
'We regret to inform you that another driver has accepted this order.'
.tr,

View File

@@ -32,8 +32,8 @@ class NotificationController extends GetxController {
// Create a notification channel
const AndroidNotificationChannel channel = AndroidNotificationChannel(
'high_importance_channel',
'High Importance Notifications',
'your channel id',
'your channel name',
description: 'This channel is used for important notifications.',
importance: Importance.high,
);

View File

@@ -59,7 +59,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
}
await Future.delayed(const Duration(seconds: 1));
NotificationController().showNotification(
NotificationController1().showNotification(
message.notification!.title.toString(),
message.notification!.body.toString(),
'order',
@@ -122,8 +122,8 @@ void main() async {
await FirebaseMessagesController().requestFirebaseMessagingPermission();
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
NotificationController().initNotifications();
NotificationController().initNotifications();
NotificationController1().initNotifications();
// NotificationController().initNotifications();
await Future.wait([
FirebaseMessagesController().getNotificationSettings(),

View File

@@ -4,6 +4,7 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart';
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
import 'package:SEFER/views/auth/captin/login_captin.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:bubble_head/bubble.dart';
@@ -143,7 +144,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
NotificationController()
NotificationController1()
.showNotification('Sefer Driver'.tr, ''.tr, '', '');
final now = DateTime.now();
DateTime? lastRequestTime =
@@ -177,95 +178,95 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
),
),
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)),
child: Builder(builder: (context) {
return IconButton(
onPressed: () async {
// Get.to(() => EgyptCardAI());
// print(box.read(BoxName.myList));
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// border: Border.all(color: AppColor.blueColor),
// borderRadius: BorderRadius.circular(15)),
// child: Builder(builder: (context) {
// return IconButton(
// onPressed: () async {
// // Get.to(() => EgyptCardAI());
// // print(box.read(BoxName.myList));
List<String> d = [
"30.003028,31.2419628",
"30.0955661,31.2665336",
"160.00",
"25.92",
"1488",
"16.93",
"114243034311436865474",
"113172279072358305645",
"hamza ayed",
"rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
"+201023248456",
"1 min",
"1 m",
"false",
"QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
"0",
"238",
"false",
"114243034311436865474",
"1488",
"startEnd",
"30.049307749732176,31.274291574954987",
"",
"",
"",
"",
"17.73",
"0",
"hamzaayedflutter@gmail.com",
"الفسطاط، حي مصر القديمة، مصر",
" الزاوية الحمراء، محافظة القاهرة، مصر",
"Speed",
"8",
"5.00"
];
FirebaseMessagesController().sendNotificationToDriverMAP(
'Order'.tr,
'from: ',
// jsonDecode(value)['message'].toString(),
'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
d,
'order.wav');
// NotificationController()
// .showNotification('VIP Order'.tr, '', 'order', '');
// try {} catch (e) {
// print('Error showing overlay: $e');
// }
// final Bubble _bubble = Bubble(showCloseButton: true);
// try {
// await _bubble.startBubbleHead(sendAppToBackground: false);
// } on PlatformException {
// print('Failed to call startBubbleHead');
// }
// List<String> d = [
// "30.003028,31.2419628",
// "30.0955661,31.2665336",
// "160.00",
// "25.92",
// "1488",
// "16.93",
// "114243034311436865474",
// "113172279072358305645",
// "hamza ayed",
// "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
// "+201023248456",
// "1 min",
// "1 m",
// "false",
// "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
// "0",
// "238",
// "false",
// "114243034311436865474",
// "1488",
// "startEnd",
// "30.049307749732176,31.274291574954987",
// "",
// "",
// "",
// "",
// "17.73",
// "0",
// "hamzaayedflutter@gmail.com",
// "الفسطاط، حي مصر القديمة، مصر",
// " الزاوية الحمراء، محافظة القاهرة، مصر",
// "Speed",
// "8",
// "5.00"
// ];
// FirebaseMessagesController().sendNotificationToDriverMAP(
// 'Order'.tr,
// 'from: ',
// // jsonDecode(value)['message'].toString(),
// 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
// d,
// 'order.wav');
// // NotificationController()
// // .showNotification('VIP Order'.tr, '', 'order', '');
// // try {} catch (e) {
// // print('Error showing overlay: $e');
// // }
// // final Bubble _bubble = Bubble(showCloseButton: true);
// // try {
// // await _bubble.startBubbleHead(sendAppToBackground: false);
// // } on PlatformException {
// // print('Failed to call startBubbleHead');
// // }
// Bubble().startBubbleHead(sendAppToBackground: true);
// }
// // Bubble().startBubbleHead(sendAppToBackground: true);
// // }
// Future<void> stopBubbleHead() async {
// try {
// await _bubble.stopBubbleHead();
// } on PlatformException {
// print('Failed to call stopBubbleHead');
// }
// }
//
// // // send data to ovelay
},
icon: const Icon(
FontAwesome5.grin_tears,
size: 29,
color: AppColor.blueColor,
),
);
}),
),
// // Future<void> stopBubbleHead() async {
// // try {
// // await _bubble.stopBubbleHead();
// // } on PlatformException {
// // print('Failed to call stopBubbleHead');
// // }
// // }
// //
// // // // send data to ovelay
// },
// icon: const Icon(
// FontAwesome5.grin_tears,
// size: 29,
// color: AppColor.blueColor,
// ),
// );
// }),
// ),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
@@ -282,14 +283,16 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// // jsonDecode(value)['message'].toString(),
// 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
// 'order.wav');
// NotificationController1().showNotification(
// 'sdf'.tr,
// 'We regret to inform you that another driver has accepted this order.'
// .tr,
// '',
// '');
NotificationController1().showNotification(
'sdf'.tr,
'We regret to inform you that another driver has accepted this order.'
.tr,
'',
'');
// requestLocationPermission();
Get.to(() => SmsSignupEgypt());
// Get.to(() => PassengerLocationMapPage(),
// arguments: box.read(BoxName.rideArguments));
print(box.read(BoxName.tokenDriver));
},
icon: const Icon(

View File

@@ -29,7 +29,7 @@ class PassengerInfoWindow extends StatelessWidget {
// left: 8,
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: Get.height * .4,
height: Get.height * .35,
width: Get.width,
decoration: AppStyle.boxDecoration1,
child: Padding(
@@ -366,191 +366,155 @@ class PassengerInfoWindow extends StatelessWidget {
),
],
),
controller.remainingTimeToPassenger != 0
? Stack(
controller.isRideBegin
? const SizedBox()
: Column(
children: [
LinearProgressIndicator(
backgroundColor: AppColor.accentColor,
color:
controller.remainingTimeToPassenger <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius: BorderRadius.circular(15),
value: controller.progressToPassenger
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeToPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isRideBegin
? const SizedBox()
: Column(
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
title: 'Start the Ride'.tr,
kolor: AppColor.greenColor,
MyElevatedButton(
title: 'Start the Ride'.tr,
kolor: AppColor.greenColor,
onPressed: () {
Get.defaultDialog(
title:
'Is the Passenger in your Car ?'
.tr,
titleStyle: AppStyle.title,
middleText:
"don't start trip if not"
.tr,
middleTextStyle:
AppStyle.title,
confirm: MyElevatedButton(
title: 'OK'.tr,
kolor:
AppColor.greenColor,
onPressed: () async {
await controller
.startRideFromDriver();
Get.back();
}),
cancel: MyElevatedButton(
title:
'No ,still Waiting.'
.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
if (controller
.calculateDistanceBetweenDriverAndPassengerLocation() <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller.isArrivedSend =
false;
} else {
Get.defaultDialog(
title:
'You are not in near to passenger location'
.tr,
middleText:
'please go to picker location exactly'
.tr,
confirm:
MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip From'
.tr +
' ${AppInformation.appName}'
.tr,
kolor:
AppColor.deepPurpleAccent,
onPressed: () {
Get.defaultDialog(
title:
'Is the Passenger in your Car ?'
'Are you sure to cancel?'
.tr,
titleStyle:
AppStyle.title,
middleText:
"don't start trip if not"
.tr,
middleTextStyle:
AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
kolor: AppColor
.greenColor,
title: 'Yes'.tr,
onPressed: () async {
await controller
.startRideFromDriver();
Get.back();
}),
cancel: MyElevatedButton(
title:
'No ,still Waiting.'
.tr,
kolor:
AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
// Await the result of the distance calculation
double distanceToArrive =
await controller
.calculateDistanceBetweenDriverAndPassengerLocation();
if (distanceToArrive <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller
.isArrivedSend =
false;
} else {
Get.defaultDialog(
title:
'You are not in near to passenger location'
.tr,
middleText:
'please go to picker location exactly'
.tr,
confirm:
MyElevatedButton(
title:
'Ok'.tr,
onPressed:
() {
Get.back();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(
15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip From'
.tr +
' ${AppInformation.appName}'
.tr,
kolor: AppColor
.deepPurpleAccent,
onPressed: () {
Get.defaultDialog(
title:
'Are you sure to cancel?'
.tr,
titleStyle:
AppStyle.title,
middleText: '',
confirm:
MyElevatedButton(
title:
'Yes'.tr,
onPressed:
() async {
FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Cancel Your Trip',
'You will be pay the cost to driver or we will get it from you on next trip'
.tr,
controller
.tokenPassenger,
[],
'cancel.wav');
await controller
.addWaitingTimeCostFromPassengerToDriverWallet();
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Driver Cancel Your Trip',
'You will be pay the cost to driver or we will get it from you on next trip'
.tr,
controller
.isdriverWaitTimeEnd =
false;
}));
})
: const SizedBox(),
],
),
.tokenPassenger,
[],
'cancel.wav');
await controller
.addWaitingTimeCostFromPassengerToDriverWallet();
controller
.isdriverWaitTimeEnd =
false;
}));
})
: const SizedBox(),
],
),
],
),
),

View File

@@ -339,6 +339,8 @@ class OrderSpeedRequest extends StatelessWidget {
kolor: AppColor.greenColor,
title: 'Accept Order'.tr,
onPressed: () async {
Get.put(HomeCaptainController()).changeRideId();
box.write(BoxName.statusDriverLocation, 'on');
var res = await CRUD()
.post(link: AppLink.updateStausFromSpeed, payload: {
'id': myList[16],
@@ -364,6 +366,34 @@ class OrderSpeedRequest extends StatelessWidget {
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id': myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id': myList[16].toString(),
'status': 'Apply'
});
CRUD().postFromDialogue(
link:
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
payload: {
'driver_id': myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id': myList[16].toString(),
'status': 'Apply'
});
CRUD().postFromDialogue(
link:
'${AppLink.seferGizaServer}/driver_order/add.php',
payload: {
'driver_id': myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id': myList[16].toString(),
'status': 'Apply'
});
// .then((value) {
// var json = jsonDecode(res);
if (res == "failure") {

View File

@@ -146,6 +146,13 @@ class AvailableRidesPage extends StatelessWidget {
"This ride is already taken by another driver."
.tr,
'', () {
CRUD().post(
link: AppLink.deleteAvailableRide,
payload: {'id': list['id']});
CRUD().post(
link:
'${AppLink.endPoint}/ride/notificationCaptain/deleteAvailableRide.php',
payload: {'id': list['id']});
Get.back();
});
} else if (jsonDecode(res)['status'] ==