25-4/14/1
This commit is contained in:
@@ -114,12 +114,12 @@ class LoginDriverController extends GetxController {
|
||||
Uri.parse(AppLink.loginJwtWalletDriver),
|
||||
body: payload,
|
||||
);
|
||||
Log.print('response.request: ${response1.request}');
|
||||
Log.print('response.body: ${response1.body}');
|
||||
print(payload);
|
||||
Log.print(
|
||||
'jsonDecode(response1.body)["jwt"]: ${jsonDecode(response1.body)['jwt']}');
|
||||
|
||||
// Log.print('response.request: ${response1.request}');
|
||||
// Log.print('response.body: ${response1.body}');
|
||||
// print(payload);
|
||||
// Log.print(
|
||||
// 'jsonDecode(response1.body)["jwt"]: ${jsonDecode(response1.body)['jwt']}');
|
||||
await box.write(BoxName.hmac, jsonDecode(response1.body)['hmac']);
|
||||
return jsonDecode(response1.body)['jwt'].toString();
|
||||
}
|
||||
|
||||
@@ -175,9 +175,9 @@ class LoginDriverController extends GetxController {
|
||||
Uri.parse(AppLink.loginJwtDriver),
|
||||
body: payload,
|
||||
);
|
||||
print(response1.request);
|
||||
print(response1.body);
|
||||
print(payload);
|
||||
// print(response1.request);
|
||||
// print(response1.body);
|
||||
// print(payload);
|
||||
if (response1.statusCode == 200) {
|
||||
final decodedResponse1 = jsonDecode(response1.body);
|
||||
// Log.print('decodedResponse1: ${decodedResponse1}');
|
||||
@@ -235,7 +235,7 @@ class LoginDriverController extends GetxController {
|
||||
'id': driverID,
|
||||
});
|
||||
|
||||
print('res is $res');
|
||||
// print('res is $res');
|
||||
if (res == 'failure') {
|
||||
//Failure
|
||||
if (box.read(BoxName.phoneVerified).toString() == '1') {
|
||||
@@ -385,7 +385,7 @@ class LoginDriverController extends GetxController {
|
||||
'password': password,
|
||||
});
|
||||
box.write(BoxName.emailDriver, (email).toString());
|
||||
print(res);
|
||||
// print(res);
|
||||
if (res == 'failure') {
|
||||
//Failure
|
||||
if (box.read(BoxName.phoneVerified).toString() == '1') {
|
||||
|
||||
@@ -81,6 +81,8 @@ class CRUD {
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
var s = await LoginDriverController().getJwtWallet();
|
||||
final hmac = box.read(BoxName.hmac);
|
||||
Log.print('hmac: ${hmac}');
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
@@ -89,7 +91,8 @@ class CRUD {
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization': 'Bearer $s'
|
||||
'Authorization': 'Bearer $s',
|
||||
'X-HMAC-Auth': hmac.toString(),
|
||||
},
|
||||
);
|
||||
// print(response.request);
|
||||
@@ -127,6 +130,8 @@ class CRUD {
|
||||
Future<dynamic> postWallet(
|
||||
{required String link, Map<String, dynamic>? payload}) async {
|
||||
var s = await LoginDriverController().getJwtWallet();
|
||||
final hmac = box.read(BoxName.hmac);
|
||||
Log.print('hmac: ${hmac}');
|
||||
var url = Uri.parse(link);
|
||||
try {
|
||||
await LoginDriverController().getJWT();
|
||||
@@ -136,7 +141,8 @@ class CRUD {
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization': 'Bearer $s'
|
||||
'Authorization': 'Bearer $s',
|
||||
'X-HMAC-Auth': hmac.toString(),
|
||||
},
|
||||
);
|
||||
// print(response.request);
|
||||
|
||||
@@ -104,6 +104,8 @@ class LocationController extends GetxController {
|
||||
return 'Cairo';
|
||||
}
|
||||
|
||||
int _insertCounter = 0;
|
||||
|
||||
Future<void> startLocationUpdates() async {
|
||||
if (box.read(BoxName.driverID) != null) {
|
||||
if (location == null) {
|
||||
@@ -117,49 +119,59 @@ class LocationController extends GetxController {
|
||||
Get.find<CaptainWalletController>().totalPoints.toString();
|
||||
isActive = Get.find<HomeCaptainController>().isActive;
|
||||
|
||||
if (isActive) {
|
||||
if (double.parse(totalPoints) > -300) {
|
||||
await getLocation();
|
||||
if (myLocation == null) {
|
||||
return;
|
||||
}
|
||||
// 'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
|
||||
if (isActive && double.parse(totalPoints) > -300) {
|
||||
await getLocation();
|
||||
if (myLocation == null) return;
|
||||
|
||||
String area =
|
||||
getLocationArea(myLocation.latitude, myLocation.longitude);
|
||||
String area =
|
||||
getLocationArea(myLocation.latitude, myLocation.longitude);
|
||||
|
||||
if (box.read(BoxName.driverID) != null) {
|
||||
await CRUD().post(
|
||||
link: box.read(BoxName.serverChosen) +
|
||||
'/ride/location/add.php',
|
||||
payload: {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'heading': heading.toString(),
|
||||
'speed': (speed * 3.6).toStringAsFixed(1),
|
||||
'distance': totalDistance == 0 && (speed * 3.6) < 5
|
||||
? '0.0'
|
||||
: totalDistance < 7
|
||||
? totalDistance.toStringAsFixed(3)
|
||||
: totalDistance.toStringAsFixed(1),
|
||||
'status': box.read(BoxName.statusDriverLocation) ?? 'off',
|
||||
});
|
||||
final payload = {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'heading': heading.toString(),
|
||||
'speed': (speed * 3.6).toStringAsFixed(1),
|
||||
'distance': totalDistance == 0 && (speed * 3.6) < 5
|
||||
? '0.0'
|
||||
: totalDistance < 7
|
||||
? totalDistance.toStringAsFixed(3)
|
||||
: totalDistance.toStringAsFixed(1),
|
||||
'status': box.read(BoxName.statusDriverLocation) ?? 'off',
|
||||
};
|
||||
|
||||
Get.find<HomeCaptainController>()
|
||||
.mapHomeCaptainController
|
||||
?.animateCamera(
|
||||
CameraUpdate.newLatLng(
|
||||
LatLng(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
// 🔁 كل 5 ثواني - تحديث الموقع
|
||||
await CRUD().post(
|
||||
link:
|
||||
box.read(BoxName.serverChosen) + '/ride/location/update.php',
|
||||
payload: payload,
|
||||
);
|
||||
|
||||
// 📍 كل 60 ثانية - إدخال جديد
|
||||
_insertCounter++;
|
||||
if (_insertCounter >= 12) {
|
||||
_insertCounter = 0;
|
||||
await CRUD().post(
|
||||
link: box.read(BoxName.serverChosen) + '/ride/location/add.php',
|
||||
payload: payload,
|
||||
);
|
||||
}
|
||||
|
||||
// 🔄 تحديث الكاميرا
|
||||
Get.find<HomeCaptainController>()
|
||||
.mapHomeCaptainController
|
||||
?.animateCamera(
|
||||
CameraUpdate.newLatLng(
|
||||
LatLng(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
print('Location update error: $e');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../../print.dart';
|
||||
|
||||
abstract class LingoHunter {
|
||||
/// Extracts translatable strings...
|
||||
static Future<void> extractAndCreateTranslationFiles({
|
||||
@@ -171,6 +173,7 @@ abstract class LingoHunter {
|
||||
// ... (rest of the function remains the same) ...
|
||||
final Directory outputDir = Directory(outputDirectory);
|
||||
if (!await outputDir.exists()) {
|
||||
Log.print('outputDir: ${outputDir}');
|
||||
await outputDir.create(recursive: true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user