25-1/28/1
This commit is contained in:
@@ -5,6 +5,7 @@ import 'dart:math' as math;
|
||||
import 'dart:ui';
|
||||
import 'package:SEFER/constant/univeries_polygon.dart';
|
||||
import 'package:SEFER/controller/firebase/local_notification.dart';
|
||||
import 'package:SEFER/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_confetti/flutter_confetti.dart';
|
||||
import 'package:vector_math/vector_math.dart' show radians, degrees;
|
||||
@@ -542,12 +543,12 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
void sendSMS(String to) async {
|
||||
// Get the driver's phone number.
|
||||
String driverPhone =
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
|
||||
String driverPhone = encryptionHelper.decryptData(
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString());
|
||||
|
||||
// Format the message.
|
||||
String message =
|
||||
'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $passengerName as the driver. $passengerName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.';
|
||||
'Hi! This is ${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n I am using ${box.read(AppInformation.appName)} to ride with $passengerName as the driver. $passengerName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.';
|
||||
|
||||
// Launch the URL to send the SMS.
|
||||
launchCommunication('sms', to, message);
|
||||
@@ -559,7 +560,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
// Format the message.
|
||||
String message =
|
||||
'${'${'Hi! This is'.tr} ${box.read(BoxName.name)}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $passengerName${' as the driver.'.tr} $passengerName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.';
|
||||
'${'${'Hi! This is'.tr} ${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $passengerName${' as the driver.'.tr} $passengerName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.';
|
||||
|
||||
// Launch the URL to send the WhatsApp message.
|
||||
launchCommunication('whatsapp', to, message);
|
||||
@@ -1958,7 +1959,7 @@ class MapPassengerController extends GetxController {
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Order'.tr,
|
||||
endNameAddress,
|
||||
driverData['token'].toString(),
|
||||
encryptionHelper.decryptData(driverData['token'].toString()),
|
||||
body,
|
||||
'order.wav');
|
||||
}
|
||||
@@ -1979,13 +1980,15 @@ class MapPassengerController extends GetxController {
|
||||
distance.toStringAsFixed(2),
|
||||
driverData['driver_id'].toString(),
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
box.read(BoxName.name).toString(),
|
||||
box.read(BoxName.tokenFCM).toString(),
|
||||
box.read(BoxName.phone).toString(),
|
||||
encryptionHelper
|
||||
.decryptData(box.read(BoxName.name).toString().split(' ')[0])
|
||||
.toString(),
|
||||
encryptionHelper.decryptData(box.read(BoxName.tokenFCM).toString()),
|
||||
encryptionHelper.decryptData(box.read(BoxName.phone).toString()),
|
||||
durationToPassenger.toStringAsFixed(0) ?? '120',
|
||||
distanceByPassenger.toString() ?? '2000',
|
||||
paymentController.isWalletChecked.toString(),
|
||||
driverData['token'].toString(),
|
||||
encryptionHelper.decryptData(driverData['token'].toString()),
|
||||
durationToPassenger.toString(),
|
||||
rideId.toString(),
|
||||
rideTimerBegin.toString(),
|
||||
@@ -2183,16 +2186,19 @@ class MapPassengerController extends GetxController {
|
||||
var response = jsonDecode(res);
|
||||
Log.print('getUpdatedRideForDriverApply: $response');
|
||||
driverId = response['data']['driver_id'];
|
||||
driverPhone = response['data']['phone'];
|
||||
driverPhone = encryptionHelper.decryptData(response['data']['phone']);
|
||||
driverCarMake = response['data']['make'];
|
||||
model = response['data']['model'];
|
||||
colorHex = response['data']['color_hex'];
|
||||
carColor = response['data']['color'];
|
||||
make = response['data']['make'];
|
||||
licensePlate = response['data']['car_plate'];
|
||||
passengerName = response['data']['passengerName'];
|
||||
driverName = response['data']['driverName'].toString();
|
||||
driverToken = response['data']['token'];
|
||||
licensePlate =
|
||||
encryptionHelper.decryptData(response['data']['car_plate']);
|
||||
passengerName =
|
||||
encryptionHelper.decryptData(response['data']['passengerName']);
|
||||
driverName = encryptionHelper
|
||||
.decryptData(response['data']['driverName'].toString());
|
||||
driverToken = encryptionHelper.decryptData(response['data']['token']);
|
||||
// Log.print('driverToken updated: $driverToken');
|
||||
carYear = response['data']['year'];
|
||||
driverRate = response['data']['ratingDriver'].toString();
|
||||
@@ -2420,31 +2426,69 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
String getLocationArea(double latitude, double longitude) {
|
||||
if (latitude >= 29.918901 &&
|
||||
latitude <= 30.198857 &&
|
||||
longitude >= 31.215009 &&
|
||||
longitude <= 31.532186) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
final locations = box.read(BoxName.locationName) ?? [];
|
||||
for (final location in locations) {
|
||||
final locationData = location as Map<String, dynamic>;
|
||||
|
||||
return 'Cairo';
|
||||
} else if (latitude >= 29.904975 &&
|
||||
latitude <= 30.143372 &&
|
||||
longitude >= 30.787030 &&
|
||||
longitude <= 31.215009) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferGizaServer);
|
||||
return 'Giza';
|
||||
} else if (latitude >= 30.396286 &&
|
||||
latitude <= 31.654458 &&
|
||||
longitude >= 29.041139 &&
|
||||
longitude <= 32.626259) {
|
||||
box.write(BoxName.serverChosen, AppLink.seferAlexandriaServer);
|
||||
return 'Alexandria';
|
||||
} else {
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
return 'Cairo';
|
||||
// Debugging: Print location data
|
||||
// print('Location Data: $locationData');
|
||||
|
||||
// Convert string values to double
|
||||
final minLatitude =
|
||||
double.tryParse(locationData['min_latitude'].toString()) ?? 0.0;
|
||||
final maxLatitude =
|
||||
double.tryParse(locationData['max_latitude'].toString()) ?? 0.0;
|
||||
final minLongitude =
|
||||
double.tryParse(locationData['min_longitude'].toString()) ?? 0.0;
|
||||
final maxLongitude =
|
||||
double.tryParse(locationData['max_longitude'].toString()) ?? 0.0;
|
||||
|
||||
// Debugging: Print converted values
|
||||
print(
|
||||
'Converted Values: minLatitude=$minLatitude, maxLatitude=$maxLatitude, minLongitude=$minLongitude, maxLongitude=$maxLongitude');
|
||||
|
||||
if (latitude >= minLatitude &&
|
||||
latitude <= maxLatitude &&
|
||||
longitude >= minLongitude &&
|
||||
longitude <= maxLongitude) {
|
||||
box.write(BoxName.serverChosen,
|
||||
encryptionHelper.decryptData(locationData['server_link']));
|
||||
// Log.print(
|
||||
// 'locationData----server_link: ${encryptionHelper.decryptData(locationData['server_link'])}');
|
||||
return locationData['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Default case
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
return 'Cairo';
|
||||
}
|
||||
|
||||
// if (latitude >= 29.918901 &&
|
||||
// latitude <= 30.198857 &&
|
||||
// longitude >= 31.215009 &&
|
||||
// longitude <= 31.532186) {
|
||||
// box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
|
||||
// return 'Cairo';
|
||||
// } else if (latitude >= 29.904975 &&
|
||||
// latitude <= 30.143372 &&
|
||||
// longitude >= 30.787030 &&
|
||||
// longitude <= 31.215009) {
|
||||
// box.write(BoxName.serverChosen, AppLink.seferGizaServer);
|
||||
// return 'Giza';
|
||||
// } else if (latitude >= 30.396286 &&
|
||||
// latitude <= 31.654458 &&
|
||||
// longitude >= 29.041139 &&
|
||||
// longitude <= 32.626259) {
|
||||
// box.write(BoxName.serverChosen, AppLink.seferAlexandriaServer);
|
||||
// return 'Alexandria';
|
||||
// } else {
|
||||
// box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
// return 'Cairo';
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<bool> getCarsLocationByPassengerAndReloadMarker(
|
||||
String carType, int boundIncreaseStep) async {
|
||||
// if (statusRide == 'wait') {
|
||||
@@ -2565,7 +2609,7 @@ class MapPassengerController extends GetxController {
|
||||
_getIconForCar(json),
|
||||
);
|
||||
|
||||
driversToken.add(json['token']);
|
||||
driversToken.add(encryptionHelper.decryptData(json['token']));
|
||||
}
|
||||
|
||||
// Add fake car markers
|
||||
@@ -2845,7 +2889,7 @@ class MapPassengerController extends GetxController {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
"Send Sefer app to him".tr,
|
||||
"Send SPEED app to him".tr,
|
||||
style: AppStyle.title.copyWith(color: AppColor.greenColor),
|
||||
)
|
||||
],
|
||||
@@ -2859,7 +2903,7 @@ class MapPassengerController extends GetxController {
|
||||
: '+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
var message = '''Dear ,
|
||||
|
||||
🚀 I have just started an exciting trip and I would like to share the details of my journey and my current location with you in real-time! Please download the SEFER app. It will allow you to view my trip details and my latest location.
|
||||
🚀 I have just started an exciting trip and I would like to share the details of my journey and my current location with you in real-time! Please download the SPEED app. It will allow you to view my trip details and my latest location.
|
||||
|
||||
👉 Download link:
|
||||
Android [https://play.google.com/store/apps/details?id=com.mobileapp.store.ride]
|
||||
@@ -2867,7 +2911,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
I look forward to keeping you close during my adventure!
|
||||
|
||||
SEFER ,'''
|
||||
SPEED ,'''
|
||||
.tr;
|
||||
launchCommunication('whatsapp', phone, message);
|
||||
}),
|
||||
@@ -2877,7 +2921,7 @@ class MapPassengerController extends GetxController {
|
||||
Get.back();
|
||||
}));
|
||||
} else if (res1['status'] == 'success') {
|
||||
var tokenParent = res1['data'][0]['token'];
|
||||
var tokenParent = encryptionHelper.decryptData(res1['data'][0]['token']);
|
||||
Get.snackbar("The invitation was sent successfully".tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
@@ -3160,7 +3204,7 @@ class MapPassengerController extends GetxController {
|
||||
} else {
|
||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||
mainBottomMenuMapHeight =
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .6;
|
||||
isWayPointSheet = false;
|
||||
if (heightMenuBool == true) {
|
||||
getDrawerMenu();
|
||||
@@ -3646,18 +3690,6 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
// LatLngBounds calculateBounds(double lat, double lng, double radiusInMeters) {
|
||||
// const double earthRadius = 6378137.0; // Earth's radius in meters
|
||||
|
||||
// double latDelta = radiusInMeters / earthRadius * (180 / pi);
|
||||
// double lngDelta =
|
||||
// radiusInMeters / (earthRadius * cos(pi * lat / 180)) * (180 / pi);
|
||||
|
||||
// return LatLngBounds(
|
||||
// southwest: LatLng(lat - latDelta, lng - lngDelta),
|
||||
// northeast: LatLng(lat + latDelta, lng + lngDelta),
|
||||
// );
|
||||
// }
|
||||
LatLngBounds calculateBounds(double lat, double lng, double radiusInMeters) {
|
||||
const double earthRadius = 6378137.0; // Earth's radius in meters
|
||||
|
||||
@@ -4018,8 +4050,14 @@ class MapPassengerController extends GetxController {
|
||||
late LatLngBounds boundsData;
|
||||
late String startNameAddress = '';
|
||||
late String endNameAddress = '';
|
||||
List<Map<String, dynamic>> stopPoints = [];
|
||||
void removeStop(Map<String, dynamic> stop) {
|
||||
stopPoints.remove(stop);
|
||||
update(); // Trigger a rebuild of the UI
|
||||
}
|
||||
|
||||
getDirectionMap(String origin, destination) async {
|
||||
getDirectionMap(String origin, destination,
|
||||
[List<String> waypoints = const []]) async {
|
||||
isLoading = true;
|
||||
update();
|
||||
remainingTime = 25; //to make cancel every call
|
||||
@@ -4039,7 +4077,10 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
var url =
|
||||
('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang) ?? 'ar'}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||
|
||||
if (waypoints.isNotEmpty) {
|
||||
String formattedWaypoints = waypoints.join('|');
|
||||
url += '&waypoints=$formattedWaypoints';
|
||||
}
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
box.remove(BoxName.tripData);
|
||||
@@ -5095,7 +5136,7 @@ class MapPassengerController extends GetxController {
|
||||
await FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'OrderVIP',
|
||||
rideId.toString(),
|
||||
driver['token'].toString(),
|
||||
encryptionHelper.decryptData(driver['token'].toString()),
|
||||
[
|
||||
id,
|
||||
rideId,
|
||||
@@ -5103,13 +5144,15 @@ class MapPassengerController extends GetxController {
|
||||
passengerLocation.latitude.toString(),
|
||||
startNameAddress.toString(),
|
||||
passengerLocation.longitude.toString(),
|
||||
box.read(BoxName.name).toString(),
|
||||
encryptionHelper
|
||||
.decryptData(box.read(BoxName.name).toString().split(' ')[0])
|
||||
.toString(),
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
box.read(BoxName.phone).toString(),
|
||||
box.read(BoxName.email).toString(),
|
||||
box.read(BoxName.passengerPhotoUrl).toString(),
|
||||
box.read(BoxName.tokenFCM).toString(),
|
||||
driver['token'].toString(),
|
||||
encryptionHelper.decryptData(driver['token'].toString()),
|
||||
],
|
||||
'order.wav');
|
||||
if (response['message'] == "Trip updated successfully") {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:SEFER/controller/payment/payment_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_contacts/flutter_contacts.dart';
|
||||
@@ -38,9 +39,9 @@ class InviteController extends GetxController {
|
||||
Future<void> shareDriverCode() async {
|
||||
if (driverCouponCode != null) {
|
||||
final String shareText = '''
|
||||
Join SEFER as a driver using my referral code!
|
||||
Join SWIFTI as a driver using my referral code!
|
||||
Use code: $driverCouponCode
|
||||
Download the SEFER Driver app now and earn rewards!
|
||||
Download the SWIFTI Driver app now and earn rewards!
|
||||
''';
|
||||
await Share.share(shareText);
|
||||
}
|
||||
@@ -49,9 +50,9 @@ Download the SEFER Driver app now and earn rewards!
|
||||
Future<void> sharePassengerCode() async {
|
||||
if (couponCode != null) {
|
||||
final String shareText = '''
|
||||
Get a discount on your first SEFER ride!
|
||||
Get a discount on your first SWIFTI ride!
|
||||
Use my referral code: $couponCode
|
||||
Download the SEFER app now and enjoy your ride!
|
||||
Download the SWIFTI app now and enjoy your ride!
|
||||
''';
|
||||
await Share.share(shareText);
|
||||
}
|
||||
@@ -175,12 +176,17 @@ Download the SEFER app now and enjoy your ride!
|
||||
|
||||
void onSelectPassengerInvitation(int index) async {
|
||||
MyDialog().getDialog(
|
||||
driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 2
|
||||
? '${'When'.tr} ${driverInvitationDataToPassengers[index]['passengerName']} ${"complete, you can claim your gift".tr} '
|
||||
int.parse(driverInvitationDataToPassengers[index]['countOfInvitDriver']
|
||||
.toString()) <
|
||||
2
|
||||
? '${'When'.tr} ${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
|
||||
: 'You deserve the gift'.tr,
|
||||
'${driverInvitationDataToPassengers[index]['passengerName']} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 2 ${'Trip'.tr}',
|
||||
'${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver'].toString()} / 2 ${'Trip'.tr}',
|
||||
() async {
|
||||
if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 2) {
|
||||
if (int.parse(driverInvitationDataToPassengers[index]
|
||||
['countOfInvitDriver']
|
||||
.toString()) <
|
||||
2) {
|
||||
Get.back();
|
||||
} else {
|
||||
// Claim the gift if 100 trips are completed
|
||||
@@ -264,14 +270,14 @@ Download the SEFER app now and enjoy your ride!
|
||||
var response =
|
||||
await CRUD().post(link: AppLink.addInvitationPassenger, payload: {
|
||||
"driverId": box.read(BoxName.passengerID),
|
||||
"inviterPassengerPhone": '+2$phoneNumber'
|
||||
"inviterPassengerPhone": encryptionHelper.encryptData('+2$phoneNumber')
|
||||
});
|
||||
|
||||
if (response != 'failure') {
|
||||
var d = response;
|
||||
Get.snackbar('Success', 'Invite sent successfully'.tr);
|
||||
|
||||
String message = '${'*SEFER APP CODE*'.tr}\n\n'
|
||||
String message = '${'*SWIFTI APP CODE*'.tr}\n\n'
|
||||
'${"Use this code in registration".tr}\n'
|
||||
'${"To get a gift for both".tr}\n\n'
|
||||
'${"The period of this code is 1 hour".tr}\n\n'
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/encrypt_decrypt.dart';
|
||||
|
||||
class VipOrderController extends GetxController {
|
||||
RxBool isLoading = false.obs;
|
||||
@@ -286,7 +287,12 @@ class VipWaittingPage extends StatelessWidget {
|
||||
? MyElevatedButton(
|
||||
title: "Click here to begin your trip\n\nGood luck, "
|
||||
.tr +
|
||||
box.read(BoxName.name).toString(),
|
||||
encryptionHelper
|
||||
.decryptData(box
|
||||
.read(BoxName.name)
|
||||
.toString()
|
||||
.split(' ')[0])
|
||||
.toString(),
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
final mapPassengerController =
|
||||
|
||||
Reference in New Issue
Block a user