| 
				
			 | 
			
			
				@@ -26,25 +26,43 @@ const  dirs = RNFetchBlob.fs.dirs 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				26
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				27
			 | 
			
				27
			 | 
			
			
				 let prefix = ((Platform.OS === 'android') ? 'file://' : '') 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				29
			 | 
			
				
			 | 
			
			
				-CameraRoll.getPhotos({first : 10}, function(resp){console.log(resp)}, (err)=>{console.log(err)}) 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				
			 | 
			
			
				-  // .then((resp) => { 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				
			 | 
			
			
				-  //   console.log(resp) 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				
			 | 
			
			
				-  // }) 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				
			 | 
			
			
				-  // .catch((err) => { 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				
			 | 
			
			
				-  //   console.log(err) 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				
			 | 
			
			
				-  // }) 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				29
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				37
			 | 
			
				
			 | 
			
			
				-describe('access file in assets', (report, done) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+describe('access assets from camera roll', (report, done) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+  let photo = null 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				32
			 | 
			
			
				   CameraRoll.getPhotos({first : 10}) 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				33
			 | 
			
			
				     .then((resp) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+      photo = resp.edges[0].node.image.uri 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				35
			 | 
			
			
				       report(<Info key="items"> 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				
			 | 
			
			
				-        <Text>{JSON.stringify(resp)}</Text> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+        <Text>{photo}</Text> 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				37
			 | 
			
			
				       </Info>) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+      return fs.readFile(photo, 'base64') 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				39
			 | 
			
			
				     }) 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				
			 | 
			
			
				-    .catch((err) => { 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				
			 | 
			
			
				-      console.log(err) 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				
			 | 
			
			
				-      report(<Info key="err"> 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				
			 | 
			
			
				-        <Text>{JSON.stringify(err)}</Text> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+    .then((data) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+      report(<Info key="asset image"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+        <Image 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+          style={styles.image} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+          source={{uri: `data:image/png;base64, ${data}`}}/> 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				45
			 | 
			
			
				       </Info>) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+      done() 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				47
			 | 
			
			
				     }) 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				48
			 | 
			
			
				 }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+describe('read asset in app bundle',(report, done) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+  let target = 'bundle-assets://test-asset2.png' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+  fs.readFile(target, 'base64') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+  .then((data) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+    report(<Info key="asset image"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+      <Image 
			 | 
		
	
		
			
			| 
				
			 | 
			
				56
			 | 
			
			
				+        style={styles.image} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+        source={{uri: `data:image/png;base64, ${data}`}}/> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+    </Info>) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+    return fs.readFile('bundle-assets://test-asset1.json', 'utf8') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				+  }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+  .then((resp) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				+    report( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+      <Assert key="asset content verify" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+        expect="asset#1" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+        actual={JSON.parse(resp).secret}/>) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+      done() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+  }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+}) 
			 |