Showing
3 changed files
with
13 additions
and
5 deletions
1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
2 | 2 | ||
3 | +import 'package:android_id/android_id.dart'; | ||
3 | import 'package:auto_track/auto_track/config/queue.dart'; | 4 | import 'package:auto_track/auto_track/config/queue.dart'; |
4 | import 'package:crypto/crypto.dart'; | 5 | import 'package:crypto/crypto.dart'; |
5 | import 'package:device_info_plus/device_info_plus.dart'; | 6 | import 'package:device_info_plus/device_info_plus.dart'; |
@@ -56,11 +57,16 @@ class AutoTrackConfigManager { | @@ -56,11 +57,16 @@ class AutoTrackConfigManager { | ||
56 | 57 | ||
57 | void _updateDeviceId() { | 58 | void _updateDeviceId() { |
58 | if (_baseDeviceInfo is IosDeviceInfo) { | 59 | if (_baseDeviceInfo is IosDeviceInfo) { |
59 | - _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')).toString(); | 60 | + _deviceId = md5 |
61 | + .convert(utf8.encode( | ||
62 | + '${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')) | ||
63 | + .toString(); | ||
60 | } else if (_baseDeviceInfo is AndroidDeviceInfo) { | 64 | } else if (_baseDeviceInfo is AndroidDeviceInfo) { |
61 | - _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as AndroidDeviceInfo).serialNumber}#${config.appKey}')).toString(); | 65 | + const AndroidId().getId().then((value) => _deviceId = |
66 | + md5.convert(utf8.encode('$value#${config.appKey}')).toString()); | ||
62 | } else if (_baseDeviceInfo is MacOsDeviceInfo) { | 67 | } else if (_baseDeviceInfo is MacOsDeviceInfo) { |
63 | - _deviceId = '${(_baseDeviceInfo as MacOsDeviceInfo).hostName}-${(_baseDeviceInfo as MacOsDeviceInfo).computerName}'; | 68 | + _deviceId = |
69 | + '${(_baseDeviceInfo as MacOsDeviceInfo).hostName}-${(_baseDeviceInfo as MacOsDeviceInfo).computerName}'; | ||
64 | } else { | 70 | } else { |
65 | _deviceId = null; | 71 | _deviceId = null; |
66 | } | 72 | } |
@@ -76,7 +82,7 @@ class AutoTrackConfigManager { | @@ -76,7 +82,7 @@ class AutoTrackConfigManager { | ||
76 | 82 | ||
77 | AutoTrackPageConfig getPageConfig(Widget pageWidget) { | 83 | AutoTrackPageConfig getPageConfig(Widget pageWidget) { |
78 | return _config.pageConfigs.firstWhere( | 84 | return _config.pageConfigs.firstWhere( |
79 | - (pageConfig) => pageConfig.isPageWidget!(pageWidget), | 85 | + (pageConfig) => pageConfig.isPageWidget!(pageWidget), |
80 | orElse: () => AutoTrackPageConfig()); | 86 | orElse: () => AutoTrackPageConfig()); |
81 | } | 87 | } |
82 | 88 | ||
@@ -112,4 +118,4 @@ class AutoTrackConfigManager { | @@ -112,4 +118,4 @@ class AutoTrackConfigManager { | ||
112 | bool get dragEnable => _config.enableDrag; | 118 | bool get dragEnable => _config.enableDrag; |
113 | 119 | ||
114 | bool get ignoreNullKeyEnable => _config.enableIgnoreNullKey; | 120 | bool get ignoreNullKeyEnable => _config.enableIgnoreNullKey; |
115 | -} | ||
121 | +} |
-
Please register or login to post a comment