display toast on openpgp status retrieval error

This commit is contained in:
Vincent Breitmoser 2017-04-12 00:19:56 +02:00
parent 0b4c1b2115
commit fb9200d2e3
3 changed files with 12 additions and 2 deletions

View file

@ -320,6 +320,10 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener
Toast.makeText(activity, R.string.error_contact_address_not_found, Toast.LENGTH_LONG).show(); Toast.makeText(activity, R.string.error_contact_address_not_found, Toast.LENGTH_LONG).show();
} }
public void showErrorOpenPgpRetrieveStatus() {
Toast.makeText(activity, R.string.error_recipient_crypto_retrieve, Toast.LENGTH_LONG).show();
}
public void showErrorOpenPgpConnection() { public void showErrorOpenPgpConnection() {
Toast.makeText(activity, R.string.error_crypto_provider_connect, Toast.LENGTH_LONG).show(); Toast.makeText(activity, R.string.error_crypto_provider_connect, Toast.LENGTH_LONG).show();
} }

View file

@ -19,7 +19,6 @@ import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting; import android.support.annotation.VisibleForTesting;
import android.text.TextUtils; import android.text.TextUtils;
import timber.log.Timber;
import android.view.Menu; import android.view.Menu;
import com.fsck.k9.Account; import com.fsck.k9.Account;
@ -29,6 +28,7 @@ import com.fsck.k9.R;
import com.fsck.k9.activity.compose.ComposeCryptoStatus.AttachErrorState; import com.fsck.k9.activity.compose.ComposeCryptoStatus.AttachErrorState;
import com.fsck.k9.activity.compose.ComposeCryptoStatus.ComposeCryptoStatusBuilder; import com.fsck.k9.activity.compose.ComposeCryptoStatus.ComposeCryptoStatusBuilder;
import com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState; import com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState;
import com.fsck.k9.activity.compose.RecipientMvpView.CryptoStatusDisplayType;
import com.fsck.k9.helper.Contacts; import com.fsck.k9.helper.Contacts;
import com.fsck.k9.helper.MailTo; import com.fsck.k9.helper.MailTo;
import com.fsck.k9.helper.ReplyToParser; import com.fsck.k9.helper.ReplyToParser;
@ -47,6 +47,7 @@ import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpApi.PermissionPingCallback; import org.openintents.openpgp.util.OpenPgpApi.PermissionPingCallback;
import org.openintents.openpgp.util.OpenPgpServiceConnection; import org.openintents.openpgp.util.OpenPgpServiceConnection;
import org.openintents.openpgp.util.OpenPgpServiceConnection.OnBound; import org.openintents.openpgp.util.OpenPgpServiceConnection.OnBound;
import timber.log.Timber;
public class RecipientPresenter implements PermissionPingCallback { public class RecipientPresenter implements PermissionPingCallback {
@ -392,7 +393,11 @@ public class RecipientPresenter implements PermissionPingCallback {
@Override @Override
protected void onPostExecute(ComposeCryptoStatus composeCryptoStatus) { protected void onPostExecute(ComposeCryptoStatus composeCryptoStatus) {
cachedCryptoStatus = composeCryptoStatus; cachedCryptoStatus = composeCryptoStatus;
recipientMvpView.showCryptoStatus(composeCryptoStatus.getCryptoStatusDisplayType()); CryptoStatusDisplayType cryptoStatusDisplayType = composeCryptoStatus.getCryptoStatusDisplayType();
if (cryptoStatusDisplayType == CryptoStatusDisplayType.ERROR) {
recipientMvpView.showErrorOpenPgpRetrieveStatus();
}
recipientMvpView.showCryptoStatus(cryptoStatusDisplayType);
recipientMvpView.showCryptoSpecialMode(composeCryptoStatus.getCryptoSpecialModeDisplayType()); recipientMvpView.showCryptoSpecialMode(composeCryptoStatus.getCryptoSpecialModeDisplayType());
} }
}.execute(); }.execute();

View file

@ -1241,4 +1241,5 @@ Please submit bug reports, contribute new features and ask questions at
<string name="mail_list_widget_loading">Loading messages…</string> <string name="mail_list_widget_loading">Loading messages…</string>
<string name="fetching_folders_failed">Fetching folder list failed</string> <string name="fetching_folders_failed">Fetching folder list failed</string>
<string name="messageview_crypto_warning_details">Show Details</string> <string name="messageview_crypto_warning_details">Show Details</string>
<string name="error_recipient_crypto_retrieve">Error retrieving recipient status from OpenPGP provider!</string>
</resources> </resources>