Skip to content

Adding Custom-Time to Firebase Storage #9576

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

Merged
merged 1 commit into from
Apr 13, 2022
Merged

Adding Custom-Time to Firebase Storage #9576

merged 1 commit into from
Apr 13, 2022

Conversation

nathanfallet
Copy link

Hey there! So you want to contribute to a Firebase SDK?
Before you file this pull request, please read these guidelines:

Discussion

  • Read the contribution guidelines (CONTRIBUTING.md).
  • If this has been discussed in an issue, make sure to link to the issue here.
    If not, go file an issue about this before creating a pull request to discuss.

Fixes #9575

Testing

  • Make sure all existing tests in the repository pass after your change.
  • If you fixed a bug or added a feature, add a new test to cover your code.

API Changes

  • At this time we cannot accept changes that affect the public API. If you'd like to help
    us make Firebase APIs better, please propose your change in a feature request so that we
    can discuss it together.

@nathanfallet
Copy link
Author

@tonyjhuang
Copy link

Thanks for the PR! LGTM, can you add a test

@nathanfallet
Copy link
Author

@tonyjhuang It should be okay, tests are passing in Xcode
image

@morganchen12
Copy link
Contributor

Tony/Sebastian, do we need to go through internal API review for this (also, do we need to add this to web and Android)?

@tonyjhuang
Copy link

Yes, filed b/228219437 to track the internal review. AFAICT this would be the first SDK to have support for this field, so there is some work to port it to Android & web.

@nathanfallet
Copy link
Author

I thought it was sad that this field was not available in the sdk, and it can be useful (for example my goal is to update the custom time to allow the file to be deleted by a cloud storage rule later, and better than file age that I currently use, which is fixed for all files).
If needed, I'm ready to make a PR for Android. However for the web, I don't have enough knowledge to do it.

@paulb777
Copy link
Member

paulb777 commented Apr 5, 2022

The associated API review is available internally at go/firebase-storage-ios-custom-time

@tonyjhuang
Copy link

tonyjhuang commented Apr 5, 2022

Thanks Nathan, just to be clear, Android and web are not blockers to getting this PR merged in. We at Firebase have an internal review process any time our public API (aka our SDK surface) is changed, so I've filed one just for the iOS sdk, which we will need to wait for approvals on before merging this PR. The turnaround is typically O(1 week) but can take longer in some cases.

That being said, if you're able to add this to our Android sdk, I'd be more than happy to review that and help get it submitted as well.

@paulb777 paulb777 requested a review from ryanwilson April 12, 2022 16:16
@ryanwilson
Copy link
Member

Thanks for the PR @nathanfallet! We've done some pretty large refactoring around Storage this release - sorry about that. These files have moved to FirebaseStorageInternal. Do you mind moving these changes there? I'm happy to do so if you'd prefer.

After that, the new API will need to be added to the Swift public API: https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseStorage/Sources/StorageMetadata.swift

Thanks, let me know if you're able to do so or want me or someone else on the team to tackle this. Cheers!

@nathanfallet
Copy link
Author

@ryanwilson Okay I will update my PR to match the refactoring around Storage

@nathanfallet nathanfallet reopened this Apr 13, 2022
@nathanfallet
Copy link
Author

@ryanwilson Same changes have been applied to the current master branch.

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks, will make sure the tests pass and merge afterwards.

@paulb777 paulb777 added this to the Firebase 9 milestone Apr 13, 2022
@ryanwilson
Copy link
Member

Merging now. cc @tonyjhuang

@ryanwilson ryanwilson merged commit 071902b into firebase:master Apr 13, 2022
@paulb777
Copy link
Member

The PR is breaking the updateMetadata2 test in all the integration tests (which don't run in forked PRs because of needing credentials).

It seems that the updateMetadata API loses the customTime on the round trip in the Metadata Task enqueue. It's encoded here, but is not part of the decoded NSDictionary here.

cc: @ryanwilson @tonyjhuang

@nathanfallet
Copy link
Author

So it's a problem coming from the server API? Or it's something I forgot in my changes in the iOS SDK?

@ryanwilson
Copy link
Member

Hmm, yeah my guess is it's not being sent by the backend. That method you pointed to @paulb777 is just a convenience method to save a few lines of code:

+ (nullable instancetype)frs_dictionaryFromJSONData:(nullable NSData *)data {
if (!data) {
return nil;
}
return [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:nil];
}

@paulb777
Copy link
Member

Yep, I understand it's a convenience method - it's just much easier to read dictionary's in the debugger than NSData's.

@paulb777
Copy link
Member

Added #9652 to revert until we sort out the integration test issues and backend behavior.

paulb777 added a commit that referenced this pull request Apr 14, 2022
@firebase firebase locked and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Custom Time support in Firebase Cloud Storage Metadata
6 participants