expo-image-loader 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 4.3.0 — 2023-06-13
|
|
14
|
+
|
|
15
|
+
- Removed `com.facebook.fresco:fresco` dependency ([#22542](https://github.com/expo/expo/pull/22542) by [@josephyanks](https://github.com/josephyanks))
|
|
16
|
+
### 📚 3rd party library updates
|
|
17
|
+
- Updated `com.github.bumptech.glide:glide` to `4.13.2` and added customizable `glideVersion` variable on ext. ([#22542](https://github.com/expo/expo/pull/22542) by [@josephyanks](https://github.com/josephyanks))
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
|
|
22
|
+
|
|
13
23
|
## 4.2.0 — 2023-05-08
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -33,21 +33,13 @@ buildscript {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
group = 'host.exp.exponent'
|
|
36
|
-
version = '4.
|
|
37
|
-
|
|
38
|
-
// Creating sources with comments
|
|
39
|
-
task androidSourcesJar(type: Jar) {
|
|
40
|
-
classifier = 'sources'
|
|
41
|
-
from android.sourceSets.main.java.srcDirs
|
|
42
|
-
}
|
|
36
|
+
version = '4.3.0'
|
|
43
37
|
|
|
44
38
|
afterEvaluate {
|
|
45
39
|
publishing {
|
|
46
40
|
publications {
|
|
47
41
|
release(MavenPublication) {
|
|
48
42
|
from components.release
|
|
49
|
-
// Add additional sourcesJar to artifacts
|
|
50
|
-
artifact(androidSourcesJar)
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
45
|
repositories {
|
|
@@ -70,25 +62,32 @@ android {
|
|
|
70
62
|
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
71
63
|
}
|
|
72
64
|
|
|
65
|
+
namespace "expo.modules.imageloader"
|
|
73
66
|
defaultConfig {
|
|
74
67
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
68
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
69
|
versionCode 8
|
|
77
|
-
versionName "4.
|
|
70
|
+
versionName "4.3.0"
|
|
78
71
|
}
|
|
79
72
|
lintOptions {
|
|
80
73
|
abortOnError false
|
|
81
74
|
}
|
|
75
|
+
publishing {
|
|
76
|
+
singleVariant("release") {
|
|
77
|
+
withSourcesJar()
|
|
78
|
+
}
|
|
79
|
+
}
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
repositories {
|
|
85
83
|
mavenCentral()
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
def glideVersion = safeExtGet('glideVersion', '4.13.2')
|
|
87
|
+
|
|
88
88
|
dependencies {
|
|
89
89
|
implementation project(':expo-modules-core')
|
|
90
90
|
|
|
91
91
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
92
|
-
api
|
|
93
|
-
api 'com.facebook.fresco:fresco:2.0.0'
|
|
92
|
+
api "com.github.bumptech.glide:glide:${glideVersion}"
|
|
94
93
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<manifest
|
|
1
|
+
<manifest>
|
|
2
2
|
</manifest>
|
|
@@ -3,27 +3,18 @@ package expo.modules.imageloader
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.graphics.Bitmap
|
|
5
5
|
import android.graphics.drawable.Drawable
|
|
6
|
-
import android.os.AsyncTask
|
|
7
|
-
import androidx.annotation.NonNull
|
|
8
|
-
import androidx.annotation.Nullable
|
|
9
6
|
import com.bumptech.glide.Glide
|
|
10
7
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|
11
|
-
import com.bumptech.glide.request.target.
|
|
8
|
+
import com.bumptech.glide.request.target.CustomTarget
|
|
12
9
|
import com.bumptech.glide.request.transition.Transition
|
|
13
|
-
import com.facebook.common.references.CloseableReference
|
|
14
|
-
import com.facebook.datasource.DataSource
|
|
15
|
-
import com.facebook.drawee.backends.pipeline.Fresco
|
|
16
|
-
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber
|
|
17
|
-
import com.facebook.imagepipeline.image.CloseableImage
|
|
18
|
-
import com.facebook.imagepipeline.request.ImageRequest
|
|
19
|
-
import expo.modules.interfaces.imageloader.ImageLoaderInterface
|
|
20
10
|
import expo.modules.core.interfaces.InternalModule
|
|
11
|
+
import expo.modules.interfaces.imageloader.ImageLoaderInterface
|
|
21
12
|
import java.util.concurrent.ExecutionException
|
|
22
13
|
import java.util.concurrent.Future
|
|
23
14
|
|
|
24
15
|
class ImageLoaderModule(val context: Context) : InternalModule, ImageLoaderInterface {
|
|
25
16
|
|
|
26
|
-
override fun getExportedInterfaces(): List<Class
|
|
17
|
+
override fun getExportedInterfaces(): List<Class<*>> {
|
|
27
18
|
return listOf(ImageLoaderInterface::class.java)
|
|
28
19
|
}
|
|
29
20
|
|
|
@@ -34,50 +25,53 @@ class ImageLoaderModule(val context: Context) : InternalModule, ImageLoaderInter
|
|
|
34
25
|
object : ImageLoaderInterface.ResultListener {
|
|
35
26
|
override fun onSuccess(bitmap: Bitmap) = future.set(bitmap)
|
|
36
27
|
|
|
37
|
-
override fun onFailure(
|
|
28
|
+
override fun onFailure(cause: Throwable?) =
|
|
29
|
+
future.setException(ExecutionException(cause))
|
|
38
30
|
}
|
|
39
31
|
)
|
|
40
32
|
return future
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
override fun loadImageForDisplayFromURL(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
35
|
+
override fun loadImageForDisplayFromURL(
|
|
36
|
+
url: String,
|
|
37
|
+
resultListener: ImageLoaderInterface.ResultListener
|
|
38
|
+
) {
|
|
39
|
+
Glide.with(context)
|
|
40
|
+
.asBitmap()
|
|
41
|
+
.load(url)
|
|
42
|
+
.into(object : CustomTarget<Bitmap>() {
|
|
43
|
+
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
|
|
44
|
+
resultListener.onSuccess(resource)
|
|
45
|
+
}
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
override fun onLoadCleared(placeholder: Drawable?) {
|
|
48
|
+
// no op
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
override fun
|
|
60
|
-
|
|
51
|
+
override fun onLoadFailed(errorDrawable: Drawable?) {
|
|
52
|
+
super.onLoadFailed(errorDrawable)
|
|
53
|
+
resultListener.onFailure(Exception("Loading bitmap failed"))
|
|
61
54
|
}
|
|
62
|
-
}
|
|
63
|
-
AsyncTask.THREAD_POOL_EXECUTOR
|
|
64
|
-
)
|
|
55
|
+
})
|
|
65
56
|
}
|
|
66
57
|
|
|
67
|
-
override fun loadImageForManipulationFromURL(
|
|
58
|
+
override fun loadImageForManipulationFromURL(url: String): Future<Bitmap> {
|
|
68
59
|
val future = SimpleSettableFuture<Bitmap>()
|
|
69
60
|
loadImageForManipulationFromURL(
|
|
70
61
|
url,
|
|
71
62
|
object : ImageLoaderInterface.ResultListener {
|
|
72
63
|
override fun onSuccess(bitmap: Bitmap) = future.set(bitmap)
|
|
73
64
|
|
|
74
|
-
override fun onFailure(
|
|
65
|
+
override fun onFailure(cause: Throwable?) = future.setException(ExecutionException(cause))
|
|
75
66
|
}
|
|
76
67
|
)
|
|
77
68
|
return future
|
|
78
69
|
}
|
|
79
70
|
|
|
80
|
-
override fun loadImageForManipulationFromURL(
|
|
71
|
+
override fun loadImageForManipulationFromURL(
|
|
72
|
+
url: String,
|
|
73
|
+
resultListener: ImageLoaderInterface.ResultListener
|
|
74
|
+
) {
|
|
81
75
|
val normalizedUrl = normalizeAssetsUrl(url)
|
|
82
76
|
|
|
83
77
|
Glide.with(context)
|
|
@@ -85,12 +79,17 @@ class ImageLoaderModule(val context: Context) : InternalModule, ImageLoaderInter
|
|
|
85
79
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
86
80
|
.skipMemoryCache(true)
|
|
87
81
|
.load(normalizedUrl)
|
|
88
|
-
.into(object :
|
|
82
|
+
.into(object : CustomTarget<Bitmap>() {
|
|
89
83
|
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
|
|
90
84
|
resultListener.onSuccess(resource)
|
|
91
85
|
}
|
|
92
86
|
|
|
87
|
+
override fun onLoadCleared(placeholder: Drawable?) {
|
|
88
|
+
// no op
|
|
89
|
+
}
|
|
90
|
+
|
|
93
91
|
override fun onLoadFailed(errorDrawable: Drawable?) {
|
|
92
|
+
super.onLoadFailed(errorDrawable)
|
|
94
93
|
resultListener.onFailure(Exception("Loading bitmap failed"))
|
|
95
94
|
}
|
|
96
95
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image-loader",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Image loader",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"expo": "*"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "66d0501185956602c144a03a891bdb34d3c03910"
|
|
28
28
|
}
|