25-10-11/1

This commit is contained in:
Hamza-Ayed
2025-11-06 12:29:17 +03:00
parent 14484fcd8f
commit a69e4c6912
46 changed files with 14145 additions and 13529 deletions

View File

@@ -68,8 +68,8 @@ class LoginDriverController extends GetxController {
void onInit() async {
box.write(BoxName.countryCode, 'Syria');
// box.write(BoxName.driverID, '34feffd3fa72d6bee56b');
await getAppTester();
// await getAppTester();
getJWT();
super.onInit();
}
@@ -150,8 +150,7 @@ class LoginDriverController extends GetxController {
// 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('payment["jwt"]: ${jsonDecode(response1.body)['jwt']}');
await box.write(BoxName.hmac, jsonDecode(response1.body)['hmac']);
return jsonDecode(response1.body)['jwt'].toString();
}
@@ -257,17 +256,19 @@ class LoginDriverController extends GetxController {
loginWithGoogleCredential(String driverID, email) async {
isloading = true;
update();
await SecurityHelper.performSecurityChecks();
// await SecurityHelper.performSecurityChecks();
// Log.print('(BoxName.emailDriver): ${box.read(BoxName.emailDriver)}');
// await getJWT();
var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: {
'email': email ?? 'yet',
// 'email': email ?? 'yet',
'id': driverID,
});
// print('res is $res');
Log.print('res: ${res}');
if (res == 'failure') {
await isPhoneVerified();
isloading = false; // <--- أضفت هذا أيضاً
update();
return false;
// Get.snackbar('Failure', '', backgroundColor: Colors.red);
} else {
var jsonDecoeded = jsonDecode(res);
@@ -358,17 +359,24 @@ class LoginDriverController extends GetxController {
// }
}
Get.offAll(() => HomeCaptain());
Get.offAll(() => HomeCaptain()); // افترض أن هذا الكلاس موجود
isloading = false; // <--- أضفت هذا
update(); // <--- أضفت هذا
return true;
} else {
Get.off(() => DriverVerificationScreen());
Get.offAll(
() => DriverVerificationScreen()); // افترض أن هذا الكلاس موجود
isloading = false; // <--- أضفت هذا
update(); // <--- أضفت هذا
return false;
}
// Get.off(() => HomeCaptain());
} else {
Get.offAll(() => PhoneNumberScreen());
isloading = false;
update();
return false; // <--- ✅ وهذا السطر موجود للحالات الأخرى
}
} else {
mySnackbarSuccess('');
@@ -399,8 +407,10 @@ class LoginDriverController extends GetxController {
var jsonDecoeded = jsonDecode(res);
var d = jsonDecoeded['data'][0];
if (jsonDecoeded.isNotEmpty) {
if (jsonDecoeded['status'] == 'success' &&
d['is_verified'].toString() == '1') {
if (jsonDecoeded['status'] == 'success')
// &&
// d['is_verified'].toString() == '1')
{
box.write(BoxName.emailDriver, d['email']);
box.write(BoxName.firstTimeLoadKey, 'false');
box.write(BoxName.driverID, (d['id']));
@@ -546,11 +556,11 @@ class LoginDriverController extends GetxController {
// 'ding.wav');
NotificationService.sendNotification(
target: (jsonDecode(token)['data'][0]['token']).toString(),
title: 'token change',
title: 'token change'.tr,
body: 'token change'.tr,
isTopic: false, // Important: this is a token
tone: 'cancel',
driverList: [],
driverList: [], category: 'token change',
);
Get.defaultDialog(
title: 'you will use this device?'.tr,

View File

@@ -111,11 +111,11 @@ class OtpVerificationController extends GetxController {
// );
await NotificationService.sendNotification(
target: ptoken.toString(),
title: 'token change',
title: 'token change'.tr,
body: 'token change'.tr,
isTopic: false, // Important: this is a token
tone: 'cancel',
driverList: [],
driverList: [], category: 'token change',
);
Get.offAll(() => HomeCaptain());

View File

@@ -59,7 +59,7 @@ class PhoneAuthHelper {
if (data['status'] == 'success') {
final isRegistered = data['message']['isRegistered'] ?? false;
box.write(BoxName.phoneVerified, true);
box.write(BoxName.phoneVerified, '1');
box.write(BoxName.phoneDriver, phoneNumber);
box.write(BoxName.driverID, data['message']['driverID']);

View File

@@ -8,6 +8,7 @@ import 'package:image_cropper/image_cropper.dart';
import 'package:image/image.dart' as img;
import 'package:path/path.dart';
import 'package:sefer_driver/constant/links.dart';
import 'package:sefer_driver/controller/firebase/notification_service.dart';
import '../../../constant/box_name.dart';
import 'package:path_provider/path_provider.dart';
// --- Final Submission ---
@@ -564,11 +565,18 @@ class RegistrationController extends GetxController {
'token': (box.read(BoxName.tokenDriver)).toString(),
'fingerPrint': fingerPrint.toString(),
});
await CRUD().post(link: AppLink.addTokensDriverWallet, payload: {
'token': box.read(BoxName.tokenDriver).toString(),
'fingerPrint': fingerPrint.toString(),
'captain_id': box.read(BoxName.driverID).toString(),
});
// CRUD().post(link: AppLink.addTokensDriverWallet, payload: {
// 'token': box.read(BoxName.tokenDriver).toString(),
// 'fingerPrint': fingerPrint.toString(),
// 'captain_id': box.read(BoxName.driverID).toString(),
// });
NotificationService.sendNotification(
target: 'service', // الإرسال لجميع المشتركين في "service"
title: 'طلب خدمة جديد',
body: 'تم استلام طلب خدمة جديد. الرجاء مراجعة التفاصيل.',
isTopic: true,
category: 'new_service_request', // فئة توضح نوع الإشعار
);
c.loginWithGoogleCredential(driverID, email);
} else {