This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions:
1 - Could you split this operation into two lines (not replacing directly after
getString
) to improve readability;2 - Extract these string
localhost
and10.0.2.2
for constants then we can have a readable name for both;3 - I don't remember if we have the environment available in the Java part but it would be good to only apply this replace in development mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, HCP doesn't work in Android emulator without this. That's the only purpose of it, is to make HCP work in Android emulator.
The proposed change is a straight steal from this existing meteor code, which is solving the same problem:
https://github.com/meteor/meteor/blob/3051150f2f5ae953f391802e73682fba613b3d46/packages/boilerplate-generator/template-web.cordova.js#L42-L50
I can split the lines for readability and extract the strings as constants, but I don't know what the test would be for whether it's dev or not. Is there a standard test for that? I'm pretty sure it already can only impact dev, because the server won't be localhost in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm ok, if Meteor is already doing the same I believe this is safe. Please just update your code to have constants and let's move this forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool -- I extracted the constants and split the line into two.