AMP requires WebView

pull/194/merge
M66B 3 years ago
parent cff26bfc69
commit 363d0ad89f

@ -2821,7 +2821,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
!EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt)); !EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt));
// Show AMP // Show AMP
ibAmp.setVisibility(args.getBoolean("has_amp") ? View.VISIBLE : View.GONE); boolean has_amp = args.getBoolean("has_amp");
ibAmp.setVisibility(has_amp && Helper.hasWebView(context)
? View.VISIBLE : View.GONE);
// Show encrypt actions // Show encrypt actions
ibVerify.setVisibility(verifyable ? View.VISIBLE : View.GONE); ibVerify.setVisibility(verifyable ? View.VISIBLE : View.GONE);

@ -157,6 +157,7 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class Helper { public class Helper {
private static Boolean hasWebView = null;
private static Boolean hasPlayStore = null; private static Boolean hasPlayStore = null;
private static Boolean hasValidFingerprint = null; private static Boolean hasValidFingerprint = null;
@ -410,6 +411,12 @@ public class Helper {
} }
static boolean hasWebView(Context context) { static boolean hasWebView(Context context) {
if (hasWebView == null)
hasWebView = _hasWebView(context);
return hasWebView;
}
private static boolean _hasWebView(Context context) {
try { try {
PackageManager pm = context.getPackageManager(); PackageManager pm = context.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_WEBVIEW)) { if (pm.hasSystemFeature(PackageManager.FEATURE_WEBVIEW)) {

Loading…
Cancel
Save