diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 7378a3bb..899d8138 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.6.5 +v4.6.6 \ No newline at end of file diff --git a/hrp/pkg/uixt/harmony_device.go b/hrp/pkg/uixt/harmony_device.go index fc333c77..8820c962 100644 --- a/hrp/pkg/uixt/harmony_device.go +++ b/hrp/pkg/uixt/harmony_device.go @@ -19,6 +19,7 @@ type HarmonyDevice struct { d *ghdc.Device ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"` IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"` + LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"` } type HarmonyDeviceOption func(*HarmonyDevice) @@ -29,6 +30,18 @@ func WithConnectKey(connectKey string) HarmonyDeviceOption { } } +func WithIgnorePopup(ignorePopup bool) HarmonyDeviceOption { + return func(device *HarmonyDevice) { + device.IgnorePopup = ignorePopup + } +} + +func WithLogOn(logOn bool) HarmonyDeviceOption { + return func(device *HarmonyDevice) { + device.LogOn = logOn + } +} + func NewHarmonyDevice(options ...HarmonyDeviceOption) (device *HarmonyDevice, err error) { device = &HarmonyDevice{} for _, option := range options { @@ -101,7 +114,7 @@ func (dev *HarmonyDevice) UUID() string { } func (dev *HarmonyDevice) LogEnabled() bool { - return false + return dev.LogOn } func (dev *HarmonyDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error) { diff --git a/hrp/pkg/uixt/harmony_hdc_driver.go b/hrp/pkg/uixt/harmony_hdc_driver.go index 456f7173..7aa89d8f 100644 --- a/hrp/pkg/uixt/harmony_hdc_driver.go +++ b/hrp/pkg/uixt/harmony_hdc_driver.go @@ -145,7 +145,10 @@ func (hd *hdcDriver) TapFloat(x, y float64, options ...ActionOption) error { x += actionOptions.getRandomOffset() y += actionOptions.getRandomOffset() - + if actionOptions.Identifier != "" { + startTime := int(time.Now().UnixMilli()) + hd.points = append(hd.points, ExportPoint{Start: startTime, End: startTime + 100, Ext: actionOptions.Identifier, RunTime: 100}) + } return hd.uiDriver.InjectGesture(ghdc.NewGesture().Start(ghdc.Point{X: int(x), Y: int(y)}).Pause(100)) } @@ -195,7 +198,10 @@ func (hd *hdcDriver) SwipeFloat(fromX, fromY, toX, toY float64, options ...Actio if actionOptions.PressDuration > 0 { duration = int(actionOptions.PressDuration * 1000) } - + if actionOptions.Identifier != "" { + startTime := int(time.Now().UnixMilli()) + hd.points = append(hd.points, ExportPoint{Start: startTime, End: startTime + 100, Ext: actionOptions.Identifier, RunTime: 100}) + } return hd.uiDriver.InjectGesture(ghdc.NewGesture().Start(ghdc.Point{X: int(fromX), Y: int(fromY)}).MoveTo(ghdc.Point{X: int(toX), Y: int(toY)}, duration)) } @@ -304,5 +310,6 @@ func (hd *hdcDriver) StartCaptureLog(identifier ...string) (err error) { } func (hd *hdcDriver) StopCaptureLog() (result interface{}, err error) { - return nil, errDriverNotImplemented + // defer clear(hd.points) + return hd.points, nil }