Skip to content

Conversation

rigdern
Copy link
Contributor

@rigdern rigdern commented May 27, 2016

This PR depends on Fresco PR facebook/fresco#1459

Allows developers to specify headers to include in the HTTP request when fetching a remote image. For example, one might leverage this when fetching an image from an endpoint that requires authentication:

<Image
  style={styles.logo}
  source={{
    uri: 'http://facebook.github.io/react/img/logo_og.png',
    headers: {
      Authorization: 'someAuthToken'
    }
  }}
/>

Note that the header values must be strings.

Related to PR #7338 which is for the iOS implementation.

Test plan (required)

  • Ran a small example like the one above and ensured the headers were sent to the server.
  • Ran a small example to ensure that components without headers still work.
  • Currently using this code in our app.

Adam Comella
Microsoft Corp.

@ghost
Copy link

ghost commented May 27, 2016

By analyzing the blame information on this pull request, we identified @foghina and @brentvatne to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels May 27, 2016
@nicklockwood
Copy link
Contributor

cc: @dmmiller - we merged the iOS version of this last week, so it would be great to get Android support landed too!

@@ -99,8 +99,8 @@ private static ImagePipelineConfig getDefaultConfig(
}

OkHttpClient okHttpClient = OkHttpClientProvider.getOkHttpClient();
ImagePipelineConfig.Builder builder =
OkHttpImagePipelineConfigFactory.newBuilder(context.getApplicationContext(), okHttpClient);
Copy link

Choose a reason for hiding this comment

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

I think you can remove the import for OkHttpImagePipelineConfigFactory.

@dmmiller
Copy link

dmmiller commented Jun 6, 2016

Few questions inline, seems good to me, but also ccing @andreicoman11 who has been looking at the image fetching code lately.

@dmmiller
Copy link

dmmiller commented Jun 6, 2016

@rigdern Looking at this, I think it would be better to add this capability first to Fresco (also open source) and then we can pull the update into RN. I'd rather not create an additional copy of a random Fresco file for just this. It seems like you can add the addHeader call when Fresco builds the request pretty easily, and then we can take this more easily.

@ghost
Copy link

ghost commented Jul 6, 2016

@rigdern do you have any updates for this pull request? It's been a while since the last update so wanted to check in and see if you've looked at the requested changes.

@rigdern
Copy link
Contributor Author

rigdern commented Jul 6, 2016

Thanks for checking in and sorry for the delay. I've been busy with some other stuff but I plan on making the requested changes soon.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 12, 2016
@ospfranco
Copy link
Contributor

Any word on when will this be merged?

@ospfranco
Copy link
Contributor

Can somebody else take over this ticket and finish the android integration? @dmmiller @andreicoman11 @rigdern

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2016
@rigdern
Copy link
Contributor Author

rigdern commented Aug 30, 2016

@ospfranco I apologize I haven't been able to finish this PR yet. Based on the earlier discussion in this PR, part of my change needs to be redone within the Fresco repo. Before I can do that, I need to wait for an internal request to be approved which will ensure I can safely contribute to the Fresco project.

Adam Comella
Microsoft Corp.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2016
@ospfranco
Copy link
Contributor

I understand, thanks @rigdern looking forward to having this released

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 6, 2016
@rigdern rigdern force-pushed the rigdern/image-headers-android branch from b888fa1 to c74001d Compare September 7, 2016 00:34
@facebook-github-bot
Copy link
Contributor

@rigdern updated the pull request - view changes

@rigdern
Copy link
Contributor Author

rigdern commented Sep 7, 2016

@dmmiller I moved some of the functionality into Fresco (PR facebook/fresco#1459). I also pushed an update to this PR which consumes the new Fresco feature. Before this PR can be merged, we'll have to get the Fresco PR merged and then update React Native to depend on that version of Fresco.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 7, 2016
@rigdern rigdern force-pushed the rigdern/image-headers-android branch from c7428d4 to c104038 Compare February 2, 2017 04:50
@rigdern
Copy link
Contributor Author

rigdern commented Feb 2, 2017

@AndrewJack thanks for the suggestion. I updated to Fresco 1.0.1 and fixed the buck compilation errors. Let's see if the CI system is happy.

@mkonicek
Copy link
Contributor

mkonicek commented Feb 6, 2017

@rigdern Tells me this has been reviewed and should be merged.

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Feb 6, 2017
@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@facebook-github-bot facebook-github-bot added Import Failed Import Started This pull request has been imported. This does not imply the PR has been approved. and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2017
@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@facebook-github-bot facebook-github-bot removed the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 7, 2017
@mobinni
Copy link

mobinni commented Feb 13, 2017

Maybe we should update to 1.0.1, since it solves EXIF problems:
facebook/fresco#1558

@rigdern

@rigdern
Copy link
Contributor Author

rigdern commented Feb 13, 2017

@mobinni Thanks, the PR was already updated to Fresco 1.0.1.

@robinvw1
Copy link

Also would like to see this getting merged, since it already works on iOS. 👍

facebook-github-bot pushed a commit that referenced this pull request Feb 18, 2017
Summary:
A copy of #7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for #7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.

(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)

Will try to keep attribution (git blame) to rigdern when merging.
Closes #12448

Differential Revision: D4584743

Pulled By: mkonicek

fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
@mkonicek
Copy link
Contributor

mkonicek commented Feb 18, 2017

I merged this as #12448. The code is in master now, although my attempt failed to edit the commit message in Phabricator to make the code blame to @rigdern. Sorry about that! Hopefully the good news this is merged will outweigh the fact I messed up the attribution!

@mkonicek mkonicek closed this Feb 18, 2017
@rigdern
Copy link
Contributor Author

rigdern commented Feb 19, 2017

@mkonicek No worries. Thanks for getting this merged!

@Traubenfuchs
Copy link

When will this be available via npm?

GaborWnuk pushed a commit to GaborWnuk/react-native that referenced this pull request Feb 28, 2017
Summary:
A copy of facebook#7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for facebook#7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.

(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)

Will try to keep attribution (git blame) to rigdern when merging.
Closes facebook#12448

Differential Revision: D4584743

Pulled By: mkonicek

fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
dudeinthemirror pushed a commit to dudeinthemirror/react-native that referenced this pull request Mar 1, 2017
Summary:
A copy of facebook#7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for facebook#7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.

(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)

Will try to keep attribution (git blame) to rigdern when merging.
Closes facebook#12448

Differential Revision: D4584743

Pulled By: mkonicek

fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
@rigdern
Copy link
Contributor Author

rigdern commented Mar 1, 2017

@Traubenfuchs Here's a description of React Native's release cadence: http://facebook.github.io/react-native/blog/2017/01/07/monthly-release-cadence.html.

Based on that, my assumption is that this change will be available in the March (0.43) version of React Native. This means you can get a release candidate containing this change at the beginning of March and a stable release containing this change at the end of March.

dudeinthemirror pushed a commit to dudeinthemirror/react-native that referenced this pull request Mar 1, 2017
Summary:
A copy of facebook#7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for facebook#7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.

(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)

Will try to keep attribution (git blame) to rigdern when merging.
Closes facebook#12448

Differential Revision: D4584743

Pulled By: mkonicek

fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
@gayancliyanage
Copy link

Can any please update of the current status of this feature? @mkonicek @rigdern

@rigdern
Copy link
Contributor Author

rigdern commented Aug 1, 2017

@gayancliyanage looking at this PR's history, this PR was closed in favor of PR #12448 by mkonicek. Looking at that PR, it was merged as commit 8c0e6ec. And looking at that commit, we can see the first stable release of React Native to include that commit is 0.43:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.