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)
|
if (contact.avatarImage == null)
|
||||||
Log.d(TAG, "Contact $id avatarImage is null")
|
Log.d(TAG, "Contact $id avatarImage is null")
|
||||||
} catch (e: Exception) {
|
} 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)
|
BaresipService.baresipContacts.add(contact)
|
||||||
|
|||||||
@@ -172,12 +172,12 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
|||||||
when (contact) {
|
when (contact) {
|
||||||
is Contact.BaresipContact -> {
|
is Contact.BaresipContact -> {
|
||||||
val id = contact.id
|
val id = contact.id
|
||||||
val avatarFile = File(BaresipService.filesPath, "$id.img")
|
val avatarFile = File(BaresipService.filesPath, "$id.png")
|
||||||
if (avatarFile.exists()) {
|
if (avatarFile.exists()) {
|
||||||
try {
|
try {
|
||||||
avatarFile.delete()
|
avatarFile.delete()
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e(TAG, "Could not delete file '$id.img")
|
Log.e(TAG, "Could not delete file '$id.png")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Contact.removeBaresipContact(contact)
|
Contact.removeBaresipContact(contact)
|
||||||
|
|||||||
Reference in New Issue
Block a user