|
@@ -213,25 +213,27 @@ RNTest.config({
|
213
|
213
|
})
|
214
|
214
|
.then((res) => {
|
215
|
215
|
deb = Date.now()
|
216
|
|
- return RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
|
|
216
|
+ let promise = RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
|
217
|
217
|
Authorization : `Bearer ${DROPBOX_TOKEN}`,
|
218
|
218
|
'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+filename+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
|
219
|
219
|
'Content-Type' : 'application/octet-stream',
|
220
|
220
|
}, RNFetchBlob.wrap(res.path()))
|
221
|
|
- .progress((now, total) => {
|
222
|
|
- if(Date.now() - deb < 1000)
|
223
|
|
- return
|
224
|
|
- deb = Date.now()
|
225
|
|
- if(begin2 === -1)
|
226
|
|
- begin2 = Date.now()
|
227
|
|
- let speed = Math.floor(now / (Date.now() - begin2))
|
228
|
|
- report(<Info uid="100" key="progress">
|
229
|
|
- <Text>
|
230
|
|
- {`upload ${now} / ${total} bytes (${speed} kb/s)`}
|
231
|
|
- {` ${Math.floor((total-now)/speed/1000)} seconds left`}
|
232
|
|
- </Text>
|
233
|
|
- </Info>)
|
234
|
|
- })
|
|
221
|
+ if(Platform.OS === 'ios')
|
|
222
|
+ promise.progress((now, total) => {
|
|
223
|
+ if(Date.now() - deb < 1000)
|
|
224
|
+ return
|
|
225
|
+ deb = Date.now()
|
|
226
|
+ if(begin2 === -1)
|
|
227
|
+ begin2 = Date.now()
|
|
228
|
+ let speed = Math.floor(now / (Date.now() - begin2))
|
|
229
|
+ report(<Info uid="100" key="progress">
|
|
230
|
+ <Text>
|
|
231
|
+ {`upload ${now} / ${total} bytes (${speed} kb/s)`}
|
|
232
|
+ {` ${Math.floor((total-now)/speed/1000)} seconds left`}
|
|
233
|
+ </Text>
|
|
234
|
+ </Info>)
|
|
235
|
+ })
|
|
236
|
+ return promise
|
235
|
237
|
})
|
236
|
238
|
.then((res) => {
|
237
|
239
|
report(<Assert
|