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
99ffcf0a
Commit
99ffcf0a
authored
Nov 20, 2025
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:1.长按桌面Icon[日志导出]功能 2.添加Log日志输出,便于统计
parent
8fd79a0e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
55 deletions
+104
-55
MainActivity.kt
...c/main/kotlin/com/secspace/sms/activities/MainActivity.kt
+78
-33
SettingsActivity.kt
...in/kotlin/com/secspace/sms/activities/SettingsActivity.kt
+3
-0
ThreadActivity.kt
...main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
+6
-3
ConversationsAdapter.kt
.../kotlin/com/secspace/sms/adapters/ConversationsAdapter.kt
+7
-9
ThreadAdapter.kt
...rc/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
+1
-1
SmsReceiver.kt
...src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
+9
-9
No files found.
app/src/main/kotlin/com/secspace/sms/activities/MainActivity.kt
View file @
99ffcf0a
...
@@ -4,7 +4,10 @@ import android.annotation.SuppressLint
...
@@ -4,7 +4,10 @@ import android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.app.role.RoleManager
import
android.app.role.RoleManager
import
android.content.Intent
import
android.content.Intent
import
android.content.pm.ShortcutInfo
import
android.database.Cursor
import
android.database.Cursor
import
android.graphics.drawable.Icon
import
android.graphics.drawable.LayerDrawable
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
...
@@ -25,6 +28,7 @@ import com.secspace.sms.extensions.*
...
@@ -25,6 +28,7 @@ import com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.*
import
com.secspace.sms.helpers.*
import
com.secspace.sms.models.*
import
com.secspace.sms.models.*
import
com.secspace.sms.receivers.SmsSendObserver
import
com.secspace.sms.receivers.SmsSendObserver
import
com.secspace.sms.shortcut.ShortCutActivity
import
com.secspace.sms.util.PhoneFromUtil
import
com.secspace.sms.util.PhoneFromUtil
import
com.secspace.sms.util.PhoneUtils
import
com.secspace.sms.util.PhoneUtils
import
com.secspace.sms.util.SmsCountUtil
import
com.secspace.sms.util.SmsCountUtil
...
@@ -133,9 +137,10 @@ class MainActivity : SimpleActivity() {
...
@@ -133,9 +137,10 @@ class MainActivity : SimpleActivity() {
binding
.
conversationsFastscroller
.
updateColors
(
properPrimaryColor
)
binding
.
conversationsFastscroller
.
updateColors
(
properPrimaryColor
)
binding
.
conversationsProgressBar
.
setIndicatorColor
(
properPrimaryColor
)
binding
.
conversationsProgressBar
.
setIndicatorColor
(
properPrimaryColor
)
binding
.
conversationsProgressBar
.
trackColor
=
properPrimaryColor
.
adjustAlpha
(
LOWER_ALPHA
)
binding
.
conversationsProgressBar
.
trackColor
=
properPrimaryColor
.
adjustAlpha
(
LOWER_ALPHA
)
// checkShortcut()
(
binding
.
conversationsFab
.
layoutParams
as
?
CoordinatorLayout
.
LayoutParams
)
?.
bottomMargin
=
(
binding
.
conversationsFab
.
layoutParams
as
?
CoordinatorLayout
.
LayoutParams
)
?.
bottomMargin
=
navigationBarHeight
+
resources
.
getDimension
(
com
.
simplemobiletools
.
commons
.
R
.
dimen
.
activity_margin
).
toInt
()
navigationBarHeight
+
resources
.
getDimension
(
com
.
simplemobiletools
.
commons
.
R
.
dimen
.
activity_margin
).
toInt
()
checkShortcuts
()
}
}
override
fun
onPause
()
{
override
fun
onPause
()
{
...
@@ -346,10 +351,10 @@ class MainActivity : SimpleActivity() {
...
@@ -346,10 +351,10 @@ class MainActivity : SimpleActivity() {
}
}
val
privateContacts
=
MyContactsContentProvider
.
getSimpleContacts
(
this
@MainActivity
,
privateCursor
)
val
privateContacts
=
MyContactsContentProvider
.
getSimpleContacts
(
this
@MainActivity
,
privateCursor
)
// Log.e
(TAG, " getNewConversations privateContacts:${GsonUtil.parseListToJson(privateContacts)}")
Log
.
d
(
TAG
,
" getNewConversations privateContacts:${GsonUtil.parseListToJson(privateContacts)}"
)
//获取系统SMS DB短信列表
//获取系统SMS DB短信列表
val
conversations
:
java
.
util
.
ArrayList
<
Conversation
>
=
getConversations
(
privateContacts
=
privateContacts
)
val
conversations
:
java
.
util
.
ArrayList
<
Conversation
>
=
getConversations
(
privateContacts
=
privateContacts
)
// Log.e
(TAG, " getNewConversations 获取系统SMS DB短信列表(脏数据) conversations:${GsonUtil.parseListToJson(conversations)}")
Log
.
d
(
TAG
,
" getNewConversations 获取系统SMS DB短信列表(脏数据) conversations:${GsonUtil.parseListToJson(conversations)}"
)
//通过DB数据与cache对比threadID
//通过DB数据与cache对比threadID
conversations
.
forEach
{
clonedConversation
->
conversations
.
forEach
{
clonedConversation
->
...
@@ -385,12 +390,12 @@ class MainActivity : SimpleActivity() {
...
@@ -385,12 +390,12 @@ class MainActivity : SimpleActivity() {
val
conv
=
conversations
.
find
{
val
conv
=
conversations
.
find
{
it
.
threadId
==
cachedConv
.
threadId
&&
!
Conversation
.
areContentsTheSame
(
cachedConv
,
it
)
it
.
threadId
==
cachedConv
.
threadId
&&
!
Conversation
.
areContentsTheSame
(
cachedConv
,
it
)
}
}
// Log.
e
(TAG, " getNewConversations 对比后的结果(新数据)222 find conv:${GsonUtil.parseBeanToJson(conv)}")
// Log.
d
(TAG, " getNewConversations 对比后的结果(新数据)222 find conv:${GsonUtil.parseBeanToJson(conv)}")
if
(
conv
!=
null
&&
conv
.
isSFNumber
)
{
if
(
conv
!=
null
&&
conv
.
isSFNumber
)
{
// Log.
e
(TAG, " conversations find it conv:${GsonUtil.parseBeanToJson(conv)}")
// Log.
d
(TAG, " conversations find it conv:${GsonUtil.parseBeanToJson(conv)}")
val
lastModified
=
maxOf
(
cachedConv
.
date
,
conv
.
date
)
val
lastModified
=
maxOf
(
cachedConv
.
date
,
conv
.
date
)
val
conversation
=
conv
.
copy
(
date
=
lastModified
)
val
conversation
=
conv
.
copy
(
date
=
lastModified
)
// Log.
e
(
// Log.
d
(
// TAG,
// TAG,
// " getNewConversations 对比后的结果(新数据) isSFNumber=${conv.isSFNumber} find conversation:${GsonUtil.parseBeanToJson(conversation)}"
// " getNewConversations 对比后的结果(新数据) isSFNumber=${conv.isSFNumber} find conversation:${GsonUtil.parseBeanToJson(conversation)}"
// )
// )
...
@@ -446,18 +451,18 @@ class MainActivity : SimpleActivity() {
...
@@ -446,18 +451,18 @@ class MainActivity : SimpleActivity() {
val
hasPerMissionResult
=
this
@MainActivity
.
hasPermission
(
PERMISSION_READ_CALL_LOG
)
val
hasPerMissionResult
=
this
@MainActivity
.
hasPermission
(
PERMISSION_READ_CALL_LOG
)
if
(
hasPerMissionResult
&&
sortedConversations
.
isNotEmpty
())
{
if
(
hasPerMissionResult
&&
sortedConversations
.
isNotEmpty
())
{
val
firstConversation
:
Conversation
=
sortedConversations
.
firstOrNull
()
?:
return
//获取第一条未掩码会话
val
firstConversation
:
Conversation
=
sortedConversations
.
firstOrNull
()
?:
return
//获取第一条未掩码会话
// Log.d(TAG, " MainActivity firstConversation()
获取第一条会话 =: ${GsonUtil.parseBeanToJson(firstConversation)}")
Log
.
d
(
TAG
,
" setFirstConversationAndUpdateData:
获取第一条会话 =: ${GsonUtil.parseBeanToJson(firstConversation)}"
)
//根据最新的短信threadId 获取所有短信列表 取最新一条记录
//根据最新的短信threadId 获取所有短信列表 取最新一条记录
val
messages
:
java
.
util
.
ArrayList
<
Message
>
=
getMessages
(
firstConversation
.
threadId
,
true
)
val
messages
:
java
.
util
.
ArrayList
<
Message
>
=
getMessages
(
firstConversation
.
threadId
,
true
)
// Log.e(TAG, " MainActivity getMessages()
执行查询会话 messages 数据库 =:${GsonUtil.parseListToJson(messages)} ")
Log
.
d
(
TAG
,
" setFirstConversationAndUpdateData:
执行查询会话 messages 数据库 =:${GsonUtil.parseListToJson(messages)} "
)
val
lastMsg
:
Message
=
messages
.
last
()
val
lastMsg
:
Message
=
messages
.
last
()
firstConversation
.
snippet
=
lastMsg
.
body
firstConversation
.
snippet
=
lastMsg
.
body
firstConversation
.
date
=
lastMsg
.
date
firstConversation
.
date
=
lastMsg
.
date
val
listContains
:
List
<
String
>
=
messages
.
map
{
it
.
body
}.
filter
{
it
.
contains
(
"\u200B"
)
}
val
listContains
:
List
<
String
>
=
messages
.
map
{
it
.
body
}.
filter
{
it
.
contains
(
"\u200B"
)
}
// Log.d(TAG, "sendNormalMessage
: 该对话是否有包含零宽字符 = ${listContains.isNotEmpty()}")
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData
: 该对话是否有包含零宽字符 = ${listContains.isNotEmpty()}"
)
if
(
listContains
.
isNotEmpty
())
{
if
(
listContains
.
isNotEmpty
())
{
firstConversation
.
isSFNumber
=
true
firstConversation
.
isSFNumber
=
true
if
(
lastMsg
.
senderPhoneNumber
.
isNotEmpty
()
&&
PhoneFromUtil
.
isNumeric
(
lastMsg
.
senderPhoneNumber
))
if
(
lastMsg
.
senderPhoneNumber
.
isNotEmpty
()
&&
PhoneFromUtil
.
isNumeric
(
lastMsg
.
senderPhoneNumber
))
...
@@ -473,18 +478,19 @@ class MainActivity : SimpleActivity() {
...
@@ -473,18 +478,19 @@ class MainActivity : SimpleActivity() {
}
}
messagesDB
.
insertOrUpdate
(
itemBean
)
messagesDB
.
insertOrUpdate
(
itemBean
)
}
}
// Log.d(TAG, " MainActivity getMessages()
lastMsg 数据库 threadId = ${lastMsg.threadId} =:${GsonUtil.parseListToJson(listMsg)} ")
Log
.
d
(
TAG
,
" setFirstConversationAndUpdateData:
lastMsg 数据库 threadId = ${lastMsg.threadId} =:${GsonUtil.parseListToJson(listMsg)} "
)
}
else
{
}
else
{
val
phoneNumber
=
firstConversation
.
title
.
replace
(
" "
,
""
)
val
phoneNumber
=
firstConversation
.
title
.
replace
(
" "
,
""
)
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData: phoneNumber = $phoneNumber"
)
//只针对手机号
//只针对手机号
if
(
phoneNumber
.
length
<
11
)
return
if
(
phoneNumber
.
length
<
11
)
return
if
(!
firstConversation
.
isSFNumber
)
{
if
(!
firstConversation
.
isSFNumber
)
{
// Log.d(TAG, "----MainActivity----
获取第一条会话手机号 phoneNumber:$phoneNumber")
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData:
获取第一条会话手机号 phoneNumber:$phoneNumber"
)
RecentsHelper
(
context
=
this
@MainActivity
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
RecentsHelper
(
context
=
this
@MainActivity
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
// Log.d(TAG, "----MainActivity----
最近通话记录列表 :${GsonUtil.parseListToJson(listCallRecent)}")
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData:
最近通话记录列表 :${GsonUtil.parseListToJson(listCallRecent)}"
)
val
findResult
:
RecentCall
?
=
listCallRecent
.
firstOrNull
{
it
.
phoneNumber
.
replace
(
" "
,
""
)
==
phoneNumber
&&
it
.
isShunFeng
}
val
findResult
:
RecentCall
?
=
listCallRecent
.
firstOrNull
{
it
.
phoneNumber
.
replace
(
" "
,
""
)
==
phoneNumber
&&
it
.
isShunFeng
}
// Log.d(TAG, "----MainActivity----
是否从通话记录中查找到电话号Result:${findResult != null}")
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData:
是否从通话记录中查找到电话号Result:${findResult != null}"
)
//从最近通话记录中找到了号码 进行掩码操作
//从最近通话记录中找到了号码 进行掩码操作
if
(
findResult
!=
null
)
{
if
(
findResult
!=
null
)
{
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
...
@@ -496,7 +502,7 @@ class MainActivity : SimpleActivity() {
...
@@ -496,7 +502,7 @@ class MainActivity : SimpleActivity() {
}
}
}
}
conversationsDB
.
insertOrUpdate
(
firstConversation
)
conversationsDB
.
insertOrUpdate
(
firstConversation
)
// Log.d(TAG, "setFirstConversationAndUpdateData
firstConversation = ${Gson().toJson(firstConversation)}")
Log
.
d
(
TAG
,
"setFirstConversationAndUpdateData:
firstConversation = ${Gson().toJson(firstConversation)}"
)
}
}
}
}
...
@@ -511,13 +517,13 @@ class MainActivity : SimpleActivity() {
...
@@ -511,13 +517,13 @@ class MainActivity : SimpleActivity() {
//根据记录被删除的会话手机号,从会话列表中判断手机号是否一致,满足就脱敏手机号(为了解决荣耀云备份后恢复,手机号未脱敏的情况)
//根据记录被删除的会话手机号,从会话列表中判断手机号是否一致,满足就脱敏手机号(为了解决荣耀云备份后恢复,手机号未脱敏的情况)
val
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
this
@MainActivity
).
listDeleteMsgIdAllData
val
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
this
@MainActivity
).
listDeleteMsgIdAllData
android
.
util
.
Log
.
d
(
TAG
,
"setupConversations
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}"
)
Log
.
d
(
TAG
,
"setupConversations 云备份
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}"
)
if
(!
listMsgIdAll
.
isNullOrEmpty
())
{
if
(!
listMsgIdAll
.
isNullOrEmpty
())
{
val
listData
:
ArrayList
<
String
>
=
listMsgIdAll
.
split
(
","
).
toArrayList
()
val
listData
:
ArrayList
<
String
>
=
listMsgIdAll
.
split
(
","
).
toArrayList
()
// android.util.Log.d(TAG, "setupConversations
split listData = ${listData}")
Log
.
d
(
TAG
,
"setupConversations 云备份
split listData = ${listData}"
)
if
(
listData
.
isNotEmpty
())
{
if
(
listData
.
isNotEmpty
())
{
val
listConversationData
:
List
<
Conversation
>
=
conversations
.
filter
{
listData
.
contains
(
it
.
phoneNumber
)
}
val
listConversationData
:
List
<
Conversation
>
=
conversations
.
filter
{
listData
.
contains
(
it
.
phoneNumber
)
}
// Log.d(TAG, "setupConversations
找到被删除的 ListConversation 会话 = ${Gson().toJson(listConversationData)}")
Log
.
d
(
TAG
,
"setupConversations 云备份
找到被删除的 ListConversation 会话 = ${Gson().toJson(listConversationData)}"
)
if
(
listConversationData
.
isNotEmpty
())
{
if
(
listConversationData
.
isNotEmpty
())
{
listConversationData
.
forEach
{
conversation
->
listConversationData
.
forEach
{
conversation
->
// Constant.listThreadData.remove(conversation.phoneNumber)
// Constant.listThreadData.remove(conversation.phoneNumber)
...
@@ -583,10 +589,13 @@ class MainActivity : SimpleActivity() {
...
@@ -583,10 +589,13 @@ class MainActivity : SimpleActivity() {
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
// android.util.Log.d(TAG, "handleConversationClick: snippet = ${conversation.snippet}")
// Log.d(TAG, "handleConversationClick: conversation = ${conversation}")
Log
.
d
(
TAG
,
"handleConversationClick: snippet = ${conversation.snippet} threadId = ${conversation.threadId}"
)
val
listMessageData
=
getMessages
(
conversation
.
threadId
,
false
)
val
listMessageData
=
getMessages
(
conversation
.
threadId
,
false
)
Log
.
d
(
TAG
,
"handleConversationClick: listMessageData是否为空 = ${listMessageData.isNotEmpty()}"
)
if
(
listMessageData
.
isNotEmpty
())
{
if
(
listMessageData
.
isNotEmpty
())
{
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
Log
.
d
(
TAG
,
"handleConversationClick: 是否包含零宽度字符 = ${listContains.isNotEmpty()}"
)
if
(
listContains
.
isNotEmpty
()
||
conversation
.
isSFNumber
)
{
if
(
listContains
.
isNotEmpty
()
||
conversation
.
isSFNumber
)
{
val
phoneNumber
=
conversation
.
title
val
phoneNumber
=
conversation
.
title
if
(
phoneNumber
.
contains
(
"+86"
))
{
if
(
phoneNumber
.
contains
(
"+86"
))
{
...
@@ -656,9 +665,9 @@ class MainActivity : SimpleActivity() {
...
@@ -656,9 +665,9 @@ class MainActivity : SimpleActivity() {
ensureBackgroundThread
{
ensureBackgroundThread
{
val
searchQuery
=
"%$text%"
val
searchQuery
=
"%$text%"
val
messages
:
List
<
Message
>
=
messagesDB
.
getMessagesWithText
(
searchQuery
)
val
messages
:
List
<
Message
>
=
messagesDB
.
getMessagesWithText
(
searchQuery
)
//
Log.d(TAG, "setupOptionsMenu 搜索消息 messages = ${GsonUtil.parseListToJson(messages)} ")
Log
.
d
(
TAG
,
"setupOptionsMenu 搜索消息 messages = ${GsonUtil.parseListToJson(messages)} "
)
val
conversations
:
List
<
Conversation
>
=
conversationsDB
.
getConversationsWithText
(
searchQuery
)
val
conversations
:
List
<
Conversation
>
=
conversationsDB
.
getConversationsWithText
(
searchQuery
)
//
Log.d(TAG, "setupOptionsMenu 搜索消息 conversations = ${GsonUtil.parseListToJson(conversations)} ")
Log
.
d
(
TAG
,
"setupOptionsMenu 搜索消息 conversations = ${GsonUtil.parseListToJson(conversations)} "
)
if
(
text
==
lastSearchedText
)
{
if
(
text
==
lastSearchedText
)
{
showSearchResults
(
messages
,
conversations
,
text
)
showSearchResults
(
messages
,
conversations
,
text
)
}
}
...
@@ -673,16 +682,16 @@ class MainActivity : SimpleActivity() {
...
@@ -673,16 +682,16 @@ class MainActivity : SimpleActivity() {
val
searchResults
=
ArrayList
<
SearchResult
>()
val
searchResults
=
ArrayList
<
SearchResult
>()
conversations
.
forEach
{
conversation
->
conversations
.
forEach
{
conversation
->
val
date
=
conversation
.
date
.
formatDateOrTime
(
this
,
true
,
true
)
val
date
=
conversation
.
date
.
formatDateOrTime
(
this
,
true
,
true
)
val
searchResult
=
SearchResult
(-
1
,
conversation
.
title
,
conversation
.
phoneNumber
,
date
,
conversation
.
threadId
,
conversation
.
photoUri
,
conversation
.
isSFNumber
)
val
searchResult
=
SearchResult
(-
1
,
conversation
.
title
,
conversation
.
phoneNumber
,
date
,
conversation
.
threadId
,
conversation
.
photoUri
,
conversation
.
isSFNumber
)
searchResults
.
add
(
searchResult
)
searchResults
.
add
(
searchResult
)
}
}
//
Log.d(TAG, "setupOptionsMenu 搜索消息 conversations searchResults = ${GsonUtil.parseListToJson(searchResults)} ")
Log
.
d
(
TAG
,
"setupOptionsMenu 搜索消息 conversations searchResults = ${GsonUtil.parseListToJson(searchResults)} "
)
if
(
messages
.
isNotEmpty
())
{
if
(
messages
.
isNotEmpty
())
{
val
listConversationData
:
List
<
String
>
=
conversationsDB
.
getNonArchived
().
filter
{
it
.
isSFNumber
}.
map
{
it
.
title
}
val
listConversationData
:
List
<
String
>
=
conversationsDB
.
getNonArchived
().
filter
{
it
.
isSFNumber
}.
map
{
it
.
title
}
messages
.
forEach
{
messages
.
forEach
{
if
(
listConversationData
.
contains
(
it
.
senderPhoneNumber
))
{
if
(
listConversationData
.
contains
(
it
.
senderPhoneNumber
))
{
//
Log.d(TAG, "showSearchResults: 找到了符合掩码的手机号 ${it.senderPhoneNumber}")
Log
.
d
(
TAG
,
"showSearchResults: 找到了符合掩码的手机号 ${it.senderPhoneNumber}"
)
listMessageId
.
add
(
it
.
id
)
listMessageId
.
add
(
it
.
id
)
}
}
}
}
...
@@ -695,11 +704,11 @@ class MainActivity : SimpleActivity() {
...
@@ -695,11 +704,11 @@ class MainActivity : SimpleActivity() {
}
}
val
date
=
message
.
date
.
formatDateOrTime
(
this
,
true
,
true
)
val
date
=
message
.
date
.
formatDateOrTime
(
this
,
true
,
true
)
if
(
listMessageId
.
contains
(
message
.
id
))
{
if
(
listMessageId
.
contains
(
message
.
id
))
{
val
searchResult
=
SearchResult
(
message
.
id
,
recipient
,
message
.
body
,
date
,
message
.
threadId
,
message
.
senderPhotoUri
,
isSfNumber
=
true
)
val
searchResult
=
SearchResult
(
message
.
id
,
recipient
,
message
.
body
,
date
,
message
.
threadId
,
message
.
senderPhotoUri
,
isSfNumber
=
true
)
searchResults
.
add
(
searchResult
)
searchResults
.
add
(
searchResult
)
}
else
{
}
else
{
val
searchResult
=
SearchResult
(
message
.
id
,
recipient
,
message
.
body
,
date
,
message
.
threadId
,
message
.
senderPhotoUri
,
isSfNumber
=
false
)
val
searchResult
=
SearchResult
(
message
.
id
,
recipient
,
message
.
body
,
date
,
message
.
threadId
,
message
.
senderPhotoUri
,
isSfNumber
=
false
)
searchResults
.
add
(
searchResult
)
searchResults
.
add
(
searchResult
)
}
}
}
}
...
@@ -715,9 +724,9 @@ class MainActivity : SimpleActivity() {
...
@@ -715,9 +724,9 @@ class MainActivity : SimpleActivity() {
hideKeyboard
()
hideKeyboard
()
Intent
(
this
,
ThreadActivity
::
class
.
java
).
apply
{
Intent
(
this
,
ThreadActivity
::
class
.
java
).
apply
{
putExtra
(
THREAD_ID
,
(
it
as
SearchResult
).
threadId
)
putExtra
(
THREAD_ID
,
(
it
as
SearchResult
).
threadId
)
if
(
it
.
isSfNumber
)
{
if
(
it
.
isSfNumber
)
{
PhoneUtils
.
phoneNumberFormat
(
it
.
title
)
PhoneUtils
.
phoneNumberFormat
(
it
.
title
)
}
else
{
}
else
{
putExtra
(
THREAD_TITLE
,
it
.
title
)
putExtra
(
THREAD_TITLE
,
it
.
title
)
}
}
putExtra
(
SEARCHED_MESSAGE_ID
,
it
.
messageId
)
putExtra
(
SEARCHED_MESSAGE_ID
,
it
.
messageId
)
...
@@ -749,8 +758,44 @@ class MainActivity : SimpleActivity() {
...
@@ -749,8 +758,44 @@ class MainActivity : SimpleActivity() {
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
fun
refreshMessages
(
event
:
Events
.
RefreshMessages
)
{
fun
refreshMessages
(
event
:
Events
.
RefreshMessages
)
{
// Log.
e
(TAG, "----MainActivity----refreshMessages EventBus")
// Log.
d
(TAG, "----MainActivity----refreshMessages EventBus")
initMessenger
()
initMessenger
()
}
}
@SuppressLint
(
"NewApi"
)
private
fun
checkShortcuts
()
{
val
appIconColor
=
config
.
appIconColor
if
(
isNougatMR1Plus
())
{
Log
.
d
(
TAG
,
"checkShortcuts: "
)
val
launchDialerUpdate
=
getLaunchExportShortcut
(
appIconColor
)
try
{
shortcutManager
.
dynamicShortcuts
=
listOf
(
launchDialerUpdate
)
config
.
lastHandledShortcutColor
=
appIconColor
shortcutManager
.
updateShortcuts
(
shortcutManager
.
dynamicShortcuts
)
}
catch
(
ignored
:
Exception
)
{
ignored
.
printStackTrace
()
}
}
}
@SuppressLint
(
"NewApi"
)
private
fun
getLaunchExportShortcut
(
appIconColor
:
Int
):
ShortcutInfo
{
val
newEvent
=
getString
(
R
.
string
.
shortcuts_back_short_label
)
val
drawable
=
resources
.
getDrawable
(
R
.
drawable
.
shortcut_dialpad_update
)
(
drawable
as
LayerDrawable
).
findDrawableByLayerId
(
R
.
id
.
shortcut_update_background
).
applyColorFilter
(
appIconColor
)
val
bmp
=
drawable
.
convertToBitmap
()
val
intent
=
Intent
(
this
,
ShortCutActivity
::
class
.
java
)
intent
.
action
=
Constant
.
EXPORT_LOG
return
ShortcutInfo
.
Builder
(
this
,
Constant
.
EXPORT_LOG
)
.
setShortLabel
(
newEvent
)
.
setLongLabel
(
newEvent
)
.
setIcon
(
Icon
.
createWithBitmap
(
bmp
))
.
setIntent
(
intent
)
.
build
()
}
}
}
app/src/main/kotlin/com/secspace/sms/activities/SettingsActivity.kt
View file @
99ffcf0a
...
@@ -6,6 +6,7 @@ import android.os.Build
...
@@ -6,6 +6,7 @@ import android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.annotation.RequiresApi
import
androidx.annotation.RequiresApi
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.R
import
com.secspace.sms.databinding.ActivitySettingsBinding
import
com.secspace.sms.databinding.ActivitySettingsBinding
import
com.secspace.sms.dialogs.ExportMessagesDialog
import
com.secspace.sms.dialogs.ExportMessagesDialog
...
@@ -29,6 +30,7 @@ class SettingsActivity : SimpleActivity() {
...
@@ -29,6 +30,7 @@ class SettingsActivity : SimpleActivity() {
private
val
messagesFileType
=
"application/json"
private
val
messagesFileType
=
"application/json"
private
val
messageImportFileTypes
=
listOf
(
"application/json"
,
"application/xml"
,
"text/xml"
)
private
val
messageImportFileTypes
=
listOf
(
"application/json"
,
"application/xml"
,
"text/xml"
)
private
val
TAG
=
"SettingsActivity"
private
val
binding
by
viewBinding
(
ActivitySettingsBinding
::
inflate
)
private
val
binding
by
viewBinding
(
ActivitySettingsBinding
::
inflate
)
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
@@ -192,6 +194,7 @@ class SettingsActivity : SimpleActivity() {
...
@@ -192,6 +194,7 @@ class SettingsActivity : SimpleActivity() {
settingsManageBlockedNumbersHolder
.
beVisibleIf
(
isNougatPlus
())
settingsManageBlockedNumbersHolder
.
beVisibleIf
(
isNougatPlus
())
settingsManageBlockedNumbersHolder
.
setOnClickListener
{
settingsManageBlockedNumbersHolder
.
setOnClickListener
{
Log
.
d
(
TAG
,
"setupManageBlockedNumbers: 黑名单管理"
)
// if (isOrWasThankYouInstalled()) {
// if (isOrWasThankYouInstalled()) {
Intent
(
this
@SettingsActivity
,
ManageBlockedNumbersActivity
::
class
.
java
).
apply
{
Intent
(
this
@SettingsActivity
,
ManageBlockedNumbersActivity
::
class
.
java
).
apply
{
startActivity
(
this
)
startActivity
(
this
)
...
...
app/src/main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
View file @
99ffcf0a
...
@@ -24,7 +24,6 @@ import android.text.format.DateUtils
...
@@ -24,7 +24,6 @@ import android.text.format.DateUtils
import
android.text.format.DateUtils.FORMAT_NO_YEAR
import
android.text.format.DateUtils.FORMAT_NO_YEAR
import
android.text.format.DateUtils.FORMAT_SHOW_DATE
import
android.text.format.DateUtils.FORMAT_SHOW_DATE
import
android.text.format.DateUtils.FORMAT_SHOW_TIME
import
android.text.format.DateUtils.FORMAT_SHOW_TIME
import
android.util.Log
import
android.util.TypedValue
import
android.util.TypedValue
import
android.view.Gravity
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.KeyEvent
...
@@ -44,6 +43,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
...
@@ -44,6 +43,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.google.gson.Gson
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.google.gson.reflect.TypeToken
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.R
import
com.secspace.sms.adapters.AttachmentsAdapter
import
com.secspace.sms.adapters.AttachmentsAdapter
import
com.secspace.sms.adapters.AutoCompleteTextViewAdapter
import
com.secspace.sms.adapters.AutoCompleteTextViewAdapter
...
@@ -477,6 +477,7 @@ class ThreadActivity : SimpleActivity() {
...
@@ -477,6 +477,7 @@ class ThreadActivity : SimpleActivity() {
private
fun
setupAdapter
()
{
private
fun
setupAdapter
()
{
threadItems
=
getThreadItems
()
threadItems
=
getThreadItems
()
Log
.
d
(
TAG
,
"setupAdapter: threadItems = $threadItems"
)
runOnUiThread
{
runOnUiThread
{
refreshMenuItems
()
refreshMenuItems
()
...
@@ -486,6 +487,7 @@ class ThreadActivity : SimpleActivity() {
...
@@ -486,6 +487,7 @@ class ThreadActivity : SimpleActivity() {
val
lastVisiblePosition
=
layoutManager
.
findLastVisibleItemPosition
()
val
lastVisiblePosition
=
layoutManager
.
findLastVisibleItemPosition
()
val
shouldScrollToBottom
:
Boolean
=
currentList
.
lastOrNull
()
!=
threadItems
.
lastOrNull
()
&&
lastPosition
-
lastVisiblePosition
==
1
val
shouldScrollToBottom
:
Boolean
=
currentList
.
lastOrNull
()
!=
threadItems
.
lastOrNull
()
&&
lastPosition
-
lastVisiblePosition
==
1
updateMessages
(
threadItems
,
if
(
shouldScrollToBottom
)
lastPosition
else
-
1
)
updateMessages
(
threadItems
,
if
(
shouldScrollToBottom
)
lastPosition
else
-
1
)
Log
.
d
(
TAG
,
"setupAdapter: threadItems = $threadItems"
)
}
}
}
}
...
@@ -973,13 +975,14 @@ class ThreadActivity : SimpleActivity() {
...
@@ -973,13 +975,14 @@ class ThreadActivity : SimpleActivity() {
ConfirmationDialog
(
this
,
getString
(
confirmationMessage
))
{
ConfirmationDialog
(
this
,
getString
(
confirmationMessage
))
{
ensureBackgroundThread
{
ensureBackgroundThread
{
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
// Log.d(TAG, "getNewConversations
conversation = ${Gson().toJson(conversation)} ")
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete:
conversation = ${Gson().toJson(conversation)} "
)
conversation
?.
let
{
conversation
?.
let
{
val
listMessageData
=
getMessages
(
threadId
,
false
)
val
listMessageData
=
getMessages
(
threadId
,
false
)
// Log.d(TAG, "getNewConversations
threadId = ${threadId} listMessageData = ${Gson().toJson(listMessageData)} ")
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete:
threadId = ${threadId} listMessageData = ${Gson().toJson(listMessageData)} "
)
if
(
listMessageData
.
isNotEmpty
())
{
if
(
listMessageData
.
isNotEmpty
())
{
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
android
.
util
.
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete: 获取云备份 记录的数据集合 = $listMsgIdAll"
)
if
(
listMsgIdAll
.
isNullOrEmpty
()){
if
(
listMsgIdAll
.
isNullOrEmpty
()){
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
=
"${it.title},"
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
=
"${it.title},"
}
else
{
}
else
{
...
...
app/src/main/kotlin/com/secspace/sms/adapters/ConversationsAdapter.kt
View file @
99ffcf0a
package
com.secspace.sms.adapters
package
com.secspace.sms.adapters
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.view.Menu
import
android.view.Menu
import
com.google.gson.Gson
import
com.google.gson.Gson
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.R
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.dialogs.RenameConversationDialog
import
com.secspace.sms.dialogs.RenameConversationDialog
import
com.secspace.sms.extensions.*
import
com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.Config
import
com.secspace.sms.helpers.Config
import
com.secspace.sms.helpers.Constant
import
com.secspace.sms.helpers.refreshMessages
import
com.secspace.sms.helpers.refreshMessages
import
com.secspace.sms.models.Conversation
import
com.secspace.sms.models.Conversation
import
com.secspace.sms.models.Message
import
com.secspace.sms.models.Message
...
@@ -132,19 +131,18 @@ class ConversationsAdapter(
...
@@ -132,19 +131,18 @@ class ConversationsAdapter(
ConfirmationDialog
(
activity
,
question
)
{
ConfirmationDialog
(
activity
,
question
)
{
ensureBackgroundThread
{
ensureBackgroundThread
{
// Log.d(TAG, "getNewConversations
selectedKeys = ${Gson().toJson(selectedKeys)} ")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
selectedKeys = ${Gson().toJson(selectedKeys)} "
)
// Log.d(TAG, "getNewConversations currentList
= ${Gson().toJson(currentList)} ")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete selectedKeys
= ${Gson().toJson(currentList)} "
)
currentList
.
forEach
{
currentList
.
forEach
{
if
(
selectedKeys
.
contains
(
it
.
hashCode
()))
{
if
(
selectedKeys
.
contains
(
it
.
hashCode
()))
{
// Log.d(TAG, "getNewConversations
selectedKeys = ${it.hashCode()} threadId = ${it.threadId}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
selectedKeys = ${it.hashCode()} threadId = ${it.threadId}"
)
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
val
listMessageData
=
activity
.
getMessages
(
it
.
threadId
,
false
)
val
listMessageData
=
activity
.
getMessages
(
it
.
threadId
,
false
)
// Log.d(TAG, "getNewConversations
threadId = ${it.threadId} listMessageData = ${Gson().toJson(listMessageData)} ")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
threadId = ${it.threadId} listMessageData = ${Gson().toJson(listMessageData)} "
)
if
(
listMessageData
.
isNotEmpty
())
{
if
(
listMessageData
.
isNotEmpty
())
{
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
// android.util.Log.d(TAG, "setupConversations
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}"
)
if
(
listMsgIdAll
.
isNullOrEmpty
()){
if
(
listMsgIdAll
.
isNullOrEmpty
()){
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
"${it.title},"
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
"${it.title},"
}
else
{
}
else
{
...
@@ -152,7 +150,7 @@ class ConversationsAdapter(
...
@@ -152,7 +150,7 @@ class ConversationsAdapter(
if
(
listContains
.
isNotEmpty
()
&&
!
listMsgIdAllResult
.
contains
(
it
.
title
)
&&
!
it
.
title
.
contains
(
"*"
))
{
if
(
listContains
.
isNotEmpty
()
&&
!
listMsgIdAllResult
.
contains
(
it
.
title
)
&&
!
it
.
title
.
contains
(
"*"
))
{
listMsgIdAll
+=
"${it.title},"
listMsgIdAll
+=
"${it.title},"
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
listMsgIdAll
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
listMsgIdAll
// android.util.Log.d(TAG, "setupConversations
获取被删除的会话集合 listMsgIdAll += ${listMsgIdAll}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
获取被删除的会话集合 listMsgIdAll += ${listMsgIdAll}"
)
}
}
}
}
}
}
...
...
app/src/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
View file @
99ffcf0a
...
@@ -6,7 +6,6 @@ import android.graphics.Typeface
...
@@ -6,7 +6,6 @@ import android.graphics.Typeface
import
android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.ColorDrawable
import
android.graphics.drawable.ColorDrawable
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.util.Log
import
android.util.Size
import
android.util.Size
import
android.util.TypedValue
import
android.util.TypedValue
import
android.view.Menu
import
android.view.Menu
...
@@ -28,6 +27,7 @@ import com.bumptech.glide.load.resource.bitmap.FitCenter
...
@@ -28,6 +27,7 @@ import com.bumptech.glide.load.resource.bitmap.FitCenter
import
com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.RequestOptions
import
com.bumptech.glide.request.RequestOptions
import
com.bumptech.glide.request.target.Target
import
com.bumptech.glide.request.target.Target
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.R
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.databinding.*
import
com.secspace.sms.databinding.*
...
...
app/src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
View file @
99ffcf0a
...
@@ -63,7 +63,7 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -63,7 +63,7 @@ class SmsReceiver : BroadcastReceiver() {
body
+=
it
.
messageBody
body
+=
it
.
messageBody
date
=
System
.
currentTimeMillis
()
date
=
System
.
currentTimeMillis
()
threadId
=
context
.
getThreadId
(
address
)
threadId
=
context
.
getThreadId
(
address
)
// android.util.
Log.d(TAG, "onReceive: address = $address body = $body date = $date")
Log
.
d
(
TAG
,
"onReceive: address = $address body = $body date = $date"
)
}
}
if
(
address
.
isNotEmpty
())
{
if
(
address
.
isNotEmpty
())
{
...
@@ -127,9 +127,9 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -127,9 +127,9 @@ class SmsReceiver : BroadcastReceiver() {
if
(
lastNumber
.
isEmpty
())
{
if
(
lastNumber
.
isEmpty
())
{
RecentsHelper
(
context
=
context
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
RecentsHelper
(
context
=
context
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
//
Log.d(TAG, "SmsReceiver最近通话 recents:${GsonUtil.parseListToJson(listCallRecent)}")
Log
.
d
(
TAG
,
"SmsReceiver最近通话 recents:${GsonUtil.parseListToJson(listCallRecent)}"
)
val
findResult
=
listCallRecent
.
filter
{
it
.
isShunFeng
}.
count
{
val
findResult
=
listCallRecent
.
filter
{
it
.
isShunFeng
}.
count
{
//
Log.d(TAG, "SmsReceiver findResult isNumber = ${PhoneFromUtil.isNumeric(it.phoneNumber)}")
Log
.
d
(
TAG
,
"SmsReceiver findResult isNumber = ${PhoneFromUtil.isNumeric(it.phoneNumber)}"
)
if
(
PhoneFromUtil
.
isNumeric
(
it
.
phoneNumber
))
{
if
(
PhoneFromUtil
.
isNumeric
(
it
.
phoneNumber
))
{
if
(
phoneNumber
.
contains
(
"+86"
)){
if
(
phoneNumber
.
contains
(
"+86"
)){
...
@@ -145,7 +145,7 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -145,7 +145,7 @@ class SmsReceiver : BroadcastReceiver() {
}
}
}
}
}
}
//
Log.d(TAG, "SmsReceiverfindResult:${findResult} phoneNumber = ${phoneNumber.trim()}")
Log
.
d
(
TAG
,
"SmsReceiverfindResult:${findResult} phoneNumber = ${phoneNumber.trim()}"
)
//从最近通话记录中找到了号码 进行掩码操作
//从最近通话记录中找到了号码 进行掩码操作
if
(
findResult
>
0
)
{
if
(
findResult
>
0
)
{
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
...
@@ -154,7 +154,7 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -154,7 +154,7 @@ class SmsReceiver : BroadcastReceiver() {
}
}
}
}
}
}
//
Log.d(TAG, "SmsReceiver lastNumber = $lastNumber")
Log
.
d
(
TAG
,
"SmsReceiver lastNumber = $lastNumber"
)
}
}
if
(
lastNumber
==
""
)
{
if
(
lastNumber
==
""
)
{
confirmCallBack
.
invoke
(
phoneNumber
)
confirmCallBack
.
invoke
(
phoneNumber
)
...
@@ -191,12 +191,12 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -191,12 +191,12 @@ class SmsReceiver : BroadcastReceiver() {
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
)
//最新消息会话
//最新消息会话
val
conversation
:
Conversation
=
context
.
getConversations
(
threadId
).
firstOrNull
()
?:
return
@ensureBackgroundThread
val
conversation
:
Conversation
=
context
.
getConversations
(
threadId
).
firstOrNull
()
?:
return
@ensureBackgroundThread
// android.util.
Log.d(TAG, "handleMessage: toJson = ${Gson().toJson(conversation)}")
Log
.
d
(
TAG
,
"handleMessage: toJson = ${Gson().toJson(conversation)}"
)
if
(
aesPhoneNumber
.
isNotBlank
()
||
body
.
contains
(
"\u200B"
))
{
if
(
aesPhoneNumber
.
isNotBlank
()
||
body
.
contains
(
"\u200B"
))
{
conversation
.
title
=
aesPhoneNumber
conversation
.
title
=
aesPhoneNumber
conversation
.
isSFNumber
=
true
conversation
.
isSFNumber
=
true
}
}
//
Log.d(TAG, "SmsReceiverhandleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}")
Log
.
d
(
TAG
,
"SmsReceiverhandleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}"
)
try
{
try
{
context
.
insertOrUpdateConversation
(
conversation
)
context
.
insertOrUpdateConversation
(
conversation
)
}
catch
(
ignored
:
Exception
)
{
}
catch
(
ignored
:
Exception
)
{
...
@@ -247,12 +247,12 @@ class SmsReceiver : BroadcastReceiver() {
...
@@ -247,12 +247,12 @@ class SmsReceiver : BroadcastReceiver() {
}
}
}
}
//
Log.d(TAG, "SmsReceiver aesPhoneNumber 手机号是否加密 :${aesPhoneNumber}")
Log
.
d
(
TAG
,
"SmsReceiver aesPhoneNumber 手机号是否加密 :${aesPhoneNumber}"
)
if
(
aesPhoneNumber
.
isNotBlank
())
{
if
(
aesPhoneNumber
.
isNotBlank
())
{
val
tipPopup
=
MyPushWindow
(
context
,
aesPhoneNumber
,
body
)
val
tipPopup
=
MyPushWindow
(
context
,
aesPhoneNumber
,
body
)
tipPopup
.
show
()
tipPopup
.
show
()
}
else
{
}
else
{
//
Log.d(TAG, "SmsReceiver 短信内容 = ${body} address = $address ")
Log
.
d
(
TAG
,
"SmsReceiver 短信内容 = ${body} address = $address "
)
if
(
body
.
contains
(
"\u200B"
))
{
if
(
body
.
contains
(
"\u200B"
))
{
if
(
address
.
contains
(
"+86"
))
{
if
(
address
.
contains
(
"+86"
))
{
address
.
replace
(
"+86"
,
""
)
address
.
replace
(
"+86"
,
""
)
...
...
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