DeepL: experimental

This commit is contained in:
M66B 2021-05-24 07:58:58 +02:00
parent 4031b3d671
commit 2f399d1809
3 changed files with 12 additions and 1 deletions

4
FAQ.md
View File

@ -2992,6 +2992,10 @@ The bounce address (=*Return-Path* header) is mostly very specific, so the email
For some background, see for [this Wikipedia article](https://en.wikipedia.org/wiki/Bounce_message).
*Translate button (version 1.1600+)*
Please see [this FAQ](#user-content-faq167) about how to configure DeepL.
<br />
<a name="faq126"></a>

View File

@ -155,6 +155,12 @@ public class DeepL {
}
}
public static boolean isAvailable(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean experiments = prefs.getBoolean("experiments", false);
return (experiments && !BuildConfig.PLAY_STORE_RELEASE);
}
public static boolean canTranslate(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String deepl_key = prefs.getString("deepl_key", null);

View File

@ -1027,7 +1027,8 @@ public class FragmentCompose extends FragmentBase {
grpAttachments.setVisibility(View.GONE);
tvNoInternet.setVisibility(View.GONE);
grpBody.setVisibility(View.GONE);
ibTranslate.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE);
ibTranslate.setVisibility(
DeepL.isAvailable(getContext()) ? View.VISIBLE : View.GONE);
grpSignature.setVisibility(View.GONE);
grpReferenceHint.setVisibility(View.GONE);
ibReferenceEdit.setVisibility(View.GONE);