feat: support pre hook and post hook for actions

This commit is contained in:
lilong.129
2025-05-09 23:01:27 +08:00
parent 433b1cd48d
commit 3715cbb432
10 changed files with 89 additions and 20 deletions

View File

@@ -307,11 +307,12 @@ func (ad *ADBDriver) TapXY(x, y float64, opts ...option.ActionOption) error {
func (ad *ADBDriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error {
log.Info().Float64("x", x).Float64("y", y).Msg("ADBDriver.TapAbsXY")
var err error
x, y, err = handlerTapAbsXY(ad, x, y, opts...)
actionOptions := option.NewActionOptions(opts...)
x, y, err := preHandler_TapAbsXY(ad, actionOptions, x, y)
if err != nil {
return err
}
defer postHandler(ad, actionOptions)
// adb shell input tap x y
xStr := fmt.Sprintf("%.1f", x)