@@ -115,47 +115,13 @@ public void getDownloadURL(final String path,
115
115
.addOnSuccessListener (new OnSuccessListener <Uri >() {
116
116
@ Override
117
117
public void onSuccess (Uri uri ) {
118
- final WritableMap res = Arguments .createMap ();
119
-
120
- res .putString ("status" , "success" );
121
- res .putString ("bucket" , FirebaseStorage .getInstance ().getApp ().getOptions ().getStorageBucket ());
122
- res .putString ("fullPath" , uri .toString ());
123
- res .putString ("path" , uri .getPath ());
124
- res .putString ("url" , uri .toString ());
125
-
126
- reference .getMetadata ()
127
- .addOnSuccessListener (new OnSuccessListener <StorageMetadata >() {
128
- @ Override
129
- public void onSuccess (final StorageMetadata storageMetadata ) {
130
- Log .d (TAG , "getMetadata success " + storageMetadata );
131
-
132
- res .putMap ("metadata" , getMetadataAsMap (storageMetadata ));
133
- res .putString ("name" , storageMetadata .getName ());
134
- res .putString ("url" , storageMetadata .getDownloadUrl ().toString ());
135
- callback .invoke (null , res );
136
- }
137
- })
138
- .addOnFailureListener (new OnFailureListener () {
139
- @ Override
140
- public void onFailure (@ NonNull Exception exception ) {
141
- Log .e (TAG , "Failure in download " + exception );
142
- final int errorCode = 1 ;
143
- callback .invoke (makeErrorPayload (errorCode , exception ));
144
- }
145
- });
146
-
118
+ callback .invoke (null , uri .toString ());
147
119
}
148
120
})
149
121
.addOnFailureListener (new OnFailureListener () {
150
122
@ Override
151
123
public void onFailure (@ NonNull Exception exception ) {
152
- Log .e (TAG , "Failed to download file " + exception .getMessage ());
153
-
154
- WritableMap err = Arguments .createMap ();
155
- err .putString ("status" , "error" );
156
- err .putString ("description" , exception .getLocalizedMessage ());
157
-
158
- callback .invoke (err );
124
+ callback .invoke (makeErrorPayload (1 , exception ));
159
125
}
160
126
});
161
127
}
0 commit comments