mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 12:30:07 +03:00
Glide: No Disk cache for encrypted images
This commit is contained in:
parent
24a9ddaa5e
commit
8e11ba21ed
1 changed files with 7 additions and 2 deletions
|
@ -23,6 +23,7 @@ import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import com.bumptech.glide.load.DataSource
|
import com.bumptech.glide.load.DataSource
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.load.engine.GlideException
|
import com.bumptech.glide.load.engine.GlideException
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
import com.bumptech.glide.request.RequestListener
|
import com.bumptech.glide.request.RequestListener
|
||||||
|
@ -129,6 +130,7 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
|
||||||
GlideApp
|
GlideApp
|
||||||
.with(contextView)
|
.with(contextView)
|
||||||
.load(data)
|
.load(data)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
} else {
|
} else {
|
||||||
// Clear image
|
// Clear image
|
||||||
val resolvedUrl = resolveUrl(data)
|
val resolvedUrl = resolveUrl(data)
|
||||||
|
@ -183,6 +185,7 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
|
||||||
GlideApp
|
GlideApp
|
||||||
.with(imageView)
|
.with(imageView)
|
||||||
.load(data)
|
.load(data)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
} else {
|
} else {
|
||||||
// Clear image
|
// Clear image
|
||||||
val resolvedUrl = resolveUrl(data)
|
val resolvedUrl = resolveUrl(data)
|
||||||
|
@ -214,14 +217,16 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createGlideRequest(data: Data, mode: Mode, imageView: ImageView, size: Size): GlideRequest<Drawable> {
|
private fun createGlideRequest(data: Data, mode: Mode, imageView: ImageView, size: Size): GlideRequest<Drawable> {
|
||||||
return createGlideRequest(data, mode, GlideApp.with(imageView), size)
|
return createGlideRequest(data, mode, GlideApp.with(imageView), size)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createGlideRequest(data: Data, mode: Mode, glideRequests: GlideRequests, size: Size = processSize(data, mode)): GlideRequest<Drawable> {
|
fun createGlideRequest(data: Data, mode: Mode, glideRequests: GlideRequests, size: Size = processSize(data, mode)): GlideRequest<Drawable> {
|
||||||
return if (data.elementToDecrypt != null) {
|
return if (data.elementToDecrypt != null) {
|
||||||
// Encrypted image
|
// Encrypted image
|
||||||
glideRequests.load(data)
|
glideRequests
|
||||||
|
.load(data)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
} else {
|
} else {
|
||||||
// Clear image
|
// Clear image
|
||||||
val contentUrlResolver = activeSessionHolder.getActiveSession().contentUrlResolver()
|
val contentUrlResolver = activeSessionHolder.getActiveSession().contentUrlResolver()
|
||||||
|
|
Loading…
Add table
Reference in a new issue