4/10/2
This commit is contained in:
@@ -147,38 +147,44 @@ class FirebaseMessagesController extends GetxController {
|
||||
driverID = myList[2].toString();
|
||||
|
||||
NotificationController().showNotification(
|
||||
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order');
|
||||
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
|
||||
// driverAppliedTripSnakBar();
|
||||
} else if (message.notification!.title! == 'Promo') {
|
||||
NotificationController()
|
||||
.showNotification('Promo', 'Show latest promo'.tr, 'order');
|
||||
.showNotification('Promo', 'Show latest promo'.tr, 'promo');
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title == 'Cancel Trip') {
|
||||
NotificationController().showNotification(
|
||||
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'order');
|
||||
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel');
|
||||
cancelTripDialog();
|
||||
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
|
||||
Get.find<MapPassengerController>().isDriverInPassengerWay = true;
|
||||
Get.find<MapPassengerController>().update();
|
||||
NotificationController().showNotification('Driver is Going To You'.tr,
|
||||
'Please stay on the picked point.'.tr, 'order');
|
||||
'Please stay on the picked point.'.tr, 'tone1');
|
||||
// Get.snackbar('Driver is Going To Passenger', '',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title! == 'message From passenger') {
|
||||
NotificationController()
|
||||
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
|
||||
passengerDialog(message.notification!.body!);
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'RideIsBegin') {
|
||||
Get.find<MapPassengerController>().getBeginRideFromDriver();
|
||||
// Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
NotificationController()
|
||||
.showNotification('Trip is Begin'.tr, ''.tr, 'order');
|
||||
.showNotification('Trip is Begin'.tr, ''.tr, 'start');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I will go now') {
|
||||
// Get.snackbar('Hi ,I will go now', '',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
NotificationController().showNotification(
|
||||
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'order');
|
||||
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
|
||||
NotificationController()
|
||||
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'order');
|
||||
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'tone2');
|
||||
driverArrivePassengerDialoge();
|
||||
|
||||
update();
|
||||
@@ -188,7 +194,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
NotificationController().showNotification(
|
||||
'Driver Finish Trip'.tr,
|
||||
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
|
||||
'order');
|
||||
'tone1');
|
||||
Get.find<MapPassengerController>().tripFinishedFromDriver();
|
||||
if (Get.find<PaymentController>().isCashChecked == false &&
|
||||
Get.find<PaymentController>().isWalletChecked == true) {
|
||||
@@ -204,13 +210,13 @@ class FirebaseMessagesController extends GetxController {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
'Call Income'.tr,
|
||||
message.notification!.body!,
|
||||
'order',
|
||||
);
|
||||
}
|
||||
// if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
'Call Income'.tr,
|
||||
message.notification!.body!,
|
||||
'iphone_ringtone',
|
||||
);
|
||||
// }
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.to(() => PassengerCallPage(
|
||||
channelName: driverList[1].toString(),
|
||||
@@ -228,7 +234,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
NotificationController().showNotification(
|
||||
'Call End'.tr,
|
||||
message.notification!.body!,
|
||||
'order',
|
||||
'tone2',
|
||||
);
|
||||
}
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
@@ -242,11 +248,14 @@ class FirebaseMessagesController extends GetxController {
|
||||
// .tr,
|
||||
// 'message',
|
||||
// backgroundColor: AppColor.redColor);
|
||||
NotificationController().showNotification(
|
||||
'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');
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
'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');
|
||||
}
|
||||
|
||||
Get.find<MapPassengerController>().restCounter();
|
||||
Get.offAll(const MapPagePassenger());
|
||||
} else if (message.notification!.title! == 'Order Applied') {
|
||||
@@ -335,6 +344,25 @@ class FirebaseMessagesController extends GetxController {
|
||||
}));
|
||||
}
|
||||
|
||||
Future<dynamic> passengerDialog(String message) {
|
||||
return Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'message From passenger'.tr,
|
||||
middleText: message.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Hi ,I will go now'.tr,
|
||||
// 'I will go now'.tr,
|
||||
// Get.find<MapPassengerController>().driverToken, []);
|
||||
// Get.find<MapPassengerController>()
|
||||
// .startTimerDriverWaitPassenger5Minute();
|
||||
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
|
||||
Future<dynamic> driverFinishTripDialoge(List<dynamic> driverList) {
|
||||
return Get.defaultDialog(
|
||||
title: 'Driver Finish Trip'.tr,
|
||||
@@ -412,7 +440,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'tone2.wav'
|
||||
'sound': 'start.wav'
|
||||
},
|
||||
'priority': 'high',
|
||||
'data': <String, dynamic>{
|
||||
@@ -507,7 +535,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'tone2.wav'
|
||||
'sound': 'promo.wav'
|
||||
},
|
||||
'data': <String, dynamic>{
|
||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||
|
||||
@@ -1,160 +1,160 @@
|
||||
// import 'dart:io';
|
||||
//
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_sound/flutter_sound.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
//
|
||||
// import '../home/map_passenger_controller.dart';
|
||||
//
|
||||
// class AudioController extends GetxController {
|
||||
// final recorder = FlutterSoundRecorder();
|
||||
// bool isRecording = false;
|
||||
//
|
||||
// @override
|
||||
// void onInit() {
|
||||
// super.onInit();
|
||||
// initRecorder();
|
||||
// }
|
||||
//
|
||||
// Future<void> initRecorder() async {
|
||||
// final status = await Permission.microphone.request();
|
||||
// if (status != PermissionStatus.granted) {
|
||||
// if (status.isPermanentlyDenied) {
|
||||
// // Handle permission permanently denied
|
||||
// showPermissionDeniedDialog();
|
||||
// } else if (status.isDenied) {
|
||||
// // Handle permission denied
|
||||
// showPermissionDeniedSnackbar();
|
||||
// } else if (status.isRestricted) {
|
||||
// // Handle permission restricted
|
||||
// showPermissionDeniedSnackbar();
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// await recorder.openRecorder();
|
||||
// recorder.setSubscriptionDuration(const Duration(minutes: 50));
|
||||
// }
|
||||
//
|
||||
// Future<void> startRecording() async {
|
||||
// if (!recorder.isStopped) {
|
||||
// await recorder.startRecorder();
|
||||
// }
|
||||
// isRecording = true;
|
||||
// update();
|
||||
// }
|
||||
//
|
||||
// Future<void> stopRecording() async {
|
||||
// final filePath = await recorder.stopRecorder();
|
||||
// final audioFile = File(filePath!);
|
||||
// print('Recorded file path: $audioFile');
|
||||
// // Now you can send this file to the server
|
||||
// isRecording = false;
|
||||
// update();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void onClose() {
|
||||
// recorder.stopRecorder();
|
||||
// super.onClose();
|
||||
// }
|
||||
//
|
||||
// void showPermissionDeniedDialog() {
|
||||
// showDialog(
|
||||
// context: Get.context!,
|
||||
// builder: (context) => AlertDialog(
|
||||
// title: const Text('Microphone Permission'),
|
||||
// content:
|
||||
// const Text('Microphone permission is required to record audio.'),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// openAppSettings();
|
||||
// },
|
||||
// child: const Text('Open Settings'),
|
||||
// ),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// child: const Text('Cancel'),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// void showPermissionDeniedSnackbar() {
|
||||
// Get.snackbar(
|
||||
// 'Microphone Permission',
|
||||
// 'Microphone permission is required to record audio.',
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// duration: const Duration(seconds: 5),
|
||||
// mainButton: TextButton(
|
||||
// onPressed: () {
|
||||
// openAppSettings();
|
||||
// },
|
||||
// child: const Text(
|
||||
// 'Open Settings',
|
||||
// style: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
// import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class AudioController extends GetxController {
|
||||
final flutterSoundHelper = FlutterSoundHelper();
|
||||
import '../home/map_passenger_controller.dart';
|
||||
|
||||
class AudioController extends GetxController {
|
||||
final recorder = FlutterSoundRecorder();
|
||||
bool isRecording = false;
|
||||
|
||||
Future<void> startRecording() async {
|
||||
if (!await flutterSoundHelper.hasPermissions()) {
|
||||
await flutterSoundHelper.requestPermissions();
|
||||
}
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
initRecorder();
|
||||
}
|
||||
|
||||
if (!await flutterSoundHelper.hasPermissions()) {
|
||||
Future<void> initRecorder() async {
|
||||
final status = await Permission.microphone.request();
|
||||
if (status != PermissionStatus.granted) {
|
||||
if (status.isPermanentlyDenied) {
|
||||
// Handle permission permanently denied
|
||||
showPermissionDeniedDialog();
|
||||
} else if (status.isDenied) {
|
||||
// Handle permission denied
|
||||
showPermissionDeniedSnackbar();
|
||||
} else if (status.isRestricted) {
|
||||
// Handle permission restricted
|
||||
// showPermissionDeniedSnackbar();
|
||||
}
|
||||
return;
|
||||
}
|
||||
await recorder.openRecorder();
|
||||
recorder.setSubscriptionDuration(const Duration(minutes: 50));
|
||||
}
|
||||
|
||||
await flutterSoundHelper.startRecorder();
|
||||
Future<void> startRecording() async {
|
||||
if (!recorder.isStopped) {
|
||||
await recorder.startRecorder();
|
||||
}
|
||||
isRecording = true;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<void> stopRecording() async {
|
||||
if (!isRecording) {
|
||||
return;
|
||||
}
|
||||
|
||||
await flutterSoundHelper.stopRecorder();
|
||||
final filePath = await recorder.stopRecorder();
|
||||
final audioFile = File(filePath!);
|
||||
print('Recorded file path: $audioFile');
|
||||
// Now you can send this file to the server
|
||||
isRecording = false;
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
recorder.stopRecorder();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void showPermissionDeniedDialog() {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Microphone Permission'),
|
||||
content:
|
||||
const Text('Microphone permission is required to record audio.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
openAppSettings();
|
||||
},
|
||||
child: const Text('Open Settings'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showPermissionDeniedSnackbar() {
|
||||
Get.snackbar(
|
||||
'Microphone Permission',
|
||||
'Microphone permission is required to record audio.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
duration: const Duration(seconds: 5),
|
||||
mainButton: TextButton(
|
||||
onPressed: () {
|
||||
openAppSettings();
|
||||
},
|
||||
child: const Text(
|
||||
'Open Settings',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FlutterSoundHelper {
|
||||
final flutterSound = FlutterSoundRecorder();
|
||||
|
||||
Future<bool> hasPermissions() async {
|
||||
return await Permission.microphone.isGranted;
|
||||
}
|
||||
|
||||
Future<void> requestPermissions() async {
|
||||
await Permission.microphone.request();
|
||||
}
|
||||
|
||||
Future<void> startRecorder() async {
|
||||
await flutterSound.openRecorder();
|
||||
await flutterSound.startRecorder(toFile: 'audio.wav');
|
||||
}
|
||||
|
||||
Future<void> stopRecorder() async {
|
||||
await flutterSound.stopRecorder();
|
||||
await flutterSound.closeRecorder();
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_sound/public/flutter_sound_recorder.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// // import 'package:flutter_sound/flutter_sound.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
//
|
||||
// class AudioController extends GetxController {
|
||||
// final flutterSoundHelper = FlutterSoundHelper();
|
||||
//
|
||||
// bool isRecording = false;
|
||||
//
|
||||
// Future<void> startRecording() async {
|
||||
// if (!await flutterSoundHelper.hasPermissions()) {
|
||||
// await flutterSoundHelper.requestPermissions();
|
||||
// }
|
||||
//
|
||||
// if (!await flutterSoundHelper.hasPermissions()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// await flutterSoundHelper.startRecorder();
|
||||
// isRecording = true;
|
||||
// }
|
||||
//
|
||||
// Future<void> stopRecording() async {
|
||||
// if (!isRecording) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// await flutterSoundHelper.stopRecorder();
|
||||
// isRecording = false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class FlutterSoundHelper {
|
||||
// final flutterSound = FlutterSoundRecorder();
|
||||
//
|
||||
// Future<bool> hasPermissions() async {
|
||||
// return await Permission.microphone.isGranted;
|
||||
// }
|
||||
//
|
||||
// Future<void> requestPermissions() async {
|
||||
// await Permission.microphone.request();
|
||||
// }
|
||||
//
|
||||
// Future<void> startRecorder() async {
|
||||
// await flutterSound.openRecorder();
|
||||
// await flutterSound.startRecorder(toFile: 'audio.wav');
|
||||
// }
|
||||
//
|
||||
// Future<void> stopRecorder() async {
|
||||
// await flutterSound.stopRecorder();
|
||||
// await flutterSound.closeRecorder();
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -478,8 +478,17 @@ class MyTranslation extends Translations {
|
||||
'Distance from Passenger to destination is ':
|
||||
"المسافة من الراكب إلى الوجهة هي ",
|
||||
'price is': 'التكلفة',
|
||||
'distance is'
|
||||
'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.':
|
||||
'حتا لو مفيش كارت SIM, متخفش! تقدر تكلم سواقك بمنتهى البساطة عن طريق التطبيق بتاعنا. احنا بنستخدم تكنولوجيا حديثة عشان نحافظ على خصوصيتك.',
|
||||
'Driver Finish Trip'
|
||||
'distance is'
|
||||
'Cost Of Trip IS ': "تكلفة الرحلة هي ",
|
||||
'Select one message': "اختر رسالة",
|
||||
'My location is correct. You can search for me using the navigation app':
|
||||
'المكان اللي أنا فيه صح، ممكن تدور عليّا من خلال تطبيق الملاحة',
|
||||
'I\'m waiting for you': 'مستنيك بفارغ الصبر',
|
||||
'Hello, I\'m at the agreed-upon location':
|
||||
' أهلاً وسهلاً، وصلت للمكان اللي اتفقنا عليه',
|
||||
"We noticed the speed is exceeding 100 km/h. Please slow down for your safety. If you feel unsafe, you can share your trip details with a contact or call the police using the red SOS button.":
|
||||
"لقد لاحظنا أن السرعة تتجاوز ١٠٠ كم/ساعة. يرجى التباطؤ من أجل سلامتك. إذا كنت تشعر بعدم الأمان، يمكنك مشاركة تفاصيل رحلتك مع جهة اتصال أو الاتصال بالشرطة باستخدام زر SOS الأحمر.",
|
||||
'Warning: Speeding detected!': "تحذير: تم رصد السرعة الزائدة!",
|
||||
|
||||
Reference in New Issue
Block a user