Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Simple-Sms
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangchengbo
Simple-Sms
Commits
128e1421
Commit
128e1421
authored
Aug 01, 2025
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:更换短信固定模版检索关键词进行脱敏操作
parent
7755696d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
26 deletions
+29
-26
MainActivity.kt
...c/main/kotlin/com/secspace/sms/activities/MainActivity.kt
+18
-6
BaseConversationsAdapter.kt
...lin/com/secspace/sms/adapters/BaseConversationsAdapter.kt
+3
-5
SmsReceiver.kt
...src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
+8
-15
No files found.
app/src/main/kotlin/com/secspace/sms/activities/MainActivity.kt
View file @
128e1421
...
@@ -7,6 +7,7 @@ import android.content.Intent
...
@@ -7,6 +7,7 @@ import android.content.Intent
import
android.database.Cursor
import
android.database.Cursor
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.provider.Settings
import
android.provider.Telephony
import
android.provider.Telephony
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
...
@@ -80,11 +81,27 @@ class MainActivity : SimpleActivity() {
...
@@ -80,11 +81,27 @@ class MainActivity : SimpleActivity() {
if
(
checkAppSideloading
())
{
if
(
checkAppSideloading
())
{
return
return
}
}
}
private
fun
isNotificationAccessEnabled
():
Boolean
{
val
enabledListeners
:
String
=
Settings
.
Secure
.
getString
(
contentResolver
,
"enabled_notification_listeners"
)
return
enabledListeners
!=
null
&&
enabledListeners
.
contains
(
packageName
)
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
val
result
=
isNotificationAccessEnabled
()
com
.
secspace
.
log
.
Log
.
d
(
TAG
,
"是否拥有通知使用权 = $result"
)
if
(!
result
){
val
intent
=
Intent
(
"android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
startActivity
(
intent
)
}
initMessenger
()
initMessenger
()
updateMenuColors
()
updateMenuColors
()
...
@@ -540,15 +557,10 @@ class MainActivity : SimpleActivity() {
...
@@ -540,15 +557,10 @@ class MainActivity : SimpleActivity() {
getOrCreateConversationsAdapter
().
notifyDataSetChanged
()
getOrCreateConversationsAdapter
().
notifyDataSetChanged
()
}
}
private
fun
containsDigit
(
str
:
String
):
Boolean
{
return
str
.
matches
(
".*\\d+.*"
.
toRegex
())
}
private
fun
handleConversationClick
(
any
:
Any
)
{
private
fun
handleConversationClick
(
any
:
Any
)
{
Intent
(
this
,
ThreadActivity
::
class
.
java
).
apply
{
Intent
(
this
,
ThreadActivity
::
class
.
java
).
apply
{
val
conversation
=
any
as
Conversation
val
conversation
=
any
as
Conversation
if
(
conversation
.
snippet
.
contains
(
"
快递单号"
)
&&
conversation
.
snippet
.
contains
(
"SF"
)
&&
containsDigit
(
conversation
.
snippet
))
{
if
(
conversation
.
snippet
.
contains
(
"
\u200B"
))
{
val
phoneNumber
=
conversation
.
title
val
phoneNumber
=
conversation
.
title
if
(
phoneNumber
.
contains
(
"+86"
))
{
if
(
phoneNumber
.
contains
(
"+86"
))
{
phoneNumber
.
replace
(
"+86"
,
""
)
phoneNumber
.
replace
(
"+86"
,
""
)
...
...
app/src/main/kotlin/com/secspace/sms/adapters/BaseConversationsAdapter.kt
View file @
128e1421
...
@@ -113,10 +113,6 @@ abstract class BaseConversationsAdapter(
...
@@ -113,10 +113,6 @@ abstract class BaseConversationsAdapter(
}
}
}
}
fun
containsDigit
(
str
:
String
):
Boolean
{
return
str
.
matches
(
".*\\d+.*"
.
toRegex
())
}
private
fun
setupView
(
view
:
View
,
conversation
:
Conversation
)
{
private
fun
setupView
(
view
:
View
,
conversation
:
Conversation
)
{
ItemConversationBinding
.
bind
(
view
).
apply
{
ItemConversationBinding
.
bind
(
view
).
apply
{
root
.
setupViewBackground
(
activity
)
root
.
setupViewBackground
(
activity
)
...
@@ -137,7 +133,7 @@ abstract class BaseConversationsAdapter(
...
@@ -137,7 +133,7 @@ abstract class BaseConversationsAdapter(
}
}
if
(
conversation
.
snippet
.
isNotEmpty
()
&&
conversation
.
title
.
length
>=
11
)
{
if
(
conversation
.
snippet
.
isNotEmpty
()
&&
conversation
.
title
.
length
>=
11
)
{
if
(
conversation
.
snippet
.
contains
(
"
快递单号"
)
&&
conversation
.
snippet
.
contains
(
"SF"
)
&&
containsDigit
(
conversation
.
snippet
))
{
if
(
conversation
.
snippet
.
contains
(
"
\u200B"
))
{
val
phoneNumber
=
conversation
.
title
val
phoneNumber
=
conversation
.
title
if
(
phoneNumber
.
contains
(
"+86"
))
{
if
(
phoneNumber
.
contains
(
"+86"
))
{
phoneNumber
.
replace
(
"+86"
,
""
)
phoneNumber
.
replace
(
"+86"
,
""
)
...
@@ -154,6 +150,8 @@ abstract class BaseConversationsAdapter(
...
@@ -154,6 +150,8 @@ abstract class BaseConversationsAdapter(
//短信内容
//短信内容
conversationBodyShort
.
apply
{
conversationBodyShort
.
apply
{
text
=
smsDraft
?:
conversation
.
snippet
text
=
smsDraft
?:
conversation
.
snippet
Log
.
d
(
"TAG"
,
"setupView: 是否包含零宽度字符 = ${text.contains("
\
u200B
")} 短信内容 = ${text}"
)
// if(text.contains("\u200B"))
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
fontSize
*
0.9f
)
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
fontSize
*
0.9f
)
}
}
...
...
app/src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
View file @
128e1421
...
@@ -236,28 +236,21 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -236,28 +236,21 @@ class SmsReceiver : BroadcastReceiver() {
val
tipPopup
=
MyPushWindow
(
context
,
aesPhoneNumber
,
body
)
val
tipPopup
=
MyPushWindow
(
context
,
aesPhoneNumber
,
body
)
tipPopup
.
show
()
tipPopup
.
show
()
}
else
{
}
else
{
/*val phoneNumberResult = CallHistoryManager.getInstance(context).phoneNumber
Log
.
d
(
TAG
,
"SmsReceiver 短信内容 = ${body} address = $address "
)
// Log.d(TAG, "SmsReceiver phoneNumberResult : $phoneNumberResult")
if
(
body
.
contains
(
"\u200B"
))
{
val listResult: List<String> = phoneNumberResult.split(",")
if
(
address
.
contains
(
"+86"
))
{
if (listResult.isNotEmpty()) {
address
.
replace
(
"+86"
,
""
)
for (item in listResult.distinct()) {
}
if (item.length < 11) continue
PhoneUtils
.
phoneNumberFormat
(
address
)
{
itNumber
->
if (item.contains("+86")) {
item.replace("+86", "")
}
PhoneUtils.phoneNumberFormat(item) { itNumber ->
val
tipPopup
=
MyPushWindow
(
context
,
itNumber
,
body
)
val
tipPopup
=
MyPushWindow
(
context
,
itNumber
,
body
)
tipPopup
.
show
()
tipPopup
.
show
()
}
}
}
}
else
{
} else {
val tipPopup = MyPushWindow(context, address, body)
tipPopup.show()
}*/
val
tipPopup
=
MyPushWindow
(
context
,
address
,
body
)
val
tipPopup
=
MyPushWindow
(
context
,
address
,
body
)
tipPopup
.
show
()
tipPopup
.
show
()
}
}
}
}
}
confirmCallBack
.
invoke
()
confirmCallBack
.
invoke
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment