evict cached previews when file gets deleted
This commit is contained in:
parent
66da5ffb6c
commit
843d7fe12d
|
@ -508,6 +508,8 @@ public class FileBackend {
|
|||
return getFile(message, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DownloadableFile getFileForPath(String path) {
|
||||
return getFileForPath(path, MimeUtils.guessMimeTypeFromExtension(MimeUtils.extractRelevantExtension(path)));
|
||||
}
|
||||
|
|
|
@ -1854,6 +1854,9 @@ public class XmppConnectionService extends Service {
|
|||
for (Conversation conversation : getConversations()) {
|
||||
deleted |= conversation.markAsDeleted(uuids);
|
||||
}
|
||||
for(final String uuid : uuids) {
|
||||
evictPreview(uuid);
|
||||
}
|
||||
if (deleted) {
|
||||
updateConversationUi();
|
||||
}
|
||||
|
@ -4575,6 +4578,12 @@ public class XmppConnectionService extends Service {
|
|||
sendIqPacket(account, set, null);
|
||||
}
|
||||
|
||||
public void evictPreview(String uuid) {
|
||||
if (mBitmapCache.remove(uuid) != null) {
|
||||
Log.d(Config.LOGTAG,"deleted cached preview");
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnMamPreferencesFetched {
|
||||
void onPreferencesFetched(Element prefs);
|
||||
|
||||
|
|
|
@ -1653,6 +1653,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
|||
builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
|
||||
message.setDeleted(true);
|
||||
activity.xmppConnectionService.evictPreview(message.getUuid());
|
||||
activity.xmppConnectionService.updateMessage(message, false);
|
||||
activity.onConversationsListItemUpdated();
|
||||
refresh();
|
||||
|
|
Loading…
Reference in New Issue