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
cafab03a
Commit
cafab03a
authored
Nov 18, 2024
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:添加短信号码对手机通话记录检索对比,2.检索为顺丰号码再次对短信记录进行检索对比进行掩码操作
parent
62f6203e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
SmsReceiver.kt
...src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
+6
-14
No files found.
app/src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
View file @
cafab03a
...
...
@@ -6,7 +6,6 @@ import android.content.Intent
import
android.os.Handler
import
android.os.Looper
import
android.provider.Telephony
import
android.util.Log
import
com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.RecentsHelper
import
com.secspace.sms.helpers.refreshMessages
...
...
@@ -23,7 +22,6 @@ import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import
com.simplemobiletools.commons.helpers.ensureBackgroundThread
import
com.simplemobiletools.commons.models.PhoneNumber
import
com.simplemobiletools.commons.models.SimpleContact
import
com.simplemobiletools.commons.util.GsonUtil
class
SmsReceiver
:
BroadcastReceiver
()
{
private
val
TAG
:
String
=
"shuju"
...
...
@@ -100,8 +98,9 @@ class SmsReceiver : BroadcastReceiver() {
if
(
lastNumber
.
isNotBlank
())
{
conversation
.
phoneNumber
=
lastNumber
conversation
.
isSFNumber
=
true
}
Log
.
e
(
TAG
,
"----handleConversation
----handleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}"
)
// Log.e(TAG, "----SmsReceiver
----handleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}")
try
{
context
.
insertOrUpdateConversation
(
conversation
)
}
catch
(
ignored
:
Exception
)
{
...
...
@@ -161,7 +160,7 @@ class SmsReceiver : BroadcastReceiver() {
subscriptionId
)
}
Log
.
e
(
TAG
,
"----handleMessage
----handleMessage message:${GsonUtil.parseBeanToJson(message)}"
)
// Log.e(TAG, "----SmsReceiver
----handleMessage message:${GsonUtil.parseBeanToJson(message)}")
context
.
messagesDB
.
insertOrUpdate
(
message
)
if
(
context
.
config
.
isArchiveAvailable
)
{
context
.
updateConversationArchivedStatus
(
threadId
,
false
)
...
...
@@ -193,33 +192,26 @@ class SmsReceiver : BroadcastReceiver() {
RecentsHelper
(
context
=
context
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
val
listCallRecent
=
recents
.
distinctBy
{
it
.
phoneNumber
}
Log
.
e
(
TAG
,
"----SmsReceiver----最近通话 recents:${listCallRecent} disListSize:${listCallRecent.size}"
)
//
Log.e(TAG, "----SmsReceiver----最近通话 recents:${listCallRecent} disListSize:${listCallRecent.size}")
val
findResult
:
Int
=
listCallRecent
.
count
{
it
.
phoneNumber
.
trim
()
==
phoneNumber
.
trim
()
}
//从最近通话记录中找到了号码 进行掩码操作
if
(
findResult
>
0
)
{
//获取所有短信
val
allConversations
=
context
.
conversationsDB
.
getNonArchived
()
as
ArrayList
<
Conversation
>
Log
.
e
(
TAG
,
" 获取DB 短信列表 allConversations:${GsonUtil.parseListToJson(allConversations)}"
)
val
searchResult
=
getIndexById
(
allConversations
,
threadId
)
Log
.
e
(
TAG
,
"----SmsReceiver----手机号掩码操作 searchResult:${searchResult}"
)
if
(
searchResult
<
0
)
return
@getRecentCalls
allConversations
.
forEach
{
if
(
it
.
threadId
==
threadId
&&
it
.
phoneNumber
==
phoneNumber
)
{
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
Log
.
e
(
/*
Log.e(
TAG,
"----SmsReceiver----手机号掩码操作 itNumber:${itNumber} 所在集合下标=${searchResult} threadId:${it.threadId} threadId:$threadId context.getThreadId:${
context.getThreadId(phoneNumber)
}"
)
val
messgeData
=
allConversations
[
searchResult
].
copy
(
isSFNumber
=
true
,
phoneNumber
=
itNumber
)
context
.
conversationsDB
.
insertOrUpdate
(
messgeData
)
context
.
insertOrUpdateConversation2
(
messgeData
)
)*/
lastNumber
=
itNumber
}
}
}
}
...
...
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