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

Commit 3bde91c9 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

on encrptionError in mailSend stage, send mail without encryption

issue:
- https://gitlab.e.foundation/e/backlog/-/issues/5445
- https://gitlab.e.foundation/e/backlog/-/issues/5492

If errorState found on message send state, send mail without encryption
& don't show any message. It is done to improve UX. User still can view
the encryption state by checking lock icon.
parent 271daf15
Loading
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -722,12 +722,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
                PgpMessageBuilder pgpBuilder = PgpMessageBuilder.newInstance();
                recipientPresenter.builderSetProperties(pgpBuilder, cryptoStatus);
                builder = pgpBuilder;
            } else if (maybeSendErrorState.isIgnorableError(cryptoStatus.getOpenPgpKeyId())) {
            } else {
                builder = SimpleMessageBuilder.newInstance();
                recipientPresenter.builderSetProperties(builder);
            } else {
                recipientPresenter.showPgpSendError(maybeSendErrorState);
                return null;
            }
        } else {
            builder = SimpleMessageBuilder.newInstance();
+1 −29
Original line number Diff line number Diff line
/*
 * Copyright ECORP SAS 2022
 *
 * this program is free software: you can redistribute it and/or modify
 * it under the terms of the gnu general public license as published by
 * the free software foundation, either version 3 of the license, or
 * (at your option) any later version.
 *
 * this program is distributed in the hope that it will be useful,
 * but without any warranty; without even the implied warranty of
 * merchantability or fitness for a particular purpose.  see the
 * gnu general public license for more details.
 *
 * you should have received a copy of the gnu general public license
 * along with this program.  if not, see <https://www.gnu.org/licenses/>.
 */

package com.fsck.k9.activity.compose

import com.fsck.k9.activity.compose.RecipientMvpView.CryptoSpecialModeDisplayType
@@ -173,18 +156,7 @@ data class ComposeCryptoStatus(
    enum class SendErrorState {
        PROVIDER_ERROR,
        KEY_CONFIG_ERROR,
        ENABLED_ERROR;

        /**
         * We want to ignore encryptionSendError on message send operation for some specific conditions.
         * These conditions are:
         *
         * - found PROVIDER_ERROR error with no openPgpKey set up, means user doesn't actually configured encryption.
         * - on ENABLED_ERROR; it means encryption is enabled but not all recipient have key setup.
         */
        fun isIgnorableError(openPgpKeyId: Long?) : Boolean {
            return ((equals(PROVIDER_ERROR) && openPgpKeyId == null) || equals(ENABLED_ERROR))
        }
        ENABLED_ERROR
    }

    enum class AttachErrorState {