[js][android][ios][storage] uploadTask.on now correctly receives a success status event

This commit is contained in:
Salakar 2017-04-07 17:57:57 +01:00
parent c83ba8b756
commit bdf588e0e2
3 changed files with 3 additions and 1 deletions

View File

@ -356,6 +356,7 @@ public class RNFirebaseStorage extends ReactContextBaseJavaModule {
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Log.d(TAG, "putFile success " + taskSnapshot);
WritableMap resp = getUploadTaskAsMap(taskSnapshot);
sendJSEvent(STORAGE_STATE_CHANGED, path, resp);
sendJSEvent(STORAGE_UPLOAD_SUCCESS, path, resp);
resp = getUploadTaskAsMap(taskSnapshot);
promise.resolve(resp);

View File

@ -349,6 +349,7 @@ RCT_EXPORT_METHOD(putFile:(NSString *) path localPath:(NSString *)localPath meta
[uploadTask observeStatus:FIRStorageTaskStatusSuccess handler:^(FIRStorageTaskSnapshot *snapshot) {
// upload completed successfully
NSDictionary *resp = [self getUploadTaskAsDictionary:snapshot];
[self sendJSEvent:STORAGE_EVENT path:path title:STORAGE_STATE_CHANGED props:resp];
[self sendJSEvent:STORAGE_EVENT path:path title:STORAGE_UPLOAD_SUCCESS props:resp];
resolve(resp);
}];

View File

@ -122,7 +122,7 @@ export default class StorageTask {
return this._subscribe.bind(this);
}
return this._subscribe(event, nextOrObserver, error, complete);
return this._subscribe(nextOrObserver, error, complete);
}
pause() {