fix(gplay): stop linking to donation pages on Play builds

Google Play's Payments policy forbids linking to pages that eventually
lead to donations. On Play builds, hide the donate buttons, unlink
depau.eu and open the website with ?gplay=1, which hides its donation
links.

GitHub release builds keep them: build with -Petchdroid.githubRelease.
This commit is contained in:
Davide Depau committed 2026-10-30 18:11:39 +01:00
1 parent 119d52c923
commit 125509078b
4 files changed
+44 -27

No files matched your search

+4
View File
@@ -66,9 +66,13 @@ android {
create("foss") {
isDefault = true
dimension = "store"
buildConfigField("boolean", "PLAY_STORE", "false")
}
create("gplay") {
dimension = "store"
// Google Play forbids linking to donations; GitHub release builds opt out with -Petchdroid.githubRelease
val playStore = !providers.gradleProperty("etchdroid.githubRelease").isPresent
buildConfigField("boolean", "PLAY_STORE", playStore.toString())
}
}
packaging {
@@ -1,3 +1,6 @@
package eu.depau.etchdroid
const val PRIVACY_URL = "https://etchdroid.app/privacy/"
// Google Play forbids linking to pages that lead to donations: the website hides them with ?gplay=1
fun websiteUrl(path: String) = "https://etchdroid.app$path" + if (BuildConfig.PLAY_STORE) "?gplay=1" else ""
val PRIVACY_URL = websiteUrl("/privacy/")
@@ -55,6 +55,7 @@ import eu.depau.etchdroid.ui.composables.MainView
import eu.depau.etchdroid.ui.composables.ScreenSizeLayoutSelector
import eu.depau.etchdroid.ui.composables.coloredShadow
import eu.depau.etchdroid.utils.ktexts.activity
import eu.depau.etchdroid.websiteUrl
class AboutActivity : ActivityBase() {
private val mViewModel: ThemeViewModel by viewModels()
@@ -245,8 +246,9 @@ fun AboutView(viewModel: ThemeViewModel) {
val githubEnd = githubStart + github.length
append(str)
for ((start, end) in listOf(
nameStart to nameEnd,
for ((start, end) in listOfNotNull(
// depau.eu links to donations, which Google Play forbids
(nameStart to nameEnd).takeUnless { BuildConfig.PLAY_STORE },
contributorsStart to contributorsEnd,
githubStart to githubEnd
)) {
@@ -259,11 +261,13 @@ fun AboutView(viewModel: ThemeViewModel) {
end = end
)
}
addLink(
LinkAnnotation.Url("https://depau.eu"),
nameStart,
nameEnd
)
if (!BuildConfig.PLAY_STORE) {
addLink(
LinkAnnotation.Url("https://depau.eu"),
nameStart,
nameEnd
)
}
addLink(
LinkAnnotation.Url("https://github.com/EtchDroid/EtchDroid/graphs/contributors"),
contributorsStart,
@@ -314,24 +318,26 @@ fun AboutView(viewModel: ThemeViewModel) {
activity?.startActivity(
Intent(
Intent.ACTION_VIEW,
"https://etchdroid.app".toUri()
websiteUrl("/").toUri()
)
)
}
) {
Text(stringResource(R.string.website))
}
OutlinedButton(
onClick = {
activity?.startActivity(
Intent(
Intent.ACTION_VIEW,
"https://etchdroid.app/donate".toUri()
if (!BuildConfig.PLAY_STORE) {
OutlinedButton(
onClick = {
activity?.startActivity(
Intent(
Intent.ACTION_VIEW,
"https://etchdroid.app/donate".toUri()
)
)
)
}
) {
Text(stringResource(R.string.support_the_project))
}
) {
Text(stringResource(R.string.support_the_project))
}
val reviewHelper = remember { activity?.let { WriteReviewHelper(it) } }
if (reviewHelper != null) {
@@ -105,6 +105,7 @@ import com.airbnb.lottie.compose.rememberLottieComposition
import com.airbnb.lottie.compose.rememberLottieDynamicProperties
import com.airbnb.lottie.compose.rememberLottieDynamicProperty
import eu.depau.etchdroid.AppSettings
import eu.depau.etchdroid.BuildConfig
import eu.depau.etchdroid.Intents
import eu.depau.etchdroid.R
import eu.depau.etchdroid.getStartJobIntent
@@ -141,6 +142,7 @@ import eu.depau.etchdroid.utils.ktexts.startForegroundServiceCompat
import eu.depau.etchdroid.utils.ktexts.toHRSize
import eu.depau.etchdroid.utils.ktexts.toast
import eu.depau.etchdroid.utils.ktexts.usbDevice
import eu.depau.etchdroid.websiteUrl
import kotlinx.coroutines.delay
import me.jahnen.libaums.libusbcommunication.LibusbError
import me.jahnen.libaums.libusbcommunication.LibusbException
@@ -930,15 +932,17 @@ fun SuccessView() {
)
}
}
OutlinedButton(onClick = {
activity?.startActivity(
Intent(
Intent.ACTION_VIEW,
"https://etchdroid.app/donate/".toUri()
if (!BuildConfig.PLAY_STORE) {
OutlinedButton(onClick = {
activity?.startActivity(
Intent(
Intent.ACTION_VIEW,
"https://etchdroid.app/donate/".toUri()
)
)
)
}) {
Text(stringResource(R.string.support_the_project))
}) {
Text(stringResource(R.string.support_the_project))
}
}
val context = LocalContext.current
OutlinedButton(onClick = {
@@ -980,7 +984,7 @@ fun SuccessView() {
), start = startIndex, end = endIndex
)
addLink(
LinkAnnotation.Url("https://etchdroid.app/broken_usb/"),
LinkAnnotation.Url(websiteUrl("/broken_usb/")),
startIndex,
endIndex
)