Merge pull request #6036 from k9mail/remove_apg_references
Silently ignore the APG crypto provider if found
This commit is contained in:
commit
27d296f873
9 changed files with 0 additions and 200 deletions
|
@ -1,43 +0,0 @@
|
|||
package com.fsck.k9.ui.dialog;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.fsck.k9.ui.R;
|
||||
|
||||
|
||||
public class ApgDeprecationWarningDialog extends AlertDialog {
|
||||
public ApgDeprecationWarningDialog(Context context) {
|
||||
super(context);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
View contentView = inflater.inflate(R.layout.dialog_apg_deprecated, null);
|
||||
|
||||
TextView textViewLearnMore = contentView.findViewById(R.id.apg_learn_more);
|
||||
makeTextViewLinksClickable(textViewLearnMore);
|
||||
|
||||
setIcon(R.drawable.ic_apg_small);
|
||||
setTitle(R.string.apg_deprecated_title);
|
||||
setView(contentView);
|
||||
setButton(Dialog.BUTTON_POSITIVE, context.getString(R.string.apg_deprecated_ok), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void makeTextViewLinksClickable(TextView textView) {
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
}
|
|
@ -30,7 +30,6 @@ import com.fsck.k9.Preferences;
|
|||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.ui.base.K9Activity;
|
||||
import com.fsck.k9.ui.base.ThemeType;
|
||||
import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.openintents.openpgp.util.OpenPgpProviderUtil;
|
||||
import timber.log.Timber;
|
||||
|
@ -40,11 +39,8 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
private static final String EXTRA_ACCOUNT = "account";
|
||||
|
||||
private static final String OPENKEYCHAIN_PACKAGE = "org.sufficientlysecure.keychain";
|
||||
private static final String PACKAGE_NAME_APG = "org.thialfihar.android.apg";
|
||||
private static final String APG_PROVIDER_PLACEHOLDER = "apg-placeholder";
|
||||
|
||||
public static final String FRAG_OPENPGP_SELECT = "openpgp_select";
|
||||
public static final String FRAG_APG_DEPRECATE = "apg_deprecate";
|
||||
public static final String FRAG_OPENKEYCHAIN_INFO = "openkeychain_info";
|
||||
|
||||
private static final Intent MARKET_INTENT = new Intent(Intent.ACTION_VIEW, Uri.parse(
|
||||
|
@ -53,7 +49,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
String.format("https://play.google.com/store/apps/details?id=%s", OPENKEYCHAIN_PACKAGE)));
|
||||
|
||||
|
||||
private boolean isStopped;
|
||||
private Account account;
|
||||
|
||||
public static void startOpenPgpChooserActivity(Context context, Account account) {
|
||||
|
@ -76,7 +71,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
isStopped = false;
|
||||
super.onStart();
|
||||
|
||||
List<String> openPgpProviderPackages = OpenPgpProviderUtil.getOpenPgpProviderPackages(this);
|
||||
|
@ -93,7 +87,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
isStopped = true;
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
@ -102,11 +95,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
fragment.show(getSupportFragmentManager(), FRAG_OPENPGP_SELECT);
|
||||
}
|
||||
|
||||
private void showApgDeprecationDialogFragment() {
|
||||
ApgDeprecationDialogFragment fragment = new ApgDeprecationDialogFragment();
|
||||
fragment.show(getSupportFragmentManager(), FRAG_APG_DEPRECATE);
|
||||
}
|
||||
|
||||
private void showOpenKeychainInfoFragment() {
|
||||
OpenKeychainInfoFragment fragment = new OpenKeychainInfoFragment();
|
||||
fragment.show(getSupportFragmentManager(), FRAG_OPENKEYCHAIN_INFO);
|
||||
|
@ -126,12 +114,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
getResources().getDrawable(R.drawable.ic_action_cancel_launchersize_light));
|
||||
openPgpProviderList.add(noneEntry);
|
||||
|
||||
if (isApgInstalled(getActivity())) {
|
||||
Drawable icon = getResources().getDrawable(R.drawable.ic_apg_small);
|
||||
openPgpProviderList.add(new OpenPgpProviderEntry(
|
||||
APG_PROVIDER_PLACEHOLDER, getString(R.string.apg), icon));
|
||||
}
|
||||
|
||||
// search for OpenPGP providers...
|
||||
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
||||
List<ResolveInfo> resInfo = getActivity().getPackageManager().queryIntentServices(intent, 0);
|
||||
|
@ -170,13 +152,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isApgInstalled(Context context) {
|
||||
Intent intent = new Intent("org.openintents.openpgp.IOpenPgpService");
|
||||
intent.setPackage(PACKAGE_NAME_APG);
|
||||
List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0);
|
||||
return resInfo != null && !resInfo.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
@ -251,27 +226,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
}
|
||||
}
|
||||
|
||||
public static class ApgDeprecationDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new ApgDeprecationWarningDialog(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
|
||||
((OpenPgpAppSelectDialog) getActivity()).onDismissApgDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public static class OpenKeychainInfoFragment extends DialogFragment {
|
||||
@NonNull
|
||||
@Override
|
||||
|
@ -323,11 +277,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
}
|
||||
|
||||
public void onSelectProvider(String selectedPackage) {
|
||||
if (APG_PROVIDER_PLACEHOLDER.equals(selectedPackage)) {
|
||||
showApgDeprecationDialogFragment();
|
||||
return;
|
||||
}
|
||||
|
||||
persistOpenPgpProviderSetting(selectedPackage);
|
||||
finish();
|
||||
}
|
||||
|
@ -337,12 +286,6 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
Preferences.getPreferences(getApplicationContext()).saveAccount(account);
|
||||
}
|
||||
|
||||
public void onDismissApgDialog() {
|
||||
if (!isStopped) {
|
||||
showOpenPgpSelectDialogFragment();
|
||||
}
|
||||
}
|
||||
|
||||
private static class OpenPgpProviderEntry {
|
||||
private String packageName;
|
||||
private String simpleName;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
tools:context=".dialog.ApgDeprecationWarningDialog">
|
||||
|
||||
<RelativeLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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_alignParentEnd="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_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>
|
||||
|
||||
</ScrollView>
|
|
@ -1148,14 +1148,6 @@ Please submit bug reports, contribute new features and ask questions at
|
|||
<string name="account_settings_crypto_hide_sign_only_off">All signatures will be displayed</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="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/2017/01/13/Why-APG-is-no-longer-supported.html">click here</a> to learn more.</string>
|
||||
<string name="apg_deprecated_ok">Got it!</string>
|
||||
<string name="apg">APG</string>
|
||||
<string name="crypto_no_provider_title">This email is encrypted</string>
|
||||
<string name="crypto_no_provider_message">This email has been encrypted with OpenPGP.\nTo read it, you need to install and configure a compatible OpenPGP App.</string>
|
||||
<string name="crypto_no_provider_button">Go to Settings</string>
|
||||
|
|
Loading…
Reference in a new issue