25-10-11/1
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user