Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion]: 多重匹配语法增加对 UID 的支持 #510

Closed
updateing opened this issue Aug 10, 2024 · 3 comments
Closed

[Suggestion]: 多重匹配语法增加对 UID 的支持 #510

updateing opened this issue Aug 10, 2024 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@updateing
Copy link

是否有人曾提过类似的问题?

否(No)

你觉得APP有什么不足之处?

转发规则 - 应用 - 匹配字段 选择多重匹配时,无法指定使用 UID 匹配。希望能够添加这个匹配条件。

现象是,在选择多重匹配后,“匹配的值”中填写 并且 是 UID 相等 999 ,再点击测试或保存,均会提示“多重匹配规则的第 1 行格式有误”。

你觉得该怎么去完善会比较好?【非必答】

从代码上看,底层的匹配代码应该是支持 UID 的:

UI 上检测多重匹配规则是否合法,只是通过一个预定义的正则表达式去检测:

//检查多重匹配规则是否正确
private fun checkMultiMatch(ruleStr: String?): Int {
if (TextUtils.isEmpty(ruleStr)) return 0
//Log.d(TAG, getString(R.string.regex_multi_match))
val regex = Regex(pattern = getString(R.string.regex_multi_match))
var lineNum = 1
val lineArray = ruleStr?.split("\\n".toRegex())?.toTypedArray()
for (line in lineArray!!) {
Log.d(TAG, line)
if (!line.matches(regex)) return lineNum
lineNum++
}
return 0
}

<string name="regex_multi_match" tools:ignore="TypographyDashes">^\\s*(并且|或者)\\s(是|不是)\\s(手机号|APP包名|短信内容|通知内容|通知标题|卡槽信息|通话类型)\\s(相等|包含|不包含|开头|结尾|正则匹配)\\s(.*)$</string>

因此或许只需要简单修改这个正则表达式,把 UID 加进去就可以支持了。但是我目前没有开发环境,无法做这个测试。

@updateing updateing added the help wanted Extra attention is needed label Aug 10, 2024
@pppscn
Copy link
Owner

pppscn commented Aug 12, 2024

覆盖安装 每周构建版 试试 (等待在线编译完成)

升级操作提示:

@updateing
Copy link
Author

测试可用。感谢!

另外留个记录:UID 不是 UserID. 如果要识别双开应用,条件应当是“以 999 开头”而不是“等于 999”。

@pppscn
Copy link
Owner

pppscn commented Aug 13, 2024

测试可用。感谢!

另外留个记录:UID 不是 UserID. 如果要识别双开应用,条件应当是“以 999 开头”而不是“等于 999”。

自定义模板插入这个标签 {{UID}} ,先转发全部通知出去,就知道你要的应用对应的uid是多少,然后修改转发规则,匹配字段选UID,匹配值添uid数字

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants