Fix video forwarding thumbnail display.

This commit is contained in:
alex-signal 2019-09-19 13:44:43 -03:00 committed by Greyson Parrelli
parent faafa40122
commit a3caabcafd
2 changed files with 15 additions and 1 deletions

View file

@ -40,7 +40,7 @@ class DecryptableStreamLocalUriFetcher extends StreamLocalUriFetcher {
}
try {
return PartAuthority.getAttachmentStream(context, uri);
return PartAuthority.getAttachmentThumbnailStream(context, uri);
} catch (IOException ioe) {
Log.w(TAG, ioe);
throw new FileNotFoundException("PartAuthority couldn't load Uri resource.");

View file

@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.providers.BlobProvider;
import org.thoughtcrime.securesms.providers.DeprecatedPersistentBlobProvider;
import org.thoughtcrime.securesms.providers.PartProvider;
import org.thoughtcrime.securesms.util.MediaUtil;
import java.io.IOException;
import java.io.InputStream;
@ -44,6 +45,19 @@ public class PartAuthority {
uriMatcher.addURI(BlobProvider.AUTHORITY, BlobProvider.PATH, BLOB_ROW);
}
public static InputStream getAttachmentThumbnailStream(@NonNull Context context, @NonNull Uri uri)
throws IOException
{
String contentType = getAttachmentContentType(context, uri);
int match = uriMatcher.match(uri);
if (match == PART_ROW && MediaUtil.isVideoType(contentType)) {
return DatabaseFactory.getAttachmentDatabase(context).getThumbnailStream(new PartUriParser(uri).getPartId());
}
return getAttachmentStream(context, uri);
}
public static InputStream getAttachmentStream(@NonNull Context context, @NonNull Uri uri)
throws IOException
{