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. Can be: nightly, stable
RELEASE_CHANNEL= RELEASE_CHANNEL=
HIDE_DONATIONS=

View File

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

View File

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

View File

@ -19,6 +19,11 @@ abstract class Env {
@EnviedField(varName: 'LASTFM_API_SECRET') @EnviedField(varName: 'LASTFM_API_SECRET')
static final String lastFmApiSecret = _Env.lastFmApiSecret; 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) { static final spotifySecrets = rawSpotifySecrets.split(',').map((e) {
final secrets = e.trim().split(":").map((e) => e.trim()); final secrets = e.trim().split(":").map((e) => e.trim());
return { return {

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/env.dart';
import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/modules/getting_started/blur_card.dart'; import 'package:spotube/modules/getting_started/blur_card.dart';
import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/context.dart';
@ -62,6 +63,7 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget {
); );
}, },
), ),
if (!Env.hideDonations) ...[
const Gap(16), const Gap(16),
FilledButton.icon( FilledButton.icon(
icon: const Icon(SpotubeIcons.openCollective), icon: const Icon(SpotubeIcons.openCollective),
@ -77,6 +79,7 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget {
); );
}, },
), ),
]
], ],
), ),
], ],

View File

@ -21,6 +21,7 @@ class SettingsAboutSection extends HookConsumerWidget {
return SectionCardWithHeading( return SectionCardWithHeading(
heading: context.l10n.about, heading: context.l10n.about,
children: [ children: [
if (!Env.hideDonations)
AdaptiveListTile( AdaptiveListTile(
leading: const Icon( leading: const Icon(
SpotubeIcons.heart, SpotubeIcons.heart,
@ -44,7 +45,8 @@ class SettingsAboutSection extends HookConsumerWidget {
trailing: (context, update) => FilledButton( trailing: (context, update) => FilledButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.red[100]), backgroundColor: WidgetStatePropertyAll(Colors.red[100]),
foregroundColor: const WidgetStatePropertyAll(Colors.pinkAccent), foregroundColor:
const WidgetStatePropertyAll(Colors.pinkAccent),
padding: const WidgetStatePropertyAll(EdgeInsets.all(15)), padding: const WidgetStatePropertyAll(EdgeInsets.all(15)),
), ),
onPressed: () { onPressed: () {