From 30d4dcbaa2230cdef885d5d0aea44045df72f185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=B3=93=E9=93=AE?= Date: Thu, 13 Jun 2024 15:09:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hrp/internal/version/VERSION | 2 +- hrp/pkg/uixt/action.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index baabcd7d..f4d009b8 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.5.6 \ No newline at end of file +v4.5.7 \ No newline at end of file diff --git a/hrp/pkg/uixt/action.go b/hrp/pkg/uixt/action.go index 1a555f91..3ec9a3cd 100644 --- a/hrp/pkg/uixt/action.go +++ b/hrp/pkg/uixt/action.go @@ -26,6 +26,8 @@ const ( ACTION_SleepRandom ActionMethod = "sleep_random" ACTION_StartCamera ActionMethod = "camera_start" // alias for app_launch camera ACTION_StopCamera ActionMethod = "camera_stop" // alias for app_terminate camera + ACTION_SetClipboard ActionMethod = "set_clipboard" + ACTION_GetClipboard ActionMethod = "get_clipboard" // UI validation // selectors @@ -594,6 +596,15 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) { return nil } return fmt.Errorf("app_terminate params should be bundleId(string), got %v", action.Params) + case ACTION_SetClipboard: + if text, ok := action.Params.(string); ok { + err := dExt.Driver.SetPasteboard(PasteboardTypePlaintext, text) + if err != nil { + return errors.Wrap(err, "failed to set clipboard") + } + return nil + } + return fmt.Errorf("set_clioboard params should be text(string), got %v", action.Params) case ACTION_Home: return dExt.Driver.Homescreen() case ACTION_TapXY: