From bad3bc0b8e7deb77a2b532fe8ffe8c48ce80b503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=B3=93=E9=93=AE?= Date: Mon, 12 Aug 2024 18:55:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=8D=B8=E8=BD=BD?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hrp/pkg/uixt/action.go | 2 +- hrp/pkg/uixt/ext.go | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hrp/pkg/uixt/action.go b/hrp/pkg/uixt/action.go index 67ddac24..6ec8ba86 100644 --- a/hrp/pkg/uixt/action.go +++ b/hrp/pkg/uixt/action.go @@ -569,7 +569,7 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) { } case ACTION_AppUninstall: if packageName, ok := action.Params.(string); ok { - if err = dExt.Uninstall(packageName); err != nil { + if err = dExt.Uninstall(packageName, action.GetOptions()...); err != nil { return errors.Wrap(err, "failed to uninstall app") } } diff --git a/hrp/pkg/uixt/ext.go b/hrp/pkg/uixt/ext.go index 94508df2..1658f8a3 100644 --- a/hrp/pkg/uixt/ext.go +++ b/hrp/pkg/uixt/ext.go @@ -222,8 +222,16 @@ func (dExt *DriverExt) InstallByUrl(url string, opts *InstallOptions) error { return nil } -func (dExt *DriverExt) Uninstall(packageName string) error { - return dExt.Device.Uninstall(packageName) +func (dExt *DriverExt) Uninstall(packageName string, options ...ActionOption) error { + actionOptions := NewActionOptions(options...) + err := dExt.Device.Uninstall(packageName) + if err != nil { + log.Warn().Err(err).Msg("failed to uninstall") + } + if actionOptions.IgnoreNotFoundError { + return nil + } + return err } func (dExt *DriverExt) Install(filePath string, opts *InstallOptions) error {