use of com.fsck.k9.activity.compose.RecipientPresenter.CryptoProviderState in project k-9 by k9mail.
the class RecipientPresenter method getCurrentCryptoStatus.
public ComposeCryptoStatus getCurrentCryptoStatus() {
if (cachedCryptoStatus == null) {
ComposeCryptoStatusBuilder builder = new ComposeCryptoStatusBuilder().setCryptoProviderState(cryptoProviderState).setCryptoMode(currentCryptoMode).setEnablePgpInline(cryptoEnablePgpInline).setRecipients(getAllRecipients());
long accountCryptoKey = account.getCryptoKey();
if (accountCryptoKey != Account.NO_OPENPGP_KEY) {
// TODO split these into individual settings? maybe after key is bound to identity
builder.setSigningKeyId(accountCryptoKey);
builder.setSelfEncryptId(accountCryptoKey);
}
cachedCryptoStatus = builder.build();
}
return cachedCryptoStatus;
}
use of com.fsck.k9.activity.compose.RecipientPresenter.CryptoProviderState in project k-9 by k9mail.
the class PgpMessageBuilderTest method build__withCryptoProviderNotOk__shouldThrow.
@Test
public void build__withCryptoProviderNotOk__shouldThrow() throws MessagingException {
cryptoStatusBuilder.setCryptoMode(CryptoMode.SIGN_ONLY);
CryptoProviderState[] cryptoProviderStates = { CryptoProviderState.LOST_CONNECTION, CryptoProviderState.UNCONFIGURED, CryptoProviderState.UNINITIALIZED, CryptoProviderState.ERROR };
for (CryptoProviderState state : cryptoProviderStates) {
cryptoStatusBuilder.setCryptoProviderState(state);
pgpMessageBuilder.setCryptoStatus(cryptoStatusBuilder.build());
Callback mockCallback = mock(Callback.class);
pgpMessageBuilder.buildAsync(mockCallback);
verify(mockCallback).onMessageBuildException(any(MessagingException.class));
verifyNoMoreInteractions(mockCallback);
}
}
Aggregations