Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit f6c2258

Browse files
Sam1301timabbott
authored andcommitted
Hide 'api/' from user during login.
Remove 'api/' from server url EditText as api.zulip.com does not exist anymore.
1 parent a5b9440 commit f6c2258

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/src/main/java/com/zulip/android/activities/LoginActivity.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,17 @@ private void showBackends(String httpScheme, String serverURL) {
197197

198198
serverUri = serverUri.buildUpon().scheme(httpScheme).build();
199199

200-
// if does not begin with "api.zulip.com" and if the path is empty, use "/api" as first segment in the path
201-
List<String> paths = serverUri.getPathSegments();
202-
if (!serverUri.getHost().startsWith("api.") && paths.isEmpty()) {
203-
serverUri = serverUri.buildUpon().appendEncodedPath("api/").build();
204-
}
200+
// display server url with http scheme used
205201
serverIn.setText(serverUri.toString());
206202
mServerEditText.setText(serverUri.toString());
207203
mServerEditText.setEnabled(false);
204+
205+
// if server url does not end with "api/" or if the path is empty, use "/api" as last segment in the path
206+
List<String> paths = serverUri.getPathSegments();
207+
if (paths.isEmpty() || !paths.get(paths.size() - 1).equals("api")) {
208+
serverUri = serverUri.buildUpon().appendEncodedPath("api/").build();
209+
}
210+
208211
((ZulipApp) getApplication()).setServerURL(serverUri.toString());
209212

210213
// create new zulipServices object every time by setting it to null

0 commit comments

Comments
 (0)