From 473cb3a4b44c1f9536111d55942083d7ad7079f4 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 23 Aug 2021 15:20:07 +0200 Subject: [PATCH] Added locale to support URI --- .../amazon/java/eu/faircode/email/ActivityBilling.java | 2 +- .../fdroid/java/eu/faircode/email/ActivityBilling.java | 2 +- app/src/main/java/eu/faircode/email/Helper.java | 10 +++++++++- .../play/java/eu/faircode/email/ActivityBilling.java | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/amazon/java/eu/faircode/email/ActivityBilling.java b/app/src/amazon/java/eu/faircode/email/ActivityBilling.java index 6133ccdfd1..44328b211d 100644 --- a/app/src/amazon/java/eu/faircode/email/ActivityBilling.java +++ b/app/src/amazon/java/eu/faircode/email/ActivityBilling.java @@ -226,7 +226,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener, private void onPurchaseError(Intent intent) { String message = intent.getStringExtra("message"); - Uri uri = Uri.parse(Helper.SUPPORT_URI); + Uri uri = Helper.getSupportUri(this); if (!TextUtils.isEmpty(message)) uri = uri.buildUpon().appendQueryParameter("message", "IAB: " + message).build(); Helper.view(this, uri, true); diff --git a/app/src/fdroid/java/eu/faircode/email/ActivityBilling.java b/app/src/fdroid/java/eu/faircode/email/ActivityBilling.java index a886e03183..f2d51e9c81 100644 --- a/app/src/fdroid/java/eu/faircode/email/ActivityBilling.java +++ b/app/src/fdroid/java/eu/faircode/email/ActivityBilling.java @@ -277,7 +277,7 @@ public class ActivityBilling extends ActivityBase implements /*PurchasesUpdatedL private void onPurchaseError(Intent intent) { String message = intent.getStringExtra("message"); - Uri uri = Uri.parse(Helper.SUPPORT_URI); + Uri uri = Helper.getSupportUri(this); if (!TextUtils.isEmpty(message)) uri = uri.buildUpon().appendQueryParameter("message", "IAB: " + message).build(); Helper.view(this, uri, true); diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 0f501880af..5bdba859b0 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -156,7 +156,7 @@ public class Helper { static final String PRIVACY_URI = "https://email.faircode.eu/privacy/"; static final String XDA_URI = "https://forum.xda-developers.com/showthread.php?t=3824168"; - static final String SUPPORT_URI = "https://contact.faircode.eu/?product=fairemailsupport&version=" + BuildConfig.VERSION_NAME; + static final String SUPPORT_URI = "https://contact.faircode.eu/"; static final String TEST_URI = "https://play.google.com/apps/testing/" + BuildConfig.APPLICATION_ID; static final String BIMI_PRIVACY_URI = "https://datatracker.ietf.org/doc/html/draft-brotman-ietf-bimi-guidance-03#section-7.4"; static final String FAVICON_PRIVACY_URI = "https://en.wikipedia.org/wiki/Favicon"; @@ -803,8 +803,16 @@ public class Helper { } static Uri getSupportUri(Context context) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + String language = prefs.getString("language", null); + Locale slocale = Resources.getSystem().getConfiguration().locale; + return Uri.parse(SUPPORT_URI) .buildUpon() + .appendQueryParameter("product", "fairemailsupport") + .appendQueryParameter("version", BuildConfig.VERSION_NAME) + .appendQueryParameter("locale", slocale.toString()) + .appendQueryParameter("language", language == null ? "" : language) .appendQueryParameter("installed", Helper.hasValidFingerprint(context) ? "" : "Other") .build(); } diff --git a/app/src/play/java/eu/faircode/email/ActivityBilling.java b/app/src/play/java/eu/faircode/email/ActivityBilling.java index 31a0260236..52bfe990a7 100644 --- a/app/src/play/java/eu/faircode/email/ActivityBilling.java +++ b/app/src/play/java/eu/faircode/email/ActivityBilling.java @@ -278,7 +278,7 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis private void onPurchaseError(Intent intent) { String message = intent.getStringExtra("message"); - Uri uri = Uri.parse(Helper.SUPPORT_URI); + Uri uri = Helper.getSupportUri(this); if (!TextUtils.isEmpty(message)) uri = uri.buildUpon().appendQueryParameter("message", "IAB: " + message).build(); Helper.view(this, uri, true);