show warning about APG being deprecated if still selected
This commit is contained in:
parent
c2cf9c8772
commit
9f51ab627e
10 changed files with 171 additions and 2 deletions
|
@ -221,6 +221,7 @@ public class Account implements BaseAccount, StoreConfig {
|
||||||
private boolean mStripSignature;
|
private boolean mStripSignature;
|
||||||
private boolean mSyncRemoteDeletions;
|
private boolean mSyncRemoteDeletions;
|
||||||
private String mCryptoApp;
|
private String mCryptoApp;
|
||||||
|
private boolean mCryptoAppIsDeprecatedApg;
|
||||||
private long mCryptoKey;
|
private long mCryptoKey;
|
||||||
private boolean mCryptoSupportSignOnly;
|
private boolean mCryptoSupportSignOnly;
|
||||||
private boolean mMarkMessageAsReadOnView;
|
private boolean mMarkMessageAsReadOnView;
|
||||||
|
@ -1607,13 +1608,19 @@ public class Account implements BaseAccount, StoreConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCryptoApp(String cryptoApp) {
|
public void setCryptoApp(String cryptoApp) {
|
||||||
if (cryptoApp == null || cryptoApp.equals("apg")) {
|
boolean isApgCryptoProvider = "apg".equals(cryptoApp);
|
||||||
|
if (cryptoApp == null || isApgCryptoProvider) {
|
||||||
|
mCryptoAppIsDeprecatedApg = isApgCryptoProvider;
|
||||||
mCryptoApp = NO_OPENPGP_PROVIDER;
|
mCryptoApp = NO_OPENPGP_PROVIDER;
|
||||||
} else {
|
} else {
|
||||||
mCryptoApp = cryptoApp;
|
mCryptoApp = cryptoApp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCryptoAppDeprecatedApg() {
|
||||||
|
return mCryptoAppIsDeprecatedApg;
|
||||||
|
}
|
||||||
|
|
||||||
public long getCryptoKey() {
|
public long getCryptoKey() {
|
||||||
return mCryptoKey;
|
return mCryptoKey;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
|
||||||
package com.fsck.k9.activity.setup;
|
package com.fsck.k9.activity.setup;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -45,7 +47,7 @@ import com.fsck.k9.mail.Store;
|
||||||
import com.fsck.k9.mailstore.LocalFolder;
|
import com.fsck.k9.mailstore.LocalFolder;
|
||||||
import com.fsck.k9.mailstore.StorageManager;
|
import com.fsck.k9.mailstore.StorageManager;
|
||||||
import com.fsck.k9.service.MailService;
|
import com.fsck.k9.service.MailService;
|
||||||
|
import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog;
|
||||||
import org.openintents.openpgp.util.OpenPgpAppPreference;
|
import org.openintents.openpgp.util.OpenPgpAppPreference;
|
||||||
import org.openintents.openpgp.util.OpenPgpKeyPreference;
|
import org.openintents.openpgp.util.OpenPgpKeyPreference;
|
||||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||||
|
@ -127,6 +129,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||||
private static final String PREFERENCE_SPAM_FOLDER = "spam_folder";
|
private static final String PREFERENCE_SPAM_FOLDER = "spam_folder";
|
||||||
private static final String PREFERENCE_TRASH_FOLDER = "trash_folder";
|
private static final String PREFERENCE_TRASH_FOLDER = "trash_folder";
|
||||||
private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc";
|
private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc";
|
||||||
|
public static final String APG_DEPRECATION_DIALOG_TAG = "apgDeprecationDialog";
|
||||||
|
|
||||||
|
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
|
@ -731,6 +734,19 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||||
mCryptoMenu.setEnabled(false);
|
mCryptoMenu.setEnabled(false);
|
||||||
mCryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_installed);
|
mCryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_installed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mAccount.isCryptoAppDeprecatedApg()) {
|
||||||
|
showApgDeprecationDialog();
|
||||||
|
mAccount.setCryptoApp("");
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showApgDeprecationDialog() {
|
||||||
|
ApgDeprecationWarningDialog fragment = ApgDeprecationWarningDialog.newInstance();
|
||||||
|
FragmentTransaction ta = getFragmentManager().beginTransaction();
|
||||||
|
ta.add(fragment, APG_DEPRECATION_DIALOG_TAG);
|
||||||
|
ta.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeListEntry(ListPreference listPreference, String remove) {
|
private void removeListEntry(ListPreference listPreference, String remove) {
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.fsck.k9.ui.dialog;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.fsck.k9.R;
|
||||||
|
|
||||||
|
|
||||||
|
public class ApgDeprecationWarningDialog extends DialogFragment {
|
||||||
|
|
||||||
|
public static ApgDeprecationWarningDialog newInstance() {
|
||||||
|
return new ApgDeprecationWarningDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
Context context = getActivity();
|
||||||
|
if (context == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
View contentView = inflater.inflate(R.layout.dialog_apg_deprecated, null, false);
|
||||||
|
|
||||||
|
((TextView) contentView.findViewById(R.id.apg_learn_more)).setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
builder.setIcon(R.drawable.ic_apg_small);
|
||||||
|
builder.setTitle(R.string.apg_deprecated_title);
|
||||||
|
builder.setView(contentView);
|
||||||
|
builder.setNeutralButton(R.string.apg_deprecated_ok, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setCancelable(false);
|
||||||
|
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
BIN
k9mail/src/main/res/drawable-hdpi/ic_apg_small.png
Normal file
BIN
k9mail/src/main/res/drawable-hdpi/ic_apg_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
k9mail/src/main/res/drawable-mdpi/ic_apg_small.png
Normal file
BIN
k9mail/src/main/res/drawable-mdpi/ic_apg_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
k9mail/src/main/res/drawable-xhdpi/ic_apg_small.png
Normal file
BIN
k9mail/src/main/res/drawable-xhdpi/ic_apg_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
BIN
k9mail/src/main/res/drawable-xxhdpi/ic_apg_small.png
Normal file
BIN
k9mail/src/main/res/drawable-xxhdpi/ic_apg_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
k9mail/src/main/res/drawable-xxxhdpi/ic_apg_small.png
Normal file
BIN
k9mail/src/main/res/drawable-xxxhdpi/ic_apg_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
87
k9mail/src/main/res/layout/dialog_apg_deprecated.xml
Normal file
87
k9mail/src/main/res/layout/dialog_apg_deprecated.xml
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="14dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/apg_deprecated_1"
|
||||||
|
style="?android:textAppearanceMedium"
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_below="@+id/textView"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:id="@+id/layout_bullet_1">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_margin="6dp"
|
||||||
|
style="@style/NegativeBulletPoint"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/apg_deprecated_bullet_1"
|
||||||
|
style="?android:textAppearanceMedium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/layout_bullet_2"
|
||||||
|
android:layout_below="@+id/layout_bullet_1"
|
||||||
|
android:layout_alignLeft="@+id/layout_bullet_1"
|
||||||
|
android:layout_alignStart="@+id/layout_bullet_1"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_margin="6dp"
|
||||||
|
style="@style/NegativeBulletPoint"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/apg_deprecated_bullet_2"
|
||||||
|
style="?android:textAppearanceMedium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/apg_deprecated_2"
|
||||||
|
android:id="@+id/apg_support_removed"
|
||||||
|
android:layout_below="@+id/layout_bullet_2"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
style="?android:textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/apg_learn_more"
|
||||||
|
android:text="@string/apg_learn_more"
|
||||||
|
android:layout_below="@+id/apg_support_removed"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
style="?android:textAppearanceMedium" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -1205,5 +1205,12 @@ Please submit bug reports, contribute new features and ask questions at
|
||||||
<string name="account_settings_crypto_support_sign_only">Support signing of unencrypted messages</string>
|
<string name="account_settings_crypto_support_sign_only">Support signing of unencrypted messages</string>
|
||||||
<string name="error_sign_only_no_encryption">Encryption unavailable in sign-only mode!</string>
|
<string name="error_sign_only_no_encryption">Encryption unavailable in sign-only mode!</string>
|
||||||
<string name="unsigned_text_divider_label">Unsigned Text</string>
|
<string name="unsigned_text_divider_label">Unsigned Text</string>
|
||||||
|
<string name="apg_deprecated_title">APG Deprecation Warning</string>
|
||||||
|
<string name="apg_deprecated_1">APG is no longer maintained!</string>
|
||||||
|
<string name="apg_deprecated_2">Because of this, support for APG has been removed from K-9 Mail.</string>
|
||||||
|
<string name="apg_deprecated_bullet_1">Development stopped in early 2014</string>
|
||||||
|
<string name="apg_deprecated_bullet_2">Contains unfixed security issues</string>
|
||||||
|
<string name="apg_learn_more">You can <a href="https://k9mail.github.io/apg_note.html">click here</a> to learn more.</string>
|
||||||
|
<string name="apg_deprecated_ok">Got it!</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue