Properly clear messages from database

This commit is contained in:
Naveen 2023-09-30 02:21:49 +05:30
parent 67e9b4587b
commit 4582bc5289
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3
4 changed files with 12 additions and 8 deletions

View file

@ -989,12 +989,15 @@ fun Context.getFileSizeFromUri(uri: Uri): Long {
// fix a glitch at enabling Release version minifying from 5.12.3
// reset messages in 5.14.3 again, as PhoneNumber is no longer minified
// reset messages in 5.19.1 again, as SimpleContact is no longer minified
fun Context.clearAllMessagesIfNeeded() {
fun Context.clearAllMessagesIfNeeded(callback: () -> Unit) {
if (!config.wasDbCleared) {
ensureBackgroundThread {
messagesDB.deleteAll()
config.wasDbCleared = true
callback()
}
config.wasDbCleared = true
} else {
callback()
}
}