Skip to content

Commit

Permalink
Fixes: nodejs#187 Ask for HTTP/HTTPS for non-prod builds
Browse files Browse the repository at this point in the history
  • Loading branch information
kunall17 committed Sep 30, 2016
1 parent a421cf7 commit 6c47173
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private void checkForError() {
// add http or https if scheme is not included
if (!serverURL.contains("://")) {
serverURL = httpScheme + "://" + serverURL;
showBackends(httpScheme, serverURL);
if (BuildConfig.DEBUG) showHTTPDialog(serverURL); //Ask for http or https if in non-prod builds otherwise if in prod then use https
else showBackends(httpScheme, serverURL);
} else {
Uri serverUri = Uri.parse(serverURL);

Expand Down Expand Up @@ -227,7 +228,7 @@ public void onFailure(Call<ZulipBackendResponse> call, Throwable t) {
private void showHTTPDialog(final String serverURL) {
new AlertDialog.Builder(this)
.setTitle(R.string.http_or_https)
.setMessage(R.string.http_message)
.setMessage(((BuildConfig.DEBUG) ? R.string.http_message_debug : R.string.http_message))
.setPositiveButton(R.string.use_https, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<string name="menu_today">Today</string>
<string name="http_or_https">HTTP/HTTPS</string>
<string name="http_message">HTTP is insecure, and we recommend using it only for testing the Zulip Android app against a development environment. Are you sure you want to use HTTP?</string>
<string name="http_message_debug">Which scheme you would like to use HTTP or HTTPS?</string>
<string name="use_https">Use HTTPS</string>
<string name="use_http">Use HTTP</string>
<string name="empty_list">Sorry, no messages here.</string>
Expand Down

0 comments on commit 6c47173

Please sign in to comment.