Fixed deleting of avatar file when avatar is removed from contact or when contact with avatar is removed
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user