yeet
This commit is contained in:
25
node_modules/expo-image-loader/CHANGELOG.md
generated
vendored
Normal file
25
node_modules/expo-image-loader/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## Unpublished
|
||||
|
||||
### 🛠 Breaking changes
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
## 1.3.0 — 2020-11-17
|
||||
|
||||
_This version does not introduce any user-facing changes._
|
||||
|
||||
## 1.2.0 — 2020-08-18
|
||||
|
||||
_This version does not introduce any user-facing changes._
|
||||
|
||||
## 1.1.1 — 2020-05-29
|
||||
|
||||
*This version does not introduce any user-facing changes.*
|
||||
|
||||
## 1.1.0 — 2020-05-27
|
||||
|
||||
*This version does not introduce any user-facing changes.*
|
25
node_modules/expo-image-loader/README.md
generated
vendored
Normal file
25
node_modules/expo-image-loader/README.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# expo-image-loader
|
||||
|
||||
Provides image loader
|
||||
|
||||
# Installation in managed Expo projects
|
||||
|
||||
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
|
||||
|
||||
# Installation in bare React Native projects
|
||||
|
||||
For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
|
||||
|
||||
### Add the package to your npm dependencies
|
||||
|
||||
```
|
||||
npm install expo-image-loader
|
||||
```
|
||||
|
||||
### Configure for Android
|
||||
|
||||
No additional set up necessary.
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
|
85
node_modules/expo-image-loader/android/build.gradle
generated
vendored
Normal file
85
node_modules/expo-image-loader/android/build.gradle
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'maven'
|
||||
|
||||
buildscript {
|
||||
// Simple helper that allows the root project to override versions declared by this library.
|
||||
ext.safeExtGet = { prop, fallback ->
|
||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "1.3.50")}")
|
||||
}
|
||||
}
|
||||
|
||||
group = 'host.exp.exponent'
|
||||
version = '1.3.0'
|
||||
|
||||
// Upload android library to maven with javadoc and android sources
|
||||
configurations {
|
||||
deployerJars
|
||||
}
|
||||
|
||||
// Creating sources with comments
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
// Put the androidSources and javadoc to the artifacts
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
configuration = configurations.deployerJars
|
||||
repository(url: mavenLocal().url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion safeExtGet("compileSdkVersion", 29)
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion safeExtGet("minSdkVersion", 21)
|
||||
targetSdkVersion safeExtGet("targetSdkVersion", 29)
|
||||
versionCode 7
|
||||
versionName "1.3.0"
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
|
||||
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
|
||||
} else {
|
||||
throw new GradleException(
|
||||
'\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
|
||||
'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
|
||||
}
|
||||
|
||||
dependencies {
|
||||
unimodule 'unimodules-core'
|
||||
unimodule 'unimodules-image-loader-interface'
|
||||
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.3.50')}"
|
||||
api 'com.github.bumptech.glide:glide:4.9.0'
|
||||
api 'com.facebook.fresco:fresco:2.0.0'
|
||||
}
|
2
node_modules/expo-image-loader/android/src/main/AndroidManifest.xml
generated
vendored
Normal file
2
node_modules/expo-image-loader/android/src/main/AndroidManifest.xml
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
<manifest package="expo.modules.imageloader">
|
||||
</manifest>
|
101
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/ImageLoaderModule.kt
generated
vendored
Normal file
101
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/ImageLoaderModule.kt
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
package expo.modules.imageloader
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.AsyncTask
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.annotation.Nullable
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.facebook.common.references.CloseableReference
|
||||
import com.facebook.datasource.DataSource
|
||||
import com.facebook.drawee.backends.pipeline.Fresco
|
||||
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber
|
||||
import com.facebook.imagepipeline.image.CloseableImage
|
||||
import com.facebook.imagepipeline.request.ImageRequest
|
||||
import org.unimodules.core.interfaces.InternalModule
|
||||
import org.unimodules.interfaces.imageloader.ImageLoader
|
||||
import java.util.concurrent.ExecutionException
|
||||
import java.util.concurrent.Future
|
||||
|
||||
|
||||
class ImageLoaderModule(val context: Context) : InternalModule, ImageLoader {
|
||||
|
||||
override fun getExportedInterfaces(): List<Class<*>>? {
|
||||
return listOf(ImageLoader::class.java)
|
||||
}
|
||||
|
||||
override fun loadImageForDisplayFromURL(url: String): Future<Bitmap> {
|
||||
val future = SimpleSettableFuture<Bitmap>()
|
||||
loadImageForDisplayFromURL(url, object : ImageLoader.ResultListener {
|
||||
override fun onSuccess(bitmap: Bitmap) = future.set(bitmap)
|
||||
|
||||
override fun onFailure(@Nullable cause: Throwable?) = future.setException(ExecutionException(cause))
|
||||
})
|
||||
return future
|
||||
}
|
||||
|
||||
override fun loadImageForDisplayFromURL(url: String, resultListener: ImageLoader.ResultListener) {
|
||||
val imageRequest = ImageRequest.fromUri(url)
|
||||
val imagePipeline = Fresco.getImagePipeline()
|
||||
val dataSource = imagePipeline.fetchDecodedImage(imageRequest, context)
|
||||
|
||||
dataSource.subscribe(
|
||||
object : BaseBitmapDataSubscriber() {
|
||||
override fun onNewResultImpl(bitmap: Bitmap?) {
|
||||
bitmap?.let {
|
||||
resultListener.onSuccess(bitmap)
|
||||
return
|
||||
}
|
||||
|
||||
resultListener.onFailure(Exception("Loaded bitmap is null"))
|
||||
}
|
||||
|
||||
override fun onFailureImpl(@NonNull dataSource: DataSource<CloseableReference<CloseableImage>>) {
|
||||
resultListener.onFailure(dataSource.failureCause)
|
||||
}
|
||||
},
|
||||
AsyncTask.THREAD_POOL_EXECUTOR
|
||||
)
|
||||
}
|
||||
|
||||
override fun loadImageForManipulationFromURL(@NonNull url: String): Future<Bitmap> {
|
||||
val future = SimpleSettableFuture<Bitmap>()
|
||||
loadImageForManipulationFromURL(url, object : ImageLoader.ResultListener {
|
||||
override fun onSuccess(bitmap: Bitmap) = future.set(bitmap)
|
||||
|
||||
override fun onFailure(@NonNull cause: Throwable?) = future.setException(ExecutionException(cause))
|
||||
})
|
||||
return future
|
||||
}
|
||||
|
||||
override fun loadImageForManipulationFromURL(url: String, resultListener: ImageLoader.ResultListener) {
|
||||
val normalizedUrl = normalizeAssetsUrl(url)
|
||||
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.skipMemoryCache(true)
|
||||
.load(normalizedUrl)
|
||||
.into(object : SimpleTarget<Bitmap>() {
|
||||
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
|
||||
resultListener.onSuccess(resource)
|
||||
}
|
||||
|
||||
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||
resultListener.onFailure(Exception("Loading bitmap failed"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun normalizeAssetsUrl(url: String): String {
|
||||
var actualUrl = url
|
||||
if (url.startsWith("asset:///")) {
|
||||
actualUrl = "file:///android_asset/" + url.split("/").last()
|
||||
}
|
||||
return actualUrl
|
||||
}
|
||||
}
|
9
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/ImageLoaderPackage.kt
generated
vendored
Normal file
9
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/ImageLoaderPackage.kt
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
package expo.modules.imageloader
|
||||
|
||||
import android.content.Context
|
||||
import org.unimodules.core.BasePackage
|
||||
import org.unimodules.core.interfaces.InternalModule
|
||||
|
||||
class ImageLoaderPackage : BasePackage() {
|
||||
override fun createInternalModules(context: Context): List<InternalModule> = listOf(ImageLoaderModule(context))
|
||||
}
|
120
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/SimpleSettableFuture.java
generated
vendored
Normal file
120
node_modules/expo-image-loader/android/src/main/java/expo/modules/imageloader/SimpleSettableFuture.java
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
// Copied from React Native
|
||||
package expo.modules.imageloader;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* A super simple Future-like class that can safely notify another Thread when a value is ready.
|
||||
* Does not support canceling.
|
||||
*/
|
||||
public class SimpleSettableFuture<T> implements Future<T> {
|
||||
private final CountDownLatch mReadyLatch = new CountDownLatch(1);
|
||||
private @Nullable
|
||||
T mResult;
|
||||
private @Nullable
|
||||
Exception mException;
|
||||
|
||||
/**
|
||||
* Sets the result. If another thread has called {@link #get}, they will immediately receive the
|
||||
* value. set or setException must only be called once.
|
||||
*/
|
||||
public void set(@Nullable T result) {
|
||||
checkNotSet();
|
||||
mResult = result;
|
||||
mReadyLatch.countDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the exception. If another thread has called {@link #get}, they will immediately receive
|
||||
* the exception. set or setException must only be called once.
|
||||
*/
|
||||
public void setException(Exception exception) {
|
||||
checkNotSet();
|
||||
mException = exception;
|
||||
mReadyLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return mReadyLatch.getCount() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable
|
||||
T get() throws InterruptedException, ExecutionException {
|
||||
mReadyLatch.await();
|
||||
if (mException != null) {
|
||||
throw new ExecutionException(mException);
|
||||
}
|
||||
|
||||
return mResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait up to the timeout time for another Thread to set a value on this future. If a value has
|
||||
* already been set, this method will return immediately.
|
||||
*
|
||||
* <p>NB: For simplicity, we catch and wrap InterruptedException. Do NOT use this class if you are
|
||||
* in the 1% of cases where you actually want to handle that.
|
||||
*/
|
||||
@Override
|
||||
public @Nullable
|
||||
T get(long timeout, TimeUnit unit)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
if (!mReadyLatch.await(timeout, unit)) {
|
||||
throw new TimeoutException("Timed out waiting for result");
|
||||
}
|
||||
if (mException != null) {
|
||||
throw new ExecutionException(mException);
|
||||
}
|
||||
|
||||
return mResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper for {@link #get()} that re-throws get()'s Exceptions as RuntimeExceptions.
|
||||
*/
|
||||
public @Nullable
|
||||
T getOrThrow() {
|
||||
try {
|
||||
return get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper for {@link #get(long, TimeUnit)} that re-throws get()'s Exceptions as
|
||||
* RuntimeExceptions.
|
||||
*/
|
||||
public @Nullable
|
||||
T getOrThrow(long timeout, TimeUnit unit) {
|
||||
try {
|
||||
return get(timeout, unit);
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNotSet() {
|
||||
if (mReadyLatch.getCount() == 0) {
|
||||
throw new RuntimeException("Result has already been set!");
|
||||
}
|
||||
}
|
||||
}
|
1
node_modules/expo-image-loader/index.js
generated
vendored
Normal file
1
node_modules/expo-image-loader/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = null;
|
23
node_modules/expo-image-loader/ios/EXImageLoader.podspec
generated
vendored
Normal file
23
node_modules/expo-image-loader/ios/EXImageLoader.podspec
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
require 'json'
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'EXImageLoader'
|
||||
s.version = package['version']
|
||||
s.summary = package['description']
|
||||
s.description = package['description']
|
||||
s.license = package['license']
|
||||
s.author = package['author']
|
||||
s.homepage = package['homepage']
|
||||
s.platform = :ios, '10.0'
|
||||
s.source = { git: 'https://github.com/expo/expo.git' }
|
||||
s.source_files = 'EXImageLoader/**/*.{h,m}'
|
||||
s.preserve_paths = 'EXImageLoader/**/*.{h,m}'
|
||||
s.requires_arc = true
|
||||
|
||||
s.dependency 'React-Core'
|
||||
s.dependency 'UMCore'
|
||||
s.dependency 'UMImageLoaderInterface'
|
||||
|
||||
end
|
10
node_modules/expo-image-loader/ios/EXImageLoader/EXImageLoader.h
generated
vendored
Normal file
10
node_modules/expo-image-loader/ios/EXImageLoader/EXImageLoader.h
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2019-present 650 Industries. All rights reserved.
|
||||
|
||||
#import <UMCore/UMInternalModule.h>
|
||||
#import <UMImageLoaderInterface/UMImageLoaderInterface.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface EXImageLoader : NSObject <RCTBridgeModule, UMInternalModule, UMImageLoaderInterface>
|
||||
|
||||
@end
|
40
node_modules/expo-image-loader/ios/EXImageLoader/EXImageLoader.m
generated
vendored
Normal file
40
node_modules/expo-image-loader/ios/EXImageLoader/EXImageLoader.m
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2019-present 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXImageLoader/EXImageLoader.h>
|
||||
#import <React/RCTImageLoaderProtocol.h>
|
||||
|
||||
@interface EXImageLoader ()
|
||||
|
||||
@property (weak, nonatomic) RCTBridge *bridge;
|
||||
|
||||
@end
|
||||
|
||||
@implementation EXImageLoader
|
||||
|
||||
UM_REGISTER_MODULE();
|
||||
|
||||
+ (NSString *)moduleName
|
||||
{
|
||||
return @"EXImageLoader";
|
||||
}
|
||||
|
||||
+ (const NSArray<Protocol *> *)exportedInterfaces
|
||||
{
|
||||
return @[@protocol(UMImageLoaderInterface)];
|
||||
}
|
||||
|
||||
- (void)setBridge:(RCTBridge *)bridge
|
||||
{
|
||||
_bridge = bridge;
|
||||
}
|
||||
|
||||
- (void)loadImageForURL:(NSURL *)imageURL
|
||||
completionHandler:(UMImageLoaderCompletionBlock)completionHandler
|
||||
{
|
||||
[[_bridge moduleForName:@"ImageLoader" lazilyLoadIfNecessary:YES] loadImageWithURLRequest:[NSURLRequest requestWithURL:imageURL]
|
||||
callback:^(NSError *error, UIImage *loadedImage) {
|
||||
completionHandler(error, loadedImage);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
30
node_modules/expo-image-loader/package.json
generated
vendored
Normal file
30
node_modules/expo-image-loader/package.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "expo-image-loader",
|
||||
"version": "1.3.0",
|
||||
"description": "Image loader",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"unimodules",
|
||||
"image-loader",
|
||||
"expo-image-loader"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/expo/expo.git",
|
||||
"directory": "packages/expo-image-loader"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/expo/expo/issues"
|
||||
},
|
||||
"author": "650 Industries, Inc.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/expo/expo/tree/master/packages/expo-image-loader",
|
||||
"peerDependencies": {
|
||||
"react-native": ">= 0.60.0"
|
||||
},
|
||||
"unimodulePeerDependencies": {
|
||||
"@unimodules/core": "*",
|
||||
"unimodules-image-loader-interface": "^5.0.0"
|
||||
},
|
||||
"gitHead": "bc6b4b3bc3cb5e44e477f145c72c07ed09588651"
|
||||
}
|
4
node_modules/expo-image-loader/unimodule.json
generated
vendored
Normal file
4
node_modules/expo-image-loader/unimodule.json
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "expo-image-loader",
|
||||
"platforms": ["android", "ios"]
|
||||
}
|
Reference in New Issue
Block a user