Removed Gravatar support for Play store version

This commit is contained in:
M66B 2021-06-23 14:19:21 +02:00
parent 85e991dacd
commit 74f605bb4e
4 changed files with 18 additions and 2 deletions

View File

@ -136,6 +136,7 @@ android {
buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/FairEmail/releases/\""
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/FairEmail/releases/latest\""
buildConfigField "String", "GITHUB_LATEST_URI", "\"https://github.com/M66B/FairEmail/releases\""
buildConfigField "String", "GRAVATAR_URI", "\"https://www.gravatar.com/avatar/\""
}
fdroid {
dimension "all"
@ -145,6 +146,7 @@ android {
buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/FairEmail/releases/\""
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/FairEmail/releases/latest\""
buildConfigField "String", "GITHUB_LATEST_URI", "\"https://github.com/M66B/FairEmail/releases\""
buildConfigField "String", "GRAVATAR_URI", "\"https://www.gravatar.com/avatar/\""
}
play {
dimension "all"
@ -155,6 +157,7 @@ android {
buildConfigField "String", "CHANGELOG", "\"\""
buildConfigField "String", "GITHUB_LATEST_API", "\"\""
buildConfigField "String", "GITHUB_LATEST_URI", "\"\""
buildConfigField "String", "GRAVATAR_URI", "\"\""
}
}

View File

@ -287,7 +287,7 @@ public class ContactInfo {
}
// Gravatar
if (info.bitmap == null && gravatars) {
if (info.bitmap == null && gravatars && !BuildConfig.PLAY_STORE_RELEASE) {
if (!TextUtils.isEmpty(info.email)) {
String gkey = info.email.toLowerCase(Locale.ROOT);
boolean lookup;
@ -300,7 +300,7 @@ public class ContactInfo {
HttpURLConnection urlConnection = null;
try {
String hash = Helper.md5(gkey.getBytes());
URL url = new URL("https://www.gravatar.com/avatar/" + hash + "?d=404");
URL url = new URL(BuildConfig.GRAVATAR_URI + hash + "?d=404");
Log.i("Gravatar key=" + gkey + " url=" + url);
urlConnection = (HttpURLConnection) url.openConnection();

View File

@ -48,6 +48,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Lifecycle;
@ -140,6 +141,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swParseClasses;
private SwitchCompat swAuthentication;
private Group grpGravatars;
private NumberFormat NF = NumberFormat.getNumberInstance();
private final static String[] RESET_OPTIONS = new String[]{
@ -246,6 +249,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swParseClasses = view.findViewById(R.id.swParseClasses);
swAuthentication = view.findViewById(R.id.swAuthentication);
grpGravatars = view.findViewById(R.id.grpGravatars);
setOptions();
// Wire controls
@ -877,6 +882,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
: R.color.lightColorBackground_cards));
}
grpGravatars.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE);
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;

View File

@ -975,6 +975,12 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewLinesHint" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpGravatars"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swGravatars,tvGravatarsHint" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>