Skip to content

Commit 7733c53

Browse files
committed
Fix Android Storage, allow config via .json file
1 parent 2cfde4a commit 7733c53

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

android/src/main/java/io/fullstack/firestack/FirestackStorage.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ public String getName() {
6060
}
6161

6262
@ReactMethod
63-
public void downloadUrl(final String storageUrl,
63+
public void downloadUrl(final String javascriptStorageBucket,
6464
final String path,
6565
final Callback callback) {
6666
FirebaseStorage storage = FirebaseStorage.getInstance();
67+
String storageBucket = storage.getApp().getOptions().getStorageBucket();
68+
String storageUrl = "gs://"+storageBucket;
6769
StorageReference storageRef = storage.getReferenceFromUrl(storageUrl);
68-
StorageReference fileRef = storageRef.child(path);
70+
StorageReference fileRef = storageRef.child(path);
6971

70-
Task<Uri> downloadTask = storageRef.getDownloadUrl();
72+
Task<Uri> downloadTask = fileRef.getDownloadUrl();
7173
downloadTask.addOnSuccessListener(new OnSuccessListener<Uri>() {
7274
@Override
7375
public void onSuccess(Uri uri) {

0 commit comments

Comments
 (0)