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 For Android Device Connection To Firestore #17449

Closed
wants to merge 4 commits into from

Conversation

samsafay
Copy link
Contributor

@samsafay samsafay commented Jan 4, 2018

Motivation

React Native had an underlying problem connecting to Firestore (Google's latest database) from Android devices. You can follow the issue here.
The main problem was in NetworkingModule.java. I have already explained it on the commit a55fe37.

Test Plan

In this video, I am showing how the react native behaved before adding the new fix and how it worked after the new fix added. The new fix starts at 50 seconds.

Release Notes

[ANDROID] [BUGFIX] [FIRESTORE][XMLHttpRequest][ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java] - Fixes the connection to Firestore by following whatwg.org's XMLHttpRequest send() method

This commit is based on a suggestion made by a Firebase member facebook#17083.
Longer timers are used in critical parts of Firebase-SDK such as refreshing the token; Its a bad user experience if the token expires and users need to keep login to the application! We appreciate your cooperation.
The following change is suggested by a Firebase member here. firebase/firebase-js-sdk#283
It follows the whatwg.org's send method guidelines. https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
At the section 3 of 4.5.6, it is suggests to check for the GET or HEAD methods, for every XMLHttpRequest send() method, then set the body to null if it is true.
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@pull-bot
Copy link

pull-bot commented Jan 4, 2018

Warnings
⚠️

🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

⚠️

❗ Big PR - This PR is extremely unlikely to get reviewed because it touches 75769 lines.

Attention: @shergin, @mhorowitz, @janicduplessis, @hramos, @grabbou, @Kureev

Generated by 🚫 dangerJS

@facebook-github-bot facebook-github-bot 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 Jan 4, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

'performance and correctness issue on Android as it keeps the timer ' +
'module awake, and timers can only be called when the app is in the foreground. ' +
'See https://github.com/facebook/react-native/issues/12981 for more info.';
const ANDROID_LONG_TIMER_MESSAGE = '(ADVICE)';

Choose a reason for hiding this comment

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

I think you may want to keep the message and just prefix as "(ADVICE) Setting a timer ..." I believe that means it'll get logged to the console but won't show up in your app with the yellow warning box.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly couldn't justify the need of it being logged to the console, that's why i deleted it; I think we may have to submit two seperate PRs, since these commits are kind of mutually exclusive, even though I initially thought they are related! Lets wait until they get back to us...

@facebook-github-bot
Copy link
Contributor

@samsafay I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@samsafay
Copy link
Contributor Author

samsafay commented Feb 5, 2018

@janicduplessis Can you take a look at this commit?

@janicduplessis
Copy link
Contributor

The PR is in a weird state, could you fix it or just reopen a new one?

@samsafay
Copy link
Contributor Author

@janicduplessis I am going to reopen a new one, just disregard this one.

@samsafay samsafay closed this Feb 11, 2018
@samsafay
Copy link
Contributor Author

@janicduplessis I have added a new PR here #17940. Sorry for the confusion!

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.

6 participants