chore: hide donations link for playstore version to adhere with Google Play's iae policy

This commit keeps food on one google PM's table by not stealing their 30% pay cut
This commit is contained in:
Kingkor Roy Tirtho 2024-10-09 16:37:41 +06:00
parent fdde972a77
commit f553e43b17
6 changed files with 69 additions and 53 deletions

View File

@ -12,3 +12,5 @@ LASTFM_API_SECRET=
# Release channel. Can be: nightly, stable
RELEASE_CHANNEL=
HIDE_DONATIONS=

View File

@ -25,7 +25,8 @@ class AndroidBuildCommand extends Command with BuildCommandCommonSteps {
);
await dotEnvFile.writeAsString(
"\nENABLE_UPDATE_CHECK=0",
"\nENABLE_UPDATE_CHECK=0"
"\nHIDE_DONATIONS=1",
mode: FileMode.append,
);

View File

@ -59,6 +59,8 @@ class Assets {
AssetGenImage('assets/spotube-hero-banner.png');
static const AssetGenImage spotubeLogoForeground =
AssetGenImage('assets/spotube-logo-foreground.jpg');
static const AssetGenImage spotubeLogoBmp =
AssetGenImage('assets/spotube-logo.bmp');
static const String spotubeLogoIco = 'assets/spotube-logo.ico';
static const AssetGenImage spotubeLogoPng =
AssetGenImage('assets/spotube-logo.png');
@ -98,6 +100,7 @@ class Assets {
placeholder,
spotubeHeroBanner,
spotubeLogoForeground,
spotubeLogoBmp,
spotubeLogoIco,
spotubeLogoPng,
spotubeLogoSvg,

View File

@ -19,6 +19,11 @@ abstract class Env {
@EnviedField(varName: 'LASTFM_API_SECRET')
static final String lastFmApiSecret = _Env.lastFmApiSecret;
@EnviedField(varName: 'HIDE_DONATIONS', defaultValue: "0")
static final int _hideDonations = _Env._hideDonations;
static bool get hideDonations => _hideDonations == 1;
static final spotifySecrets = rawSpotifySecrets.split(',').map((e) {
final secrets = e.trim().split(":").map((e) => e.trim());
return {

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/env.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/modules/getting_started/blur_card.dart';
import 'package:spotube/extensions/context.dart';
@ -62,21 +63,23 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget {
);
},
),
const Gap(16),
FilledButton.icon(
icon: const Icon(SpotubeIcons.openCollective),
label: Text(context.l10n.donate_on_open_collective),
style: FilledButton.styleFrom(
backgroundColor: const Color(0xff4cb7f6),
foregroundColor: Colors.white,
if (!Env.hideDonations) ...[
const Gap(16),
FilledButton.icon(
icon: const Icon(SpotubeIcons.openCollective),
label: Text(context.l10n.donate_on_open_collective),
style: FilledButton.styleFrom(
backgroundColor: const Color(0xff4cb7f6),
foregroundColor: Colors.white,
),
onPressed: () async {
await launchUrlString(
"https://opencollective.com/spotube",
mode: LaunchMode.externalApplication,
);
},
),
onPressed: () async {
await launchUrlString(
"https://opencollective.com/spotube",
mode: LaunchMode.externalApplication,
);
},
),
]
],
),
],

View File

@ -21,48 +21,50 @@ class SettingsAboutSection extends HookConsumerWidget {
return SectionCardWithHeading(
heading: context.l10n.about,
children: [
AdaptiveListTile(
leading: const Icon(
SpotubeIcons.heart,
color: Colors.pink,
),
title: SizedBox(
height: 50,
width: 200,
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
context.l10n.u_love_spotube,
maxLines: 1,
style: const TextStyle(
color: Colors.pink,
fontWeight: FontWeight.bold,
if (!Env.hideDonations)
AdaptiveListTile(
leading: const Icon(
SpotubeIcons.heart,
color: Colors.pink,
),
title: SizedBox(
height: 50,
width: 200,
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
context.l10n.u_love_spotube,
maxLines: 1,
style: const TextStyle(
color: Colors.pink,
fontWeight: FontWeight.bold,
),
),
),
),
),
trailing: (context, update) => FilledButton(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.red[100]),
foregroundColor: const WidgetStatePropertyAll(Colors.pinkAccent),
padding: const WidgetStatePropertyAll(EdgeInsets.all(15)),
),
onPressed: () {
launchUrlString(
"https://opencollective.com/spotube",
mode: LaunchMode.externalApplication,
);
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(SpotubeIcons.heart),
const SizedBox(width: 5),
Text(context.l10n.please_sponsor),
],
trailing: (context, update) => FilledButton(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.red[100]),
foregroundColor:
const WidgetStatePropertyAll(Colors.pinkAccent),
padding: const WidgetStatePropertyAll(EdgeInsets.all(15)),
),
onPressed: () {
launchUrlString(
"https://opencollective.com/spotube",
mode: LaunchMode.externalApplication,
);
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(SpotubeIcons.heart),
const SizedBox(width: 5),
Text(context.l10n.please_sponsor),
],
),
),
),
),
if (Env.enableUpdateChecker)
SwitchListTile(
secondary: const Icon(SpotubeIcons.update),