Skip to content

Commit

Permalink
Added get reference from url
Browse files Browse the repository at this point in the history
  • Loading branch information
Reedyuk committed Sep 2, 2024
1 parent fde1e95 commit 9464afc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public actual class FirebaseStorage(internal val android: com.google.firebase.st
public actual val reference: StorageReference get() = StorageReference(android.reference)

public actual fun reference(location: String): StorageReference = StorageReference(android.getReference(location))

public actual fun getReferenceFromUrl(fullUrl: String): StorageReference = StorageReference(android.getReferenceFromUrl(fullUrl))
}

public val StorageReference.android: com.google.firebase.storage.StorageReference get() = android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ public expect class FirebaseStorage {
* @return An instance of [StorageReference] at the given child path.
*/
public fun reference(location: String): StorageReference

/**
* Creates a [StorageReference] given a gs:// or https:// URL pointing to a Firebase Storage location.
*
* @param fullUrl A gs:// or http[s]:// URL used to initialize the reference. For example, you can pass
* in a download URL retrieved from getDownloadUrl or the uri retrieved from toString An error is
* thrown if fullUrl is not associated with the FirebaseApp used to initialize this FirebaseStorage.
* @return An instance of [StorageReference] at the given url.
*/
public fun getReferenceFromUrl(fullUrl: String): StorageReference
}

@Deprecated("Deprecated to use Kotlin Duration", replaceWith = ReplaceWith("maxOperationRetryTime"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public actual class FirebaseStorage(internal val ios: FIRStorage) {
public actual val reference: StorageReference get() = StorageReference(ios.reference())

public actual fun reference(location: String): StorageReference = StorageReference(ios.referenceWithPath(location))

public actual fun getReferenceFromUrl(fullUrl: String): StorageReference = StorageReference(ios.referenceForURL(fullUrl))
}

public val StorageReference.ios: FIRStorageReference get() = ios
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public actual class FirebaseStorage(internal val js: dev.gitlive.firebase.storag
public actual val reference: StorageReference get() = StorageReference(ref(js))

public actual fun reference(location: String): StorageReference = rethrow { StorageReference(ref(js, location)) }

public actual fun getReferenceFromUrl(fullUrl: String): StorageReference = rethrow { StorageReference(ref(js, fullUrl)) }
}

public val StorageReference.js get() = js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public actual class FirebaseStorage {
public actual fun reference(location: String): StorageReference {
TODO("Not yet implemented")
}

public actual fun getReferenceFromUrl(fullUrl: String): StorageReference {
TODO("Not yet implemented")
}
}

public actual class StorageReference {
Expand Down

0 comments on commit 9464afc

Please sign in to comment.