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