6/9/1
This commit is contained in:
@@ -53,7 +53,7 @@ android {
|
||||
applicationId "com.mobileapp.store.ride"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 22
|
||||
minSdkVersion 23
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode 30
|
||||
versionName '1.5.30'
|
||||
|
||||
@@ -19,6 +19,7 @@ import '../../views/home/map_page_passenger.dart';
|
||||
import '../../views/home/map_widget.dart/call_passenger_page.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../auth/google_sign.dart';
|
||||
import '../functions/audio_record1.dart';
|
||||
import '../home/map_passenger_controller.dart';
|
||||
import 'local_notification.dart';
|
||||
|
||||
@@ -128,8 +129,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
var passengerList = message.data['passengerList'];
|
||||
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
driverID = myList[0].toString();
|
||||
Get.find<MapPassengerController>().driverToken = myList[2].toString();
|
||||
NotificationController().showNotification(
|
||||
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
|
||||
// driverAppliedTripSnakBar();
|
||||
@@ -180,6 +181,10 @@ class FirebaseMessagesController extends GetxController {
|
||||
'Driver Finish Trip'.tr,
|
||||
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
|
||||
'tone1');
|
||||
Get.find<AudioRecorderController>().stopRecording();
|
||||
if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
box.write(BoxName.passengerWalletTotal, 0);
|
||||
}
|
||||
Get.find<MapPassengerController>().tripFinishedFromDriver();
|
||||
// if (Get.find<PaymentController>().isCashChecked == false &&
|
||||
// Get.find<PaymentController>().isWalletChecked == true) {
|
||||
@@ -263,16 +268,19 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
Get.find<MapPassengerController>().restCounter();
|
||||
Get.offAll(const MapPagePassenger());
|
||||
} else if (message.notification!.title! == 'Order Applied') {
|
||||
Get.snackbar(
|
||||
"The order has been accepted by another driver."
|
||||
.tr, // Corrected grammar
|
||||
"Be more mindful next time to avoid dropping orders."
|
||||
.tr, // Improved sentence structure
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else if (message.notification!.title! == 'Order Applied') {
|
||||
}
|
||||
// else if (message.notification!.title! == 'Order Applied') {
|
||||
// Get.snackbar(
|
||||
// "The order has been accepted by another driver."
|
||||
// .tr, // Corrected grammar
|
||||
// "Be more mindful next time to avoid dropping orders."
|
||||
// .tr, // Improved sentence structure
|
||||
// backgroundColor: AppColor.yellowColor,
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// );
|
||||
// }
|
||||
|
||||
else if (message.notification!.title! == 'Order Applied') {
|
||||
NotificationController().showNotification(
|
||||
'The order Accepted by another Driver'.tr,
|
||||
'We regret to inform you that another driver has accepted this order.'
|
||||
@@ -321,6 +329,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
.startTimerDriverWaitPassenger5Minute();
|
||||
|
||||
Get.back();
|
||||
Get.find<MapPassengerController>().remainingTime = 0;
|
||||
Get.find<MapPassengerController>().update();
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ class AudioRecorderController extends GetxController {
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
// Generate a unique file name using the current timestamp
|
||||
String fileName =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}_${Get.find<MapPassengerController>().rideId}.aac';
|
||||
// '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}_${Get.find<MapPassengerController>().rideId}.m4a';
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}.m4a';
|
||||
filePath = '${directory.path}/$fileName';
|
||||
|
||||
// Define the configuration for the recording
|
||||
|
||||
@@ -13,23 +13,21 @@ void launchCommunication(
|
||||
String method, String contactInfo, String message) async {
|
||||
String url;
|
||||
|
||||
// Encode the message
|
||||
String encodedMessage = Uri.encodeComponent(message);
|
||||
|
||||
if (Platform.isIOS) {
|
||||
switch (method) {
|
||||
case 'phone':
|
||||
url = 'tel:$contactInfo';
|
||||
break;
|
||||
case 'sms':
|
||||
url = 'sms:$contactInfo&body=$encodedMessage';
|
||||
url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'whatsapp':
|
||||
url =
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=$encodedMessage';
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'email':
|
||||
url = 'mailto:$contactInfo?subject=Subject&body=$encodedMessage';
|
||||
url =
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
print('Method not supported on iOS');
|
||||
@@ -41,13 +39,25 @@ void launchCommunication(
|
||||
url = 'tel:$contactInfo';
|
||||
break;
|
||||
case 'sms':
|
||||
url = 'sms:$contactInfo?body=$encodedMessage';
|
||||
url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'whatsapp':
|
||||
url = 'whatsapp://send?phone=$contactInfo&text=$encodedMessage';
|
||||
// Check if WhatsApp is installed
|
||||
final bool whatsappInstalled =
|
||||
await canLaunchUrl(Uri.parse('whatsapp://'));
|
||||
if (whatsappInstalled) {
|
||||
url =
|
||||
'whatsapp://send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
} else {
|
||||
print('WhatsApp is not installed on this device.');
|
||||
// Provide an alternative action, such as opening the WhatsApp Web API
|
||||
url =
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
url = 'mailto:$contactInfo?subject=Subject&body=$encodedMessage';
|
||||
url =
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
print('Method not supported on Android');
|
||||
@@ -58,7 +68,7 @@ void launchCommunication(
|
||||
return;
|
||||
}
|
||||
|
||||
print('Launching URL: $url'); // Add this line for debugging
|
||||
print('Launching URL: $url');
|
||||
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
await launchUrl(Uri.parse(url));
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:math' show cos;
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:SEFER/controller/functions/tts.dart';
|
||||
import 'package:SEFER/views/home/map_page_passenger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -25,6 +26,7 @@ import '../../models/model/locations.dart';
|
||||
import '../../views/home/map_widget.dart/car_details_widget_to_go.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
import '../functions/audio_record1.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/launch.dart';
|
||||
import '../functions/secure_storage.dart';
|
||||
@@ -880,6 +882,8 @@ class MapPassengerController extends GetxController {
|
||||
late String make = '';
|
||||
late String licensePlate = '';
|
||||
confirmRideForFirstDriver() async {
|
||||
print('confirmRideForFirstDriver');
|
||||
print('statusRide $statusRide');
|
||||
await getCarsLocationByPassengerAndReloadMarker();
|
||||
await getNearestDriverByPassengerLocationAPIGOOGLE();
|
||||
|
||||
@@ -1066,7 +1070,7 @@ class MapPassengerController extends GetxController {
|
||||
];
|
||||
print('driversToken');
|
||||
print(driversToken);
|
||||
for (var i = 0; i < driversToken.length; i++) {
|
||||
for (var i = 1; i < driversToken.length; i++) {
|
||||
FirebaseMessagesController().sendNotificationToDriverMapPolyline(
|
||||
'OrderSpeed',
|
||||
rideId.toString(),
|
||||
@@ -1450,26 +1454,27 @@ class MapPassengerController extends GetxController {
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
|
||||
}
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
isCashConfirmPageShown = false;
|
||||
isSearchingWindow = false;
|
||||
statusRide = 'Cancel';
|
||||
isPassengerChosen = false;
|
||||
isCashSelectedBeforeConfirmRide = false;
|
||||
isPickerShown = false;
|
||||
isMarkersShown = false;
|
||||
haveSteps = false;
|
||||
isMarkersShown = false;
|
||||
driverToken = '';
|
||||
driverId = '';
|
||||
driverPhone = '';
|
||||
driverName = '';
|
||||
// totalStepDurations = 0;
|
||||
timeToPassengerFromDriverAfterApplied = 0;
|
||||
remainingTime = 0;
|
||||
isWayPointStopsSheetUtilGetMap = false;
|
||||
update();
|
||||
// rideConfirm = false;
|
||||
// shouldFetch = false;
|
||||
// isCashConfirmPageShown = false;
|
||||
// isSearchingWindow = false;
|
||||
// statusRide = 'Cancel';
|
||||
// isPassengerChosen = false;
|
||||
// isCashSelectedBeforeConfirmRide = false;
|
||||
// isPickerShown = false;
|
||||
// isMarkersShown = false;
|
||||
// haveSteps = false;
|
||||
// isMarkersShown = false;
|
||||
// driverToken = '';
|
||||
// driverId = '';
|
||||
// driverPhone = '';
|
||||
// driverName = '';
|
||||
// // totalStepDurations = 0;
|
||||
// timeToPassengerFromDriverAfterApplied = 0;
|
||||
// remainingTime = 0;
|
||||
// isWayPointStopsSheetUtilGetMap = false;
|
||||
// update();
|
||||
Get.offAll(const MapPagePassenger());
|
||||
} else {
|
||||
clearPlacesDestination();
|
||||
clearPolyline();
|
||||
@@ -1479,28 +1484,28 @@ class MapPassengerController extends GetxController {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
|
||||
isPickerShown = false;
|
||||
isWayPointStopsSheetUtilGetMap = false;
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
driverToken = '';
|
||||
driverId = '';
|
||||
driverPhone = '';
|
||||
driverName = '';
|
||||
isCashConfirmPageShown = false;
|
||||
isSearchingWindow = false;
|
||||
isPassengerChosen = false;
|
||||
isCashSelectedBeforeConfirmRide = false;
|
||||
statusRide = 'Cancel';
|
||||
haveSteps = false;
|
||||
isMarkersShown = false;
|
||||
timeToPassengerFromDriverAfterApplied = 0;
|
||||
changeCancelRidePageShow();
|
||||
clearPolyline();
|
||||
remainingTime = 0;
|
||||
durationTimer = 0;
|
||||
update();
|
||||
Get.offAll(const MapPagePassenger());
|
||||
// isPickerShown = false;
|
||||
// isWayPointStopsSheetUtilGetMap = false;
|
||||
// rideConfirm = false;
|
||||
// shouldFetch = false;
|
||||
// driverToken = '';
|
||||
// driverId = '';
|
||||
// driverPhone = '';
|
||||
// driverName = '';
|
||||
// isCashConfirmPageShown = false;
|
||||
// isSearchingWindow = false;
|
||||
// isPassengerChosen = false;
|
||||
// isCashSelectedBeforeConfirmRide = false;
|
||||
// statusRide = 'Cancel';
|
||||
// haveSteps = false;
|
||||
// isMarkersShown = false;
|
||||
// timeToPassengerFromDriverAfterApplied = 0;
|
||||
// changeCancelRidePageShow();
|
||||
// clearPolyline();
|
||||
// remainingTime = 0;
|
||||
// durationTimer = 0;
|
||||
// update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2623,7 +2628,7 @@ class MapPassengerController extends GetxController {
|
||||
if (jsonDecode(res)['message']['rating'] == null) {
|
||||
passengerRate = 5;
|
||||
} else {
|
||||
passengerRate = jsonDecode(res)['message']['rating'];
|
||||
passengerRate = jsonDecode(res)['message']['rating'].toDouble();
|
||||
}
|
||||
} else {
|
||||
passengerRate = 5;
|
||||
@@ -2649,6 +2654,7 @@ class MapPassengerController extends GetxController {
|
||||
Get.put(TextToSpeechController());
|
||||
box.write(BoxName.carType, 'yet');
|
||||
box.write(BoxName.tipPercentage, '0');
|
||||
Get.put(AudioRecorderController());
|
||||
// await getNearestDriverByPassengerLocation();
|
||||
|
||||
initilizeGetStorage();
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../controller/functions/audio_record1.dart';
|
||||
@@ -88,6 +89,26 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
// width: controller.widthMapTypeAndTraffic,
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColor.secondaryColor,
|
||||
// border: Border.all(),
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () async {
|
||||
// // AudioRecorderController audioController =
|
||||
// // Get.put(AudioRecorderController());
|
||||
// // sql.deleteAllData(TableName.recentLocations);
|
||||
// // await audioController.startRecording();
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.voice_chat,
|
||||
// size: 29,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
@@ -97,10 +118,13 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
sql.deleteAllData(TableName.recentLocations);
|
||||
var phone = box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '+2${box.read(BoxName.sosPhonePassenger)}'
|
||||
: '+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.voice_chat,
|
||||
Icons.chat,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user