10/2/1
This commit is contained in:
@@ -178,6 +178,12 @@ class FirebasMessagesController extends GetxController {
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title == ('Ride Begin')) {
|
||||
Get.snackbar(
|
||||
'Trip Begin'.tr,
|
||||
'by Passenger'.tr,
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -464,21 +470,7 @@ class FirebasMessagesController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void sendNotificationToDriverId(
|
||||
String title,
|
||||
body,
|
||||
strin1,
|
||||
strin2,
|
||||
strin3,
|
||||
strin4,
|
||||
strin5,
|
||||
strin6,
|
||||
string7,
|
||||
string8,
|
||||
passengerName,
|
||||
passengertoken,
|
||||
passengerPhone,
|
||||
token) async {
|
||||
void sendNotificationToDriverId(String title, body, token) async {
|
||||
http
|
||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
@@ -491,21 +483,7 @@ class FirebasMessagesController extends GetxController {
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
},
|
||||
'data': {
|
||||
'myList': jsonEncode([
|
||||
strin1,
|
||||
strin2,
|
||||
strin3,
|
||||
strin4,
|
||||
strin5,
|
||||
strin6,
|
||||
string7,
|
||||
string8,
|
||||
passengerName,
|
||||
passengertoken,
|
||||
passengerPhone
|
||||
]),
|
||||
},
|
||||
'data': {},
|
||||
'priority': 'high',
|
||||
'to': token,
|
||||
}))
|
||||
|
||||
@@ -214,7 +214,7 @@ class MapController extends GetxController {
|
||||
box.read(BoxName.phone).toString(),
|
||||
durationByPassenger.toString(),
|
||||
distanceByPassenger.toString(),
|
||||
paymentController.isWalletChecked.toString() //todo if it is work
|
||||
paymentController.isWalletChecked.toString()
|
||||
];
|
||||
FirebasMessagesController().sendNotificationToDriverMAP(
|
||||
'Order',
|
||||
|
||||
@@ -11,6 +11,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MapController());
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => controller.isPassengerInfoWindow
|
||||
? Positioned(
|
||||
|
||||
@@ -3,10 +3,13 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/firebase/firbase_messge.dart';
|
||||
import '../../../controller/functions/crud.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
import '../../../main.dart';
|
||||
|
||||
class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
const TimerToPassengerFromDriver({
|
||||
@@ -66,6 +69,8 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
onPressed: () async {
|
||||
MapController mapController =
|
||||
Get.find<MapController>();
|
||||
final firebasMessagesController =
|
||||
Get.put(FirebasMessagesController());
|
||||
//todo start the trip and rest all counter ,start new counter of the trip time
|
||||
await CRUD()
|
||||
.post(link: AppLink.updateRides, payload: {
|
||||
@@ -74,6 +79,20 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
'status': 'Applied'
|
||||
});
|
||||
mapController.driverArrivePassenger();
|
||||
// Send notification to driver to alert him that trip is begin
|
||||
firebasMessagesController
|
||||
.sendNotificationToDriverId(
|
||||
'Ride Begin',
|
||||
box.read(BoxName.name).toString(),
|
||||
mapController
|
||||
.dataCarsLocationByPassenger['message'][0]
|
||||
['token']
|
||||
.toString(),
|
||||
);
|
||||
print(mapController
|
||||
.dataCarsLocationByPassenger['message'][0]
|
||||
['token']
|
||||
.toString());
|
||||
Get.snackbar(
|
||||
'The Ride is Begin'.tr,
|
||||
'',
|
||||
|
||||
@@ -9,10 +9,11 @@ import '../widgets/mycircular.dart';
|
||||
|
||||
class PassengerLocationDirection extends StatelessWidget {
|
||||
PassengerLocationDirection({super.key});
|
||||
final LocationController locationController = Get.put(LocationController());
|
||||
// final LocationController locationController = Get.put(LocationController());
|
||||
// final MapDirection mapDirection = Get.find<MapDirection>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(LocationController());
|
||||
// mapDirection.getMap();//todo get this argument
|
||||
return MyScafolld(
|
||||
title: 'Map'.tr,
|
||||
@@ -22,7 +23,7 @@ class PassengerLocationDirection extends StatelessWidget {
|
||||
child: GetBuilder<LocationController>(
|
||||
builder: (controller) => GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: locationController.myLocation,
|
||||
target: controller.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user