From 00b33dabc453d5c2265bf506d4a66bde18c5ac3d Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 7 Feb 2022 08:24:15 +0100 Subject: [PATCH] Local properties --- app/build.gradle | 13 +++++++++++-- app/src/main/java/eu/faircode/email/HtmlHelper.java | 6 ++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 752b04a1c0..280fae5e0c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,10 +8,11 @@ def getRevision = { -> return "a" } def getReleaseName = { -> return "Fulgurotherium" } // https://en.wikipedia.org/wiki/List_of_dinosaur_genera -def keystorePropertiesFile = rootProject.file("keystore.properties") def keystoreProperties = new Properties() +keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties"))) -keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +Properties localProperties = new Properties() +localProperties.load(new FileInputStream(rootProject.file("local.properties"))) android { compileSdkVersion 31 @@ -155,6 +156,8 @@ android { 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/\"" + buildConfigField "String", "GPA_URI", localProperties.getProperty("gpa.uri", "") + buildConfigField "String", "PAYPAL_URI", localProperties.getProperty("paypal.uri", "") } fdroid { dimension "all" @@ -167,6 +170,8 @@ android { 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/\"" + buildConfigField "String", "PAYPAL_URI", "\"\"" + buildConfigField "String", "GPA_URI", "\"\"" } play { dimension "all" @@ -180,6 +185,8 @@ android { buildConfigField "String", "GITHUB_LATEST_API", "\"\"" buildConfigField "String", "GITHUB_LATEST_URI", "\"\"" buildConfigField "String", "GRAVATAR_URI", "\"\"" + buildConfigField "String", "PAYPAL_URI", "\"\"" + buildConfigField "String", "GPA_URI", "\"\"" } amazon { dimension "all" @@ -193,6 +200,8 @@ android { buildConfigField "String", "GITHUB_LATEST_API", "\"\"" buildConfigField "String", "GITHUB_LATEST_URI", "\"\"" buildConfigField "String", "GRAVATAR_URI", "\"\"" + buildConfigField "String", "PAYPAL_URI", "\"\"" + buildConfigField "String", "GPA_URI", "\"\"" } } diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 53ed9c314e..060b8507fc 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -1354,8 +1354,6 @@ public class HtmlHelper { // geo:,[,][;u=] // tel: final Pattern GPA_PATTERN = Pattern.compile("GPA\\.\\d{4}-\\d{4}-\\d{4}-\\d{5}"); - final String GPA_LINK = "https://play.google.com/console/u/0/developers/8420080860664580239/orders/"; - final String PAYPAL = "https://www.paypal.com/activity/payment/"; final Pattern pattern = Pattern.compile( "(((?i:mailto):)?" + PatternsCompat.AUTOLINK_EMAIL_ADDRESS.pattern() + ")|" + PatternsCompat.AUTOLINK_WEB_URL.pattern() @@ -1378,7 +1376,7 @@ public class HtmlHelper { Element parent = (Element) node.parentNode(); if ("faircode_txn_id".equals(parent.className())) { Element a = document.createElement("a"); - a.attr("href", PAYPAL + text.trim()); + a.attr("href", BuildConfig.PAYPAL_URI + text.trim()); a.text(text); tnode.before(a); tnode.text(""); @@ -1431,7 +1429,7 @@ public class HtmlHelper { Element a = document.createElement("a"); if (BuildConfig.DEBUG && GPA_PATTERN.matcher(group).matches()) - a.attr("href", GPA_LINK + group); + a.attr("href", BuildConfig.GPA_URI + group); else a.attr("href", (email ? "mailto:" : "") + group); a.text(group);