mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-11 02:08:44 +02:00
chore: clean up redundant comments across Go backend and Flutter sources
This commit is contained in:
1 parent
c1c0494912
commit
50509d0a16
23 files changed
+20
-88
No files matched your search
@@ -29,14 +29,14 @@ class DownloadItem {
|
||||
final DownloadStatus status;
|
||||
final double progress;
|
||||
final double speedMBps;
|
||||
final int bytesReceived; // Bytes downloaded so far
|
||||
final int bytesReceived;
|
||||
final int bytesTotal; // Total bytes when the server provides content length
|
||||
final String? filePath;
|
||||
final String? error;
|
||||
final DownloadErrorType? errorType;
|
||||
final DateTime createdAt;
|
||||
final String? qualityOverride; // Override quality for this specific download
|
||||
final String? playlistName; // Playlist context for folder organization
|
||||
final String? qualityOverride;
|
||||
final String? playlistName;
|
||||
final int? playlistPosition; // 1-based position in the source playlist
|
||||
|
||||
const DownloadItem({
|
||||
|
||||
+10
-10
@@ -15,11 +15,11 @@ class AppSettings {
|
||||
final String storageMode; // 'app' or 'saf'
|
||||
final String downloadTreeUri; // SAF persistable tree URI
|
||||
final bool autoFallback;
|
||||
final bool embedMetadata; // Master switch for metadata/cover/lyrics embedding
|
||||
final bool embedMetadata;
|
||||
final String
|
||||
artistTagMode; // 'joined' or 'split_vorbis' for Vorbis-based formats
|
||||
final bool embedLyrics;
|
||||
final bool embedReplayGain; // Calculate and embed ReplayGain tags
|
||||
final bool embedReplayGain;
|
||||
final bool maxQualityCover;
|
||||
final bool isFirstLaunch;
|
||||
final bool checkForUpdates;
|
||||
@@ -50,7 +50,7 @@ class AppSettings {
|
||||
final bool
|
||||
useAllFilesAccess; // Android 13+ only: enable MANAGE_EXTERNAL_STORAGE
|
||||
final bool
|
||||
autoExportFailedDownloads; // Auto export failed downloads to TXT file
|
||||
autoExportFailedDownloads;
|
||||
final String
|
||||
downloadNetworkMode; // 'any' = WiFi + Mobile, 'wifi_only' = WiFi only
|
||||
final bool
|
||||
@@ -62,20 +62,20 @@ class AppSettings {
|
||||
final bool
|
||||
nativeDownloadWorkerEnabled; // Experimental Android service-owned worker
|
||||
|
||||
final bool localLibraryEnabled; // Enable local library scanning
|
||||
final String localLibraryPath; // Path to scan for audio files
|
||||
final bool localLibraryEnabled;
|
||||
final String localLibraryPath;
|
||||
final String
|
||||
localLibraryBookmark; // Base64-encoded iOS security-scoped bookmark
|
||||
final bool
|
||||
localLibraryShowDuplicates; // Show indicator when searching for existing tracks
|
||||
localLibraryShowDuplicates;
|
||||
final String
|
||||
localLibraryAutoScan; // Auto-scan mode: 'off', 'on_open', 'daily', 'weekly'
|
||||
|
||||
final bool
|
||||
hasCompletedTutorial; // Track if user has completed the app tutorial
|
||||
hasCompletedTutorial;
|
||||
|
||||
final List<String>
|
||||
lyricsProviders; // Ordered list of enabled lyrics provider IDs
|
||||
lyricsProviders;
|
||||
final bool
|
||||
lyricsIncludeTranslationNetease; // Append translated lyrics (Netease)
|
||||
final bool
|
||||
@@ -91,8 +91,8 @@ class AppSettings {
|
||||
lastSeenVersion; // Last app version the user has acknowledged (e.g. '3.7.0')
|
||||
|
||||
final bool
|
||||
deduplicateDownloads; // Skip downloading tracks already present in history
|
||||
final bool saveDownloadHistory; // Record completed downloads in local history
|
||||
deduplicateDownloads;
|
||||
final bool saveDownloadHistory;
|
||||
|
||||
const AppSettings({
|
||||
this.defaultService = '',
|
||||
|
||||
@@ -4539,14 +4539,13 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
.where((item) => _albumRgKey(item.track) == key)
|
||||
.toList();
|
||||
|
||||
// If any item is still in-flight, the album isn't complete yet.
|
||||
final pending = albumItemsInQueue.where(
|
||||
(item) =>
|
||||
item.status == DownloadStatus.queued ||
|
||||
item.status == DownloadStatus.downloading ||
|
||||
item.status == DownloadStatus.finalizing,
|
||||
);
|
||||
if (pending.isNotEmpty) return; // still in progress
|
||||
if (pending.isNotEmpty) return;
|
||||
|
||||
// If any item is failed/skipped, the user might retry it later.
|
||||
// Don't finalize album RG with partial data — wait until all album
|
||||
@@ -4556,7 +4555,7 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
item.status == DownloadStatus.failed ||
|
||||
item.status == DownloadStatus.skipped,
|
||||
);
|
||||
if (retryable.isNotEmpty) return; // still retryable
|
||||
if (retryable.isNotEmpty) return;
|
||||
|
||||
// The accumulator entries represent successfully scanned tracks. Entries
|
||||
// are only added after a successful ReplayGain scan, removed on retry or
|
||||
@@ -4696,7 +4695,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// If any representative item is available, use its track.
|
||||
final representative = albumItems.first;
|
||||
_checkAndWriteAlbumReplayGain(representative.track);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,6 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
},
|
||||
);
|
||||
|
||||
// Watch for new homeFeed extension being installed/enabled after init
|
||||
_homeFeedExtSub = ref.listenManual<bool>(
|
||||
extensionProvider.select(
|
||||
(s) => s.extensions.any((e) => e.enabled && e.hasHomeFeed),
|
||||
|
||||
@@ -772,7 +772,7 @@ class _SwingIconState extends State<SwingIcon>
|
||||
duration: const Duration(milliseconds: 600),
|
||||
vsync: this,
|
||||
);
|
||||
// Create a swinging motion (like a pendulum/sign)
|
||||
|
||||
_rotationAnimation = TweenSequence<double>([
|
||||
TweenSequenceItem(tween: Tween(begin: 0.0, end: -0.2), weight: 20),
|
||||
TweenSequenceItem(tween: Tween(begin: -0.2, end: 0.15), weight: 20),
|
||||
|
||||
@@ -531,8 +531,8 @@ class _SetupScreenState extends ConsumerState<SetupScreen> {
|
||||
}
|
||||
|
||||
bool _isStepCompleted(int step) {
|
||||
if (step == 0) return true; // Welcome
|
||||
if (step == 1) return true; // Language (always valid)
|
||||
if (step == 0) return true;
|
||||
if (step == 1) return true;
|
||||
|
||||
final logicStep = step - 2;
|
||||
|
||||
|
||||
@@ -834,7 +834,6 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
// Fetch ISRC from Deezer track metadata if still missing
|
||||
if (needsIsrc &&
|
||||
(enriched['isrc'] ?? '').trim().isEmpty &&
|
||||
deezerId != null) {
|
||||
|
||||
@@ -2691,7 +2691,6 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
cleanFilePath,
|
||||
tempOutput,
|
||||
);
|
||||
// Fall back to downloading from URL if extraction failed.
|
||||
if (result['error'] != null &&
|
||||
_coverUrl != null &&
|
||||
_coverUrl!.isNotEmpty) {
|
||||
@@ -2782,13 +2781,10 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
|
||||
Map<String, dynamic> result;
|
||||
if (_fileExists) {
|
||||
// Prefer extracting cover from the already-downloaded file to avoid
|
||||
// a redundant network request.
|
||||
result = await PlatformBridge.extractCoverToFile(
|
||||
cleanFilePath,
|
||||
outputPath,
|
||||
);
|
||||
// Fall back to downloading from URL if extraction failed.
|
||||
if (result['error'] != null &&
|
||||
_coverUrl != null &&
|
||||
_coverUrl!.isNotEmpty) {
|
||||
@@ -2850,7 +2846,6 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
}
|
||||
|
||||
if (_isSafFile) {
|
||||
// SAF file: save to temp, then copy to SAF tree
|
||||
final tempDir = await Directory.systemTemp.createTemp('lyrics_');
|
||||
final tempOutput =
|
||||
'${tempDir.path}${Platform.pathSeparator}$baseName.lrc';
|
||||
@@ -4407,7 +4402,6 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
|
||||
var finalOutputPaths = outputPaths;
|
||||
|
||||
// Embed cover art into split FLAC files using Go backend
|
||||
if (coverPath != null && finalOutputPaths != null) {
|
||||
for (final path in finalOutputPaths) {
|
||||
if (path.toLowerCase().endsWith('.flac')) {
|
||||
|
||||
@@ -1338,7 +1338,6 @@ class FFmpegService {
|
||||
final tempFile = File(tempOutput);
|
||||
if (await tempFile.exists()) {
|
||||
if (returnTempPath) {
|
||||
// Caller will handle SAF write-back and cleanup.
|
||||
onTempReady?.call(tempOutput);
|
||||
return true;
|
||||
}
|
||||
@@ -3051,7 +3050,6 @@ class FFmpegService {
|
||||
case 'COMMENT':
|
||||
id3Map['comment'] = value;
|
||||
break;
|
||||
// ReplayGain as TXXX user-defined frames
|
||||
// FFmpeg writes these as TXXX frames automatically with uppercase keys
|
||||
case 'REPLAYGAINTRACKGAIN':
|
||||
id3Map['REPLAYGAIN_TRACK_GAIN'] = value;
|
||||
|
||||
@@ -2027,8 +2027,6 @@ class PlatformBridge {
|
||||
return const <String, dynamic>{};
|
||||
}
|
||||
|
||||
// MARK: - iOS Security-Scoped Bookmark
|
||||
|
||||
/// Create a security-scoped bookmark from a filesystem path picked by
|
||||
/// FilePicker on iOS. Must be called while the picker session is still active.
|
||||
/// Returns base64-encoded bookmark data, or null on failure.
|
||||
|
||||
@@ -16,11 +16,6 @@ class AppTheme {
|
||||
// cost of the predictive-back preview animation.
|
||||
static const PageTransitionsTheme _pageTransitionsTheme = PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
// Android default is PredictiveBackPageTransitionsBuilder, whose
|
||||
// _PredictiveBackGestureDetector mis-routes the back gesture to a nested
|
||||
// Navigator (flutter#152323). For NON-gesture transitions that builder
|
||||
// already delegates to FadeForwardsPageTransitionsBuilder, so we use it
|
||||
// directly: identical push/pop animation, minus the buggy gesture detector.
|
||||
TargetPlatform.android: FadeForwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
|
||||
|
||||
@@ -542,7 +542,7 @@ class ArtistScreenSkeleton extends StatelessWidget {
|
||||
borderRadius: 4,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// Mimics the small "In Library" badge pill.
|
||||
|
||||
const SkeletonBox(
|
||||
width: 64,
|
||||
height: 14,
|
||||
|
||||
@@ -121,10 +121,6 @@ Future<void> showAppAnnouncementDialog(
|
||||
required RemoteAnnouncement announcement,
|
||||
required VoidCallback onDismiss,
|
||||
}) {
|
||||
// barrierDismissible is false so a stray tap outside the dialog can no longer
|
||||
// close (and silently mark-as-seen) the notice. Dismissal — and the
|
||||
// mark-as-seen side effect in onDismiss — only happens via the explicit close
|
||||
// button or the CTA, both of which call onDismiss themselves.
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
|
||||
@@ -1646,7 +1646,6 @@ class _SpectrogramView extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
// Intensity color legend (matches the spectrogram colormap).
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(40, 0, 10, 8),
|
||||
child: Row(
|
||||
@@ -1731,7 +1730,6 @@ class _SpectrogramPainter extends CustomPainter {
|
||||
);
|
||||
if (plot.width <= 0 || plot.height <= 0) return;
|
||||
|
||||
// Spectrogram image.
|
||||
canvas.drawImageRect(
|
||||
image,
|
||||
Rect.fromLTWH(0, 0, image.width.toDouble(), image.height.toDouble()),
|
||||
@@ -1760,7 +1758,6 @@ class _SpectrogramPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
// Time axis (X): 0 at the left, duration at the right.
|
||||
if (durationSec > 0) {
|
||||
final stepSec = _niceStepSec(durationSec);
|
||||
for (double ts = 0; ts <= durationSec + 0.001; ts += stepSec) {
|
||||
|
||||
Reference in new issue
Block a user