|  | @@ -28,27 +28,30 @@ let prefix = ((Platform.OS === 'android') ? 'file://' : '')
 | 
	
		
			
			| 28 | 28 |  let photo = null
 | 
	
		
			
			| 29 | 29 |  
 | 
	
		
			
			| 30 | 30 |  describe('upload asset from camera roll', (report, done) => {
 | 
	
		
			
			| 31 |  | -  let imgName = `image-from-camera-roll-${Platform.OS}.jpg`
 | 
	
		
			
			|  | 31 | +  let imgName = `image-from-camera-roll-${Platform.OS}-${Date.now()}.jpg`
 | 
	
		
			
			| 32 | 32 |    let tick = Date.now()
 | 
	
		
			
			|  | 33 | +  let tick2 = Date.now()
 | 
	
		
			
			| 33 | 34 |    CameraRoll.getPhotos({first : 10})
 | 
	
		
			
			| 34 | 35 |      .then((resp) => {
 | 
	
		
			
			| 35 |  | -      console.log('cameraroll', JSON.stringify(resp))
 | 
	
		
			
			| 36 | 36 |        let url = resp.edges[0].node.image.uri
 | 
	
		
			
			|  | 37 | +      console.log('CameraRoll',url)
 | 
	
		
			
			| 37 | 38 |        photo = url
 | 
	
		
			
			| 38 | 39 |        return RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
 | 
	
		
			
			| 39 | 40 |          Authorization : `Bearer ${DROPBOX_TOKEN}`,
 | 
	
		
			
			| 40 | 41 |          'Dropbox-API-Arg': `{\"path\": \"/rn-upload/${imgName}\",\"mode\": \"add\",\"autorename\": false,\"mute\": false}`,
 | 
	
		
			
			| 41 | 42 |          'Content-Type' : 'application/octet-stream',
 | 
	
		
			
			| 42 | 43 |        }, RNFetchBlob.wrap(url))
 | 
	
		
			
			| 43 |  | -      .progress((now, total) => {
 | 
	
		
			
			| 44 |  | -        if(Date.now() - tick < 1000)
 | 
	
		
			
			|  | 44 | +      .uploadProgress((now, total) => {
 | 
	
		
			
			|  | 45 | +        if(Date.now() - tick2 < 1000)
 | 
	
		
			
			| 45 | 46 |          return
 | 
	
		
			
			| 46 |  | -        report(<Info key="progress" uid="pg1">
 | 
	
		
			
			|  | 47 | +        report(<Info key="upload progress" uid="pg0">
 | 
	
		
			
			| 47 | 48 |            <Text>{`upload ${now} / ${total} ${Math.floor(now/total*100)}% `}</Text>
 | 
	
		
			
			| 48 | 49 |          </Info>)
 | 
	
		
			
			|  | 50 | +        tick2 = Date.now()
 | 
	
		
			
			| 49 | 51 |        })
 | 
	
		
			
			| 50 | 52 |      })
 | 
	
		
			
			| 51 | 53 |      .then((resp) => {
 | 
	
		
			
			|  | 54 | +      console.log(resp)
 | 
	
		
			
			| 52 | 55 |        resp = resp.json()
 | 
	
		
			
			| 53 | 56 |        report(
 | 
	
		
			
			| 54 | 57 |          <Assert key="confirm the file has been uploaded" expect={imgName} actual={resp.name}/>
 |