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
d0f67c58
Commit
d0f67c58
authored
Dec 10, 2025
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:解决收到新的短信消息,未读状态未更新
parent
a4433c7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
SmsReceiver.kt
...src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
+7
-7
No files found.
app/src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
View file @
d0f67c58
...
@@ -185,18 +185,18 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -185,18 +185,18 @@ class SmsReceiver : BroadcastReceiver() {
var
notificationUserName
=
""
//通讯录如果有备注则优先展示备注,其次手机号
var
notificationUserName
=
""
//通讯录如果有备注则优先展示备注,其次手机号
Handler
(
Looper
.
getMainLooper
()).
post
{
Handler
(
Looper
.
getMainLooper
()).
post
{
//最新消息会话
val
conversation
:
Conversation
=
context
.
getConversations
(
threadId
).
firstOrNull
()
?:
return
@post
Log
.
d
(
TAG
,
"handleMessage: conversation toJson = ${Gson().toJson(conversation)} "
)
if
(!
PhoneFromUtil
.
isNumeric
(
conversation
.
userName
)){
notificationUserName
=
conversation
.
userName
}
if
(!
context
.
isNumberBlocked
(
address
))
{
if
(!
context
.
isNumberBlocked
(
address
))
{
val
privateCursor
=
context
.
getMyContactsCursor
(
favoritesOnly
=
false
,
withPhoneNumbersOnly
=
true
)
val
privateCursor
=
context
.
getMyContactsCursor
(
favoritesOnly
=
false
,
withPhoneNumbersOnly
=
true
)
ensureBackgroundThread
{
ensureBackgroundThread
{
val
newMessageId
:
Long
=
context
.
insertNewSMS
(
address
,
subject
,
body
,
date
,
read
,
threadId
,
type
,
subscriptionId
)
val
newMessageId
:
Long
=
context
.
insertNewSMS
(
address
,
subject
,
body
,
date
,
read
,
threadId
,
type
,
subscriptionId
)
//最新消息会话 必须在insertNewSMS 后获取,否则读取的read状态不生效
val
conversation
:
Conversation
=
context
.
getConversations
(
threadId
).
firstOrNull
()
?:
return
@ensureBackgroundThread
Log
.
d
(
TAG
,
"handleMessage: conversation toJson = ${Gson().toJson(conversation)} "
)
if
(!
PhoneFromUtil
.
isNumeric
(
conversation
.
userName
)){
notificationUserName
=
conversation
.
userName
}
if
(
aesPhoneNumber
.
isNotBlank
()
||
body
.
contains
(
"\u200B"
))
{
if
(
aesPhoneNumber
.
isNotBlank
()
||
body
.
contains
(
"\u200B"
))
{
conversation
.
title
=
aesPhoneNumber
conversation
.
title
=
aesPhoneNumber
conversation
.
isSFNumber
=
true
conversation
.
isSFNumber
=
true
...
...
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