Skip to content

Commit 1f2783d

Browse files
committed
revert: remove react-native-background-upload package
1 parent f5a9389 commit 1f2783d

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"prettier": "^2.0.5",
7676
"react": "16.13.1",
7777
"react-native": "0.63.4",
78-
"react-native-background-upload": "^6.2.4",
7978
"react-native-builder-bob": "^0.18.0",
8079
"react-native-fs": "^2.18.0",
8180
"release-it": "^14.2.2",
@@ -85,7 +84,6 @@
8584
"react": "*",
8685
"react-native": "*",
8786
"react-native-fs": "*",
88-
"react-native-background-upload": ">=6.0.0",
8987
"uuid": "*"
9088
},
9189
"jest": {

src/Video/index.tsx

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
22
import { v4 as uuidv4 } from 'uuid';
3-
import Upload from 'react-native-background-upload';
43

54
export declare enum FileSystemUploadType {
65
BINARY_CONTENT = 0,
@@ -96,45 +95,6 @@ const Video: VideoCompressorType = {
9695
}
9796
},
9897
backgroundUpload: async (url, fileUrl, options, onProgress) => {
99-
if (!NativeVideoCompressor || !NativeVideoCompressor.upload) {
100-
//check if expo can upload the file
101-
const scheme = fileUrl.split('://')[0];
102-
if (['file'].includes(scheme)) {
103-
return Upload.startUpload({
104-
url: url,
105-
path: fileUrl,
106-
method: options.httpMethod || 'PUT',
107-
type: 'raw',
108-
})
109-
.then((uploadId) => {
110-
console.log('Upload started');
111-
Upload.addListener(
112-
'progress',
113-
uploadId,
114-
(data: any) =>
115-
onProgress && onProgress(parseInt(data.progress), 100)
116-
);
117-
Upload.addListener('error', uploadId, (data) => {
118-
throw data.error;
119-
});
120-
})
121-
.catch((err) => {
122-
throw err;
123-
});
124-
//fallback to use expo upload
125-
// return FileSystem.uploadAsync(url, fileUrl, options);
126-
} else {
127-
// Use poor old fetch
128-
const fileRes = await fetch(fileUrl);
129-
const fileBody = await fileRes.blob();
130-
131-
return fetch(url, {
132-
method: options.httpMethod,
133-
body: fileBody,
134-
headers: options.headers,
135-
});
136-
}
137-
}
13898
const uuid = uuidv4();
13999
let subscription = null;
140100
try {

0 commit comments

Comments
 (0)