mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-30 15:58:51 +02:00
feat(download): preserve quality variants
This commit is contained in:
@@ -39,6 +39,7 @@ class DownloadItem {
|
||||
final String? playlistName;
|
||||
final int? playlistPosition; // 1-based position in the source playlist
|
||||
final bool fromBatch;
|
||||
final bool preserveQualityVariant;
|
||||
|
||||
const DownloadItem({
|
||||
required this.id,
|
||||
@@ -57,6 +58,7 @@ class DownloadItem {
|
||||
this.playlistName,
|
||||
this.playlistPosition,
|
||||
this.fromBatch = false,
|
||||
this.preserveQualityVariant = false,
|
||||
});
|
||||
|
||||
DownloadItem copyWith({
|
||||
@@ -76,6 +78,7 @@ class DownloadItem {
|
||||
String? playlistName,
|
||||
int? playlistPosition,
|
||||
bool? fromBatch,
|
||||
bool? preserveQualityVariant,
|
||||
}) {
|
||||
return DownloadItem(
|
||||
id: id ?? this.id,
|
||||
@@ -94,6 +97,8 @@ class DownloadItem {
|
||||
playlistName: playlistName ?? this.playlistName,
|
||||
playlistPosition: playlistPosition ?? this.playlistPosition,
|
||||
fromBatch: fromBatch ?? this.fromBatch,
|
||||
preserveQualityVariant:
|
||||
preserveQualityVariant ?? this.preserveQualityVariant,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ DownloadItem _$DownloadItemFromJson(Map<String, dynamic> json) => DownloadItem(
|
||||
playlistName: json['playlistName'] as String?,
|
||||
playlistPosition: (json['playlistPosition'] as num?)?.toInt(),
|
||||
fromBatch: json['fromBatch'] as bool? ?? false,
|
||||
preserveQualityVariant: json['preserveQualityVariant'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$DownloadItemToJson(DownloadItem instance) =>
|
||||
@@ -45,6 +46,7 @@ Map<String, dynamic> _$DownloadItemToJson(DownloadItem instance) =>
|
||||
'playlistName': instance.playlistName,
|
||||
'playlistPosition': instance.playlistPosition,
|
||||
'fromBatch': instance.fromBatch,
|
||||
'preserveQualityVariant': instance.preserveQualityVariant,
|
||||
};
|
||||
|
||||
const _$DownloadStatusEnumMap = {
|
||||
|
||||
@@ -97,6 +97,7 @@ class AppSettings {
|
||||
lastSeenVersion; // Last app version the user has acknowledged (e.g. '3.7.0')
|
||||
|
||||
final bool deduplicateDownloads;
|
||||
final bool allowQualityVariants;
|
||||
final bool saveDownloadHistory;
|
||||
|
||||
final String playerMode;
|
||||
@@ -165,6 +166,7 @@ class AppSettings {
|
||||
this.musixmatchLanguage = '',
|
||||
this.lastSeenVersion = '',
|
||||
this.deduplicateDownloads = true,
|
||||
this.allowQualityVariants = false,
|
||||
this.saveDownloadHistory = true,
|
||||
this.playerMode = 'external',
|
||||
});
|
||||
@@ -236,6 +238,7 @@ class AppSettings {
|
||||
String? musixmatchLanguage,
|
||||
String? lastSeenVersion,
|
||||
bool? deduplicateDownloads,
|
||||
bool? allowQualityVariants,
|
||||
bool? saveDownloadHistory,
|
||||
String? playerMode,
|
||||
}) {
|
||||
@@ -329,6 +332,7 @@ class AppSettings {
|
||||
musixmatchLanguage: musixmatchLanguage ?? this.musixmatchLanguage,
|
||||
lastSeenVersion: lastSeenVersion ?? this.lastSeenVersion,
|
||||
deduplicateDownloads: deduplicateDownloads ?? this.deduplicateDownloads,
|
||||
allowQualityVariants: allowQualityVariants ?? this.allowQualityVariants,
|
||||
saveDownloadHistory: saveDownloadHistory ?? this.saveDownloadHistory,
|
||||
playerMode: playerMode ?? this.playerMode,
|
||||
);
|
||||
|
||||
@@ -87,6 +87,7 @@ AppSettings _$AppSettingsFromJson(Map<String, dynamic> json) => AppSettings(
|
||||
musixmatchLanguage: json['musixmatchLanguage'] as String? ?? '',
|
||||
lastSeenVersion: json['lastSeenVersion'] as String? ?? '',
|
||||
deduplicateDownloads: json['deduplicateDownloads'] as bool? ?? true,
|
||||
allowQualityVariants: json['allowQualityVariants'] as bool? ?? false,
|
||||
saveDownloadHistory: json['saveDownloadHistory'] as bool? ?? true,
|
||||
playerMode: json['playerMode'] as String? ?? 'external',
|
||||
);
|
||||
@@ -158,6 +159,7 @@ Map<String, dynamic> _$AppSettingsToJson(
|
||||
'musixmatchLanguage': instance.musixmatchLanguage,
|
||||
'lastSeenVersion': instance.lastSeenVersion,
|
||||
'deduplicateDownloads': instance.deduplicateDownloads,
|
||||
'allowQualityVariants': instance.allowQualityVariants,
|
||||
'saveDownloadHistory': instance.saveDownloadHistory,
|
||||
'playerMode': instance.playerMode,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user