|
@@ -106,7 +106,6 @@ describe('android download manager', (report, done) => {
|
106
|
106
|
report(
|
107
|
107
|
<Assert key="download manager complete handler" expect={true} actual={true}/>
|
108
|
108
|
)
|
109
|
|
- console.log('woo',resp)
|
110
|
109
|
return resp.readStream('ascii')
|
111
|
110
|
})
|
112
|
111
|
.then((stream) => {
|
|
@@ -126,3 +125,51 @@ describe('android download manager', (report, done) => {
|
126
|
125
|
})
|
127
|
126
|
})
|
128
|
127
|
})
|
|
128
|
+
|
|
129
|
+describe('open a file from intent', (report, done) => {
|
|
130
|
+ let url = null
|
|
131
|
+ RNFetchBlob.config({
|
|
132
|
+ addAndroidDownloads : {
|
|
133
|
+ useDownloadManager : true,
|
|
134
|
+ title : 'test-image',
|
|
135
|
+ description : 'open it from intent !',
|
|
136
|
+ mime : 'image/png',
|
|
137
|
+ mediaScannable : true,
|
|
138
|
+ notification : true,
|
|
139
|
+ }
|
|
140
|
+ })
|
|
141
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
|
|
142
|
+ .then((res) => {
|
|
143
|
+ let sendIntent = RNFetchBlob.android.actionViewIntent
|
|
144
|
+ return sendIntent(res.path(), 'image/png')
|
|
145
|
+ })
|
|
146
|
+ .then(() => {
|
|
147
|
+ done()
|
|
148
|
+ })
|
|
149
|
+})
|
|
150
|
+
|
|
151
|
+// #75
|
|
152
|
+describe('APK downloaded from Download Manager should correct', (report, done) => {
|
|
153
|
+
|
|
154
|
+ let url = null
|
|
155
|
+
|
|
156
|
+ RNFetchBlob.config({
|
|
157
|
+ addAndroidDownloads : {
|
|
158
|
+ useDownloadManager : true,
|
|
159
|
+ title : 'test-APK',
|
|
160
|
+ description : 'apk install file',
|
|
161
|
+ mime : 'application/vnd.android.package-archive',
|
|
162
|
+ mediaScannable : true,
|
|
163
|
+ notification : true,
|
|
164
|
+ }
|
|
165
|
+ })
|
|
166
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/apk-dummy.apk`)
|
|
167
|
+ .then((res) => {
|
|
168
|
+ let sendIntent = RNFetchBlob.android.actionViewIntent
|
|
169
|
+ return sendIntent(res.path(), 'application/vnd.android.package-archive')
|
|
170
|
+ })
|
|
171
|
+ .then(() => {
|
|
172
|
+ done()
|
|
173
|
+ })
|
|
174
|
+
|
|
175
|
+})
|