Merge branch 'master' into pr/import-fix-timestamps
This commit is contained in:
commit
011dc3393e
4 changed files with 24 additions and 18 deletions
|
|
@ -104,12 +104,10 @@ class MainActivity : SimpleActivity() {
|
|||
useTopSearchMenu = true
|
||||
)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
checkAndDeleteOldRecycleBinMessages()
|
||||
clearAllMessagesIfNeeded {
|
||||
loadMessages()
|
||||
}
|
||||
}
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -307,9 +307,9 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
if (binding.messageHolder.threadTypeMessage.value != "" && getAttachmentSelections().isEmpty()) {
|
||||
saveSmsDraft(binding.messageHolder.threadTypeMessage.value, threadId)
|
||||
val draftMessage = binding.messageHolder.threadTypeMessage.value
|
||||
if (draftMessage.isNotEmpty() && getAttachmentSelections().isEmpty()) {
|
||||
saveSmsDraft(draftMessage, threadId)
|
||||
} else {
|
||||
deleteSmsDraft(threadId)
|
||||
}
|
||||
|
|
@ -969,6 +969,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
private fun maybeDisableShortCodeReply() {
|
||||
if (isSpecialNumber() && !isRecycleBin) {
|
||||
binding.messageHolder.threadTypeMessage.text?.clear()
|
||||
binding.messageHolder.root.beGone()
|
||||
binding.shortCodeHolder.root.beVisible()
|
||||
val textColor = getProperTextColor()
|
||||
|
|
|
|||
|
|
@ -1081,6 +1081,8 @@ fun Context.getAllDrafts(): HashMap<Long, String?> {
|
|||
}
|
||||
|
||||
fun Context.saveSmsDraft(body: String, threadId: Long) {
|
||||
deleteSmsDraft(threadId)
|
||||
|
||||
val uri = Sms.Draft.CONTENT_URI
|
||||
val contentValues = ContentValues().apply {
|
||||
put(Sms.BODY, body)
|
||||
|
|
@ -1092,6 +1094,7 @@ fun Context.saveSmsDraft(body: String, threadId: Long) {
|
|||
try {
|
||||
contentResolver.insert(uri, contentValues)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1100,17 +1103,17 @@ fun Context.deleteSmsDraft(threadId: Long) {
|
|||
val projection = arrayOf(Sms._ID)
|
||||
val selection = "${Sms.THREAD_ID} = ?"
|
||||
val selectionArgs = arrayOf(threadId.toString())
|
||||
try {
|
||||
val cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)
|
||||
cursor.use {
|
||||
if (cursor?.moveToFirst() == true) {
|
||||
val draftId = cursor.getLong(0)
|
||||
queryCursor(
|
||||
uri = uri,
|
||||
projection = projection,
|
||||
selection = selection,
|
||||
selectionArgs = selectionArgs,
|
||||
showErrors = true
|
||||
) { cursor ->
|
||||
val draftId = cursor.getLongValue(Sms._ID)
|
||||
val draftUri = Uri.withAppendedPath(Sms.CONTENT_URI, "/${draftId}")
|
||||
contentResolver.delete(draftUri, null, null)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.updateLastConversationMessage(threadId: Long) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<include
|
||||
layout="@layout/divider"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thread_add_contacts"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue