...
This commit is contained in:
parent
08b9637fa3
commit
3a5f60f17d
@ -78,6 +78,7 @@ class RecentSmsGetter : BaseGetter {
|
|||||||
Telephony.Sms.MESSAGE_TYPE_QUEUED -> {dir = "MESSAGE_TYPE_QUEUED"}
|
Telephony.Sms.MESSAGE_TYPE_QUEUED -> {dir = "MESSAGE_TYPE_QUEUED"}
|
||||||
}
|
}
|
||||||
var log = RecentSms(
|
var log = RecentSms(
|
||||||
|
id.plus("_").plus(reciveDate).plus("_").plus(sendedDate),
|
||||||
phNumber,
|
phNumber,
|
||||||
dir,
|
dir,
|
||||||
reciveDate,
|
reciveDate,
|
||||||
@ -85,12 +86,11 @@ class RecentSmsGetter : BaseGetter {
|
|||||||
smsBody,
|
smsBody,
|
||||||
callerName ?: ""
|
callerName ?: ""
|
||||||
)
|
)
|
||||||
log.id = id
|
|
||||||
log.isMms = false
|
log.isMms = false
|
||||||
// BLog.LOGE("RecentSmsGetter resultData put ${phNumber +"_"+ reciveDate} >>> ${log.toJson()}")
|
// BLog.LOGE("RecentSmsGetter resultData put ${phNumber +"_"+ reciveDate} >>> ${log.toJson()}")
|
||||||
log.sender = getContactName(applicationContext.contentResolver,phNumber) ?: ""
|
log.sender = getContactName(applicationContext.contentResolver,phNumber) ?: ""
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
if (query<RecentSms>("id == $0", id).find().size == 0) {
|
if (query<RecentSms>("uniqKey == $0", log.uniqKey).find().size == 0) {
|
||||||
writeBlocking {
|
writeBlocking {
|
||||||
copyToRealm(log)
|
copyToRealm(log)
|
||||||
}
|
}
|
||||||
@ -133,6 +133,7 @@ internal class RecentSms : RealmObject {
|
|||||||
var sender : String = ""
|
var sender : String = ""
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
id : String,
|
||||||
addr: String,
|
addr: String,
|
||||||
type: String,
|
type: String,
|
||||||
rcvDate: Long,
|
rcvDate: Long,
|
||||||
@ -140,7 +141,9 @@ internal class RecentSms : RealmObject {
|
|||||||
body: String,
|
body: String,
|
||||||
person: String
|
person: String
|
||||||
) {
|
) {
|
||||||
this.uniqKey = id.plus(addr.plus("_").plus(Math.max(rcvDate,pstDate)).plus("_SMS"))
|
this.id = id
|
||||||
|
this.uniqKey = id.plus("_").plus(addr).plus("_").plus(Math.max(rcvDate,pstDate)).plus("_SMS")
|
||||||
|
BLog.LOGE("sender ${sender} ::::: Id >> ${id} , addr ${addr}")
|
||||||
this.addr = addr
|
this.addr = addr
|
||||||
this.type = type
|
this.type = type
|
||||||
this.rcvDate = rcvDate
|
this.rcvDate = rcvDate
|
||||||
@ -152,13 +155,16 @@ internal class RecentSms : RealmObject {
|
|||||||
|
|
||||||
constructor(id: String, sender: String, date: Long, body: HashMap<String?,ArrayList<String>>) {
|
constructor(id: String, sender: String, date: Long, body: HashMap<String?,ArrayList<String>>) {
|
||||||
this.id = id
|
this.id = id
|
||||||
this.uniqKey = body.get("partId")!!.joinToString { "_" }.plus(sender.plus("_").plus(date).plus("_MMS")).plus(this.texts.joinToString("").length)
|
this.uniqKey = body.get("partId")!!.joinToString("_").plus(sender.plus("_").plus(date).plus("_MMS"))
|
||||||
|
// BLog.LOGE("sender ${sender} ::::: partId >> ${body.get("partId")!!.joinToString("_")}")
|
||||||
this.rcvDate = date
|
this.rcvDate = date
|
||||||
this.mmsContents = body
|
this.mmsContents = body
|
||||||
this.images.addAll(mmsContents.get("image")!!)
|
this.images.addAll(mmsContents.get("image")!!)
|
||||||
this.audios.addAll(mmsContents.get("audio")!!)
|
this.audios.addAll(mmsContents.get("audio")!!)
|
||||||
this.texts.addAll(mmsContents.get("text")!!)
|
this.texts.addAll(mmsContents.get("text")!!)
|
||||||
this.videos.addAll(mmsContents.get("video")!!)
|
this.videos.addAll(mmsContents.get("video")!!)
|
||||||
|
|
||||||
|
|
||||||
this.addr = sender
|
this.addr = sender
|
||||||
this.isMms = true
|
this.isMms = true
|
||||||
}
|
}
|
||||||
@ -260,6 +266,8 @@ internal class MmsQueryHelper(
|
|||||||
val text = arrayListOf<String>()
|
val text = arrayListOf<String>()
|
||||||
val image = arrayListOf<String>()
|
val image = arrayListOf<String>()
|
||||||
val audio = arrayListOf<String>()
|
val audio = arrayListOf<String>()
|
||||||
|
val partsIds = arrayListOf<String>()
|
||||||
|
partsIds.add(id.toString())
|
||||||
val projection = arrayOf("*")
|
val projection = arrayOf("*")
|
||||||
val video = arrayListOf<String>()
|
val video = arrayListOf<String>()
|
||||||
_contentResolver.query(
|
_contentResolver.query(
|
||||||
@ -276,7 +284,7 @@ internal class MmsQueryHelper(
|
|||||||
val partContentType =
|
val partContentType =
|
||||||
partsCursor.getString(partsCursor.getColumnIndexOrThrow(Telephony.Mms.Part.CONTENT_TYPE))
|
partsCursor.getString(partsCursor.getColumnIndexOrThrow(Telephony.Mms.Part.CONTENT_TYPE))
|
||||||
// BLog.LOGE("partContentType >> ${partContentType}")
|
// BLog.LOGE("partContentType >> ${partContentType}")
|
||||||
|
partsIds.add(partId.toString())
|
||||||
if(partContentType?.contains("text") == true) {
|
if(partContentType?.contains("text") == true) {
|
||||||
// BLog.LOGE("partContentType text >> ${partContentType} :: ${partId}")
|
// BLog.LOGE("partContentType text >> ${partContentType} :: ${partId}")
|
||||||
val data =
|
val data =
|
||||||
@ -318,7 +326,7 @@ internal class MmsQueryHelper(
|
|||||||
} while (partsCursor.moveToNext())
|
} while (partsCursor.moveToNext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returns.put("partId", arrayListOf(id.toString()))
|
returns.put("partId", partsIds)
|
||||||
returns.put("text", text)
|
returns.put("text", text)
|
||||||
returns.put("image", image)
|
returns.put("image", image)
|
||||||
returns.put("audio", audio)
|
returns.put("audio", audio)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user