@@ -69,12 +69,26 @@ public void onClick(View v) {
69
69
((EditText ) findViewById (R .id .username ))
70
70
.getText ().toString (),
71
71
((EditText ) findViewById (R .id .password ))
72
- .getText ().toString ());
72
+ .getText ().toString (), serverUrlText . getText (). toString (), startedFromAddRealm , realmNameET . getText (). toString () );
73
73
// Remove the CPD when done
74
74
alog .setCallback (new AsyncTaskCompleteListener () {
75
75
@ Override
76
76
public void onTaskComplete (String result ) {
77
77
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
+ }
78
92
}
79
93
80
94
@ Override
@@ -182,7 +196,7 @@ public void authWithGapps() {
182
196
this .app .getEmail (), scope );
183
197
// Send token to the server to exchange for an API key
184
198
final AsyncLogin loginTask = new AsyncLogin (that ,
185
- "google-oauth2-token" , token );
199
+ "google-oauth2-token" , token , serverUrlText . getText (). toString (), startedFromAddRealm , realmNameET . getText (). toString () );
186
200
loginTask .setCallback (new AsyncTaskCompleteListener () {
187
201
@ Override
188
202
public void onTaskComplete (String result ) {
0 commit comments