Fix some media not appearing in the gallery picker.

Works around the glide issue by using the straight URI when possible,
which allows glide to not have to keep a buffer. However, as soon as you
select it, it'll be an encrypted file, and we'll run into this same
issue where glide needs to keep a buffer for the input stream.

Related to #11014
This commit is contained in:
Greyson Parrelli
2025-02-26 12:44:01 -05:00
parent 6ebc860064
commit 5ad042d232
2 changed files with 21 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ import org.thoughtcrime.securesms.components.transfercontrols.TransferControlVie
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
import org.thoughtcrime.securesms.mms.ImageSlide;
import org.thoughtcrime.securesms.mms.PartAuthority;
import org.thoughtcrime.securesms.mms.Slide;
import org.thoughtcrime.securesms.mms.SlideClickListener;
import org.thoughtcrime.securesms.mms.SlidesClickedListener;
@@ -483,7 +484,12 @@ public class ThumbnailView extends FrameLayout {
transferControlViewStub.setVisibility(View.GONE);
RequestBuilder<Drawable> request = requestManager.load(new DecryptableUri(uri))
Object glideModel = uri;
if (PartAuthority.isLocalUri(uri)) {
glideModel = new DecryptableUri(uri);
}
RequestBuilder<Drawable> request = requestManager.load(glideModel)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.downsample(SignalDownsampleStrategy.CENTER_OUTSIDE_NO_UPSCALE)
.listener(listener);