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

Switch to OKHttp #3163

Merged
merged 17 commits into from
Jun 19, 2019
Merged

Switch to OKHttp #3163

merged 17 commits into from
Jun 19, 2019

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Jun 17, 2019

Closes #2869

What has been done to verify that this works as intended?

Tests run locally and a quick play with the app on the emulator. Also ran the build through test lab as a precaution.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This should not effect users at all but as we're changing the backbone of the communication with Open Rosa servers it would be good to check Collect thoroughly against Aggregate/Central (and any other common Open Rosa servers).

Before submitting this PR, please make sure you have:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg marked this pull request as ready for review June 18, 2019 12:53
@seadowg
Copy link
Member Author

seadowg commented Jun 18, 2019

Ooooohhhh. Went to do one last commit to clean out the HttpClientConnection itself and it seems like we're still using the httpclientandroidlib dependency for the ContentType object.

I'll have a look at moving this out as I think it's best we don't leave the custom lib lying around.

@seadowg
Copy link
Member Author

seadowg commented Jun 18, 2019

Ok this looks good for testing now. Had to rework the CollectThenSystemContentTypeMapper somewhat so that stops that having to be saved for a rainy day!

String downloadListUrl = url != null ? url :
settings.getString(GeneralKeys.KEY_SERVER_URL,
Collect.getInstance().getString(R.string.default_server_url));

if (downloadListUrl.endsWith("/")) {
Copy link
Member

@lognaturel lognaturel Jun 18, 2019

Choose a reason for hiding this comment

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

The rationale for the while loop was presumably that since it's user input there could be multiple trailing /, as unlikely as that might seem. Did you change it because it just doesn't seem likely or is there another reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope that is a genuine mistake. I can look at putting that back in and make sure it's covered by a test so it doesn't get absentmindedly removed again by someone (like me).

@lognaturel
Copy link
Member

For a rainy day / good first issue, some of the types that Collect matches against are handled by the Android type mapper. It would be great for someone to go through and remove custom handling for those, I think.

@kkrawczyk123
Copy link
Contributor

I believe that tested with success here!
Verified on Androids: 4.2, 4.4, 5.1, 6.0, 7.0 and 8.1

List of verified cases:

  • Aggregate 2.0 download and send
  • Central download and send
  • Autosend Aggregate 2.0 and Central
  • 1000 submissions send to Aggregate
  • 1000 submissions send to Central
  • 1000 submissions send to Google sheet
  • Ona download and send
  • Ona autosend
  • Kobo download and send
  • Kobo autosend
  • Send the form with specified submission URL
  • Aggregate 1.7 download, send and autosend
  • Automatically download the upgraded version of the form
  • Download form from Google Drive
  • Send to Google Sheet
  • Autosend to Google Sheet
  • Autosend specified in form

@opendatakit-bot unlabel "needs testing"
@opendatakit-bot label "behavior verified"

@lognaturel
Copy link
Member

Thank you, @seadowg and @kkrawczyk123! Great to see httpclientandroidlib go.

@yanokwa, please see odk-x/httpclientandroidlib#2 which can be merged when the release goes out.

@seadowg seadowg deleted the ok-http branch June 20, 2019 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use OkHttpConnection rather than HttpClientConnection
4 participants