check if account is online before doing smp
This commit is contained in:
parent
52ca2e7391
commit
f1e2be4096
|
@ -50,30 +50,34 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer
|
||||||
private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() {
|
private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
|
if (isAccountOnline()) {
|
||||||
final String question = mSharedSecretHint.getText().toString();
|
final String question = mSharedSecretHint.getText().toString();
|
||||||
final String secret = mSharedSecretSecret.getText().toString();
|
final String secret = mSharedSecretSecret.getText().toString();
|
||||||
if (!initSmp(question,secret)) {
|
initSmp(question, secret);
|
||||||
Toast.makeText(getApplicationContext(),"smp failed",Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private View.OnClickListener mCancelSharedSecretListener = new View.OnClickListener() {
|
private View.OnClickListener mCancelSharedSecretListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if (isAccountOnline()) {
|
||||||
abortSmp();
|
abortSmp();
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() {
|
private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if (isAccountOnline()) {
|
||||||
final String question = mSharedSecretHint.getText().toString();
|
final String question = mSharedSecretHint.getText().toString();
|
||||||
final String secret = mSharedSecretSecret.getText().toString();
|
final String secret = mSharedSecretSecret.getText().toString();
|
||||||
respondSmp(question,secret);
|
respondSmp(question, secret);
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private View.OnClickListener mRetrySharedSecretListener = new View.OnClickListener() {
|
private View.OnClickListener mRetrySharedSecretListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,6 +142,15 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isAccountOnline() {
|
||||||
|
if (this.mAccount.getStatus() != Account.STATUS_ONLINE) {
|
||||||
|
Toast.makeText(this,R.string.not_connected_try_again,Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean handleIntent(Intent intent) {
|
protected boolean handleIntent(Intent intent) {
|
||||||
if (intent.getAction().equals(ACTION_VERIFY_CONTACT)) {
|
if (intent.getAction().equals(ACTION_VERIFY_CONTACT)) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue