From a91d9c5b11dd8ae46428fd6df7fcf342a6973bf9 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Tue, 6 Jun 2023 21:17:57 +0800 Subject: [PATCH] change: add popups --- hrp/internal/version/VERSION | 2 +- hrp/pkg/uixt/ocr_vedem_test.go | 22 ++++++++++++++++++++++ hrp/pkg/uixt/video_crawler.go | 9 +++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index ceb7ead9..dde3816e 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.3.4-beta-2306052205 \ No newline at end of file +v4.3.4-beta-2306062225 \ No newline at end of file diff --git a/hrp/pkg/uixt/ocr_vedem_test.go b/hrp/pkg/uixt/ocr_vedem_test.go index ec7b5a4e..a026aafc 100644 --- a/hrp/pkg/uixt/ocr_vedem_test.go +++ b/hrp/pkg/uixt/ocr_vedem_test.go @@ -6,6 +6,7 @@ import ( "bytes" "fmt" "os" + "regexp" "testing" ) @@ -50,3 +51,24 @@ func TestOCRWithLocalFile(t *testing.T) { t.Fatal(err) } } + +func matchPopup(text string) bool { + for _, popup := range popups { + if regexp.MustCompile(popup[1]).MatchString(text) { + return true + } + } + return false +} + +func TestMatchRegex(t *testing.T) { + testData := []string{ + "以后再说", "我知道了", "同意", "拒绝", "稍后", + "始终允许", "继续使用", "仅在使用中允许", + } + for _, text := range testData { + if !matchPopup(text) { + t.Fatal(text) + } + } +} diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index f7b9a023..e1f1ba55 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -500,14 +500,15 @@ var popups = [][]string{ {".*青少年.*", "我知道了"}, // 青少年弹窗 {".*个人信息保护.*", "同意"}, {".*通讯录.*", "拒绝"}, - {".*更新.*", "以后再说"}, - {".*升级.*", "以后再说"}, + {".*更新.*", "以后再说|稍后"}, + {".*升级.*", "以后再说|稍后"}, {".*定位.*", "仅.*允许"}, {".*拍照.*", "仅.*允许"}, {".*录音.*", "仅.*允许"}, {".*位置.*", "仅.*允许"}, - {".*权限.*", "仅.*允许"}, - {".*允许.*", "仅.*允许"}, + {".*权限.*", "仅.*允许|始终允许"}, + {".*允许.*", "仅.*允许|始终允许"}, + {".*风险.*", "继续使用"}, {"管理使用时间", ".*忽略.*"}, }