2026-03-10-1

This commit is contained in:
Hamza-Ayed
2026-03-10 00:00:41 +03:00
parent 94ee193750
commit 0376a835ce
15 changed files with 764 additions and 562 deletions

View File

@@ -13,6 +13,7 @@ class BoxName {
static const String FCM_PRIVATE_KEY = "FCM_PRIVATE_KEY";
static const String hmac = "hmac";
static const String ttsEnabled = "ttsEnabled";
static const String deviceFingerprint = "deviceFingerprint";
static const String security_check = "security_check";
static const String rideType = "rideType";
static const String walletType = "walletType";

View File

@@ -12,7 +12,7 @@ class AppLink {
'https://location.intaleq.xyz/intaleq/ride/location';
static const String routeApiBaseUrl =
"https://routesjo.intaleq.xyz/route/v1/driving";
static final String endPoint = 'https://api.intaleq.xyz/intaleq';
static final String endPoint = 'https://api.intaleq.xyz/intaleq_v1';
static final String syria = 'https://syria.intaleq.xyz/intaleq';
static final String server = endPoint;

View File

@@ -126,6 +126,12 @@ class LoginDriverController extends GetxController {
update();
}
String shortHash(String password) {
var bytes = utf8.encode(password);
var digest = sha256.convert(bytes);
return base64UrlEncode(digest.bytes);
}
var dev = '';
getJwtWallet() async {
if (box.read(BoxName.security_check).toString() != 'passed') {
@@ -134,7 +140,6 @@ class LoginDriverController extends GetxController {
}
Log.print('Security check passed');
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
// print('fingerPrint: ${fingerPrint}');
dev = Platform.isAndroid ? 'android' : 'ios';
var payload = {
'id': box.read(BoxName.driverID),
@@ -146,20 +151,14 @@ 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('payment["jwt"]: ${jsonDecode(response1.body)['jwt']}');
Log.print('response.request: ${response1.request}');
Log.print('response.body: ${response1.body}');
Log.print('payment["jwt"]: ${jsonDecode(response1.body)['jwt']}');
await box.write(BoxName.hmac, jsonDecode(response1.body)['hmac']);
return jsonDecode(response1.body)['jwt'].toString();
}
String shortHash(String password) {
var bytes = utf8.encode(password);
var digest = sha256.convert(bytes);
return base64UrlEncode(digest.bytes);
}
getJWT() async {
dev = Platform.isAndroid ? 'android' : 'ios';
Log.print(
@@ -169,6 +168,8 @@ class LoginDriverController extends GetxController {
'id': box.read(BoxName.driverID) ?? AK.newId,
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
'fingerPrint': box.read(BoxName.deviceFingerprint) ??
await DeviceHelper.getDeviceFingerprint(),
};
// Log.print('payload: ${payload}');
@@ -197,14 +198,16 @@ class LoginDriverController extends GetxController {
'id': box.read(BoxName.driverID),
'password': box.read(BoxName.emailDriver),
'aud': '${AK.allowed}$dev',
'fingerPrint': box.read(BoxName.deviceFingerprint) ??
await DeviceHelper.getDeviceFingerprint(),
};
// print(payload);
var response1 = await http.post(
Uri.parse(AppLink.loginJwtDriver),
body: payload,
);
// print(response1.request);
// print(response1.body);
Log.print('response1.request: ${response1.request}');
Log.print('response1.body: ${response1.body}');
if (response1.statusCode == 200) {
final decodedResponse1 = jsonDecode(response1.body);

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,7 @@ Future<void> checkForUpdate(BuildContext context) async {
final packageInfo = await PackageInfo.fromPlatform();
final currentVersion = packageInfo.buildNumber;
final version = packageInfo.version;
Log.print('version: ${version}');
Log.print('version: $version');
print('currentVersion is : $currentVersion');
// Fetch the latest version from your server
String latestVersion = await getPackageInfo();
@@ -191,16 +191,18 @@ class DeviceHelper {
: deviceData['identifierForVendor'] ?? 'unknown';
final String deviceModel = deviceData['model'] ?? 'unknown';
final String osVersion = Platform.isAndroid
? deviceData['version']['release'] ?? 'unknown'
: deviceData['systemVersion'] ?? 'unknown';
// final String osVersion = Platform.isAndroid
// ? deviceData['version']['release'] ?? 'unknown'
// : deviceData['systemVersion'] ?? 'unknown';
// Log the extracted information
// Generate and return the encrypted fingerprint
final String fingerprint = '${deviceId}_${deviceModel}_$osVersion';
final String fingerprint =
EncryptionHelper.instance.encryptData('${deviceId}_$deviceModel');
// Log.print('fingerprint: ${fingerprint}');
// print(EncryptionHelper.instance.encryptData(fingerprint));
box.write(BoxName.deviceFingerprint, fingerprint);
return (fingerprint);
} catch (e) {
throw Exception('Failed to generate device fingerprint');

View File

@@ -4,7 +4,7 @@ class Log {
Log._();
static void print(String value, {StackTrace? stackTrace}) {
// developer.log(value, name: 'LOG', stackTrace: stackTrace);
developer.log(value, name: 'LOG', stackTrace: stackTrace);
}
static Object? inspect(Object? object) {