display toast on pgp error
This commit is contained in:
parent
ea1e4c773d
commit
28dc888159
|
@ -256,7 +256,7 @@ public class PgpEngine {
|
||||||
account);
|
account);
|
||||||
return;
|
return;
|
||||||
case OpenPgpApi.RESULT_CODE_ERROR:
|
case OpenPgpApi.RESULT_CODE_ERROR:
|
||||||
callback.error(R.string.openpgp_error, account);
|
callback.error(R.string.unable_to_connect_to_keychain, account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -452,7 +452,12 @@ public class XmppConnectionService extends Service {
|
||||||
getFileBackend().copyFileToPrivateStorage(message, uri);
|
getFileBackend().copyFileToPrivateStorage(message, uri);
|
||||||
getFileBackend().updateFileParams(message);
|
getFileBackend().updateFileParams(message);
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
||||||
getPgpEngine().encrypt(message, callback);
|
final PgpEngine pgpEngine = getPgpEngine();
|
||||||
|
if (pgpEngine != null) {
|
||||||
|
pgpEngine.encrypt(message, callback);
|
||||||
|
} else if (callback != null){
|
||||||
|
callback.error(R.string.unable_to_connect_to_keychain, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
}
|
}
|
||||||
|
@ -492,7 +497,12 @@ public class XmppConnectionService extends Service {
|
||||||
try {
|
try {
|
||||||
getFileBackend().copyImageToPrivateStorage(message, uri);
|
getFileBackend().copyImageToPrivateStorage(message, uri);
|
||||||
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) {
|
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) {
|
||||||
getPgpEngine().encrypt(message, callback);
|
final PgpEngine pgpEngine = getPgpEngine();
|
||||||
|
if (pgpEngine != null) {
|
||||||
|
pgpEngine.encrypt(message, callback);
|
||||||
|
} else if (callback != null){
|
||||||
|
callback.error(R.string.unable_to_connect_to_keychain, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,7 +541,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(int error, Contact contact) {
|
public void error(int error, Contact contact) {
|
||||||
displayErrorDialog(error);
|
replaceToast(getString(error));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (mode == Conversation.MODE_MULTI && conversation.getMucOptions().pgpKeysInUse()) {
|
} else if (mode == Conversation.MODE_MULTI && conversation.getMucOptions().pgpKeysInUse()) {
|
||||||
|
@ -1465,8 +1465,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(int errorCode, Message message) {
|
public void error(int errorCode, Message message) {
|
||||||
hidePrepareFileToast(prepareFileToast);
|
replaceToast(getString(errorCode));
|
||||||
displayErrorDialog(errorCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1498,8 +1497,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(int error, Message message) {
|
public void error(int error, Message message) {
|
||||||
hidePrepareFileToast(prepareFileToast);
|
replaceToast(getString(error));
|
||||||
displayErrorDialog(error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue