Skip to content

Commit 676a725

Browse files
Ron RadtkeRon Radtke
authored andcommitted
Renaming the lib to react-native-blob-util
Merge remote-tracking branch 'origin/feature/rename'
2 parents a6dcaaf + 4fea693 commit 676a725

File tree

121 files changed

+1362
-1297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1362
-1297
lines changed

.eslintrc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
/* See all the pre-defined configs here: https://www.npmjs.com/package/eslint-config-defaults */
3+
"extends": "defaults/configurations/eslint",
4+
"parser": "babel-eslint",
5+
"plugins": [
6+
"react", "html"
7+
],
8+
"env": {
9+
"amd": true,
10+
"browser": true,
11+
"jquery": true,
12+
"node": true,
13+
"es6": false,
14+
"worker": true
15+
},
16+
"rules": {
17+
18+
"eqeqeq": 2,
19+
"comma-dangle": 1,
20+
"no-console": 1,
21+
"no-debugger": 1,
22+
"no-extra-semi": 2,
23+
"no-extra-parens": 1,
24+
"no-extra-boolean-cast": 0,
25+
"no-cond-assign": 2,
26+
"no-irregular-whitespace": 2,
27+
"no-undef": 0,
28+
"no-unused-vars": 0,
29+
"semi": 2,
30+
"semi-spacing": 2,
31+
"valid-jsdoc": [
32+
1,
33+
{ "requireReturn": false,
34+
"requireParamDescription": false,
35+
"requireReturnDescription": false}
36+
],
37+
38+
"react/display-name": 2,
39+
"react/forbid-prop-types": 1,
40+
"react/jsx-boolean-value": 1,
41+
"react/jsx-closing-bracket-location": 1,
42+
"react/jsx-curly-spacing": 1,
43+
"react/jsx-indent-props": 0,
44+
"react/jsx-max-props-per-line": 0,
45+
"react/jsx-no-duplicate-props": 1,
46+
"react/jsx-no-literals": 0,
47+
"react/jsx-no-undef": 1,
48+
"react/jsx-sort-props": 0,
49+
"react/jsx-uses-react": 1,
50+
"react/jsx-uses-vars": 1,
51+
"react/jsx-wrap-multilines": 1,
52+
"react/no-danger": 1,
53+
"react/no-did-mount-set-state": 1,
54+
"react/no-did-update-set-state": 1,
55+
"react/no-direct-mutation-state": 1,
56+
"react/no-multi-comp": 1,
57+
"react/no-set-state": 0,
58+
"react/no-unknown-property": 1,
59+
"react/prop-types": 0,
60+
"react/react-in-jsx-scope": 0,
61+
"react/self-closing-comp": 1,
62+
"react/sort-comp": 1
63+
}
64+
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.imdone
22
testconfig
3-
RNFetchBlobTest/
3+
ReactNativeBlobUtilTest/
44
test/test-server/public/*
55
!test/test-server/public/github.png
66

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
For developers who interested in making contribution to this project, please see [https://github.com/joltup/rn-fetch-blob-dev](https://github.com/joltup/rn-fetch-blob-dev) for more information.
1+
For developers who interested in making contribution to this project, please see [https://github.com/joltup/react-native-blob-util-dev](https://github.com/joltup/react-native-blob-util-dev) for more information.

README.md

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

android.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,49 @@
44

55
import { NativeModules, Platform } from 'react-native'
66

7-
const RNFetchBlob = NativeModules.RNFetchBlob
7+
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
88

99
/**
1010
* Send an intent to open the file.
1111
* @param {string} path Path of the file to be open.
1212
* @param {string} mime MIME type string
13-
* @param {string} title for chooser, if not set the chooser won't be displayed (see https://developer.android.com/reference/android/content/Intent.html#createChooser(android.content.Intent,%20java.lang.CharSequence))
13+
* @param {string} chooserTitle for chooser, if not set the chooser won't be displayed (see https://developer.android.com/reference/android/content/Intent.html#createChooser(android.content.Intent,%20java.lang.CharSequence))
1414
* @return {Promise}
1515
*/
1616
function actionViewIntent(path, mime, chooserTitle) {
1717
if(typeof chooserTitle === 'undefined') chooserTitle = null;
1818
if(Platform.OS === 'android')
19-
return RNFetchBlob.actionViewIntent(path, mime, chooserTitle)
19+
return ReactNativeBlobUtil.actionViewIntent(path, mime, chooserTitle)
2020
else
21-
return Promise.reject('RNFetchBlob.android.actionViewIntent only supports Android.')
21+
return Promise.reject('ReactNativeBlobUtil.android.actionViewIntent only supports Android.')
2222
}
2323

2424
function getContentIntent(mime) {
2525
if(Platform.OS === 'android')
26-
return RNFetchBlob.getContentIntent(mime)
26+
return ReactNativeBlobUtil.getContentIntent(mime)
2727
else
28-
return Promise.reject('RNFetchBlob.android.getContentIntent only supports Android.')
28+
return Promise.reject('ReactNativeBlobUtil.android.getContentIntent only supports Android.')
2929
}
3030

3131
function addCompleteDownload(config) {
3232
if(Platform.OS === 'android')
33-
return RNFetchBlob.addCompleteDownload(config)
33+
return ReactNativeBlobUtil.addCompleteDownload(config)
3434
else
35-
return Promise.reject('RNFetchBlob.android.addCompleteDownload only supports Android.')
35+
return Promise.reject('ReactNativeBlobUtil.android.addCompleteDownload only supports Android.')
3636
}
3737

3838
function getSDCardDir() {
3939
if(Platform.OS === 'android')
40-
return RNFetchBlob.getSDCardDir()
40+
return ReactNativeBlobUtil.getSDCardDir()
4141
else
42-
return Promise.reject('RNFetchBlob.android.getSDCardDir only supports Android.')
42+
return Promise.reject('ReactNativeBlobUtil.android.getSDCardDir only supports Android.')
4343
}
4444

4545
function getSDCardApplicationDir() {
4646
if(Platform.OS === 'android')
47-
return RNFetchBlob.getSDCardApplicationDir()
47+
return ReactNativeBlobUtil.getSDCardApplicationDir()
4848
else
49-
return Promise.reject('RNFetchBlob.android.getSDCardApplicationDir only supports Android.')
49+
return Promise.reject('ReactNativeBlobUtil.android.getSDCardApplicationDir only supports Android.')
5050
}
5151

5252

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ dependencies {
4444
implementation 'com.squareup.okhttp3:okhttp:+'
4545
implementation 'com.squareup.okhttp3:logging-interceptor:+'
4646
implementation 'com.squareup.okhttp3:okhttp-urlconnection:+'
47-
// {RNFetchBlob_PRE_0.28_DEPDENDENCY}
47+
// {ReactNativeBlobUtil_PRE_0.28_DEPDENDENCY}
4848
}

android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.RNFetchBlob">
2+
package="com.ReactNativeBlobUtil">
33

44
<!-- Required to access Google Play Licensing -->
55
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
@@ -27,7 +27,7 @@
2727
<application android:label="@string/app_name">
2828

2929
<provider
30-
android:name="com.RNFetchBlob.Utils.FileProvider"
30+
android:name="com.ReactNativeBlobUtil.Utils.FileProvider"
3131
android:authorities="${applicationId}.provider"
3232
android:exported="false"
3333
android:grantUriPermissions="true">

android/src/main/java/com/RNFetchBlob/RNFetchBlobConst.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobDefaultResp.java renamed to android/src/main/java/com/ReactNativeBloBUtil/Response/ReactNativeBlobUtilDefaultResp.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.RNFetchBlob.Response;
1+
package com.ReactNativeBlobUtil.Response;
22

3-
import com.RNFetchBlob.RNFetchBlobConst;
4-
import com.RNFetchBlob.RNFetchBlobProgressConfig;
5-
import com.RNFetchBlob.RNFetchBlobReq;
3+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilConst;
4+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilProgressConfig;
5+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilReq;
66
import com.facebook.react.bridge.Arguments;
77
import com.facebook.react.bridge.ReactApplicationContext;
88
import com.facebook.react.bridge.WritableMap;
@@ -22,14 +22,14 @@
2222
/**
2323
* Created by wkh237 on 2016/7/11.
2424
*/
25-
public class RNFetchBlobDefaultResp extends ResponseBody {
25+
public class ReactNativeBlobUtilDefaultResp extends ResponseBody {
2626

2727
String mTaskId;
2828
ReactApplicationContext rctContext;
2929
ResponseBody originalBody;
3030
boolean isIncrement = false;
3131

32-
public RNFetchBlobDefaultResp(ReactApplicationContext ctx, String taskId, ResponseBody body, boolean isIncrement) {
32+
public ReactNativeBlobUtilDefaultResp(ReactApplicationContext ctx, String taskId, ResponseBody body, boolean isIncrement) {
3333
this.rctContext = ctx;
3434
this.mTaskId = taskId;
3535
this.originalBody = body;
@@ -65,7 +65,7 @@ public long read(Buffer sink, long byteCount) throws IOException {
6565

6666
long read = mOriginalSource.read(sink, byteCount);
6767
bytesRead += read > 0 ? read : 0;
68-
RNFetchBlobProgressConfig reportConfig = RNFetchBlobReq.getReportProgress(mTaskId);
68+
ReactNativeBlobUtilProgressConfig reportConfig = ReactNativeBlobUtilReq.getReportProgress(mTaskId);
6969
long cLen = contentLength();
7070
if(reportConfig != null && cLen != 0 && reportConfig.shouldReport(bytesRead/contentLength())) {
7171
WritableMap args = Arguments.createMap();
@@ -80,7 +80,7 @@ public long read(Buffer sink, long byteCount) throws IOException {
8080
}
8181

8282
rctContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
83-
.emit(RNFetchBlobConst.EVENT_PROGRESS, args);
83+
.emit(ReactNativeBlobUtilConst.EVENT_PROGRESS, args);
8484
}
8585
return read;
8686
}

android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java renamed to android/src/main/java/com/ReactNativeBloBUtil/Response/ReactNativeBlobUtilFileResp.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.RNFetchBlob.Response;
1+
package com.ReactNativeBlobUtil.Response;
22

33
import androidx.annotation.NonNull;
44

5-
import com.RNFetchBlob.RNFetchBlobConst;
6-
import com.RNFetchBlob.RNFetchBlobProgressConfig;
7-
import com.RNFetchBlob.RNFetchBlobReq;
5+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilConst;
6+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilProgressConfig;
7+
import com.ReactNativeBlobUtil.ReactNativeBlobUtilReq;
88
import com.facebook.react.bridge.Arguments;
99
import com.facebook.react.bridge.ReactApplicationContext;
1010
import com.facebook.react.bridge.WritableMap;
@@ -25,7 +25,7 @@
2525
/**
2626
* Created by wkh237 on 2016/7/11.
2727
*/
28-
public class RNFetchBlobFileResp extends ResponseBody {
28+
public class ReactNativeBlobUtilFileResp extends ResponseBody {
2929

3030
String mTaskId;
3131
ResponseBody originalBody;
@@ -35,7 +35,7 @@ public class RNFetchBlobFileResp extends ResponseBody {
3535
FileOutputStream ofStream;
3636
boolean isEndMarkerReceived;
3737

38-
public RNFetchBlobFileResp(ReactApplicationContext ctx, String taskId, ResponseBody body, String path, boolean overwrite) throws IOException {
38+
public ReactNativeBlobUtilFileResp(ReactApplicationContext ctx, String taskId, ResponseBody body, String path, boolean overwrite) throws IOException {
3939
super();
4040
this.rctContext = ctx;
4141
this.mTaskId = taskId;
@@ -94,7 +94,7 @@ public long read(@NonNull Buffer sink, long byteCount) throws IOException {
9494
// End marker has been received for chunked download
9595
isEndMarkerReceived = true;
9696
}
97-
RNFetchBlobProgressConfig reportConfig = RNFetchBlobReq.getReportProgress(mTaskId);
97+
ReactNativeBlobUtilProgressConfig reportConfig = ReactNativeBlobUtilReq.getReportProgress(mTaskId);
9898

9999
if (contentLength() != 0) {
100100

@@ -130,7 +130,7 @@ private void reportProgress(String taskId, long bytesDownloaded, long contentLen
130130
args.putString("written", String.valueOf(bytesDownloaded));
131131
args.putString("total", String.valueOf(contentLength));
132132
rctContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
133-
.emit(RNFetchBlobConst.EVENT_PROGRESS, args);
133+
.emit(ReactNativeBlobUtilConst.EVENT_PROGRESS, args);
134134
}
135135

136136
@Override

0 commit comments

Comments
 (0)