Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 146914a9 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

Properly label button for missing keys

parent 0c620944
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -79,6 +79,17 @@ public class CryptoInfoDialog extends DialogFragment {
                    ((OnClickShowCryptoKeyListener) frag).onClickShowSecurityWarning();
                }
            });
        } else if (displayStatus.isUnknownKey()) {
            b.setNeutralButton(R.string.crypto_info_search_key, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    Fragment frag = getTargetFragment();
                    if (! (frag instanceof OnClickShowCryptoKeyListener)) {
                        throw new AssertionError("Displaying activity must implement OnClickShowCryptoKeyListener!");
                    }
                    ((OnClickShowCryptoKeyListener) frag).onClickSearchKey();
                }
            });
        } else if (displayStatus.hasAssociatedKey()) {
            int buttonLabel = displayStatus.isUnencryptedSigned() ?
                    R.string.crypto_info_view_signer : R.string.crypto_info_view_sender;
@@ -124,5 +135,6 @@ public class CryptoInfoDialog extends DialogFragment {
    public interface OnClickShowCryptoKeyListener {
        void onClickShowCryptoKey();
        void onClickShowSecurityWarning();
        void onClickSearchKey();
    }
}
+2 −5
Original line number Diff line number Diff line
@@ -107,9 +107,6 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
            case LOADING:
                // no need to do anything, there is a progress bar...
                break;
            case UNENCRYPTED_SIGN_UNKNOWN:
                launchPendingIntent(cryptoResultAnnotation);
                break;
            default:
                displayCryptoInfoDialog(displayStatus);
                break;
@@ -136,9 +133,9 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
                displayStatus, cryptoResultAnnotation.hasOpenPgpInsecureWarningPendingIntent());
    }

    private void launchPendingIntent(CryptoResultAnnotation cryptoResultAnnotation) {
    void onClickSearchKey() {
        try {
            PendingIntent pendingIntent = cryptoResultAnnotation.getOpenPgpPendingIntent();
            PendingIntent pendingIntent = cryptoResultAnnotation.getOpenPgpSigningKeyIntentIfAny();
            if (pendingIntent != null) {
                messageCryptoMvpView.startPendingIntentForCryptoPresenter(
                        pendingIntent.getIntentSender(), REQUEST_CODE_UNKNOWN_KEY, null, 0, 0, 0);
+5 −0
Original line number Diff line number Diff line
@@ -712,6 +712,11 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
        messageCryptoPresenter.onClickShowCryptoWarningDetails();
    }

    @Override
    public void onClickSearchKey() {
        messageCryptoPresenter.onClickSearchKey();
    }

    @Override
    public void onClickShowCryptoKey() {
        messageCryptoPresenter.onClickShowCryptoKey();
+8 −2
Original line number Diff line number Diff line
@@ -360,7 +360,6 @@ public enum MessageCryptoDisplayStatus {

    public boolean hasAssociatedKey() {
        switch (this) {
            case ENCRYPTED_SIGN_UNKNOWN:
            case ENCRYPTED_SIGN_VERIFIED:
            case ENCRYPTED_SIGN_UNVERIFIED:
            case ENCRYPTED_SIGN_MISMATCH:
@@ -368,7 +367,6 @@ public enum MessageCryptoDisplayStatus {
            case ENCRYPTED_SIGN_REVOKED:
            case ENCRYPTED_SIGN_INSECURE:

            case UNENCRYPTED_SIGN_UNKNOWN:
            case UNENCRYPTED_SIGN_VERIFIED:
            case UNENCRYPTED_SIGN_UNVERIFIED:
            case UNENCRYPTED_SIGN_MISMATCH:
@@ -395,4 +393,12 @@ public enum MessageCryptoDisplayStatus {
        return false;
    }

    public boolean isUnknownKey() {
        switch (this) {
            case ENCRYPTED_SIGN_UNKNOWN:
            case UNENCRYPTED_SIGN_UNKNOWN:
                return true;
        }
        return false;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -1241,6 +1241,7 @@ Please submit bug reports, contribute new features and ask questions at
    <string name="crypto_msg_encrypted_insecure">but encryption not considered secure</string>

    <string name="crypto_info_ok">OK</string>
    <string name="crypto_info_search_key">Search Key</string>
    <string name="crypto_info_view_signer">View Signer</string>
    <string name="crypto_info_view_sender">View Sender</string>
    <string name="crypto_info_view_security_warning">Details</string>