flutterfire_desktop icon indicating copy to clipboard operation
flutterfire_desktop copied to clipboard

feat(firebase_storage): firebase storage Dart & Desktop

Open Ahmed-elshorbagy opened this issue 2 years ago • 14 comments

starting firestorage dart/desktop implementation

Ahmed-elshorbagy avatar Apr 24 '22 14:04 Ahmed-elshorbagy

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 24 '22 14:04 CLAassistant

@pr-Mais @TimWhiting I need help in starting the api part so i can continue from there as rest api is still in beta but it is supported in firebase javascript sdk so what should i do or start with

Ahmed-elshorbagy avatar Apr 26 '22 12:04 Ahmed-elshorbagy

I would look at how the javascript is accessing it: https://github.com/firebase/firebase-js-sdk/blob/master/packages/storage/src/implementation/requests.ts

Not sure I would organize it the same as the javascript, but the functions in that file seems to be the api surface I would implement in an FirebaseStorageApiClient class.

TimWhiting avatar Apr 26 '22 15:04 TimWhiting

As @TimWhiting said, the JS SDK was my reference in auth, if you look at the API layer in Auth you can take inspiration. Additionally, we use the generated Firebase APIs instead of building it from scratch.

pr-Mais avatar Apr 26 '22 15:04 pr-Mais

@pr-Mais @TimWhiting I have already done this but couldn't figure how to extend this by imported code from js sdk as some of functions are implemented twice with different approaches i have searched also the android firebase library so iam stuck at the start but i will try my best

Ahmed-elshorbagy avatar Apr 26 '22 21:04 Ahmed-elshorbagy

I used to check the three SDKs for the same functionality (iOS, Android, and JS). There's a way each is implementing something following the practices for the language and framework, but the general idea should be the same. You can start from the Dart API part in firebase_storage_web, then add an API layer under it, which will be in place of interop part in the web package.

pr-Mais avatar Apr 27 '22 11:04 pr-Mais

sorry for bothering you but how can i test my implementationsof any api request is correct thanks in advance for both dart /desktop packages "should i create them from scratch??"

Ahmed-elshorbagy avatar May 02 '22 21:05 Ahmed-elshorbagy

how to get "'X-Firebase-Storage-Version'" token inside firebase app @pr-Mais @TimWhiting

Ahmed-elshorbagy avatar May 03 '22 16:05 Ahmed-elshorbagy

Off-topic but I've just added the newly released firebasestorage:v1 api (https://github.com/invertase/dart_firebase_apis/pull/3) to https://github.com/invertase/dart_firebase_apis

Salakar avatar May 09 '22 08:05 Salakar

@Ahmed-elshorbagy sorry for delay. Could you reference a link to where is X-Firebase-Storage-Version mentioned?

Regarding testing, write test cases following FlutterFire tests for the Desktop package, and refer to the tests in auth for the Dart package. Also, make an example app in the Desktop package and test the functionalities you implement.

pr-Mais avatar May 09 '22 09:05 pr-Mais

@pr-Mais https://github.com/firebase/firebase-js-sdk/blob/e34e98e73a72f77ee87d9005d6728402129deda9/packages/storage/src/implementation/request.ts#L249 this header is required form most app requests its linked to json file in app core package

Ahmed-elshorbagy avatar May 09 '22 14:05 Ahmed-elshorbagy

I tracked it down here: https://github.com/firebase/firebase-js-sdk/blob/cdada6c68f9740d13dd6674bcb658e28e68253b6/packages/app/src/api.ts#L31-L51

So this header represents the current SDK version used by the app making the requests. On Dart, could be read from pubspec.yaml, will see the best way to get this done for all packages, I assume they all would have such a header. For now, you can manually set a constant with the initial version number hardcoded

pr-Mais avatar May 09 '22 15:05 pr-Mais

cloud.

ghost avatar Jun 11 '22 05:06 ghost

+1

stMerlHin avatar Dec 05 '23 13:12 stMerlHin