diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 9f58b0da64..312a9225a3 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -1351,7 +1351,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity @Override public void onImageCapture(@NonNull final byte[] imageBytes) { - setMedia(PersistentBlobProvider.getInstance(this).create(masterSecret, recipients, imageBytes), MediaType.IMAGE); + setMedia(PersistentBlobProvider.getInstance(this).create(masterSecret, imageBytes), MediaType.IMAGE); quickAttachmentDrawer.hide(false); } diff --git a/src/org/thoughtcrime/securesms/providers/PersistentBlobProvider.java b/src/org/thoughtcrime/securesms/providers/PersistentBlobProvider.java index 1375b505f6..0b0afcc19b 100644 --- a/src/org/thoughtcrime/securesms/providers/PersistentBlobProvider.java +++ b/src/org/thoughtcrime/securesms/providers/PersistentBlobProvider.java @@ -4,7 +4,6 @@ import android.content.ContentUris; import android.content.Context; import android.content.UriMatcher; import android.net.Uri; -import android.os.AsyncTask; import android.support.annotation.NonNull; import android.util.Log; @@ -61,10 +60,9 @@ public class PersistentBlobProvider { } public Uri create(@NonNull MasterSecret masterSecret, - @NonNull Recipients recipients, @NonNull byte[] imageBytes) { - final long id = generateId(recipients); + final long id = System.currentTimeMillis(); cache.put(id, imageBytes); return create(masterSecret, new ByteArrayInputStream(imageBytes), id); } @@ -108,8 +106,12 @@ public class PersistentBlobProvider { public boolean delete(@NonNull Uri uri) { switch (MATCHER.match(uri)) { - case MATCH: return getFile(ContentUris.parseId(uri)).delete(); - default: return new File(uri.getPath()).delete(); + case MATCH: + long id = ContentUris.parseId(uri); + cache.remove(id); + return getFile(ContentUris.parseId(uri)).delete(); + default: + return new File(uri.getPath()).delete(); } }