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

Commit 688afe2b authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

5445-Enable_openPGP_support_by_default

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

As we enable openPgp encryption by default, on the first run it may not
be configured. To configure it, user need to allow mail to access
openPgp. & to encyption to work, the openPgpKey also needs to be set up.

so if the encrptionStatus gives provider error & no openPgpKeyId set up,
means user doesn't configure encryption; so the mail send should be done
using no-encryption mode.

This commit also add missing licences.
parent 35d124cb
Loading
Loading
Loading
Loading
Loading
+28 −9
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;


@@ -25,9 +42,6 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.TypedValue;
@@ -46,6 +60,9 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.fsck.k9.Account;
@@ -115,7 +132,6 @@ import com.fsck.k9.ui.messagelist.DefaultFolderProvider;
import com.fsck.k9.ui.permissions.K9PermissionUiHelper;
import com.fsck.k9.ui.permissions.Permission;
import com.fsck.k9.ui.permissions.PermissionUiHelper;

import org.jetbrains.annotations.NotNull;
import org.openintents.openpgp.OpenPgpApiManager;
import org.openintents.openpgp.util.OpenPgpApi;
@@ -702,14 +718,17 @@ public class MessageCompose extends K9Activity implements OnClickListener,
        boolean shouldUsePgpMessageBuilder = cryptoStatus.isOpenPgpConfigured();
        if (shouldUsePgpMessageBuilder) {
            SendErrorState maybeSendErrorState = cryptoStatus.getSendErrorStateOrNull();
            if (maybeSendErrorState != null) {
                recipientPresenter.showPgpSendError(maybeSendErrorState);
                return null;
            }

            if (maybeSendErrorState == null) {
                PgpMessageBuilder pgpBuilder = PgpMessageBuilder.newInstance();
                recipientPresenter.builderSetProperties(pgpBuilder, cryptoStatus);
                builder = pgpBuilder;
            } else if (SendErrorState.PROVIDER_ERROR.equals(maybeSendErrorState) && cryptoStatus.getOpenPgpKeyId() == null) { // found provider error with no openPgpKey set up, means user doesn't actually configured encryption
                builder = SimpleMessageBuilder.newInstance();
                recipientPresenter.builderSetProperties(builder);
            } else {
                recipientPresenter.showPgpSendError(maybeSendErrorState);
                return null;
            }
        } else {
            builder = SimpleMessageBuilder.newInstance();
            recipientPresenter.builderSetProperties(builder);
+20 −8
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.setup;


import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -24,9 +37,6 @@ import com.fsck.k9.DI;
import com.fsck.k9.EmailAddressValidator;
import com.fsck.k9.Preferences;
import com.fsck.k9.account.AccountCreator;
import com.fsck.k9.mail.oauth.OAuth2Provider;
import com.fsck.k9.preferences.AccountManager;
import com.fsck.k9.ui.base.K9Activity;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings;
import com.fsck.k9.autodiscovery.api.DiscoveryResults;
@@ -35,9 +45,11 @@ import com.fsck.k9.autodiscovery.providersxml.ProvidersXmlDiscovery;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.oauth.OAuth2Provider;
import com.fsck.k9.mailstore.SpecialLocalFoldersCreator;
import com.fsck.k9.ui.R;
import com.fsck.k9.ui.ConnectionSettings;
import com.fsck.k9.ui.R;
import com.fsck.k9.ui.base.K9Activity;
import com.fsck.k9.ui.settings.ExtraAccountDiscovery;
import com.fsck.k9.view.ClientCertificateSpinner;
import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener;
+17 −0
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.setup.accountmanager;


+17 −0
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 org.openintents.openpgp.util;