Skip to content

Commit 45dd327

Browse files
Ron RadtkeRon Radtke
authored andcommitted
Fixing a problem in the npm ignore
Merge remote-tracking branch 'origin/develop'
2 parents 46d3c6b + d43d311 commit 45dd327

17 files changed

+1289
-362
lines changed

.npmignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jsconfig.json
2424
.eslintignore
2525
codecov.yml
2626

27-
# Scripts
28-
scripts/
29-
3027
# Example
3128
img/
3229
example/

android/.editorconfig

Lines changed: 918 additions & 0 deletions
Large diffs are not rendered by default.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ buildscript {
3030
mavenCentral()
3131
}
3232
dependencies {
33-
classpath 'com.android.tools.build:gradle:4.1.0'
33+
classpath 'com.android.tools.build:gradle:4.1.3'
3434
}
3535
}
3636
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip

android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import android.content.pm.PackageManager;
77
import android.net.Uri;
88
import android.os.Build;
9+
910
import androidx.core.content.FileProvider;
11+
1012
import android.util.SparseArray;
1113
import android.content.ActivityNotFoundException;
1214

@@ -30,6 +32,7 @@
3032
import okhttp3.OkHttpClient;
3133

3234
import javax.annotation.Nullable;
35+
3336
import java.io.File;
3437
import java.util.Map;
3538
import java.util.concurrent.LinkedBlockingQueue;
@@ -44,12 +47,12 @@ public class ReactNativeBlobUtil extends ReactContextBaseJavaModule {
4447
private final OkHttpClient mClient;
4548

4649
static ReactApplicationContext RCTContext;
47-
private static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<>();
48-
private static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
50+
private static final LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<>();
51+
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
4952
static LinkedBlockingQueue<Runnable> fsTaskQueue = new LinkedBlockingQueue<>();
50-
private static ThreadPoolExecutor fsThreadPool = new ThreadPoolExecutor(2, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
53+
private static final ThreadPoolExecutor fsThreadPool = new ThreadPoolExecutor(2, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
5154
private static boolean ActionViewVisible = false;
52-
private static SparseArray<Promise> promiseTable = new SparseArray<>();
55+
private static final SparseArray<Promise> promiseTable = new SparseArray<>();
5356

5457
public ReactNativeBlobUtil(ReactApplicationContext reactContext) {
5558

@@ -64,7 +67,7 @@ public ReactNativeBlobUtil(ReactApplicationContext reactContext) {
6467
reactContext.addActivityEventListener(new ActivityEventListener() {
6568
@Override
6669
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
67-
if(requestCode == GET_CONTENT_INTENT && resultCode == RESULT_OK) {
70+
if (requestCode == GET_CONTENT_INTENT && resultCode == RESULT_OK) {
6871
Uri d = data.getData();
6972
promiseTable.get(GET_CONTENT_INTENT).resolve(d.toString());
7073
promiseTable.remove(GET_CONTENT_INTENT);
@@ -142,7 +145,7 @@ public void actionViewIntent(String path, String mime, @Nullable String chooserT
142145
try {
143146
this.getReactApplicationContext().startActivity(intent);
144147
promise.resolve(true);
145-
} catch(ActivityNotFoundException ex) {
148+
} catch (ActivityNotFoundException ex) {
146149
promise.reject("ENOAPP", "No app installed for " + mime);
147150
}
148151
}
@@ -152,7 +155,7 @@ public void actionViewIntent(String path, String mime, @Nullable String chooserT
152155

153156
@Override
154157
public void onHostResume() {
155-
if(ActionViewVisible)
158+
if (ActionViewVisible)
156159
promise.resolve(null);
157160
RCTContext.removeLifecycleEventListener(this);
158161
}
@@ -168,7 +171,7 @@ public void onHostDestroy() {
168171
}
169172
};
170173
RCTContext.addLifecycleEventListener(listener);
171-
} catch(Exception ex) {
174+
} catch (Exception ex) {
172175
promise.reject("EUNSPECIFIED", ex.getLocalizedMessage());
173176
}
174177
}
@@ -280,13 +283,13 @@ public void scanFile(final ReadableArray pairs, final Callback callback) {
280283
@Override
281284
public void run() {
282285
int size = pairs.size();
283-
String [] p = new String[size];
284-
String [] m = new String[size];
285-
for(int i=0;i<size;i++) {
286+
String[] p = new String[size];
287+
String[] m = new String[size];
288+
for (int i = 0; i < size; i++) {
286289
ReadableMap pair = pairs.getMap(i);
287-
if(pair.hasKey("path")) {
290+
if (pair.hasKey("path")) {
288291
p[i] = pair.getString("path");
289-
if(pair.hasKey("mime"))
292+
if (pair.hasKey("mime"))
290293
m[i] = pair.getString("mime");
291294
else
292295
m[i] = null;
@@ -308,8 +311,8 @@ public void run() {
308311
}
309312

310313
/**
311-
* @param path Stream file path
312-
* @param encoding Stream encoding, should be one of `base64`, `ascii`, and `utf8`
314+
* @param path Stream file path
315+
* @param encoding Stream encoding, should be one of `base64`, `ascii`, and `utf8`
313316
* @param bufferSize Stream buffer size, default to 4096 or 4095(base64).
314317
*/
315318
@ReactMethod
@@ -375,7 +378,7 @@ public void fetchBlobForm(ReadableMap options, String taskId, String method, Str
375378
@ReactMethod
376379
public void getContentIntent(String mime, Promise promise) {
377380
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
378-
if(mime != null)
381+
if (mime != null)
379382
i.setType(mime);
380383
else
381384
i.setType("*/*");
@@ -385,15 +388,14 @@ public void getContentIntent(String mime, Promise promise) {
385388
}
386389

387390
@ReactMethod
388-
public void addCompleteDownload (ReadableMap config, Promise promise) {
391+
public void addCompleteDownload(ReadableMap config, Promise promise) {
389392
DownloadManager dm = (DownloadManager) RCTContext.getSystemService(RCTContext.DOWNLOAD_SERVICE);
390-
if (config == null || !config.hasKey("path"))
391-
{
393+
if (config == null || !config.hasKey("path")) {
392394
promise.reject("EINVAL", "ReactNativeBlobUtil.addCompleteDownload config or path missing.");
393395
return;
394396
}
395397
String path = ReactNativeBlobUtilFS.normalizePath(config.getString("path"));
396-
if(path == null) {
398+
if (path == null) {
397399
promise.reject("EINVAL", "ReactNativeBlobUtil.addCompleteDownload can not resolve URI:" + config.getString("path"));
398400
return;
399401
}
@@ -409,8 +411,7 @@ public void addCompleteDownload (ReadableMap config, Promise promise) {
409411
config.hasKey("showNotification") && config.getBoolean("showNotification")
410412
);
411413
promise.resolve(null);
412-
}
413-
catch(Exception ex) {
414+
} catch (Exception ex) {
414415
promise.reject("EUNSPECIFIED", ex.getLocalizedMessage());
415416
}
416417

0 commit comments

Comments
 (0)