mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-26 09:59:28 +00:00
don't try generating an in-progress part thumbnail
Closes #4042 // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
21b7dccf1c
commit
526f6e3058
@@ -24,6 +24,7 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@@ -640,17 +641,22 @@ public class PartDatabase extends Database {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream call() throws Exception {
|
||||
public @Nullable InputStream call() throws Exception {
|
||||
final InputStream stream = getDataStream(masterSecret, partId, THUMBNAIL);
|
||||
if (stream != null) {
|
||||
return stream;
|
||||
}
|
||||
|
||||
PduPart part = getPart(partId);
|
||||
if (part.isInProgress()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ThumbnailData data = MediaUtil.generateThumbnail(context, masterSecret, part.getDataUri(), Util.toIsoString(part.getContentType()));
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
updatePartThumbnail(masterSecret, partId, part, data.toDataStream(), data.getAspectRatio());
|
||||
|
||||
return getDataStream(masterSecret, partId, THUMBNAIL);
|
||||
|
||||
Reference in New Issue
Block a user