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