25-3/8/1
This commit is contained in:
@@ -2,6 +2,9 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
import 'package:sefer_driver/constant/box_name.dart';
|
||||
import 'package:sefer_driver/constant/info.dart';
|
||||
import 'package:sefer_driver/constant/links.dart';
|
||||
@@ -400,7 +403,10 @@ class AI extends GetxController {
|
||||
'last_name': EncryptionHelper.instance.encryptData(
|
||||
responseNonIdCardFront['full_name'].toString().split(' ').last) ??
|
||||
'Not specified',
|
||||
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
|
||||
'email': EncryptionHelper.instance
|
||||
.encryptData(box.read(BoxName.emailDriver))
|
||||
?.toString() ??
|
||||
'Not specified',
|
||||
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
|
||||
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
|
||||
'password':
|
||||
@@ -494,9 +500,21 @@ class AI extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
String shortHash(String password) {
|
||||
var bytes = utf8.encode(password);
|
||||
var digest = sha256.convert(bytes);
|
||||
return base64UrlEncode(digest.bytes);
|
||||
}
|
||||
|
||||
Future<void> addDriverEgypt() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
final loginDriverController = Get.put(LoginDriverController());
|
||||
|
||||
var pass = loginDriverController.passwordController.text.isEmpty
|
||||
? '${box.read(BoxName.emailDriver)}${box.read(BoxName.driverID)}'
|
||||
: '${loginDriverController.emailController.text.toString()}${box.read(BoxName.driverID)}';
|
||||
String hashedPassword = shortHash(pass);
|
||||
|
||||
var payload = {
|
||||
'first_name': EncryptionHelper.instance.encryptData(
|
||||
@@ -505,16 +523,13 @@ class AI extends GetxController {
|
||||
'last_name': EncryptionHelper.instance.encryptData(
|
||||
responseIdEgyptDriverLicense['lastName'].toString()) ??
|
||||
'Not specified',
|
||||
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
|
||||
'email': EncryptionHelper.instance
|
||||
.encryptData(box.read(BoxName.emailDriver))
|
||||
.toString() ??
|
||||
'Not specified',
|
||||
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
|
||||
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
|
||||
'password':
|
||||
Get.put(LoginDriverController()).passwordController.text.isEmpty
|
||||
? box.read(BoxName.emailDriver).toString()
|
||||
: Get.find<LoginDriverController>()
|
||||
.passwordController
|
||||
.text
|
||||
.toString(),
|
||||
'password': hashedPassword.toString(),
|
||||
'gender': EncryptionHelper.instance
|
||||
.encryptData(responseIdEgyptBack['gender'].toString()) ??
|
||||
'Not specified',
|
||||
@@ -825,7 +840,7 @@ class AI extends GetxController {
|
||||
var json = jsonDecode(extractedString);
|
||||
// Log.print('extractedString: ${extractedString}');
|
||||
var textValues = CRUD().extractTextFromLines(json);
|
||||
Log.print('textValues: ${textValues}');
|
||||
Log.print('textValues: $textValues');
|
||||
// Log.print('json: ${json}');
|
||||
|
||||
DocumentType detectedType = checkDocumentType(textValues);
|
||||
@@ -1141,7 +1156,7 @@ class AI extends GetxController {
|
||||
jsonDecode(responseData['content'][0]['text']);
|
||||
} else if (idType == 'non_id_front') {
|
||||
responseNonIdCardFront = jsonDecode(responseData['content'][0]['text']);
|
||||
Log.print('responseNonIdCardFront: ${responseNonIdCardFront}');
|
||||
Log.print('responseNonIdCardFront: $responseNonIdCardFront');
|
||||
} else if (idType == 'non_id_back') {
|
||||
responseNonIdCardBack = jsonDecode(responseData['content'][0]['text']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user