Skip to content
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

fix(Storage): AL (asset library) methodology deprecated since iOS 8 #4054

Merged
merged 8 commits into from
Aug 15, 2020

Conversation

russellwheatley
Copy link
Member

@russellwheatley russellwheatley commented Aug 5, 2020

Description

This PR stems from the deprecation of the AL (asset library) URL methodology for iOS that started in iOS 8, and now appears to be defunct in iOS 13.

The Storage package relies on this method to fetch a local asset using the AL methodology. This method now returns a Nil object that was the probable cause for app crashes in #2762 & #4032.

This PR ensures any Nil objects resulting from the defunct AL methodology ought to safely return an error message to JS side.

Related issues

#2762
#4032

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

@russellwheatley russellwheatley changed the title fix(Storage): AL lib deprecated iOS 8 > fix(Storage): AL (asset library) methodology deprecated since iOS 8 Aug 5, 2020
@mikehardy
Copy link
Collaborator

not reviewing (per request not to) but this also caused a build failure on one of the other os as well (catalyst I think?) because it's so dead-dead :-)

@russellwheatley
Copy link
Member Author

@mikehardy Yeah, I took a look at that issue when making this PR, it partly affects the same area of code!

@russellwheatley russellwheatley marked this pull request as ready for review August 7, 2020 12:34
@@ -57,16 +57,16 @@ + (PHAsset *)fetchAssetForPath:(NSString *)localFilePath {
if ([localFilePath hasPrefix:@"assets-library://"] || [localFilePath hasPrefix:@"ph://"]) {
if ([localFilePath hasPrefix:@"assets-library://"]) {
NSURL *localFile = [[NSURL alloc] initWithString:localFilePath];
#if TARGET_OS_MACCATALYST
Copy link
Collaborator

Choose a reason for hiding this comment

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

@andymatuschak or @brunolemos - both of you are interested in this working on mac catalyst, can you confirm this change won't be a regression for you? We're trying to remove the AL APIs entirely and this is an intermediate step, but I'm not sure if the @available check is strong enough vs the #if TARGET_nnn test

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Mike, if the catalyst build passes that's good enough for my case. I don't think I use this specific feature related to this code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay - that's the hard part, I'm not sure it does - we don't have CI coverage of a catalyst build (yet) and none of us are currently targeting that platform personally, so it's untested as of yet. I have some action items related to that, but @brunolemos if you have any links to good docs on how to target react-native at catalyst that would help me cover it in CI to prove this works and keep it squared away for the future

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for checking. This'll be fine!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay great - thanks a ton for giving it a look @andymatuschak - I'll mark this for merge+release then, and of course if I/we are wrong about it I'll be listening and we'll get it fixed up so catalyst works. Cheers

@mikehardy
Copy link
Collaborator

I'm inclined to merge this but I asked for a targetted review from the 2 known-interested catalyst folks. If I don't hear back I'll merge but hopefully one or both gives a thumbs up :-)

@mikehardy mikehardy added Workflow: Needs Review Pending feedback or review from a maintainer. Workflow: Waiting for User Response Blocked waiting for user response. impact: build-error Behaviour causing build failure platform: ios plugin: storage Firebase Cloud Storage labels Aug 14, 2020
Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM and confirmed with catalyst users it should work for them, sweet

@mikehardy mikehardy removed Workflow: Needs Review Pending feedback or review from a maintainer. Workflow: Waiting for User Response Blocked waiting for user response. labels Aug 14, 2020
@mikehardy mikehardy merged commit bf3b252 into master Aug 15, 2020
@mikehardy mikehardy deleted the @russell/storage-bug branch August 15, 2020 01:56
androidIsForVivek pushed a commit to androidIsForVivek/react-native-firebase that referenced this pull request Aug 9, 2021
…nvertase#4054)

* fix(Storage): AL lib deprecated iOS 8 >
* chore(Storage, iOS): improve warning message

Co-authored-by: Mike Diarmid <[email protected]>
Co-authored-by: Mike Hardy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: build-error Behaviour causing build failure platform: ios plugin: storage Firebase Cloud Storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants