新增测试通知标题和修复英文正则表达式 (#208)

* 新增:测试通知转发规则时可以指定通知标题

* 修复:英文版多重匹配的正则错误
pull/214/head
J.Tan 2 years ago committed by GitHub
parent bffebeba74
commit 84d321dba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -565,12 +565,16 @@ class RulesEditFragment : BaseFragment<FragmentRulesEditBinding?>(), View.OnClic
val rgSimSlot = dialogTest.findViewById<RadioGroup>(R.id.rg_sim_slot)
val tvFrom = dialogTest.findViewById<TextView>(R.id.tv_from)
val etFrom = dialogTest.findViewById<EditText>(R.id.et_from)
val tvTitle = dialogTest.findViewById<TextView>(R.id.tv_title)
val etTitle = dialogTest.findViewById<EditText>(R.id.et_title)
val tvContent = dialogTest.findViewById<TextView>(R.id.tv_content)
val etContent = dialogTest.findViewById<EditText>(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<FragmentRulesEditBinding?>(), 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<FragmentRulesEditBinding?>(), 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)

@ -43,6 +43,21 @@
android:inputType="textMultiLine"
app:met_clearButton="true" />
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test_inform_title"
android:visibility="gone" />
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
android:id="@+id/et_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:visibility="gone"
app:met_clearButton="true" />
<TextView
android:id="@+id/tv_content"
android:layout_width="match_parent"

@ -229,6 +229,7 @@
<string name="test_phone_number">Test Phone Number</string>
<string name="test_msg_content">Test Msg Content</string>
<string name="test_package_name">Test PackageName</string>
<string name="test_inform_title">Test Notify Title</string>
<string name="test_inform_content">Test Notify Content</string>
<string name="match_sim_slot">SIM Slot</string>
<string name="match_field">Field</string>
@ -708,7 +709,7 @@
<string name="choose_sender">Drop-down selection, keyword fuzzy match</string>
<string name="choose_app">Installed apps</string>
<string name="choose_app_hint">Drop-down selection to get package name, keyword fuzzy matching APP name</string>
<string name="regex_multi_match" tools:ignore="TypographyDashes">^\\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(.*)$</string>
<string name="regex_multi_match" tools:ignore="TypographyDashes">^\\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(.*)$</string>
<string name="privacy_content_1">Welcome to</string>
<string name="privacy_content_2">We understand the importance of personal information to you and thank you for your trust in us.\n</string>
<string name="privacy_content_3">In order to better protect your rights and comply with relevant regulatory requirements, we will pass "</string>

@ -230,6 +230,7 @@
<string name="test_phone_number">测试模拟的来源号码</string>
<string name="test_msg_content">测试模拟的短信内容</string>
<string name="test_package_name">测试模拟的APP包名</string>
<string name="test_inform_title">测试模拟的通知标题</string>
<string name="test_inform_content">测试模拟的通知内容</string>
<string name="match_sim_slot">匹配卡槽</string>
<string name="match_field">匹配字段</string>

Loading…
Cancel
Save