Fixed deleting of avatar file when avatar is removed from contact or when contact with avatar is removed

This commit is contained in:
Juha Heinanen
2024-03-22 07:57:53 +02:00
parent ceb14a5b7a
commit 8f72c6fcc4
2 changed files with 3 additions and 3 deletions

View File

@ -209,7 +209,7 @@ sealed class Contact {
if (contact.avatarImage == null)
Log.d(TAG, "Contact $id avatarImage is null")
} catch (e: Exception) {
Log.e(TAG, "Could not read avatar image from '$id.img")
Log.e(TAG, "Could not read avatar image from '$id.png")
}
}
BaresipService.baresipContacts.add(contact)

View File

@ -172,12 +172,12 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
when (contact) {
is Contact.BaresipContact -> {
val id = contact.id
val avatarFile = File(BaresipService.filesPath, "$id.img")
val avatarFile = File(BaresipService.filesPath, "$id.png")
if (avatarFile.exists()) {
try {
avatarFile.delete()
} catch (e: IOException) {
Log.e(TAG, "Could not delete file '$id.img")
Log.e(TAG, "Could not delete file '$id.png")
}
}
Contact.removeBaresipContact(contact)