mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-13 12:07:57 +01:00
Fix support for large images in media-send.
This commit is contained in:
committed by
Greyson Parrelli
parent
9005367241
commit
cc7f88ea2d
@@ -308,8 +308,8 @@ object MediaSendV3Repository : MediaSendRepository {
|
||||
return !RemoteConfig.cameraXMixedModelBlocklist.asListContains(Build.MODEL)
|
||||
}
|
||||
|
||||
override fun getMediaConstraints(): MediaConstraints {
|
||||
return PushMediaConstraints(null)
|
||||
override fun getMediaConstraints(quality: SentMediaQuality?): MediaConstraints {
|
||||
return PushMediaConstraints(quality)
|
||||
}
|
||||
|
||||
override var storyMaxVideoDuration: Duration = Stories.MAX_VIDEO_DURATION_MILLIS.milliseconds
|
||||
|
||||
@@ -538,13 +538,17 @@ class MediaSendFlowViewModel(
|
||||
|
||||
// TODO - this should likely be in a repository?
|
||||
private fun createImageEditorModel(media: Media): EditorModel {
|
||||
// Bounded to what we would ever send, since an unbounded decode of something like a 50MP photo produces a bitmap
|
||||
// too large for a Canvas to draw.
|
||||
val constraints = repository.getMediaConstraints(SentMediaQuality.HIGH)
|
||||
|
||||
val editorModel = EditorModel.create(0x0)
|
||||
val element = EditorElement(
|
||||
UriGlideRenderer(
|
||||
media.uri,
|
||||
true,
|
||||
0,
|
||||
0,
|
||||
constraints.imageMaxWidth,
|
||||
constraints.imageMaxHeight,
|
||||
UriGlideRenderer.STRONG_BLUR,
|
||||
object : RequestListener<Bitmap> {
|
||||
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap?>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
|
||||
@@ -145,7 +145,10 @@ interface MediaSendRepository {
|
||||
|
||||
var isCameraFacingFront: Boolean
|
||||
|
||||
fun getMediaConstraints(): MediaConstraints
|
||||
/**
|
||||
* @param quality The quality the constraints should describe, or null for whatever the app would send at by default.
|
||||
*/
|
||||
fun getMediaConstraints(quality: SentMediaQuality? = null): MediaConstraints
|
||||
|
||||
var storyMaxVideoDuration: Duration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user