Dubhe
Committed by GitHub

feat: add uploadInterval config

@@ -22,7 +22,8 @@ class AutoTrackConfig { @@ -22,7 +22,8 @@ class AutoTrackConfig {
22 this.enableClick = true, 22 this.enableClick = true,
23 this.enableUpload = false, 23 this.enableUpload = false,
24 this.enableDrag = false, 24 this.enableDrag = false,
25 - this.enableIgnoreNullKey = false 25 + this.enableIgnoreNullKey = false,
  26 + this.uploadInterval
26 }) { 27 }) {
27 trackId ??= const Uuid().v4().replaceAll('-', ''); 28 trackId ??= const Uuid().v4().replaceAll('-', '');
28 signature ??= (t) => sha256.convert(utf8.encode('$appKey$t$appSecret')).toString(); 29 signature ??= (t) => sha256.convert(utf8.encode('$appKey$t$appSecret')).toString();
@@ -35,6 +36,8 @@ class AutoTrackConfig { @@ -35,6 +36,8 @@ class AutoTrackConfig {
35 String? userId; 36 String? userId;
36 String? uniqueId; 37 String? uniqueId;
37 38
  39 + int? uploadInterval;
  40 +
38 Function? signature; 41 Function? signature;
39 42
40 List<AutoTrackPageConfig> pageConfigs; 43 List<AutoTrackPageConfig> pageConfigs;
@@ -41,6 +41,8 @@ class AutoTrackConfigManager { @@ -41,6 +41,8 @@ class AutoTrackConfigManager {
41 _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')).toString(); 41 _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')).toString();
42 } else if (_baseDeviceInfo is AndroidDeviceInfo) { 42 } else if (_baseDeviceInfo is AndroidDeviceInfo) {
43 _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as AndroidDeviceInfo).serialNumber}#${config.appKey}')).toString(); 43 _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as AndroidDeviceInfo).serialNumber}#${config.appKey}')).toString();
  44 + } else if (_baseDeviceInfo is MacOsDeviceInfo) {
  45 + _deviceId = '${(_baseDeviceInfo as MacOsDeviceInfo).hostName}-${(_baseDeviceInfo as MacOsDeviceInfo).computerName}';
44 } else { 46 } else {
45 _deviceId = ''; 47 _deviceId = '';
46 } 48 }
@@ -23,7 +23,7 @@ class AutoTrackQueue { @@ -23,7 +23,7 @@ class AutoTrackQueue {
23 23
24 void start() { 24 void start() {
25 if (_timer != null) return; 25 if (_timer != null) return;
26 - _timer = Timer.periodic(const Duration(seconds: 10), (timer) { 26 + _timer = Timer.periodic(Duration(seconds: AutoTrackConfigManager.instance.config.uploadInterval ?? 10), (timer) {
27 flush(); 27 flush();
28 }); 28 });
29 } 29 }
@@ -16,8 +16,7 @@ class DragInfo { @@ -16,8 +16,7 @@ class DragInfo {
16 dragInfo._beginOffset = begin; 16 dragInfo._beginOffset = begin;
17 dragInfo._endOffset = end; 17 dragInfo._endOffset = end;
18 dragInfo._duration = duration; 18 dragInfo._duration = duration;
19 - dragInfo._ignore = AutoTrackConfigManager.instance.isIgnoreElement(  
20 - pageElement.widget.key ?? ValueKey(pageInfo.pageManualKey)); 19 + dragInfo._ignore = pageInfo.ignore;
21 20
22 double dx = dragInfo.endOffset.dx - dragInfo.beginOffset.dx; 21 double dx = dragInfo.endOffset.dx - dragInfo.beginOffset.dx;
23 double dy = dragInfo.endOffset.dy - dragInfo.beginOffset.dy; 22 double dy = dragInfo.endOffset.dy - dragInfo.beginOffset.dy;
@@ -51,7 +51,7 @@ class _AutoTrackPanGestureRecognizer extends PanGestureRecognizer { @@ -51,7 +51,7 @@ class _AutoTrackPanGestureRecognizer extends PanGestureRecognizer {
51 if (beginEvent != null) { 51 if (beginEvent != null) {
52 final distance = (beginEvent!.position.dx - event.position.dx).abs() + 52 final distance = (beginEvent!.position.dx - event.position.dx).abs() +
53 (beginEvent!.position.dy - event.position.dy).abs(); 53 (beginEvent!.position.dy - event.position.dy).abs();
54 - if (distance > 30) { 54 + if (distance > 50) {
55 final info = DragInfo.from( 55 final info = DragInfo.from(
56 begin: beginEvent!.position, 56 begin: beginEvent!.position,
57 end: event.position, 57 end: event.position,