Files
SpotiFLAC-Mobile/lib/models/settings.dart
2026-01-01 19:28:15 +07:00

53 lines
1.5 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'settings.g.dart';
@JsonSerializable()
class AppSettings {
final String defaultService;
final String audioQuality;
final String filenameFormat;
final String downloadDirectory;
final bool autoFallback;
final bool embedLyrics;
final bool maxQualityCover;
final bool isFirstLaunch;
const AppSettings({
this.defaultService = 'tidal',
this.audioQuality = 'LOSSLESS',
this.filenameFormat = '{title} - {artist}',
this.downloadDirectory = '',
this.autoFallback = true,
this.embedLyrics = true,
this.maxQualityCover = true,
this.isFirstLaunch = true,
});
AppSettings copyWith({
String? defaultService,
String? audioQuality,
String? filenameFormat,
String? downloadDirectory,
bool? autoFallback,
bool? embedLyrics,
bool? maxQualityCover,
bool? isFirstLaunch,
}) {
return AppSettings(
defaultService: defaultService ?? this.defaultService,
audioQuality: audioQuality ?? this.audioQuality,
filenameFormat: filenameFormat ?? this.filenameFormat,
downloadDirectory: downloadDirectory ?? this.downloadDirectory,
autoFallback: autoFallback ?? this.autoFallback,
embedLyrics: embedLyrics ?? this.embedLyrics,
maxQualityCover: maxQualityCover ?? this.maxQualityCover,
isFirstLaunch: isFirstLaunch ?? this.isFirstLaunch,
);
}
factory AppSettings.fromJson(Map<String, dynamic> json) =>
_$AppSettingsFromJson(json);
Map<String, dynamic> toJson() => _$AppSettingsToJson(this);
}