12/17/1
This commit is contained in:
@@ -1,91 +1,4 @@
|
|||||||
//
|
|
||||||
//def localProperties = new Properties()
|
|
||||||
//def localPropertiesFile = rootProject.file('local.properties')
|
|
||||||
//if (localPropertiesFile.exists()) {
|
|
||||||
// localPropertiesFile.withReader('UTF-8') { reader ->
|
|
||||||
// localProperties.load(reader)
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
||||||
//if (flutterRoot == null) {
|
|
||||||
// throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
|
||||||
//if (flutterVersionCode == null) {
|
|
||||||
// flutterVersionCode = '12'
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
|
||||||
//if (flutterVersionName == null) {
|
|
||||||
// flutterVersionName = '1.1.2'
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//apply plugin: 'com.android.application'
|
|
||||||
//apply plugin: 'kotlin-android'
|
|
||||||
//// apply plugin: 'com.google.gms.google-services'
|
|
||||||
//apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
//def keystoreProperties = new Properties()
|
|
||||||
//def keystorePropertiesFile = rootProject.file('key.properties')
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//android {
|
|
||||||
// namespace "com.mobileapp.store.ride"
|
|
||||||
// compileSdkVersion 34
|
|
||||||
// ndkVersion flutter.ndkVersion
|
|
||||||
//
|
|
||||||
// compileOptions {
|
|
||||||
// sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
// targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// kotlinOptions {
|
|
||||||
// jvmTarget = '1.8'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// sourceSets {
|
|
||||||
// main.java.srcDirs += 'src/main/kotlin'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// defaultConfig {
|
|
||||||
// // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
||||||
// 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 23
|
|
||||||
// targetSdkVersion 34
|
|
||||||
// versionCode 67
|
|
||||||
// versionName '1.5.67'
|
|
||||||
// // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// signingConfigs {
|
|
||||||
// release {
|
|
||||||
// keyAlias keystoreProperties['keyAlias']
|
|
||||||
// keyPassword keystoreProperties['keyPassword']
|
|
||||||
// storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
|
|
||||||
// storePassword keystoreProperties['storePassword']
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// buildTypes {
|
|
||||||
// release {
|
|
||||||
// signingConfig signingConfigs.release
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//flutter {
|
|
||||||
// source '../..'
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//dependencies {
|
|
||||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
// // implementation platform('com.google.firebase:firebase-bom:32.1.1')
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
@@ -124,7 +37,7 @@ if (keystorePropertiesFile.exists()) {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace "com.mobileapp.store.ride"
|
namespace "com.mobileapp.store.ride"
|
||||||
compileSdk 34
|
compileSdk 35
|
||||||
ndkVersion "26.1.10909125"
|
ndkVersion "26.1.10909125"
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -148,8 +61,8 @@ android {
|
|||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = 106
|
versionCode = 108
|
||||||
versionName = '1.6.106'
|
versionName = '1.6.108'
|
||||||
multiDexEnabled =true
|
multiDexEnabled =true
|
||||||
|
|
||||||
// manifestPlaceholders can be specified here if needed
|
// manifestPlaceholders can be specified here if needed
|
||||||
@@ -167,6 +80,9 @@ android {
|
|||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
// minifyEnabled true
|
||||||
|
// shrinkResources true
|
||||||
|
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,11 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>77</string>
|
<string>78</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>4.3.77</string>
|
<string>4.3.78</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
Get.find<MapPassengerController>().statusRide == 'Apply';
|
Get.find<MapPassengerController>().statusRide == 'Apply';
|
||||||
Get.find<MapPassengerController>().isSearchingWindow == false;
|
Get.find<MapPassengerController>().isSearchingWindow == false;
|
||||||
Get.find<MapPassengerController>().update();
|
Get.find<MapPassengerController>().update();
|
||||||
|
Get.find<MapPassengerController>().rideAppliedFromDriver(true);
|
||||||
|
|
||||||
// driverAppliedTripSnakBar();
|
// driverAppliedTripSnakBar();
|
||||||
} else if (message.notification!.title! == 'Promo'.tr) {
|
} else if (message.notification!.title! == 'Promo'.tr) {
|
||||||
@@ -236,7 +237,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
title: 'Cancel'.tr,
|
title: 'Cancel'.tr,
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.offAll(const MapPagePassenger());
|
Get.offAll(() => const MapPagePassenger());
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// Get.find<MapPassengerController>()
|
// Get.find<MapPassengerController>()
|
||||||
@@ -256,18 +257,16 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
box.write(BoxName.passengerWalletTotal, 0);
|
box.write(BoxName.passengerWalletTotal, 0);
|
||||||
}
|
}
|
||||||
Get.find<MapPassengerController>().tripFinishedFromDriver();
|
Get.find<MapPassengerController>().tripFinishedFromDriver();
|
||||||
|
|
||||||
Get.to(() => RateDriverFromPassenger(), arguments: {
|
|
||||||
'driverId': driverList[0].toString(),
|
|
||||||
'rideId': driverList[1].toString(),
|
|
||||||
'price': driverList[3].toString()
|
|
||||||
});
|
|
||||||
notificationController.showNotification(
|
notificationController.showNotification(
|
||||||
'Don’t forget your personal belongings.'.tr,
|
'Don’t forget your personal belongings.'.tr,
|
||||||
'Please make sure you have all your personal belongings and that any remaining fare, if applicable, has been added to your wallet before leaving. Thank you for choosing the Sefer app'
|
'Please make sure you have all your personal belongings and that any remaining fare, if applicable, has been added to your wallet before leaving. Thank you for choosing the Sefer app'
|
||||||
.tr,
|
.tr,
|
||||||
'ding');
|
'ding');
|
||||||
// }
|
Get.to(() => RateDriverFromPassenger(), arguments: {
|
||||||
|
'driverId': driverList[0].toString(),
|
||||||
|
'rideId': driverList[1].toString(),
|
||||||
|
'price': driverList[3].toString()
|
||||||
|
});
|
||||||
} else if (message.notification!.title! == "Finish Monitor".tr) {
|
} else if (message.notification!.title! == "Finish Monitor".tr) {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
titleStyle: AppStyle.title,
|
titleStyle: AppStyle.title,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
import 'package:timezone/data/latest.dart' as tz;
|
import 'package:timezone/data/latest.dart' as tz;
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
|
|
||||||
|
import '../../main.dart';
|
||||||
|
|
||||||
class NotificationController extends GetxController {
|
class NotificationController extends GetxController {
|
||||||
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
|
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
|
||||||
FlutterLocalNotificationsPlugin();
|
FlutterLocalNotificationsPlugin();
|
||||||
@@ -63,6 +65,55 @@ class NotificationController extends GetxController {
|
|||||||
|
|
||||||
// Assume _flutterLocalNotificationsPlugin is initialized somewhere in your code
|
// Assume _flutterLocalNotificationsPlugin is initialized somewhere in your code
|
||||||
|
|
||||||
|
// void scheduleNotificationsForSevenDays(
|
||||||
|
// String title, String message, String tone) async {
|
||||||
|
// final AndroidNotificationDetails android = AndroidNotificationDetails(
|
||||||
|
// 'high_importance_channel',
|
||||||
|
// 'High Importance Notifications',
|
||||||
|
// importance: Importance.max,
|
||||||
|
// priority: Priority.high,
|
||||||
|
// sound: RawResourceAndroidNotificationSound(tone),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const DarwinNotificationDetails ios = DarwinNotificationDetails(
|
||||||
|
// sound: 'default',
|
||||||
|
// presentAlert: true,
|
||||||
|
// presentBadge: true,
|
||||||
|
// presentSound: true,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// final NotificationDetails details =
|
||||||
|
// NotificationDetails(android: android, iOS: ios);
|
||||||
|
|
||||||
|
// // Check for the exact alarm permission on Android 12 and above
|
||||||
|
// if (Platform.isAndroid) {
|
||||||
|
// if (await Permission.scheduleExactAlarm.isDenied) {
|
||||||
|
// if (await Permission.scheduleExactAlarm.request().isGranted) {
|
||||||
|
// print('SCHEDULE_EXACT_ALARM permission granted');
|
||||||
|
// } else {
|
||||||
|
// print('SCHEDULE_EXACT_ALARM permission denied');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Schedule notifications for the next 7 days
|
||||||
|
// for (int day = 0; day < 7; day++) {
|
||||||
|
// // Schedule for 8:00 AM
|
||||||
|
// await _scheduleNotificationForTime(
|
||||||
|
// day, 8, 0, title, message, details, day * 1000 + 1);
|
||||||
|
|
||||||
|
// // Schedule for 3:00 PM
|
||||||
|
// await _scheduleNotificationForTime(
|
||||||
|
// day, 15, 0, title, message, details, day * 1000 + 2); // Unique ID
|
||||||
|
|
||||||
|
// // Schedule for 8:00 PM
|
||||||
|
// await _scheduleNotificationForTime(
|
||||||
|
// day, 20, 0, title, message, details, day * 1000 + 3); // Unique ID
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print('Notifications scheduled successfully for the next 7 days');
|
||||||
|
// }
|
||||||
void scheduleNotificationsForSevenDays(
|
void scheduleNotificationsForSevenDays(
|
||||||
String title, String message, String tone) async {
|
String title, String message, String tone) async {
|
||||||
final AndroidNotificationDetails android = AndroidNotificationDetails(
|
final AndroidNotificationDetails android = AndroidNotificationDetails(
|
||||||
@@ -97,17 +148,37 @@ class NotificationController extends GetxController {
|
|||||||
|
|
||||||
// Schedule notifications for the next 7 days
|
// Schedule notifications for the next 7 days
|
||||||
for (int day = 0; day < 7; day++) {
|
for (int day = 0; day < 7; day++) {
|
||||||
// Schedule for 8:00 AM
|
// List of notification times
|
||||||
await _scheduleNotificationForTime(
|
final notificationTimes = [
|
||||||
day, 8, 0, title, message, details, day * 1000 + 1);
|
{'hour': 8, 'minute': 0, 'id': day * 1000 + 1}, // 8:00 AM
|
||||||
|
{'hour': 15, 'minute': 0, 'id': day * 1000 + 2}, // 3:00 PM
|
||||||
|
{'hour': 20, 'minute': 0, 'id': day * 1000 + 3}, // 8:00 PM
|
||||||
|
];
|
||||||
|
|
||||||
// Schedule for 3:00 PM
|
for (var time in notificationTimes) {
|
||||||
await _scheduleNotificationForTime(
|
final notificationId = time['id'] as int;
|
||||||
day, 15, 0, title, message, details, day * 1000 + 2); // Unique ID
|
|
||||||
|
|
||||||
// Schedule for 8:00 PM
|
// Check if this notification ID is already stored
|
||||||
await _scheduleNotificationForTime(
|
bool isScheduled = box.read('notification_$notificationId') ?? false;
|
||||||
day, 20, 0, title, message, details, day * 1000 + 3); // Unique ID
|
|
||||||
|
if (!isScheduled) {
|
||||||
|
// Schedule the notification if not already scheduled
|
||||||
|
await _scheduleNotificationForTime(
|
||||||
|
day,
|
||||||
|
time['hour'] as int,
|
||||||
|
time['minute'] as int,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
details,
|
||||||
|
notificationId,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mark this notification ID as scheduled in GetStorage
|
||||||
|
box.write('notification_$notificationId', true);
|
||||||
|
} else {
|
||||||
|
print('Notification with ID $notificationId is already scheduled.');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print('Notifications scheduled successfully for the next 7 days');
|
print('Notifications scheduled successfully for the next 7 days');
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CRUD {
|
|||||||
|
|
||||||
Log.print('response.request: ${response.request}');
|
Log.print('response.request: ${response.request}');
|
||||||
Log.print('payload: ${payload}');
|
Log.print('payload: ${payload}');
|
||||||
Log.print('response.reasonPhrase: ${response.reasonPhrase}');
|
// Log.print('response.reasonPhrase: ${response.reasonPhrase}');
|
||||||
|
|
||||||
Log.print('response.body: ${response.body}');
|
Log.print('response.body: ${response.body}');
|
||||||
// print(payload);
|
// print(payload);
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ class MapPassengerController extends GetxController {
|
|||||||
box.read(BoxName.carType), 4000);
|
box.read(BoxName.carType), 4000);
|
||||||
// confirmRideForAllDriverAvailable();
|
// confirmRideForAllDriverAvailable();
|
||||||
|
|
||||||
icreaseForSameRideAndDelay();
|
increaseForSameRideAndDelay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -932,13 +932,14 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tripFinishedFromDriver() async {
|
void tripFinishedFromDriver() {
|
||||||
isRideFinished = true;
|
isRideFinished = true;
|
||||||
rideTimerBegin = false;
|
rideTimerBegin = false;
|
||||||
statusRideVip = 'Finished';
|
statusRideVip = 'Finished';
|
||||||
box.write(BoxName.arrivalTime, '');
|
box.write(BoxName.arrivalTime, '');
|
||||||
remainingTimeTimerRideBegin = 0;
|
remainingTimeTimerRideBegin = 0;
|
||||||
box.write(BoxName.passengerWalletTotal, '0');
|
box.write(BoxName.passengerWalletTotal, '0');
|
||||||
|
update();
|
||||||
if (box.read(BoxName.parentTripSelected) == true) {
|
if (box.read(BoxName.parentTripSelected) == true) {
|
||||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||||
"Finish Monitor".tr,
|
"Finish Monitor".tr,
|
||||||
@@ -950,7 +951,6 @@ class MapPassengerController extends GetxController {
|
|||||||
box.write(BoxName.parentTripSelected, false);
|
box.write(BoxName.parentTripSelected, false);
|
||||||
box.remove(BoxName.tokenParent);
|
box.remove(BoxName.tokenParent);
|
||||||
}
|
}
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool isBeginRideFromDriver = false;
|
// bool isBeginRideFromDriver = false;
|
||||||
@@ -998,6 +998,8 @@ class MapPassengerController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getRideStatusBegin, payload: {'ride_id': rideId});
|
link: AppLink.getRideStatusBegin, payload: {'ride_id': rideId});
|
||||||
|
print(res);
|
||||||
|
print('1002');
|
||||||
if (res != 'failure') {
|
if (res != 'failure') {
|
||||||
var decode = jsonDecode(res);
|
var decode = jsonDecode(res);
|
||||||
_beginRideStreamController
|
_beginRideStreamController
|
||||||
@@ -1067,6 +1069,8 @@ class MapPassengerController extends GetxController {
|
|||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getRideStatusFromStartApp,
|
link: AppLink.getRideStatusFromStartApp,
|
||||||
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
||||||
|
print(res);
|
||||||
|
print('1070');
|
||||||
if (res == 'failure') {
|
if (res == 'failure') {
|
||||||
print(
|
print(
|
||||||
"No rides found for the given passenger ID within the last hour.");
|
"No rides found for the given passenger ID within the last hour.");
|
||||||
@@ -1330,7 +1334,7 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
Set<String> notifiedDrivers = {};
|
Set<String> notifiedDrivers = {};
|
||||||
|
|
||||||
addRideToNotificationDriverString() async {
|
addRideToNotificationDriverAvailable() async {
|
||||||
await CRUD().post(link: AppLink.addWaitingRide, payload: {
|
await CRUD().post(link: AppLink.addWaitingRide, payload: {
|
||||||
'id': rideId.toString(),
|
'id': rideId.toString(),
|
||||||
'start_location':
|
'start_location':
|
||||||
@@ -1343,11 +1347,12 @@ class MapPassengerController extends GetxController {
|
|||||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||||
'status': 'waiting',
|
'status': 'waiting',
|
||||||
'carType': box.read(BoxName.carType),
|
'carType': box.read(BoxName.carType),
|
||||||
'passengerRate': passengerRate,
|
'passengerRate': passengerRate.toStringAsFixed(2),
|
||||||
'price_for_passenger': totalME.toString(),
|
'price_for_passenger': totalME.toStringAsFixed(2),
|
||||||
'distance': distance.toString(),
|
'distance': distance.toStringAsFixed(1),
|
||||||
'duration': duration ?? '10',
|
'duration': duration.toStringAsFixed(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
CRUD().post(
|
CRUD().post(
|
||||||
link: '${AppLink.endPoint}/notificationCaptain/addWaitingRide.php',
|
link: '${AppLink.endPoint}/notificationCaptain/addWaitingRide.php',
|
||||||
@@ -1363,10 +1368,10 @@ class MapPassengerController extends GetxController {
|
|||||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||||
'status': 'waiting',
|
'status': 'waiting',
|
||||||
'carType': box.read(BoxName.carType),
|
'carType': box.read(BoxName.carType),
|
||||||
'passengerRate': passengerRate,
|
'passengerRate': passengerRate.toStringAsFixed(2),
|
||||||
'price_for_passenger': totalME.toString(),
|
'price_for_passenger': totalME.toStringAsFixed(2),
|
||||||
'distance': distance.toString(),
|
'distance': distance.toStringAsFixed(1),
|
||||||
'duration': duration ?? '10',
|
'duration': duration.toStringAsFixed(0),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1382,7 +1387,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// if (dataCarsLocationByPassenger != 'failure' &&
|
// if (dataCarsLocationByPassenger != 'failure' &&
|
||||||
// dataCarsLocationByPassenger != null &&
|
// dataCarsLocationByPassenger != null &&
|
||||||
// dataCarsLocationByPassenger.containsKey('data') &&
|
// dataCarsLocationByPassenger.containsKey('data') &&
|
||||||
// dataCarsLocationByPassenger['data'] != null) {
|
// dataCarsLocationByPassenger['message'] != null) {
|
||||||
// driversFound = true;
|
// driversFound = true;
|
||||||
// break; // Exit loop if drivers are found
|
// break; // Exit loop if drivers are found
|
||||||
// }
|
// }
|
||||||
@@ -1445,7 +1450,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// "endtime": durationToAdd.toString(),
|
// "endtime": durationToAdd.toString(),
|
||||||
// "price": totalPassenger.toStringAsFixed(2),
|
// "price": totalPassenger.toStringAsFixed(2),
|
||||||
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
||||||
// "driver_id": dataCarsLocationByPassenger['data'][carsOrder]['driver_id']
|
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||||
// .toString(),
|
// .toString(),
|
||||||
// "status": "waiting",
|
// "status": "waiting",
|
||||||
// 'carType': box.read(BoxName.carType),
|
// 'carType': box.read(BoxName.carType),
|
||||||
@@ -1477,8 +1482,8 @@ class MapPassengerController extends GetxController {
|
|||||||
// box.read(BoxName.carType), 3000);
|
// box.read(BoxName.carType), 3000);
|
||||||
// if (dataCarsLocationByPassenger != null &&
|
// if (dataCarsLocationByPassenger != null &&
|
||||||
// dataCarsLocationByPassenger.containsKey('data') &&
|
// dataCarsLocationByPassenger.containsKey('data') &&
|
||||||
// dataCarsLocationByPassenger['data'] != null) {
|
// dataCarsLocationByPassenger['message'] != null) {
|
||||||
// for (var driverData in dataCarsLocationByPassenger['data']) {
|
// for (var driverData in dataCarsLocationByPassenger['message']) {
|
||||||
// String driverId = driverData['driver_id'].toString();
|
// String driverId = driverData['driver_id'].toString();
|
||||||
// if (!notifiedDrivers.contains(driverId)) {
|
// if (!notifiedDrivers.contains(driverId)) {
|
||||||
// notifiedDrivers.add(driverId);
|
// notifiedDrivers.add(driverId);
|
||||||
@@ -1549,7 +1554,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// "endtime": durationToAdd.toString(),
|
// "endtime": durationToAdd.toString(),
|
||||||
// "price": totalPassenger.toStringAsFixed(2),
|
// "price": totalPassenger.toStringAsFixed(2),
|
||||||
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
||||||
// "driver_id": dataCarsLocationByPassenger['data'][carsOrder]['driver_id']
|
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||||
// .toString(),
|
// .toString(),
|
||||||
// "status": "waiting",
|
// "status": "waiting",
|
||||||
// 'carType': box.read(BoxName.carType),
|
// 'carType': box.read(BoxName.carType),
|
||||||
@@ -1563,116 +1568,117 @@ class MapPassengerController extends GetxController {
|
|||||||
// update();
|
// update();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
icreaseForSameRideAndDelay() async {
|
increaseForSameRideAndDelay() async {
|
||||||
bool driversFound = false;
|
reSearchAfterCanceledFromDriver();
|
||||||
for (int attempt = 0; attempt < 8; attempt++) {
|
// bool driversFound = false;
|
||||||
await getCarsLocationByPassengerAndReloadMarker(
|
// for (int attempt = 0; attempt < 8; attempt++) {
|
||||||
box.read(BoxName.carType), 4500);
|
// await getCarsLocationByPassengerAndReloadMarker(
|
||||||
|
// box.read(BoxName.carType), 4500);
|
||||||
|
|
||||||
// Check if dataCarsLocationByPassenger is valid and contains drivers
|
// // Check if dataCarsLocationByPassenger is valid and contains drivers
|
||||||
if (dataCarsLocationByPassenger != 'failure' &&
|
// if (dataCarsLocationByPassenger != 'failure' &&
|
||||||
dataCarsLocationByPassenger != null &&
|
// dataCarsLocationByPassenger != null &&
|
||||||
dataCarsLocationByPassenger.containsKey('data') &&
|
// dataCarsLocationByPassenger.containsKey('message') &&
|
||||||
dataCarsLocationByPassenger['data'] != null) {
|
// dataCarsLocationByPassenger['message'] != null) {
|
||||||
driversFound = true;
|
// driversFound = true;
|
||||||
break; // Exit loop if drivers are found
|
// break; // Exit loop if drivers are found
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Wait 2 seconds before next attempt
|
// // Wait 2 seconds before next attempt
|
||||||
await Future.delayed(const Duration(seconds: 2));
|
// await Future.delayed(const Duration(seconds: 2));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// If no drivers were found after 4 attempts, show a dialog
|
// // If no drivers were found after 4 attempts, show a dialog
|
||||||
if (!driversFound) {
|
// if (!driversFound) {
|
||||||
Get.dialog(
|
// Get.dialog(
|
||||||
BackdropFilter(
|
// BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
// filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||||
child: CupertinoAlertDialog(
|
// child: CupertinoAlertDialog(
|
||||||
title: Text(
|
// title: Text(
|
||||||
"No Car or Driver Found in your area.".tr,
|
// "No Car or Driver Found in your area.".tr,
|
||||||
style: AppStyle.title.copyWith(
|
// style: AppStyle.title.copyWith(
|
||||||
fontSize: 20,
|
// fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
content: Text(
|
// content: Text(
|
||||||
"No Car or Driver Found in your area.".tr,
|
// "No Car or Driver Found in your area.".tr,
|
||||||
style: AppStyle.title.copyWith(fontSize: 16),
|
// style: AppStyle.title.copyWith(fontSize: 16),
|
||||||
),
|
// ),
|
||||||
actions: [
|
// actions: [
|
||||||
CupertinoDialogAction(
|
// CupertinoDialogAction(
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
Get.offAll(() => const MapPagePassenger());
|
// Get.offAll(() => const MapPagePassenger());
|
||||||
},
|
// },
|
||||||
child: Text('OK'.tr,
|
// child: Text('OK'.tr,
|
||||||
style: const TextStyle(color: AppColor.greenColor)),
|
// style: const TextStyle(color: AppColor.greenColor)),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
barrierDismissible: false,
|
// barrierDismissible: false,
|
||||||
);
|
// );
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
PaymentController paymentController = Get.find<PaymentController>();
|
// PaymentController paymentController = Get.find<PaymentController>();
|
||||||
rideConfirm = true;
|
// rideConfirm = true;
|
||||||
shouldFetch = true;
|
// shouldFetch = true;
|
||||||
isBottomSheetShown = false;
|
// isBottomSheetShown = false;
|
||||||
timeToPassengerFromDriverAfterApplied = 60;
|
// timeToPassengerFromDriverAfterApplied = 60;
|
||||||
// confirmRideForAllDriverAvailable();
|
// // confirmRideForAllDriverAvailable();
|
||||||
for (var i = 0; i < dataCarsLocationByPassenger['data'].length; i++) {
|
// for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||||
List<String> body = [
|
// List<String> body = [
|
||||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||||
totalPassenger.toStringAsFixed(2),
|
// totalPassenger.toStringAsFixed(2),
|
||||||
totalDriver.toStringAsFixed(2),
|
// totalDriver.toStringAsFixed(2),
|
||||||
durationToRide.toString(),
|
// durationToRide.toString(),
|
||||||
distance.toStringAsFixed(2),
|
// distance.toStringAsFixed(2),
|
||||||
dataCarsLocationByPassenger['data'][i]['driver_id'].toString(),
|
// dataCarsLocationByPassenger['message'][i]['driver_id'].toString(),
|
||||||
box.read(BoxName.passengerID).toString(),
|
// box.read(BoxName.passengerID).toString(),
|
||||||
box.read(BoxName.name).toString(),
|
// box.read(BoxName.name).toString(),
|
||||||
box.read(BoxName.tokenFCM).toString(),
|
// box.read(BoxName.tokenFCM).toString(),
|
||||||
box.read(BoxName.phone).toString(),
|
// box.read(BoxName.phone).toString(),
|
||||||
durationByPassenger.toString(),
|
// durationByPassenger.toString(),
|
||||||
distanceByPassenger.toString(),
|
// distanceByPassenger.toString(),
|
||||||
paymentController.isWalletChecked.toString(),
|
// paymentController.isWalletChecked.toString(),
|
||||||
dataCarsLocationByPassenger['data'][i]['token'].toString(),
|
// dataCarsLocationByPassenger['message'][i]['token'].toString(),
|
||||||
durationToPassenger.toString(),
|
// durationToPassenger.toString(),
|
||||||
rideId.toString(),
|
// rideId.toString(),
|
||||||
rideTimerBegin.toString(),
|
// rideTimerBegin.toString(),
|
||||||
dataCarsLocationByPassenger['data'][i]['driver_id'].toString(),
|
// dataCarsLocationByPassenger['message'][i]['driver_id'].toString(),
|
||||||
durationToRide.toString(),
|
// durationToRide.toString(),
|
||||||
Get.find<WayPointController>().wayPoints.length > 1
|
// Get.find<WayPointController>().wayPoints.length > 1
|
||||||
? 'haveSteps'
|
// ? 'haveSteps'
|
||||||
: 'startEnd',
|
// : 'startEnd',
|
||||||
placesCoordinate[0],
|
// placesCoordinate[0],
|
||||||
placesCoordinate[1],
|
// placesCoordinate[1],
|
||||||
placesCoordinate[2],
|
// placesCoordinate[2],
|
||||||
placesCoordinate[3],
|
// placesCoordinate[3],
|
||||||
placesCoordinate[4],
|
// placesCoordinate[4],
|
||||||
costForDriver.toStringAsFixed(2),
|
// costForDriver.toStringAsFixed(2),
|
||||||
double.parse(box.read(BoxName.passengerWalletTotal)) < 0
|
// double.parse(box.read(BoxName.passengerWalletTotal)) < 0
|
||||||
? double.parse(box.read(BoxName.passengerWalletTotal))
|
// ? double.parse(box.read(BoxName.passengerWalletTotal))
|
||||||
.toStringAsFixed(2)
|
// .toStringAsFixed(2)
|
||||||
: '0',
|
// : '0',
|
||||||
box.read(BoxName.email).toString(),
|
// box.read(BoxName.email).toString(),
|
||||||
data[0]['start_address'],
|
// data[0]['start_address'],
|
||||||
data[0]['end_address'],
|
// data[0]['end_address'],
|
||||||
box.read(BoxName.carType),
|
// box.read(BoxName.carType),
|
||||||
kazan.toStringAsFixed(0),
|
// kazan.toStringAsFixed(0),
|
||||||
passengerRate.toStringAsFixed(2),
|
// passengerRate.toStringAsFixed(2),
|
||||||
];
|
// ];
|
||||||
// Log.print('body: ${body}');
|
// // Log.print('body: ${body}');
|
||||||
|
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
// FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
'OrderSpeed',
|
// 'OrderSpeed',
|
||||||
rideId.toString(),
|
// rideId.toString(),
|
||||||
dataCarsLocationByPassenger['data'][i]['token'].toString(),
|
// dataCarsLocationByPassenger['message'][i]['token'].toString(),
|
||||||
body,
|
// body,
|
||||||
'order.wav');
|
// 'order.wav');
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
int tick = 0; // Move tick outside the function to maintain its state
|
int tick = 0; // Move tick outside the function to maintain its state
|
||||||
@@ -1760,6 +1766,7 @@ class MapPassengerController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String driversStatusForSearchWindow = '';
|
||||||
Future<void> confirmRideForAllDriverAvailable() async {
|
Future<void> confirmRideForAllDriverAvailable() async {
|
||||||
bool driversFound = false;
|
bool driversFound = false;
|
||||||
const maxAttempts = 8;
|
const maxAttempts = 8;
|
||||||
@@ -1770,7 +1777,7 @@ class MapPassengerController extends GetxController {
|
|||||||
await getCarsLocationByPassengerAndReloadMarker(
|
await getCarsLocationByPassengerAndReloadMarker(
|
||||||
box.read(BoxName.carType), reloadDuration);
|
box.read(BoxName.carType), reloadDuration);
|
||||||
// await getNearestDriverByPassengerLocation();
|
// await getNearestDriverByPassengerLocation();
|
||||||
|
driversStatusForSearchWindow = 'We are search for nearst driver'.tr;
|
||||||
if (isDriversDataValid()) {
|
if (isDriversDataValid()) {
|
||||||
driversFound = true;
|
driversFound = true;
|
||||||
break;
|
break;
|
||||||
@@ -1783,9 +1790,16 @@ class MapPassengerController extends GetxController {
|
|||||||
showNoDriversDialog();
|
showNoDriversDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
driversStatusForSearchWindow = 'Your order is being prepared'.tr;
|
||||||
|
Log.print('driversStatusForSearchWindow: ${driversStatusForSearchWindow}');
|
||||||
|
update();
|
||||||
await postRideDetailsToServer();
|
await postRideDetailsToServer();
|
||||||
|
driversStatusForSearchWindow = 'Your order sent to drivers'.tr;
|
||||||
await notifyAvailableDrivers();
|
await notifyAvailableDrivers();
|
||||||
|
|
||||||
|
driversStatusForSearchWindow = 'The drivers are reviewing your request'.tr;
|
||||||
|
Log.print('driversStatusForSearchWindow: ${driversStatusForSearchWindow}');
|
||||||
|
update();
|
||||||
delayAndFetchRideStatusForAllDriverAvailable(rideId);
|
delayAndFetchRideStatusForAllDriverAvailable(rideId);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -1823,8 +1837,8 @@ class MapPassengerController extends GetxController {
|
|||||||
bool isDriversDataValid() {
|
bool isDriversDataValid() {
|
||||||
return dataCarsLocationByPassenger != 'failure' &&
|
return dataCarsLocationByPassenger != 'failure' &&
|
||||||
dataCarsLocationByPassenger != null &&
|
dataCarsLocationByPassenger != null &&
|
||||||
dataCarsLocationByPassenger.containsKey('data') &&
|
dataCarsLocationByPassenger.containsKey('message') &&
|
||||||
dataCarsLocationByPassenger['data'] != null;
|
dataCarsLocationByPassenger['message'] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showNoDriversDialog() {
|
void showNoDriversDialog() {
|
||||||
@@ -1889,7 +1903,8 @@ class MapPassengerController extends GetxController {
|
|||||||
"endtime": durationToAdd.toString(),
|
"endtime": durationToAdd.toString(),
|
||||||
"price": totalPassenger.toStringAsFixed(2),
|
"price": totalPassenger.toStringAsFixed(2),
|
||||||
"passenger_id": box.read(BoxName.passengerID).toString(),
|
"passenger_id": box.read(BoxName.passengerID).toString(),
|
||||||
"driver_id": dataCarsLocationByPassenger['data'][carsOrder]['driver_id']
|
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||||
|
['driver_id']
|
||||||
.toString(),
|
.toString(),
|
||||||
"status": "waiting",
|
"status": "waiting",
|
||||||
'carType': box.read(BoxName.carType),
|
'carType': box.read(BoxName.carType),
|
||||||
@@ -1911,9 +1926,9 @@ class MapPassengerController extends GetxController {
|
|||||||
box.read(BoxName.carType), 3000);
|
box.read(BoxName.carType), 3000);
|
||||||
|
|
||||||
if (dataCarsLocationByPassenger != null &&
|
if (dataCarsLocationByPassenger != null &&
|
||||||
dataCarsLocationByPassenger.containsKey('data') &&
|
dataCarsLocationByPassenger.containsKey('message') &&
|
||||||
dataCarsLocationByPassenger['data'] != null) {
|
dataCarsLocationByPassenger['message'] != null) {
|
||||||
for (var driverData in dataCarsLocationByPassenger['data']) {
|
for (var driverData in dataCarsLocationByPassenger['message']) {
|
||||||
String driverId = driverData['driver_id'].toString();
|
String driverId = driverData['driver_id'].toString();
|
||||||
if (!notifiedDrivers.contains(driverId)) {
|
if (!notifiedDrivers.contains(driverId)) {
|
||||||
notifiedDrivers.add(driverId);
|
notifiedDrivers.add(driverId);
|
||||||
@@ -1926,14 +1941,18 @@ class MapPassengerController extends GetxController {
|
|||||||
driverLng,
|
driverLng,
|
||||||
);
|
);
|
||||||
|
|
||||||
double distanceToDriverInKm = distanceToDriverInMeters / 1000;
|
double distanceToDriverInKm = distanceToDriverInMeters *
|
||||||
|
1.25 / //to approximate to stright distance
|
||||||
|
1000;
|
||||||
double durationToDriverInHours =
|
double durationToDriverInHours =
|
||||||
distanceToDriverInKm / 25; // 25 km/h as default speed
|
distanceToDriverInKm / 25; // 25 km/h as default speed
|
||||||
double durationToDriverInSeconds = durationToDriverInHours * 3600;
|
double durationToDriverInSeconds = durationToDriverInHours * 3600;
|
||||||
durationToPassenger = durationToDriverInSeconds.toInt();
|
durationToPassenger = durationToDriverInSeconds.toInt();
|
||||||
distanceByPassenger = distanceToDriverInMeters.toStringAsFixed(0);
|
distanceByPassenger =
|
||||||
|
(distanceToDriverInMeters * 1.25).toStringAsFixed(0);
|
||||||
|
Future.delayed(const Duration(microseconds: 10));
|
||||||
final body = constructNotificationBody(driverData);
|
final body = constructNotificationBody(driverData);
|
||||||
Log.print('body:ww ${body}');
|
// Log.print('body:ww ${body}');
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
'OrderSpeed',
|
'OrderSpeed',
|
||||||
rideId,
|
rideId,
|
||||||
@@ -1961,8 +1980,8 @@ class MapPassengerController extends GetxController {
|
|||||||
box.read(BoxName.name).toString(),
|
box.read(BoxName.name).toString(),
|
||||||
box.read(BoxName.tokenFCM).toString(),
|
box.read(BoxName.tokenFCM).toString(),
|
||||||
box.read(BoxName.phone).toString(),
|
box.read(BoxName.phone).toString(),
|
||||||
durationToPassenger.toString(),
|
durationToPassenger.toStringAsFixed(0) ?? '120',
|
||||||
distanceByPassenger.toString(),
|
distanceByPassenger.toString() ?? '2000',
|
||||||
paymentController.isWalletChecked.toString(),
|
paymentController.isWalletChecked.toString(),
|
||||||
driverData['token'].toString(),
|
driverData['token'].toString(),
|
||||||
durationToPassenger.toString(),
|
durationToPassenger.toString(),
|
||||||
@@ -1996,12 +2015,13 @@ class MapPassengerController extends GetxController {
|
|||||||
StreamController<String>.broadcast();
|
StreamController<String>.broadcast();
|
||||||
Stream<String> get rideStatusStream => _rideStatusStreamController.stream;
|
Stream<String> get rideStatusStream => _rideStatusStreamController.stream;
|
||||||
|
|
||||||
void delayAndFetchRideStatusForAllDriverAvailable(String rideId) {
|
Future<void> delayAndFetchRideStatusForAllDriverAvailable(
|
||||||
|
String rideId) async {
|
||||||
const int maxAttempts = 15;
|
const int maxAttempts = 15;
|
||||||
int attemptCounter = 0;
|
int attemptCounter = 0;
|
||||||
bool isApplied = false;
|
bool isApplied = false;
|
||||||
tick = 0;
|
tick = 0;
|
||||||
|
await addRideToNotificationDriverAvailable();
|
||||||
Timer.periodic(const Duration(seconds: 1), (timer) async {
|
Timer.periodic(const Duration(seconds: 1), (timer) async {
|
||||||
if (attemptCounter >= maxAttempts || isApplied) {
|
if (attemptCounter >= maxAttempts || isApplied) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
@@ -2014,8 +2034,10 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
var res = await getRideStatus(rideId);
|
var res = await getRideStatus(rideId);
|
||||||
|
Log.print('res:2022 ${res}');
|
||||||
String rideStatusDelayed = res.toString();
|
String rideStatusDelayed = res.toString();
|
||||||
addRideToNotificationDriverString();
|
Log.print('rideStatusDelayed: ${rideStatusDelayed}');
|
||||||
|
|
||||||
_rideStatusStreamController
|
_rideStatusStreamController
|
||||||
.add(rideStatusDelayed); // Emit the ride status
|
.add(rideStatusDelayed); // Emit the ride status
|
||||||
// addRideToNotificationDriverString();
|
// addRideToNotificationDriverString();
|
||||||
@@ -2025,41 +2047,23 @@ class MapPassengerController extends GetxController {
|
|||||||
"Order Cancelled".tr, "you canceled order".tr, 'ding');
|
"Order Cancelled".tr, "you canceled order".tr, 'ding');
|
||||||
_rideStatusStreamController
|
_rideStatusStreamController
|
||||||
.close(); // Close stream after cancellation
|
.close(); // Close stream after cancellation
|
||||||
|
//
|
||||||
|
//
|
||||||
} else if (rideStatusDelayed == 'Apply' ||
|
} else if (rideStatusDelayed == 'Apply' ||
|
||||||
rideStatusDelayed == 'Applied') {
|
rideStatusDelayed == 'Applied') {
|
||||||
await getUpdatedRideForDriverApply(rideId);
|
rideAppliedFromDriver(isApplied);
|
||||||
NotificationController().showNotification(
|
|
||||||
'Order Accepted'.tr,
|
|
||||||
'$driverName ${'accepted your order at price'.tr} ${totalPassenger.toStringAsFixed(1)} ${'with type'.tr} ${box.read(BoxName.carType)}',
|
|
||||||
'ding');
|
|
||||||
if (box.read(BoxName.carType) == 'Speed' ||
|
|
||||||
box.read(BoxName.carType) == 'Awfar Car') {
|
|
||||||
NotificationController().showNotification(
|
|
||||||
'The captain is responsible for the route.'.tr,
|
|
||||||
'This price is fixed even if the route changes for the driver.'
|
|
||||||
.tr,
|
|
||||||
'ding');
|
|
||||||
} else if (box.read(BoxName.carType) == 'Comfort' ||
|
|
||||||
box.read(BoxName.carType) == 'Lady') {
|
|
||||||
NotificationController().showNotification('Attention'.tr,
|
|
||||||
'The price may increase if the route changes.'.tr, 'ding');
|
|
||||||
}
|
|
||||||
isApplied = true;
|
|
||||||
statusRide = 'Apply';
|
|
||||||
rideConfirm = false;
|
|
||||||
isSearchingWindow = false;
|
|
||||||
|
|
||||||
startTimer();
|
|
||||||
update();
|
|
||||||
startTimerFromDriverToPassengerAfterApplied();
|
|
||||||
|
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
_rideStatusStreamController.close(); // Close stream after applying
|
// Close stream after applying
|
||||||
} else if (attemptCounter >= maxAttempts &&
|
} else if (attemptCounter >= maxAttempts ||
|
||||||
rideStatusDelayed != 'Cancel') {
|
rideStatusDelayed != 'Cancel') {
|
||||||
timer.cancel();
|
timer.cancel(); //todo
|
||||||
// addRideToNotificationDriverString();
|
// addRideToNotificationDriverString();
|
||||||
// Show dialog to increase fee...
|
// Show dialog to increase fee...
|
||||||
|
MyDialog().getDialog(
|
||||||
|
'Are you want to wait drivers to accept your order'.tr, '', () {
|
||||||
|
Get.back();
|
||||||
|
addRideToNotificationDriverAvailable();
|
||||||
|
});
|
||||||
update();
|
update();
|
||||||
_rideStatusStreamController
|
_rideStatusStreamController
|
||||||
.close(); // Close stream after max attempts
|
.close(); // Close stream after max attempts
|
||||||
@@ -2070,6 +2074,36 @@ class MapPassengerController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rideAppliedFromDriver(bool isApplied) async {
|
||||||
|
await getUpdatedRideForDriverApply(rideId);
|
||||||
|
NotificationController().showNotification(
|
||||||
|
'Order Accepted'.tr,
|
||||||
|
'$driverName ${'accepted your order at price'.tr} ${totalPassenger.toStringAsFixed(1)} ${'with type'.tr} ${box.read(BoxName.carType)}',
|
||||||
|
'ding');
|
||||||
|
if (box.read(BoxName.carType) == 'Speed' ||
|
||||||
|
box.read(BoxName.carType) == 'Awfar Car') {
|
||||||
|
NotificationController().showNotification(
|
||||||
|
'The captain is responsible for the route.'.tr,
|
||||||
|
'This price is fixed even if the route changes for the driver.'.tr,
|
||||||
|
'ding');
|
||||||
|
} else if (box.read(BoxName.carType) == 'Comfort' ||
|
||||||
|
box.read(BoxName.carType) == 'Lady') {
|
||||||
|
NotificationController().showNotification('Attention'.tr,
|
||||||
|
'The price may increase if the route changes.'.tr, 'ding');
|
||||||
|
}
|
||||||
|
isApplied = true;
|
||||||
|
statusRide = 'Apply';
|
||||||
|
rideConfirm = false;
|
||||||
|
isSearchingWindow = false;
|
||||||
|
update();
|
||||||
|
startTimer();
|
||||||
|
// todo stop this because this method in startTimer()
|
||||||
|
// startTimerFromDriverToPassengerAfterApplied();
|
||||||
|
|
||||||
|
// timer.cancel();
|
||||||
|
_rideStatusStreamController.close();
|
||||||
|
}
|
||||||
|
|
||||||
// Listening to the Stream
|
// Listening to the Stream
|
||||||
void listenToRideStatusStream() {
|
void listenToRideStatusStream() {
|
||||||
rideStatusStream.listen((rideStatus) {
|
rideStatusStream.listen((rideStatus) {
|
||||||
@@ -2084,15 +2118,12 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reSearchAfterCanceledFromDriver() async {
|
reSearchAfterCanceledFromDriver() async {
|
||||||
await getCarsLocationByPassengerAndReloadMarker(
|
|
||||||
box.read(BoxName.carType), 3000);
|
|
||||||
|
|
||||||
updateConfirmRideForAllDriverAvailable();
|
|
||||||
shouldFetch = true; // Stop further fetches
|
shouldFetch = true; // Stop further fetches
|
||||||
statusRide = 'wait';
|
statusRide = 'wait';
|
||||||
rideConfirm = true;
|
rideConfirm = true;
|
||||||
isSearchingWindow = true;
|
isSearchingWindow = true;
|
||||||
update();
|
update();
|
||||||
|
updateConfirmRideForAllDriverAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void start15SecondTimer(String rideId) {
|
void start15SecondTimer(String rideId) {
|
||||||
@@ -2131,7 +2162,8 @@ class MapPassengerController extends GetxController {
|
|||||||
final response = await CRUD().get(
|
final response = await CRUD().get(
|
||||||
link: "${AppLink.endPoint}/ride/rides/getRideStatus.php",
|
link: "${AppLink.endPoint}/ride/rides/getRideStatus.php",
|
||||||
payload: {'id': rideId});
|
payload: {'id': rideId});
|
||||||
|
print(response);
|
||||||
|
print('2140');
|
||||||
return jsonDecode(response)['data'];
|
return jsonDecode(response)['data'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2492,11 +2524,12 @@ class MapPassengerController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
noCarString = false;
|
noCarString = false;
|
||||||
dataCarsLocationByPassenger = jsonDecode(res);
|
dataCarsLocationByPassenger = jsonDecode(res);
|
||||||
Log.print('dataCarsLocationByPassenger: ${dataCarsLocationByPassenger}');
|
Log.print(
|
||||||
|
'dataCarsLocationByPassenger:getCarsLocationByPassengerAndReloadMarker ${dataCarsLocationByPassenger}');
|
||||||
|
|
||||||
// Check if 'message' is present and not null
|
// Check if 'message' is present and not null
|
||||||
if (dataCarsLocationByPassenger['data'] != null &&
|
if (dataCarsLocationByPassenger != null &&
|
||||||
dataCarsLocationByPassenger['data'].isNotEmpty) {
|
dataCarsLocationByPassenger.isNotEmpty) {
|
||||||
// Check if carsOrder is within bounds
|
// Check if carsOrder is within bounds
|
||||||
// if (carsOrder < dataCarsLocationByPassenger['message'].length) {
|
// if (carsOrder < dataCarsLocationByPassenger['message'].length) {
|
||||||
// driverId = dataCarsLocationByPassenger['message'][carsOrder]
|
// driverId = dataCarsLocationByPassenger['message'][carsOrder]
|
||||||
@@ -2508,7 +2541,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// ['token']
|
// ['token']
|
||||||
// .toString();
|
// .toString();
|
||||||
// } else {
|
// } else {
|
||||||
// print('carsOrder is out of bounds for message array');
|
print('carsOrder is in of bounds for message array');
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
@@ -2519,8 +2552,8 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
carsLocationByPassenger.clear(); // Clear existing markers
|
carsLocationByPassenger.clear(); // Clear existing markers
|
||||||
|
|
||||||
for (var i = 0; i < dataCarsLocationByPassenger['data'].length; i++) {
|
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||||
var json = dataCarsLocationByPassenger['data'][i];
|
var json = dataCarsLocationByPassenger['message'][i];
|
||||||
_updateOrCreateMarker(
|
_updateOrCreateMarker(
|
||||||
MarkerId(json['latitude']).toString(),
|
MarkerId(json['latitude']).toString(),
|
||||||
LatLng(
|
LatLng(
|
||||||
@@ -3778,13 +3811,15 @@ class MapPassengerController extends GetxController {
|
|||||||
if (!rideConfirm) {
|
if (!rideConfirm) {
|
||||||
if (dataCarsLocationByPassenger != 'failure' &&
|
if (dataCarsLocationByPassenger != 'failure' &&
|
||||||
dataCarsLocationByPassenger != null &&
|
dataCarsLocationByPassenger != null &&
|
||||||
dataCarsLocationByPassenger['data'] != null &&
|
dataCarsLocationByPassenger['message'] != null &&
|
||||||
dataCarsLocationByPassenger['data'].length > 0) {
|
dataCarsLocationByPassenger['message'].length > 0) {
|
||||||
double nearestDistance = double.infinity; // Initialize nearest distance
|
double nearestDistance = double.infinity; // Initialize nearest distance
|
||||||
CarLocation? nearestCar;
|
CarLocation? nearestCar;
|
||||||
|
|
||||||
for (var i = 0; i < dataCarsLocationByPassenger['data'].length; i++) {
|
for (var i = 0;
|
||||||
var carLocation = dataCarsLocationByPassenger['data'][i];
|
i < dataCarsLocationByPassenger['message'].length;
|
||||||
|
i++) {
|
||||||
|
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||||
Log.print('carLocation: $carLocation');
|
Log.print('carLocation: $carLocation');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -617,6 +617,9 @@ iOS [https://getapp.cc/app/6458734951]
|
|||||||
"Tip is ": " مَبْلَغ الأُكْرَامِيَّة هُوَ",
|
"Tip is ": " مَبْلَغ الأُكْرَامِيَّة هُوَ",
|
||||||
"Are you sure to delete this location?":
|
"Are you sure to delete this location?":
|
||||||
"هل أنت متأكد من حذف هذا الموقع؟",
|
"هل أنت متأكد من حذف هذا الموقع؟",
|
||||||
|
'Are you want to wait drivers to accept your order':
|
||||||
|
'هل تريد الانتظار حتى يقبل السائقون طلبك؟',
|
||||||
|
|
||||||
"deleted": "تم الحذف",
|
"deleted": "تم الحذف",
|
||||||
'Trip is begin': "الرحلة قد بدأت",
|
'Trip is begin': "الرحلة قد بدأت",
|
||||||
'This price is fixed even if the route changes for the driver.':
|
'This price is fixed even if the route changes for the driver.':
|
||||||
@@ -625,6 +628,9 @@ iOS [https://getapp.cc/app/6458734951]
|
|||||||
"احتمالية زيادة السعر عند تغيير المسار",
|
"احتمالية زيادة السعر عند تغيير المسار",
|
||||||
"The captain is responsible for the route.":
|
"The captain is responsible for the route.":
|
||||||
"الكابتن مسؤول عن المسار",
|
"الكابتن مسؤول عن المسار",
|
||||||
|
'Your order is being prepared': "جاري تجهيز الطلب",
|
||||||
|
'The drivers are reviewing your request': 'يدرس السائقين طلبك',
|
||||||
|
'Your order sent to drivers': 'تم إرسال طلبك إلى السائقين',
|
||||||
"يمكنك الاتصال أو تسجيل صوت لهذه الرحلة":
|
"يمكنك الاتصال أو تسجيل صوت لهذه الرحلة":
|
||||||
"You can call or record audio of this trip",
|
"You can call or record audio of this trip",
|
||||||
|
|
||||||
|
|||||||
@@ -137,11 +137,13 @@ class SearchingCaptainWindow extends StatelessWidget {
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: AppStyle.boxDecoration1,
|
decoration: AppStyle.boxDecoration1,
|
||||||
height: Get.height * .2,
|
height: Get.height * .25,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
// Use Stack for overlapping widgets
|
// Use Stack for overlapping widgets
|
||||||
children: [
|
children: [
|
||||||
// Text elements
|
// Text elements
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: Get.width * .7,
|
width: Get.width * .7,
|
||||||
child: const LinearProgressIndicator(
|
child: const LinearProgressIndicator(
|
||||||
@@ -151,9 +153,13 @@ class SearchingCaptainWindow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"We are searching for the nearest driver to you".tr,
|
mapPassengerController.driversStatusForSearchWindow,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
|
// Text(
|
||||||
|
// "We are searching for the nearest driver to you".tr,
|
||||||
|
// style: AppStyle.title,
|
||||||
|
// ),
|
||||||
Text(
|
Text(
|
||||||
'please wait till driver accept your order'.tr,
|
'please wait till driver accept your order'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class MyDialogContent extends GetxController {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await textToSpeechController.speakText(title);
|
await textToSpeechController.speakText(title);
|
||||||
},
|
},
|
||||||
child: const Icon(CupertinoIcons.headphones,
|
child: const Icon(CupertinoIcons.speaker_2,
|
||||||
color: AppColor.primaryColor),
|
color: AppColor.primaryColor),
|
||||||
),
|
),
|
||||||
content!
|
content!
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# This file is used to configure the Shorebird updater used by your app.
|
# This file is used to configure the Shorebird updater used by your app.
|
||||||
# Learn more at https://docs.shorebird.dev
|
# Learn more at https://docs.shorebird.dev
|
||||||
# This file should be checked into version control.
|
# This file does not contain any sensitive information and should be checked into version control.
|
||||||
|
|
||||||
# This is the unique identifier assigned to your app.
|
# Your app_id is the unique identifier assigned to your app.
|
||||||
# Your app_id is not a secret and is just used to identify your app
|
# It is used to identify your app when requesting patches from Shorebird's servers.
|
||||||
# when requesting patches from Shorebird's servers.
|
# It is not a secret and can be shared publicly.
|
||||||
app_id: 8a571d7f-dfbf-4a65-be62-17eed08cbd5c
|
app_id: 496cb3ac-c25c-455d-9d2e-5ebbea13ab03
|
||||||
|
|
||||||
# auto_update controls if Shorebird should automatically update in the background on launch.
|
# auto_update controls if Shorebird should automatically update in the background on launch.
|
||||||
# If auto_update: false, you will need to use package:shorebird_code_push to trigger updates.
|
# If auto_update: false, you will need to use package:shorebird_code_push to trigger updates.
|
||||||
|
|||||||
Reference in New Issue
Block a user