优化:`自动任务·快捷指令` —— 执行动作:`发送短信`支持插入`变量标签`(标签适用场景参见 wiki附录3) #441

pull/473/head
pppscn 2 months ago
parent 5e0537e1e2
commit 1bd8cb04f8

@ -78,7 +78,7 @@ data class MsgInfo(
}
@SuppressLint("SimpleDateFormat")
fun replaceTemplate(template: String, regexReplace: String, needJson: Boolean = false): String {
fun replaceTemplate(template: String, regexReplace: String = "", needJson: Boolean = false): String {
return template.replaceTag(getString(R.string.tag_from), from, needJson)
.replaceTag(getString(R.string.tag_package_name), from, needJson)
.replaceTag(getString(R.string.tag_sms), content, needJson)

@ -128,7 +128,9 @@ class ActionWorker(context: Context, params: WorkerParameters) : CoroutineWorker
val msg = if (ActivityCompat.checkSelfPermission(App.context, Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED) {
getString(R.string.no_sms_sending_permission)
} else {
PhoneUtils.sendSms(mSubscriptionId, smsSetting.phoneNumbers, smsSetting.msgContent)
val mobileList = msgInfo.replaceTemplate(smsSetting.phoneNumbers)
val message = msgInfo.replaceTemplate(smsSetting.msgContent)
PhoneUtils.sendSms(mSubscriptionId, mobileList, message)
}
if (msg == null || msg == "") {
successNum++

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z" />
</vector>
Loading…
Cancel
Save