Merge branch 'dev'

This commit is contained in:
Kingkor Roy Tirtho 2024-10-09 16:38:23 +06:00
commit 94e704087f
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 {
@ -41,4 +46,4 @@ abstract class Env {
kIsFlatpak || _enableUpdateChecker == "1"; kIsFlatpak || _enableUpdateChecker == "1";
static String discordAppId = "1176718791388975124"; static String discordAppId = "1176718791388975124";
} }

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