Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Oct 9, 2024
2 parents 8e287ab + f553e43 commit 94e7040
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ LASTFM_API_SECRET=

# Release channel. Can be: nightly, stable
RELEASE_CHANNEL=

HIDE_DONATIONS=
3 changes: 2 additions & 1 deletion cli/commands/build/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down
3 changes: 3 additions & 0 deletions lib/collections/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/collections/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -41,4 +46,4 @@ abstract class Env {
kIsFlatpak || _enableUpdateChecker == "1";

static String discordAppId = "1176718791388975124";
}
}
31 changes: 17 additions & 14 deletions lib/pages/getting_started/sections/support.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
);
},
),
]
],
),
],
Expand Down
76 changes: 39 additions & 37 deletions lib/pages/settings/sections/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 94e7040

Please sign in to comment.