mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 00:12:24 +01:00
support: Buy Me a Coffee first in Settings, the popup, the thank-you page and the repo's Sponsor button; Monero last
This commit is contained in:
1 parent
77b84212db
commit
c6d8d8e787
4 files changed
+27
-5
No files matched your search
@@ -35,6 +35,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
|
||||
/** Where Gearslip lives outside the app: support, the chat room, and the code. */
|
||||
internal object GearslipLinks {
|
||||
const val BUY_ME_A_COFFEE = "https://buymeacoffee.com/seb3thehacker"
|
||||
const val LIBERAPAY = "https://liberapay.com/Seb3thehacker"
|
||||
/** A card payment page for giving once, any amount. Its row stays hidden while this is empty. */
|
||||
const val PAYMENT_LINK = ""
|
||||
@@ -66,7 +67,7 @@ internal object GearslipLinks {
|
||||
}
|
||||
}
|
||||
|
||||
/** The ways to support Gearslip. Liberapay always; card and Monero once they're set up. */
|
||||
/** The ways to support Gearslip: Buy Me a Coffee first, Monero last, card once it's set up. */
|
||||
@Composable
|
||||
internal fun DonateRows() {
|
||||
val context = LocalContext.current
|
||||
@@ -77,6 +78,14 @@ internal fun DonateRows() {
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
SettingsRow(
|
||||
"Buy Me a Coffee",
|
||||
Modifier.clickable { GearslipLinks.open(context, GearslipLinks.BUY_ME_A_COFFEE) },
|
||||
subtitle = "Give once or monthly, by card",
|
||||
icon = Icons.Filled.Favorite,
|
||||
trailing = arrow,
|
||||
)
|
||||
SettingsDivider()
|
||||
SettingsRow(
|
||||
"Liberapay",
|
||||
Modifier.clickable { GearslipLinks.open(context, GearslipLinks.LIBERAPAY) },
|
||||
@@ -110,7 +119,7 @@ internal fun DonateRows() {
|
||||
|
||||
/** The Monero address in full, with ways to pay it from this phone or another device. */
|
||||
@Composable
|
||||
private fun MoneroDialog(onDismiss: () -> Unit) {
|
||||
internal fun MoneroDialog(onDismiss: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
|
||||
@@ -14,7 +14,9 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -85,7 +87,12 @@ object DonatePrompt {
|
||||
internal fun DonateDialog(live: Boolean) {
|
||||
val context = LocalContext.current
|
||||
val waiting by remember { DonatePrompt.pending(context) }.collectAsStateWithLifecycle()
|
||||
var monero by remember { mutableStateOf(false) }
|
||||
if (!waiting || live) return
|
||||
if (monero) {
|
||||
MoneroDialog { DonatePrompt.answer(context, donated = true) }
|
||||
return
|
||||
}
|
||||
fun give(url: String) {
|
||||
DonatePrompt.answer(context, donated = true)
|
||||
GearslipLinks.open(context, url)
|
||||
@@ -102,7 +109,10 @@ internal fun DonateDialog(live: Boolean) {
|
||||
},
|
||||
confirmButton = {
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Button(onClick = { give(GearslipLinks.LIBERAPAY) }, Modifier.fillMaxWidth()) {
|
||||
Button(onClick = { give(GearslipLinks.BUY_ME_A_COFFEE) }, Modifier.fillMaxWidth()) {
|
||||
Text("Buy me a coffee")
|
||||
}
|
||||
OutlinedButton(onClick = { give(GearslipLinks.LIBERAPAY) }, Modifier.fillMaxWidth()) {
|
||||
Text("Support on Liberapay")
|
||||
}
|
||||
if (GearslipLinks.PAYMENT_LINK.isNotEmpty()) {
|
||||
@@ -110,6 +120,9 @@ internal fun DonateDialog(live: Boolean) {
|
||||
Text("Give once by card")
|
||||
}
|
||||
}
|
||||
OutlinedButton(onClick = { monero = true }, Modifier.fillMaxWidth()) {
|
||||
Text("Monero")
|
||||
}
|
||||
TextButton(onClick = { DonatePrompt.answer(context, donated = false) }, Modifier.fillMaxWidth()) {
|
||||
Text("Not now")
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ fun IntroScreen(onDone: () -> Unit) {
|
||||
"Each note shows which cars work and which still fail, so I know what to fix next.", step,
|
||||
action = "See which cars work" to { GearslipLinks.open(context, GearslipLinks.CARS) },
|
||||
outlined = true,
|
||||
secondAction = "Support on Liberapay" to { GearslipLinks.open(context, GearslipLinks.LIBERAPAY) },
|
||||
secondAction = "Buy me a coffee" to { GearslipLinks.open(context, GearslipLinks.BUY_ME_A_COFFEE) },
|
||||
) { HeartIcon(c.onTertiaryC) }
|
||||
IntroStep.CHAT -> BadgeStep(c, ::cq, ::cqSp, c.primaryC, "Come say hi.",
|
||||
"Gearslip has a chat room on Matrix. Talk with other drivers about cars, apps, and " +
|
||||
|
||||
Reference in new issue
Block a user