From 84d321dba8998c1840fcbaf106700b706c12d37d Mon Sep 17 00:00:00 2001 From: "J.Tan" <5207957+genment@users.noreply.github.com> Date: Wed, 17 Aug 2022 20:57:12 -0400 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=A0=87=E9=A2=98=E5=92=8C=E4=BF=AE=E5=A4=8D=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=20(#208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 新增:测试通知转发规则时可以指定通知标题 * 修复:英文版多重匹配的正则错误 --- .../sms/forwarder/fragment/RulesEditFragment.kt | 8 ++++++-- app/src/main/res/layout/dialog_rule_test.xml | 15 +++++++++++++++ app/src/main/res/values-en/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/fragment/RulesEditFragment.kt b/app/src/main/java/com/idormy/sms/forwarder/fragment/RulesEditFragment.kt index 4f873aef..63ee0d08 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/fragment/RulesEditFragment.kt +++ b/app/src/main/java/com/idormy/sms/forwarder/fragment/RulesEditFragment.kt @@ -565,12 +565,16 @@ class RulesEditFragment : BaseFragment(), View.OnClic val rgSimSlot = dialogTest.findViewById(R.id.rg_sim_slot) val tvFrom = dialogTest.findViewById(R.id.tv_from) val etFrom = dialogTest.findViewById(R.id.et_from) + val tvTitle = dialogTest.findViewById(R.id.tv_title) + val etTitle = dialogTest.findViewById(R.id.et_title) val tvContent = dialogTest.findViewById(R.id.tv_content) val etContent = dialogTest.findViewById(R.id.et_content) if ("app" == ruleType) { tvSimSlot.visibility = View.GONE rgSimSlot.visibility = View.GONE + tvTitle.visibility = View.VISIBLE + etTitle.visibility = View.VISIBLE tvFrom.setText(R.string.test_package_name) tvContent.setText(R.string.test_inform_content) } else if ("call" == ruleType) { @@ -592,7 +596,7 @@ class RulesEditFragment : BaseFragment(), View.OnClic .positiveText(R.string.action_test) .onPositive { _: MaterialDialog?, _: DialogAction? -> try { - val simSlot = when (rgSimSlot.checkedRadioButtonId) { + val simSlot = when (if (ruleType == "app") -1 else rgSimSlot.checkedRadioButtonId) { R.id.rb_sim_slot_1 -> 0 R.id.rb_sim_slot_2 -> 1 else -> -1 @@ -608,7 +612,7 @@ class RulesEditFragment : BaseFragment(), View.OnClic val simInfo = when (simSlot) { 0 -> "SIM1_" + SettingUtils.extraSim1 1 -> "SIM2_" + SettingUtils.extraSim2 - else -> "" + else -> etTitle.text.toString() } val msgInfo = MsgInfo(ruleType, etFrom.text.toString(), etContent.text.toString(), Date(), simInfo, simSlot) diff --git a/app/src/main/res/layout/dialog_rule_test.xml b/app/src/main/res/layout/dialog_rule_test.xml index 44b65f86..c27c0d58 100644 --- a/app/src/main/res/layout/dialog_rule_test.xml +++ b/app/src/main/res/layout/dialog_rule_test.xml @@ -43,6 +43,21 @@ android:inputType="textMultiLine" app:met_clearButton="true" /> + + + + Test Phone Number Test Msg Content Test PackageName + Test Notify Title Test Notify Content SIM Slot Field @@ -708,7 +709,7 @@ Drop-down selection, keyword fuzzy match Installed apps Drop-down selection to get package name, keyword fuzzy matching APP name - ^\\s*(AND|OR)\\s(IS|NOTIS)\\s(PHONE_NUM|PACKAGE_NAME|MSG_CONTENT|INFORM_CONTENT|INFORM_TITLE|CARD_SLOT)\\\\s(EQUALS|CONTAIN|NOTCONTAIN|STARTWITH|ENDWITH|REGEX)\\s(.*)$ + ^\\s*(AND|OR)\\s(IS|NOTIS)\\s(PHONE_NUM|PACKAGE_NAME|MSG_CONTENT|INFORM_CONTENT|INFORM_TITLE|CARD_SLOT)\\s(EQUALS|CONTAIN|NOTCONTAIN|STARTWITH|ENDWITH|REGEX)\\s(.*)$ Welcome to We understand the importance of personal information to you and thank you for your trust in us.\n In order to better protect your rights and comply with relevant regulatory requirements, we will pass " diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 03466761..e967bf4b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -230,6 +230,7 @@ 测试模拟的来源号码 测试模拟的短信内容 测试模拟的APP包名 + 测试模拟的通知标题 测试模拟的通知内容 匹配卡槽 匹配字段