Closed tiagonuneslx closed 1 year ago
Library | Class | Platforms |
---|---|---|
storage | FirebaseStorage | Android, iOS |
I need this module for the app I'm currently building so I'm taking a crack at it. Does anyone have any guidance on how to handle the two platform apis being different? E.g. Android's StorageReference.get/putStream()
vs ios' nothing.
Hi @mjmarathon can you send links to the API docs for the methods you mentioned? Generally, the best way to handle these difference is to find the kotlin way to do the same kind of thing use that instead - for example, the 3 platforms all have different ways to serialise objects so we use kotlin serialization and convert to the platform specific formats under the hood
Hey there @nbransby! Thanks for the quick follow up.
Docs for the aforementioned methods here: https://firebase.google.com/docs/reference/android/com/google/firebase/storage/StorageReference#getStream(com.google.firebase.storage.StreamDownloadTask.StreamProcessor) https://firebase.google.com/docs/reference/android/com/google/firebase/storage/StorageReference#putStream(java.io.InputStream,%20com.google.firebase.storage.StorageMetadata)
If the ios platform sdk doesn't support/use streams I'm unsure about how to keep the streaming methods exposed.
I need this module for the app I'm currently building so I'm taking a crack at it. Does anyone have any guidance on how to handle the two platform apis being different? E.g. Android's
StorageReference.get/putStream()
vs ios' nothing.
I can think of 3 ways to solve that issue:
I think the 3rd option is the best, at least inside the library. Not everything should be shared. And if you want, you can create an extension function in your final shared code, that calls putFile on iOS and putStream on Android.