Ben Hsieh 8 лет назад
Родитель
Сommit
43563cdff9

+ 6
- 0
src/index.js Просмотреть файл

@@ -134,6 +134,12 @@ function fetch(...args:any):Promise {
134 134
       }
135 135
     })
136 136
 
137
+    // When the request body comes from Blob polyfill, we should use special its ref
138
+    // as the request body
139
+    if( body instanceof Blob && body.isRNFetchBlobPolyfill) {
140
+      body = body.getRNFetchBlobRef()
141
+    }
142
+
137 143
     let req = RNFetchBlob[nativeMethodName]
138 144
     req(options, taskId, method, url, headers || {}, body, (err, data) => {
139 145
 

+ 10
- 10
src/ios/RNFetchBlob/RNFetchBlob.m Просмотреть файл

@@ -80,22 +80,22 @@ RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
80 80
                   headers:(NSDictionary *)headers
81 81
                   body:(NSString *)body callback:(RCTResponseSenderBlock)callback)
82 82
 {
83
-	NSString *cType = [headers valueForKey:"content-type"]
84
-	if (cType != nil && cType == @"application/x-www-form-urlencoded") {
85
-		[RNFetchBlobReqBuilder buildEncodedRequest:options taskId:taskId method:method url:url headers:headers body:body onComplete:^(NSURLRequest *req, long bodyLength) {
86
-	        // send HTTP request
87
-	        RNFetchBlobNetwork * utils = [[RNFetchBlobNetwork alloc] init];
88
-	        [utils sendRequest:options contentLength:bodyLength bridge:self.bridge taskId:taskId withRequest:req callback:callback];
89
-	        utils = nil;
90
-	    }];
91
-	} else {
83
+    NSString *cType = [headers valueForKey:@"content-type"];
84
+//	if (cType != nil && cType == @"application/x-www-form-urlencoded") {
85
+//		[RNFetchBlobReqBuilder buildEncodedRequest:options taskId:taskId method:method url:url headers:headers body:body onComplete:^(NSURLRequest *req, long bodyLength) {
86
+//	        // send HTTP request
87
+//	        RNFetchBlobNetwork * utils = [[RNFetchBlobNetwork alloc] init];
88
+//	        [utils sendRequest:options contentLength:bodyLength bridge:self.bridge taskId:taskId withRequest:req callback:callback];
89
+//	        utils = nil;
90
+//	    }];
91
+//	} else {
92 92
 		[RNFetchBlobReqBuilder buildOctetRequest:options taskId:taskId method:method url:url headers:headers body:body onComplete:^(NSURLRequest *req, long bodyLength) {
93 93
 	        // send HTTP request
94 94
 	        RNFetchBlobNetwork * utils = [[RNFetchBlobNetwork alloc] init];
95 95
 	        [utils sendRequest:options contentLength:bodyLength bridge:self.bridge taskId:taskId withRequest:req callback:callback];
96 96
 	        utils = nil;
97 97
 	    }];
98
-	}
98
+//	}
99 99
 }
100 100
 
101 101
 RCT_EXPORT_METHOD(createFile:(NSString *)path data:(NSString *)data encoding:(NSString *)encoding callback:(RCTResponseSenderBlock)callback) {

+ 1
- 1
src/ios/RNFetchBlobConst.m Просмотреть файл

@@ -19,7 +19,7 @@ extern NSString *const CONFIG_FILE_PATH = @"path";
19 19
 extern NSString *const CONFIG_FILE_EXT = @"appendExt";
20 20
 extern NSString *const CONFIG_TRUSTY = @"trusty";
21 21
 extern NSString *const CONFIG_INDICATOR = @"indicator";
22
-extern NSString *const CONFIG_KEY = "@key";
22
+extern NSString *const CONFIG_KEY = @"key";
23 23
 
24 24
 extern NSString *const EVENT_STATE_CHANGE = @"RNFetchBlobState";
25 25
 extern NSString *const MSG_EVENT = @"RNFetchBlobMessage";

+ 4
- 4
src/ios/RNFetchBlobNetwork.m Просмотреть файл

@@ -74,8 +74,8 @@ NSOperationQueue *taskQueue;
74 74
     return mheaders;
75 75
 }
76 76
 
77
-- (NSString *)md5 {
78
-    const char* str = [self UTF8String];
77
+- (NSString *)md5:(NSString *)input {
78
+    const char* str = [input UTF8String];
79 79
     unsigned char result[CC_MD5_DIGEST_LENGTH];
80 80
     CC_MD5(str, (CC_LONG)strlen(str), result);
81 81
 
@@ -120,14 +120,14 @@ NSOperationQueue *taskQueue;
120 120
 
121 121
 		NSString* cacheKey = taskId;
122 122
 		if (key != nil) {
123
-			cacheKey = [key md5];
123
+            cacheKey = [self md5:key];
124 124
 			if (cacheKey == nil) {
125 125
 				cacheKey = taskId;
126 126
 			}
127 127
 
128 128
 			destPath = [RNFetchBlobFS getTempPath:cacheKey withExtension:[self.options valueForKey:CONFIG_FILE_EXT]];
129 129
             if ([[NSFileManager defaultManager] fileExistsAtPath:destPath]) {
130
-				callback([NSNull null], destPath]);
130
+				callback(@[[NSNull null], destPath]);
131 131
                 return;
132 132
             }
133 133
 		}

+ 13
- 12
src/ios/RNFetchBlobReqBuilder.m Просмотреть файл

@@ -138,18 +138,19 @@
138 138
     });
139 139
 }
140 140
 
141
-+(void) buildEncodedRequest:(NSDictionary *)options
142
-                   taskId:(NSString *)taskId
143
-                   method:(NSString *)method
144
-                      url:(NSString *)url
145
-                  headers:(NSDictionary *)headers
146
-                     body:(NSString *)body
147
-               onComplete:(void(^)(NSURLRequest * req, long bodyLength))onComplete
148
-{
149
-	NSMutableData * formData = [[NSMutableData alloc] init];
150
-	[formData appendData:[[NSString stringWithFormat:@"%@", body] dataUsingEncoding:NSUTF8StringEncoding]];
151
-	onComplete(formData);
152
-}
141
+//+(void) buildEncodedRequest:(NSDictionary *)options
142
+//                   taskId:(NSString *)taskId
143
+//                   method:(NSString *)method
144
+//                      url:(NSString *)url
145
+//                  headers:(NSDictionary *)headers
146
+//                     body:(NSString *)body
147
+//               onComplete:(void(^)(NSURLRequest * req, long bodyLength))onComplete
148
+//{
149
+//	NSMutableData * formData = [[NSMutableData alloc] init];
150
+//    
151
+//	[formData appendData:[[NSString stringWithFormat:@"%@", body] dataUsingEncoding:NSUTF8StringEncoding]];
152
+//	onComplete(formData);
153
+//}
153 154
 
154 155
 
155 156
 +(void) buildFormBody:(NSArray *)form boundary:(NSString *)boundary onComplete:(void(^)(NSData * formData))onComplete

+ 50
- 13
src/polyfill/Blob.js Просмотреть файл

@@ -5,9 +5,13 @@
5 5
 import RNFetchBlob from '../index.js'
6 6
 import fs from '../fs.js'
7 7
 import getUUID from '../utils/uuid'
8
+import Log from '../utils/log.js'
8 9
 
10
+const log = new Log('Blob')
9 11
 const blobCacheDir = fs.dirs.DocumentDir + '/RNFetchBlob-blob/'
10 12
 
13
+log.level(3)
14
+
11 15
 /**
12 16
  * A RNFetchBlob style Blob polyfill class, this is a Blob which compatible to
13 17
  * Response object attain fron RNFetchBlob.fetch.
@@ -17,6 +21,7 @@ export default class Blob {
17 21
   cacheName:string;
18 22
   type:string;
19 23
   size:number;
24
+  isRNFetchBlobPolyfill:boolean = true;
20 25
 
21 26
   _ref:string = null;
22 27
   _blobCreated:boolean = false;
@@ -26,8 +31,12 @@ export default class Blob {
26 31
 
27 32
   // legacy constructor
28 33
   constructor(data:any, mime:?string) {
34
+
29 35
     this.cacheName = getBlobName()
36
+    this.isRNFetchBlobPolyfill = true
30 37
     this.type = mime
38
+    log.verbose('Blob constructor called' , data, 'mime', mime)
39
+
31 40
     if(typeof data === 'string') {
32 41
       // content from file
33 42
       if(data.startsWith('RNFetchBlob-file://')) {
@@ -36,6 +45,7 @@ export default class Blob {
36 45
       }
37 46
       // content from variable need create file
38 47
       else {
48
+        log.verbose('create Blob cache file ..')
39 49
         this._ref = RNFetchBlob.wrap(blobCacheDir + this.cacheName)
40 50
         let encoding = 'utf8'
41 51
         if(typeof data === 'string' && String(mime).match('application/octet') )
@@ -45,22 +55,26 @@ export default class Blob {
45 55
 
46 56
         this.init(data, encoding)
47 57
           .then(() => {
58
+            log.verbose('init executed ')
48 59
             if(typeof this._onCreated === 'function')
49
-              this._onCreated()
50
-            _blobCreated = true
60
+              this._onCreated(this)
51 61
           })
52 62
           .catch((err) => {
53
-            console.log('RNFetchBlob cannot create Blob', err)
63
+            log.error('RNFetchBlob cannot create Blob', err)
54 64
           })
55 65
       }
66
+    }
67
+    // TODO : handle mixed blob array
68
+    else if(Array.isArray(data)) {
69
+
56 70
     }
57 71
     else {
58
-      console.log('TODO')
72
+      log.verbose('TODO: else')
59 73
     }
60 74
   }
61 75
 
62 76
   onCreated(fn:() => void) {
63
-    console.log('register blob onCreated', fn)
77
+    log.verbose('register blob onCreated')
64 78
     if(this._blobCreated)
65 79
       fn()
66 80
     else
@@ -75,13 +89,27 @@ export default class Blob {
75 89
    * @return {Promise}
76 90
    */
77 91
   init(data, encoding):Promise {
78
-    console.log('blob init called')
79
-    return fs.exists(blobCacheDir).then((exist) => {
80
-      if(!exist)
81
-        return fs.mkdir(blobCacheDir).then(() => fs.createFile(this._ref, data, encoding))
82
-      else
83
-        return fs.createFile(this._ref, data, encoding)
92
+    return new Promise((resolve, reject) => {
93
+      fs.exists(blobCacheDir)
94
+        .then((exist) => {
95
+          log.verbose('blob cache folder exist', blobCacheDir, exist)
96
+          let path = String(this._ref).replace('RNFetchBlob-file://', '')
97
+          log.verbose('create cache file', path)
98
+          if(!exist)
99
+            return fs.mkdir(blobCacheDir)
100
+                     .then(() => fs.createFile(path, data, encoding))
101
+          else
102
+            return fs.createFile(path, data, encoding)
103
+        })
104
+        .then(() => {
105
+          this._blobCreated = true
106
+          resolve()
107
+        })
108
+        .catch((err) => {
109
+          reject(err)
110
+        })
84 111
     })
112
+
85 113
   }
86 114
 
87 115
   /**
@@ -100,7 +128,7 @@ export default class Blob {
100 128
    * @return {Blob}
101 129
    */
102 130
   slice(start:?number, end:?number, encoding:?string):Blob {
103
-    console.log('slice called')
131
+    log.verbose('slice called')
104 132
     // return fs.slice(this.cacheName, getBlobName(), contentType, start, end)
105 133
   }
106 134
 
@@ -113,7 +141,6 @@ export default class Blob {
113 141
     return fs.unlink(this._ref)
114 142
   }
115 143
 
116
-
117 144
 }
118 145
 
119 146
 /**
@@ -123,3 +150,13 @@ export default class Blob {
123 150
 function getBlobName() {
124 151
   return 'blob-' + getUUID()
125 152
 }
153
+
154
+/**
155
+ * Create a file according to given array. The element in array can be a number,
156
+ * Blob, string.
157
+ * @param  {Array} dataArray An array contains different types of data.
158
+ * @return {string}      The blob file reference
159
+ */
160
+function createMixedBlobData(dataArray) {
161
+  // TODO : mixed blob data creator
162
+}

+ 7
- 0
src/polyfill/FormData.js Просмотреть файл

@@ -0,0 +1,7 @@
1
+export default class FormData {
2
+
3
+  constructor() {
4
+    console.log('FormData constructor called')
5
+  }
6
+
7
+}

+ 41
- 29
src/polyfill/XMLHttpRequest.js Просмотреть файл

@@ -4,6 +4,12 @@
4 4
 
5 5
 import RNFetchBlob from '../index.js'
6 6
 import XMLHttpRequestEventTarget from './XMLHttpRequestEventTarget.js'
7
+import Log from '../utils/log.js'
8
+import Blob from './Blob.js'
9
+
10
+const log = new Log('XMLHttpRequest')
11
+
12
+log.level(3)
7 13
 
8 14
 const UNSENT = 0
9 15
 const OPENED = 1
@@ -61,7 +67,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
61 67
 
62 68
   constructor(...args) {
63 69
     super()
64
-    console.log('XMLHttpRequest constructor called', args)
70
+    log.verbose('XMLHttpRequest constructor called', args)
65 71
     this._config = {}
66 72
     this._args = {}
67 73
     this._headers = {}
@@ -69,7 +75,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
69 75
 
70 76
   // XMLHttpRequest.open, always async, user and password not supported.
71 77
   open(method:string, url:string, async:true, user:any, password:any) {
72
-    console.log('XMLHttpRequest open ', method, url, async, user, password)
78
+    log.verbose('XMLHttpRequest open ', method, url, async, user, password)
73 79
     this._method = method
74 80
     this._url = url
75 81
     this.readyState = XMLHttpRequest.OPENED
@@ -80,10 +86,16 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
80 86
    * @param  {any} body Body in RNfetchblob flavor
81 87
    */
82 88
   send(body) {
83
-    console.log('XMLHttpRequest send ', body)
89
+    log.verbose('XMLHttpRequest send ', body)
84 90
     let {_method, _url, _headers } = this
85
-    console.log('sending request with args', _method, _url, _headers, body)
91
+    log.verbose('sending request with args', _method, _url, _headers, body)
92
+
86 93
     this._upload = new XMLHttpRequestEventTarget()
94
+    log.verbose(typeof body, body instanceof FormData)
95
+    if(Array.isArray(body)) {
96
+      // TODO
97
+    }
98
+
87 99
     this.dispatchEvent('loadstart')
88 100
     if(this.onloadstart)
89 101
       this.onloadstart()
@@ -98,17 +110,17 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
98 110
   }
99 111
 
100 112
   overrideMimeType(mime:string) {
101
-    console.log('XMLHttpRequest overrideMimeType', mime)
113
+    log.verbose('XMLHttpRequest overrideMimeType', mime)
102 114
     this._headers['content-type'] = mime
103 115
   }
104 116
 
105 117
   setRequestHeader(name, value) {
106
-    console.log('XMLHttpRequest set header', name, value)
118
+    log.verbose('XMLHttpRequest set header', name, value)
107 119
     this._headers[name] = value
108 120
   }
109 121
 
110 122
   abort() {
111
-    console.log('XMLHttpRequest abort ')
123
+    log.verbose('XMLHttpRequest abort ')
112 124
     if(!this._task)
113 125
       return
114 126
     this._task.cancel((err) => {
@@ -130,7 +142,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
130 142
   }
131 143
 
132 144
   getResponseHeader(field:string):string | null {
133
-    console.log('XMLHttpRequest get header', field)
145
+    log.verbose('XMLHttpRequest get header', field)
134 146
     if(!this.responseHeaders)
135 147
       return null
136 148
     return this.responseHeaders[field] || null
@@ -138,7 +150,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
138 150
   }
139 151
 
140 152
   getAllResponseHeaders():string | null {
141
-    console.log('XMLHttpRequest get all headers')
153
+    log.verbose('XMLHttpRequest get all headers')
142 154
     if(!this.responseHeaders)
143 155
       return null
144 156
     let result = ''
@@ -150,7 +162,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
150 162
   }
151 163
 
152 164
   _headerReceived(e) {
153
-    console.log('header received ', e)
165
+    log.verbose('header received ', e)
154 166
     this.responseURL = this._url
155 167
     if(e.state === "2") {
156 168
       this.readyState = XMLHttpRequest.HEADERS_RECEIVED
@@ -162,7 +174,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
162 174
   }
163 175
 
164 176
   _progressEvent(send:number, total:number) {
165
-    console.log(this.readyState)
177
+    log.verbose(this.readyState)
166 178
     if(this.readyState === XMLHttpRequest.HEADERS_RECEIVED)
167 179
       this.readyState = XMLHttpRequest.LOADING
168 180
     let lengthComputable = false
@@ -179,7 +191,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
179 191
   }
180 192
 
181 193
   _onError(err) {
182
-    console.log('XMLHttpRequest error', err)
194
+    log.verbose('XMLHttpRequest error', err)
183 195
     this.statusText = err
184 196
     this.status = String(err).match(/\d+/)
185 197
     this.status = this.status ? Math.floor(this.status) : 404
@@ -199,7 +211,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
199 211
   }
200 212
 
201 213
   _onDone(resp) {
202
-    console.log('XMLHttpRequest done', resp.text())
214
+    log.verbose('XMLHttpRequest done', resp.text())
203 215
     this.statusText = '200 OK'
204 216
     this._status = 200
205 217
     switch(resp.type) {
@@ -228,17 +240,17 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
228 240
   }
229 241
 
230 242
   set onreadystatechange(fn:() => void) {
231
-    console.log('XMLHttpRequest set onreadystatechange', fn.toString())
243
+    log.verbose('XMLHttpRequest set onreadystatechange', fn.toString())
232 244
     this._onreadystatechange = fn
233 245
   }
234 246
 
235 247
   set readyState(val:number) {
236 248
 
237
-    console.log('XMLHttpRequest ready state changed to ', val)
249
+    log.verbose('XMLHttpRequest ready state changed to ', val)
238 250
     this._readyState = val
239 251
     if(this._onreadystatechange) {
240
-      console.log('trigger onreadystatechange event', this._readyState)
241
-      console.log(this._onreadystatechange)
252
+      log.verbose('trigger onreadystatechange event', this._readyState)
253
+      log.verbose(this._onreadystatechange)
242 254
       this.dispatchEvent('readystatechange', )
243 255
       if(this._onreadystatechange)
244 256
         this._onreadystatechange()
@@ -246,12 +258,12 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
246 258
   }
247 259
 
248 260
   get readyState() {
249
-    console.log('get readyState', this._readyState)
261
+    log.verbose('get readyState', this._readyState)
250 262
     return this._readyState
251 263
   }
252 264
 
253 265
   get status() {
254
-    console.log('get status', this._status)
266
+    log.verbose('get status', this._status)
255 267
     return this._status
256 268
   }
257 269
 
@@ -260,52 +272,52 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
260 272
   }
261 273
 
262 274
   get statusText() {
263
-    console.log('get statusText', this._statusText)
275
+    log.verbose('get statusText', this._statusText)
264 276
     return this._statusText
265 277
   }
266 278
 
267 279
   set response(val) {
268
-    console.log('set response', val)
280
+    log.verbose('set response', val)
269 281
     this._response = val
270 282
   }
271 283
 
272 284
   get response() {
273
-    console.log('get response', this._response)
285
+    log.verbose('get response', this._response)
274 286
     return this._response
275 287
   }
276 288
 
277 289
   get responseText() {
278
-    console.log('get responseText', this._responseText)
290
+    log.verbose('get responseText', this._responseText)
279 291
     return this._responseText
280 292
   }
281 293
 
282 294
   get responseURL() {
283
-    console.log('get responseURL', this._responseURL)
295
+    log.verbose('get responseURL', this._responseURL)
284 296
     return this._responseURL
285 297
   }
286 298
 
287 299
   get responseHeaders() {
288
-    console.log('get responseHeaders', this._responseHeaders)
300
+    log.verbose('get responseHeaders', this._responseHeaders)
289 301
     return this._responseHeaders
290 302
   }
291 303
 
292 304
   set timeout(val) {
293
-    console.log('set timeout', this._timeout)
305
+    log.verbose('set timeout', this._timeout)
294 306
     this._timeout = val
295 307
   }
296 308
 
297 309
   get timeout() {
298
-    console.log('get timeout', this._timeout)
310
+    log.verbose('get timeout', this._timeout)
299 311
     return this._timeout
300 312
   }
301 313
 
302 314
   get upload() {
303
-    console.log('get upload', this._upload)
315
+    log.verbose('get upload', this._upload)
304 316
     return this._upload
305 317
   }
306 318
 
307 319
   get responseType() {
308
-    console.log('get response type', this._responseType)
320
+    log.verbose('get response type', this._responseType)
309 321
     return this._responseType
310 322
   }
311 323
 

+ 2
- 0
src/polyfill/XMLHttpRequestEventTarget.js Просмотреть файл

@@ -6,6 +6,8 @@ import Log from '../utils/log.js'
6 6
 
7 7
 const log = new Log('XMLHttpRequestEventTarget')
8 8
 
9
+log.disable()
10
+
9 11
 export default class XMLHttpRequestEventTarget extends EventTarget {
10 12
 
11 13
   _onabort : (e:Event) => void;

+ 2
- 1
src/polyfill/index.js Просмотреть файл

@@ -1,7 +1,8 @@
1 1
 import Blob from './Blob.js'
2 2
 import File from './File.js'
3 3
 import XMLHttpRequest from './XMLHttpRequest.js'
4
+import FormData from './FormData.js'
4 5
 
5 6
 export default {
6
-  Blob, File, XMLHttpRequest
7
+  Blob, File, XMLHttpRequest, FormData
7 8
 }

+ 22
- 4
src/utils/log.js Просмотреть файл

@@ -1,21 +1,39 @@
1 1
 export default class Log {
2 2
 
3 3
   _name:string;
4
+  _isEnable:boolean = true
5
+  _level:number = 0
4 6
 
5 7
   constructor(name:string) {
6 8
     this._name = name
7 9
   }
8 10
 
9
-  info(...args) {
10
-    console.log(this._name, '-info:', ...args)
11
+  level(val:number) {
12
+    this._level = val
13
+  }
14
+
15
+  enable() {
16
+    this._isEnable = true
17
+  }
18
+
19
+  disable() {
20
+    this._isEnable = false
21
+  }
22
+
23
+  verbose(...args) {
24
+    this._isEnable && this._level > 2 && console.log(this._name, 'verbose:', ...args)
11 25
   }
12 26
 
13 27
   debug(...args) {
14
-    console.log(this._name, '-debug:', ...args)
28
+    this._isEnable && this._level > 1 && console.log(this._name, 'debug:', ...args)
29
+  }
30
+
31
+  info(...args) {
32
+    this._isEnable && this._level > 0 && console.log(this._name, 'info:', ...args)
15 33
   }
16 34
 
17 35
   error(...args) {
18
-    console.log(this._name, '-error:', ...args)
36
+    this._isEnable && this._level > -1 && console.log(this._name, 'error:', ...args)
19 37
   }
20 38
 
21 39
 }

+ 1
- 2
test/test-firebase.js Просмотреть файл

@@ -20,6 +20,7 @@ const Blob = RNFetchBlob.polyfill.Blob
20 20
 
21 21
 window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
22 22
 window.Blob = Blob
23
+window.FormData = RNFetchBlob.polyfill.FormData
23 24
 
24 25
 const { Assert, Comparer, Info, prop } = RNTest
25 26
 const describe = RNTest.config({
@@ -61,13 +62,11 @@ describe('firebase login', (report, done) => {
61 62
   })
62 63
 })
63 64
 
64
-
65 65
 describe('upload file to firebase', (report, done) => {
66 66
 
67 67
   try {
68 68
     let blob = new Blob(RNTest.prop('image'), 'application/octet-binary')
69 69
     blob.onCreated(() => {
70
-      console.log('BINGO')
71 70
       let storage = firebase.storage().ref()
72 71
       let task = storage
73 72
         .child(`testdata/firebase-test-${Platform.OS}.png`)

+ 2
- 2
test/test-init.js Просмотреть файл

@@ -18,8 +18,8 @@ const { Assert, Comparer, Info, prop } = RNTest
18 18
 // test environment variables
19 19
 
20 20
 prop('FILENAME', `${Platform.OS}-0.7.0-${Date.now()}.png`)
21
-prop('TEST_SERVER_URL', 'http://192.168.16.70:8123')
22
-prop('TEST_SERVER_URL_SSL', 'https://192.168.16.70:8124')
21
+prop('TEST_SERVER_URL', 'http://192.168.0.11:8123')
22
+prop('TEST_SERVER_URL_SSL', 'https://192.168.0.11:8124')
23 23
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
24 24
 prop('styles', {
25 25
   image : {