feat: add deduplicateDownloads setting & fix build errors

- Add deduplicateDownloads field to AppSettings (default: true)
- Add setDeduplicateDownloads() to SettingsNotifier
- Fix type mismatch in files_settings_page (Object → String cast)
- Run build_runner to regenerate settings.g.dart
This commit is contained in:
Amonoman
2026-05-02 18:47:09 +02:00
parent 8f14ff169a
commit f8b7812943
4 changed files with 15 additions and 1 deletions
+3
View File
@@ -76,6 +76,9 @@ jobs:
- name: Get Flutter dependencies
run: flutter pub get
- name: Generate code
run: dart run build_runner build --delete-conflicting-outputs
- name: Build APK (Only arm64)
run: flutter build apk --release --target-platform android-arm64
+6
View File
@@ -82,6 +82,9 @@ class AppSettings {
final String
lastSeenVersion; // Last app version the user has acknowledged (e.g. '3.7.0')
final bool
deduplicateDownloads; // Skip downloading tracks already present in history
const AppSettings({
this.defaultService = 'tidal',
this.audioQuality = 'LOSSLESS',
@@ -144,6 +147,7 @@ class AppSettings {
this.lyricsMultiPersonWordByWord = false,
this.musixmatchLanguage = '',
this.lastSeenVersion = '',
this.deduplicateDownloads = true,
});
AppSettings copyWith({
@@ -205,6 +209,7 @@ class AppSettings {
bool? lyricsMultiPersonWordByWord,
String? musixmatchLanguage,
String? lastSeenVersion,
bool? deduplicateDownloads,
}) {
return AppSettings(
defaultService: defaultService ?? this.defaultService,
@@ -281,6 +286,7 @@ class AppSettings {
lyricsMultiPersonWordByWord ?? this.lyricsMultiPersonWordByWord,
musixmatchLanguage: musixmatchLanguage ?? this.musixmatchLanguage,
lastSeenVersion: lastSeenVersion ?? this.lastSeenVersion,
deduplicateDownloads: deduplicateDownloads ?? this.deduplicateDownloads,
);
}
+5
View File
@@ -544,6 +544,11 @@ class SettingsNotifier extends Notifier<AppSettings> {
state = state.copyWith(hasCompletedTutorial: true);
_saveSettings();
}
void setDeduplicateDownloads(bool enabled) {
state = state.copyWith(deduplicateDownloads: enabled);
_saveSettings();
}
}
final settingsProvider = NotifierProvider<SettingsNotifier, AppSettings>(
@@ -753,7 +753,7 @@ class _FilesSettingsPageState extends ConsumerState<FilesSettingsPage> {
),
const SizedBox(height: 8),
Text(
description ?? context.l10n.downloadFilenameDescription,
description ?? context.l10n.downloadFilenameDescription as String,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: colorScheme.onSurfaceVariant,
),