ready to map intaleq 26-4-18-1
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -160,6 +160,7 @@ class LoginDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getJWT() async {
|
getJWT() async {
|
||||||
|
await EncryptionHelper.initialize();
|
||||||
dev = Platform.isAndroid ? 'android' : 'ios';
|
dev = Platform.isAndroid ? 'android' : 'ios';
|
||||||
Log.print(
|
Log.print(
|
||||||
'box.read(BoxName.firstTimeLoadKey): ${box.read(BoxName.firstTimeLoadKey)}');
|
'box.read(BoxName.firstTimeLoadKey): ${box.read(BoxName.firstTimeLoadKey)}');
|
||||||
@@ -581,7 +582,7 @@ class LoginDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
updateAppTester(AppInformation.appName);
|
updateAppTester(AppInformation.appName);
|
||||||
|
|
||||||
var fingerPrint = DeviceHelper.getDeviceFingerprint().toString();
|
var fingerPrint = await DeviceHelper.getDeviceFingerprint();
|
||||||
await storage.write(key: BoxName.fingerPrint, value: fingerPrint);
|
await storage.write(key: BoxName.fingerPrint, value: fingerPrint);
|
||||||
|
|
||||||
var token = await CRUD().get(
|
var token = await CRUD().get(
|
||||||
|
|||||||
@@ -168,44 +168,35 @@ void showUpdateDialog(BuildContext context) {
|
|||||||
|
|
||||||
class DeviceHelper {
|
class DeviceHelper {
|
||||||
static Future<String> getDeviceFingerprint() async {
|
static Future<String> getDeviceFingerprint() async {
|
||||||
|
await EncryptionHelper.initialize();
|
||||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||||
var deviceData;
|
var deviceData;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
// Fetch Android-specific device information
|
|
||||||
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
||||||
deviceData = androidInfo.toMap(); // Convert to a map for easier access
|
deviceData = androidInfo.toMap();
|
||||||
// Log.print('deviceData: ${jsonEncode(deviceData)}');
|
|
||||||
} else if (Platform.isIOS) {
|
} else if (Platform.isIOS) {
|
||||||
// Fetch iOS-specific device information
|
|
||||||
IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
|
IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
|
||||||
deviceData = iosInfo.toMap(); // Convert to a map for easier access
|
deviceData = iosInfo.toMap();
|
||||||
} else {
|
} else {
|
||||||
throw UnsupportedError('Unsupported platform');
|
throw UnsupportedError('Unsupported platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract relevant device information
|
|
||||||
final String deviceId = Platform.isAndroid
|
final String deviceId = Platform.isAndroid
|
||||||
? deviceData['androidId'] ?? deviceData['fingerprint'] ?? 'unknown'
|
? deviceData['id'] ?? deviceData['androidId'] ?? deviceData['fingerprint'] ?? 'unknown'
|
||||||
: deviceData['identifierForVendor'] ?? 'unknown';
|
: deviceData['identifierForVendor'] ?? 'unknown';
|
||||||
|
|
||||||
final String deviceModel = deviceData['model'] ?? 'unknown';
|
final String deviceModel = deviceData['model'] ?? '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 =
|
final String fingerprint =
|
||||||
EncryptionHelper.instance.encryptData('${deviceId}_$deviceModel');
|
EncryptionHelper.instance.encryptData('${deviceId}_$deviceModel');
|
||||||
// Log.print('fingerprint: ${fingerprint}');
|
|
||||||
// print(EncryptionHelper.instance.encryptData(fingerprint));
|
|
||||||
box.write(BoxName.deviceFingerprint, fingerprint);
|
box.write(BoxName.deviceFingerprint, fingerprint);
|
||||||
return (fingerprint);
|
return (fingerprint);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Failed to generate device fingerprint');
|
debugPrint('Error generating device fingerprint: $e');
|
||||||
|
throw Exception('Failed to generate device fingerprint: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user