diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 0f1b7970..0a2ce4b3 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1 @@
-custom: ['https://www.buymeacoffee.com/sspanak']
+custom: ['https://www.paypal.com/donate/?hosted_button_id=LW97X3JM2CRZC']
diff --git a/app/build.gradle b/app/build.gradle
index 7cdd04d1..4f8da83c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -76,6 +76,7 @@ clean {
}
// using the exported Closures directly causes weird values, hence the extra wrappers here
+def getDonationUrl = { -> return new File(FUNDING_FILE).text.replace("custom:", "").replaceAll("['\\s\\[\\]]+", "") }
def getVerCode = { -> return getVersionCode() }
def getVerName = { -> return getVersionName() }
def getVersionString = { flavor -> return flavor == 'debug' ? getDebugVersion() : getReleaseVersion() }
@@ -100,11 +101,13 @@ android {
buildTypes {
debug {
+ buildConfigField 'String', 'DONATION_URL', "\"${getDonationUrl()}\""
buildConfigField 'String', 'DICTIONARY_EXTENSION', "\"${DICTIONARY_OUTPUT_EXTENSION}\""
buildConfigField 'String', 'VERSION_FULL', "\"${getVersionString('debug')}\""
}
release {
+ buildConfigField 'String', 'DONATION_URL', "\"${getDonationUrl()}\""
buildConfigField 'String', 'DICTIONARY_EXTENSION', "\"${DICTIONARY_OUTPUT_EXTENSION}\""
buildConfigField 'String', 'VERSION_FULL', "\"${getVersionString('release')}\""
diff --git a/app/constants.gradle b/app/constants.gradle
index b70542e0..21e971ab 100644
--- a/app/constants.gradle
+++ b/app/constants.gradle
@@ -11,6 +11,8 @@ def APP_ROOT_DIR = "${project.rootDir}/app"
def MAIN_ASSETS_DIR = "${APP_ROOT_DIR}/src/main/assets"
def FULL_VERSION_ASSETS_DIR = "${APP_ROOT_DIR}/src/full/assets"
+ext.FUNDING_FILE = "${project.rootDir}/.github/FUNDING.yml"
+
ext.HELP_MARKDOWN_DIR = "${project.rootDir}/docs/help"
ext.HELP_HTML_DIR = "${MAIN_ASSETS_DIR}/help"
diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/main/DonatePreference.java b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/main/DonatePreference.java
index 24e7ced6..23b1e40e 100644
--- a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/main/DonatePreference.java
+++ b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/main/DonatePreference.java
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
+import io.github.sspanak.tt9.BuildConfig;
import io.github.sspanak.tt9.R;
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
import io.github.sspanak.tt9.ui.UI;
@@ -70,7 +71,7 @@ public class DonatePreference extends Preference {
private boolean onLongClick(View v) {
try {
- getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getContext().getString(R.string.donate_url))));
+ getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.DONATION_URL)));
return true;
} catch (Exception e) {
Logger.w(getClass().getSimpleName(), "Cannot navigate to the donation page. " + e.getMessage() + " (do you have a browser?)");
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4453c739..74857524 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -152,7 +152,6 @@
Donate
If you like %1$s, you could buy me a beer.
Press and hold to open in the browser.
- https://www.buymeacoffee.com/sspanak
Key \"%1$s\" is already assigned to function \"%2$s\". Do you want to assign it to \"%3$s\"?
* Press or hold a key to assign it to the \"%1$s\" function.\n\n* Press 0 to cancel.\n\n* Press 2 to disable the function.