-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(firebase_storage): rework #3612
Conversation
Co-authored-by: Greg Hesp <greg.hesp@gmail.com> Co-authored-by: Helena Ford <helenaellieford@gmail.com> Co-authored-by: Kirsty Williams <kirstywilliams@users.noreply.github.com> Co-authored-by: Salakar <mike.diarmid@gmail.com> Co-authored-by: Kirsty Williams <kirsty@kirstywilliams.co.uk>
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
…ertase/storage_v1
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
A |
Hi, I believe I did find a few omissions from the changelogs during my migration:
So far, this is all I have, but if I find anything else during the actual testing, I'll be sure to comment. |
When trying to upload a file, I get the following exception:
I managed to track this down to What else do you need from me to look into it? |
@zmeggyesi Do you have a minimal code sample you can provide that is causing the error? Might be best opening an issue following the template with all the info |
@greghesp I'll try to create a runnable demo tomorrow, but just in case it rings a bell for someone, this is the immediate context:
|
I think I see the issue @zmeggyesi, I'll push a dev release with a fix in an hour or so. Will ping here |
@Salakar Do I need to update the pubspec ref to load your fix, or just |
…y string Internally `getCustomMetadata` checks if the metadata string is empty and returns null if it is, we don't want this behaviour for FF.
@Salakar As of commit As for iOS, I could not find any immediately obvious problems so far. |
Co-authored-by: @Ehesp
Co-authored-by: @greghesp
Co-authored-by: @helenaford
Co-authored-by: @kirstywilliams
Co-authored-by: @Salakar
A
firebase_storage
dev release is now available -5.0.0-dev.1
.NEW USAGE DOCUMENTATION.
TODO
Description
As part of our on-going work for #2582 this is our Firebase Storage rework changes.
Overall, Firebase Storage has been heavily reworked to bring it inline with the federated plugin setup along with adding new features, documentation and many more unit and end-to-end tests (tested on Android, iOS & MacOS).
FirebaseStorage
FirebaseStorage.instanceFor
orFirebaseStorage.instance
instead.getReferenceFromUrl()
is deprecated in favor of callingref()
with a path.getMaxOperationRetryTimeMillis()
is deprecated in favor of the gettermaxOperationRetryTime
.getMaxUploadRetryTimeMillis()
is deprecated in favor of the gettermaxUploadRetryTime
.getMaxDownloadRetryTimeMillis()
is deprecated in favor of the gettermaxDownloadRetryTime
.setMaxOperationRetryTimeMillis()
is deprecated in favor ofsetMaxUploadRetryTime()
.setMaxUploadRetryTimeMillis()
is deprecated in favor ofsetMaxUploadRetryTime()
.setMaxDownloadRetryTimeMillis()
is deprecated in favor ofsetMaxDownloadRetryTime()
.ref()
creates a newReference
at the bucket root, whereas an optional path (ref('/foo/bar.png')
) can be used to create aReference
pointing at a specific location.refFromURL
, which accepts a Google Storage (gs://
) or HTTP URL and returns aReference
synchronously.Reference
StorageReference
has been renamed toReference
.getParent()
is deprecated in favor of.parent
.getRoot()
is deprecated in favor of.root
.getStorage()
is deprecated in favor of.storage
.getBucket()
is deprecated in favor of.bucket
.getPath()
is deprecated in favor of.fullPath
.getName()
is deprecated in favor of.name
.list(options)
.ListOptions
API (see below).listAll()
.putString()
has been added to accept a string value, of type Base64, Base64Url, a Data URL or raw strings.Content-Type
metadata if not already set.getData()
does not require amaxSize
, it can now be called with a default of 10mb.NEW
ListOptions
The
list()
method accepts aListOptions
instance with the following arguments:maxResults
: limits the number of results returned from a call. Defaults to 1000.pageToken
: a page token returned from aListResult
- used if there are more items to query.NEW
ListResult
A
ListResult
class has been added, which is returned from a call tolist()
orlistAll()
. It exposes the following properties:items
(List<Reference>
): Returns the list of reference objects at the current reference location.prefixes
(List<Reference>
): Returns the list of reference sub-folders at the current reference location.nextPageToken
(String
): Returns a string (or null) if a next page during alist()
call exists.Tasks
Tasks have been overhauled to be closer to the expected Firebase Web SDK Storage API, allowing users to access and control on-going tasks easier. There are a number of breaking changes & features with this overhaul:
StorageUploadTask
has been renamed toUploadTask
(extendsTask
).StorageDownloadTask
has been renamed toDownloadTask
(extendsTask
).StorageTaskEvent
has been removed (see below).StorageTaskSnapshot
has been renamed toTaskSnapshot
.pause()
,cancel()
andresume()
are now Futures which return a boolean value to represent whether the status update was successful.void
methods but still carried out an asynchronous tasks, potentially leading to uncaught exceptions.isCanceled
,isComplete
,isInProgress
,isPaused
andisSuccessful
have now been removed. Instead you should subscribe to the stream (for paused/progress/complete/error events) or the taskFuture
for task completion/errors.events
stream (nowsnapshotEvents
) previously returned aStorageTaskEvent
, containing aStorageTaskEventType
andStorageTaskSnapshot
Instead, the stream now returns aTaskSnapshot
which includes thestate
.FirebaseException
instead of a new event.events
stream is deprecated in favor ofsnapshotEvents
.lastSnapshot
is deprecated in favor ofsnapshot
.Example
The new API matches the Web SDK API, for example:
Subscribing to Stream updates and/or the tasks delegating Future is optional - if you require progress updates on your task use the Stream, otherwise the Future will resolve once its complete. Using both together is also supported.
SettableMetadata
StorageMetadata
has been renamed toSettableMetadata
.getMetadata()
now returns aFullMetadata
instance vsStorageMetadata
.Related Issues & PRs
..and more (will be manually linked and closed following merge of this PR).
Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?