feat: restore mms

This commit is contained in:
darthpaul 2021-09-18 16:14:58 +01:00
parent 9656207135
commit e10a410788
10 changed files with 438 additions and 142 deletions

View file

@ -1,46 +1,52 @@
package com.simplemobiletools.smsmessenger.models
import android.content.ContentValues
import android.provider.Telephony
import androidx.core.content.contentValuesOf
import com.google.gson.annotations.SerializedName
data class SmsBackup(
@SerializedName(Telephony.Sms._ID)
val id: Long,
@SerializedName(Telephony.Sms.ADDRESS)
val address: String,
@SerializedName(Telephony.Sms.BODY)
val body: String,
@SerializedName(Telephony.Sms.CREATOR)
val creator: String,
@SerializedName(Telephony.Sms.DATE)
val date: Long,
@SerializedName(Telephony.Sms.DATE_SENT)
val dateSent: Int,
@SerializedName(Telephony.Sms.ERROR_CODE)
val errorCode: Int,
@SerializedName(Telephony.Sms.LOCKED)
val locked: Int,
@SerializedName(Telephony.Sms.PERSON)
val person: String,
@SerializedName(Telephony.Sms.PROTOCOL)
val protocol: String,
@SerializedName("read")
val read: Int,
@SerializedName("reply_path_present")
val replyPathPresent: Any,
@SerializedName("seen")
val seen: Int,
@SerializedName("service_center")
val serviceCenter: Any,
@SerializedName("status")
val status: Int,
@SerializedName("sub_id")
val subId: Int,
@SerializedName("subject")
val subject: Any,
@SerializedName("thread_id")
val threadId: Long,
@SerializedName("sub_id")
val subscriptionId: Long,
@SerializedName("address")
val address: String,
@SerializedName("body")
val body: String,
@SerializedName("date")
val date: Long,
@SerializedName("date_sent")
val dateSent: Long,
@SerializedName("locked")
val locked: Int,
@SerializedName("protocol")
val protocol: String?,
@SerializedName("read")
val read: Int,
@SerializedName("status")
val status: Int,
@SerializedName("type")
val type: Int
)
val type: Int,
@SerializedName("service_center")
val serviceCenter: String?
) {
fun toContentValues(): ContentValues {
return contentValuesOf(
Telephony.Sms.THREAD_ID to threadId,
Telephony.Sms.SUBSCRIPTION_ID to subscriptionId,
Telephony.Sms.ADDRESS to address,
Telephony.Sms.BODY to body,
Telephony.Sms.DATE to date,
Telephony.Sms.DATE_SENT to dateSent,
Telephony.Sms.LOCKED to locked,
Telephony.Sms.PROTOCOL to protocol,
Telephony.Sms.READ to read,
Telephony.Sms.STATUS to status,
Telephony.Sms.TYPE to type,
Telephony.Sms.SERVICE_CENTER to serviceCenter,
)
}
}