Initial push to my private server
This commit is contained in:
@@ -21,6 +21,7 @@ import 'package:location/location.dart';
|
||||
|
||||
import '../../../constant/api_key.dart';
|
||||
import '../../../constant/info.dart';
|
||||
import '../../../print.dart';
|
||||
import '../../../views/auth/captin/otp_page.dart';
|
||||
import '../../../views/auth/captin/otp_token_page.dart';
|
||||
import '../../../views/auth/syria/pending_driver_page.dart';
|
||||
@@ -98,11 +99,10 @@ class LoginDriverController extends GetxController {
|
||||
}
|
||||
|
||||
isPhoneVerified() async {
|
||||
var res = await CRUD().post(link: AppLink.isPhoneVerified, payload: {
|
||||
'phone_number': box.read(
|
||||
BoxName.phoneDriver,
|
||||
)
|
||||
});
|
||||
var res = await CRUD().post(
|
||||
link: AppLink.isPhoneVerified,
|
||||
payload: {'phone_number': box.read(BoxName.phoneDriver)});
|
||||
|
||||
if (res != 'failure') {
|
||||
// Get.offAll(() => SyrianCardAI());
|
||||
Get.offAll(() => RegistrationView());
|
||||
@@ -163,8 +163,8 @@ class LoginDriverController extends GetxController {
|
||||
|
||||
getJWT() async {
|
||||
dev = Platform.isAndroid ? 'android' : 'ios';
|
||||
// Log.print(
|
||||
// 'box.read(BoxName.firstTimeLoadKey): ${box.read(BoxName.firstTimeLoadKey)}');
|
||||
Log.print(
|
||||
'box.read(BoxName.firstTimeLoadKey): ${box.read(BoxName.firstTimeLoadKey)}');
|
||||
if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
|
||||
var payload = {
|
||||
'id': box.read(BoxName.driverID) ?? AK.newId,
|
||||
@@ -185,13 +185,6 @@ class LoginDriverController extends GetxController {
|
||||
|
||||
final jwt = decodedResponse1['jwt'];
|
||||
box.write(BoxName.jwt, c(jwt));
|
||||
// await box.write(BoxName.hmac, decodedResponse1['hmac']);
|
||||
|
||||
// await AppInitializer().getAIKey(Driver.payMobApikey);
|
||||
// await AppInitializer().getAIKey(Driver.FCM_PRIVATE_KEY);
|
||||
|
||||
// await AppInitializer().getAIKey(Driver.initializationVector);
|
||||
// await AppInitializer().getAIKey(Driver.keyOfApp);
|
||||
|
||||
// ✅ بعد التأكد أن كل المفاتيح موجودة
|
||||
await EncryptionHelper.initialize();
|
||||
@@ -206,7 +199,7 @@ class LoginDriverController extends GetxController {
|
||||
'password': box.read(BoxName.emailDriver),
|
||||
'aud': '${AK.allowed}$dev',
|
||||
};
|
||||
// print(payload);
|
||||
print(payload);
|
||||
var response1 = await http.post(
|
||||
Uri.parse(AppLink.loginJwtDriver),
|
||||
body: payload,
|
||||
@@ -332,32 +325,30 @@ class LoginDriverController extends GetxController {
|
||||
key: BoxName.fingerPrint, value: fingerPrint.toString());
|
||||
// print(jsonDecode(token)['data'][0]['token'].toString());
|
||||
// print(box.read(BoxName.tokenDriver).toString());
|
||||
if (email == '962798583052@intaleqapp.com') {
|
||||
} else {
|
||||
if (token != 'failure') {
|
||||
if ((jsonDecode(token)['data'][0]['token'].toString()) !=
|
||||
box.read(BoxName.tokenDriver).toString()) {
|
||||
await Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Device Change Detected'.tr,
|
||||
middleText: 'Please verify your identity'.tr,
|
||||
textConfirm: 'Verify'.tr,
|
||||
confirmTextColor: Colors.white,
|
||||
onConfirm: () {
|
||||
// Get.back();
|
||||
// انتقل لصفحة OTP الجديدة
|
||||
Get.to(
|
||||
() => OtpVerificationPage(
|
||||
phone: d['phone'].toString(),
|
||||
deviceToken: fingerPrint.toString(),
|
||||
token: token.toString(),
|
||||
ptoken:
|
||||
jsonDecode(token)['data'][0]['token'].toString(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (token != 'failure') {
|
||||
if ((jsonDecode(token)['data'][0]['token'].toString()) !=
|
||||
box.read(BoxName.tokenDriver).toString()) {
|
||||
await Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Device Change Detected'.tr,
|
||||
middleText: 'Please verify your identity'.tr,
|
||||
textConfirm: 'Verify'.tr,
|
||||
confirmTextColor: Colors.white,
|
||||
onConfirm: () {
|
||||
// Get.back();
|
||||
// انتقل لصفحة OTP الجديدة
|
||||
Get.to(
|
||||
() => OtpVerificationPage(
|
||||
phone: d['phone'].toString(),
|
||||
deviceToken: fingerPrint.toString(),
|
||||
token: token.toString(),
|
||||
ptoken:
|
||||
jsonDecode(token)['data'][0]['token'].toString(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,15 +86,28 @@ class OtpVerificationController extends GetxController {
|
||||
},
|
||||
);
|
||||
|
||||
if (response != 'failure' && response['status'] == 'success') {
|
||||
if (response != 'failure') {
|
||||
Get.back(); // توجه إلى الصفحة التالية
|
||||
Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
|
||||
await CRUD().post(
|
||||
link:
|
||||
'${AppLink.seferPaymentServer}/auth/token/update_driver_auth.php',
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenDriver).toString(),
|
||||
'fingerPrint': finger.toString(),
|
||||
'captain_id': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
final fcm = Get.isRegistered<FirebaseMessagesController>()
|
||||
? Get.find<FirebaseMessagesController>()
|
||||
: Get.put(FirebaseMessagesController());
|
||||
|
||||
await fcm.sendNotificationToDriverMAP(
|
||||
'token change',
|
||||
'change device'.tr,
|
||||
ptoken.toString(),
|
||||
[],
|
||||
'cancel.wav',
|
||||
);
|
||||
|
||||
Get.offAll(() => HomeCaptain());
|
||||
} else {
|
||||
Get.snackbar('Verification Failed', 'OTP is incorrect or expired');
|
||||
|
||||
Reference in New Issue
Block a user