This commit is contained in:
lunaticbum 2024-09-11 18:45:58 +09:00
parent 384881bf07
commit 08b9637fa3
3 changed files with 14 additions and 4 deletions

View File

@ -591,7 +591,7 @@ internal class LauncherHome : Fragment() {
binding.infoList.visibility = View.INVISIBLE
binding.notiList.visibility = View.INVISIBLE
var dateParam = beforeDay(Date(),7).toString()
var dateParam = beforeDay(Date(),30).toString()
if (binding.missedCalls.isSelected) {
WorkersDb.getRealm().apply {
val result = query<RecentCall>().query("callDayTime >= $0", dateParam).sort("callDayTime", Sort.DESCENDING).find()

View File

@ -61,7 +61,7 @@ internal class SmsLogsAdapter(
getContactName(lActivity!!.contentResolver,todo.addr)
}
if(todo.isMms) {
var body = todo.mmsContents.get("text")?.joinToString("\n")?.replace("\n"," ")
var body = todo.texts?.joinToString("\n")?.replace("\n"," ")
body = if (body?.length ?: 0 > 60) body?.substring(0,60).plus("...") else body
holder.view.itemText.text = "\u25CF ${if(name != null && name.length > 0) name else if(todo.person != null && todo.person.length > 0){todo.person} else todo.addr} : ${
SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(

View File

@ -114,6 +114,8 @@ class RecentSmsGetter : BaseGetter {
internal class RecentSms : RealmObject {
@PrimaryKey
var uniqKey : String = ""
var id : String = ""
var isMms : Boolean = false
var addr : String = ""
@ -138,6 +140,7 @@ internal class RecentSms : RealmObject {
body: String,
person: String
) {
this.uniqKey = id.plus(addr.plus("_").plus(Math.max(rcvDate,pstDate)).plus("_SMS"))
this.addr = addr
this.type = type
this.rcvDate = rcvDate
@ -149,6 +152,7 @@ internal class RecentSms : RealmObject {
constructor(id: String, sender: String, date: Long, body: HashMap<String?,ArrayList<String>>) {
this.id = id
this.uniqKey = body.get("partId")!!.joinToString { "_" }.plus(sender.plus("_").plus(date).plus("_MMS")).plus(this.texts.joinToString("").length)
this.rcvDate = date
this.mmsContents = body
this.images.addAll(mmsContents.get("image")!!)
@ -256,7 +260,6 @@ internal class MmsQueryHelper(
val text = arrayListOf<String>()
val image = arrayListOf<String>()
val audio = arrayListOf<String>()
val projection = arrayOf("*")
val video = arrayListOf<String>()
_contentResolver.query(
@ -315,6 +318,7 @@ internal class MmsQueryHelper(
} while (partsCursor.moveToNext())
}
}
returns.put("partId", arrayListOf(id.toString()))
returns.put("text", text)
returns.put("image", image)
returns.put("audio", audio)
@ -335,11 +339,17 @@ internal class MmsQueryHelper(
data?.let {
if (it?.pstDate ?: 0L > dateTime || it?.rcvDate ?: 0L > dateTime) {
WorkersDb.getRealm().apply {
if (query<RecentSms>("id == $0", it.id).find().size == 0) {
if (query<RecentSms>("uniqKey == $0", it.uniqKey).find().size == 0) {
writeBlocking {
copyToRealm(it)
}
}
// else if (it.isMms && it.addr.contains("#CMAS#")){
// writeBlocking {
// it.uniqKey = it.uniqKey.plus("1")
// copyToRealm(it)
// }
// }
}
// smsList.add(it)
}