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

Commit bd3edaf

Browse files
committed
On successful Login start ZulipActivity
1 parent 6c2e48d commit bd3edaf

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,26 @@ public void onClick(View v) {
6969
((EditText) findViewById(R.id.username))
7070
.getText().toString(),
7171
((EditText) findViewById(R.id.password))
72-
.getText().toString());
72+
.getText().toString(),serverUrlText.getText().toString(), startedFromAddRealm, realmNameET.getText().toString());
7373
// Remove the CPD when done
7474
alog.setCallback(new AsyncTaskCompleteListener() {
7575
@Override
7676
public void onTaskComplete(String result) {
7777
connectionProgressDialog.dismiss();
78+
if(startedFromAddRealm){
79+
try {
80+
JSONObject jsonObject = new JSONObject(result);
81+
Intent intent = new Intent(LoginActivity.this, ZulipActivity.class);
82+
intent.putExtra("username", ((EditText) findViewById(R.id.username)).getText().toString());
83+
intent.putExtra("realmName", ((EditText) findViewById(R.id.realmName)).getText().toString());
84+
intent.putExtra("server", serverUrlText.getText().toString());
85+
intent.putExtra("api_key", jsonObject.getString("api_key"));
86+
setResult(Activity.RESULT_OK, intent);
87+
finish();
88+
} catch (JSONException e) {
89+
e.printStackTrace();
90+
}
91+
}
7892
}
7993

8094
@Override
@@ -182,7 +196,7 @@ public void authWithGapps() {
182196
this.app.getEmail(), scope);
183197
// Send token to the server to exchange for an API key
184198
final AsyncLogin loginTask = new AsyncLogin(that,
185-
"google-oauth2-token", token);
199+
"google-oauth2-token", token, serverUrlText.getText().toString(), startedFromAddRealm, realmNameET.getText().toString());
186200
loginTask.setCallback(new AsyncTaskCompleteListener() {
187201
@Override
188202
public void onTaskComplete(String result) {

0 commit comments

Comments
 (0)