diff --git a/lib/models/extension.dart b/lib/models/extension.dart index cdd07724..66d6b811 100644 --- a/lib/models/extension.dart +++ b/lib/models/extension.dart @@ -588,8 +588,6 @@ class ExtensionHealthStatus { [], ); } - - bool get isSupported => status != 'unsupported'; } class ExtensionHealthCheckStatus { diff --git a/lib/providers/download_history_provider.dart b/lib/providers/download_history_provider.dart index a256c21f..12d270e3 100644 --- a/lib/providers/download_history_provider.dart +++ b/lib/providers/download_history_provider.dart @@ -9,7 +9,7 @@ import 'package:spotiflac_android/models/track.dart'; import 'package:spotiflac_android/services/platform_bridge.dart'; import 'package:spotiflac_android/services/history_database.dart'; import 'package:spotiflac_android/services/history_maintenance.dart'; -import 'package:spotiflac_android/utils/logger.dart' hide log; +import 'package:spotiflac_android/utils/logger.dart'; import 'package:spotiflac_android/utils/file_access.dart'; import 'package:spotiflac_android/utils/string_utils.dart'; import 'package:spotiflac_android/utils/audio_format_utils.dart'; diff --git a/lib/providers/download_queue_provider.dart b/lib/providers/download_queue_provider.dart index cce3e2ba..c4740dfb 100644 --- a/lib/providers/download_queue_provider.dart +++ b/lib/providers/download_queue_provider.dart @@ -37,7 +37,7 @@ import 'package:spotiflac_android/services/replaygain_service.dart'; import 'package:spotiflac_android/services/album_replaygain_readiness.dart'; import 'package:spotiflac_android/services/notification_service.dart'; import 'package:spotiflac_android/services/verification_notification.dart'; -import 'package:spotiflac_android/utils/logger.dart' hide log; +import 'package:spotiflac_android/utils/logger.dart'; import 'package:spotiflac_android/utils/file_access.dart'; import 'package:spotiflac_android/utils/string_utils.dart'; import 'package:spotiflac_android/utils/artist_utils.dart'; diff --git a/lib/providers/library_collections_provider.dart b/lib/providers/library_collections_provider.dart index db35fdf9..3e2973c1 100644 --- a/lib/providers/library_collections_provider.dart +++ b/lib/providers/library_collections_provider.dart @@ -778,50 +778,12 @@ class LibraryCollectionsNotifier extends Notifier { _invalidatePlaylistPickerSummaries(); }); - /// Returns the full collections snapshot (wishlist, loved, playlists, - /// favorite artists) for a backup, ensuring data is loaded first. - Future> exportCollections() async { - await _ensureLoaded(); - await ensurePlaylistsLoaded(state.playlists.map((playlist) => playlist.id)); - return exportLibraryCollectionsState(state); - } - Future exportCollectionsJson() async { await _ensureLoaded(); await ensurePlaylistsLoaded(state.playlists.map((playlist) => playlist.id)); return exportLibraryCollectionsJson(state); } - /// Exports custom playlist cover images as base64, keyed by playlist id. - /// Each value contains the original file extension and the encoded bytes so a - /// restore on another device can recreate the cover files. - Future>> exportPlaylistCovers() async { - await _ensureLoaded(); - final covers = >{}; - final playlists = List.of(state.playlists); - for (final playlist in playlists) { - var path = playlist.coverImagePath; - if (path == null || path.isEmpty) continue; - try { - if (await _playlistCoverNeedsNormalization(path)) { - await setPlaylistCover(playlist.id, path); - path = state.playlistById(playlist.id)?.coverImagePath ?? path; - } - final file = File(path); - if (!await file.exists()) continue; - final bytes = await file.readAsBytes(); - if (bytes.isEmpty) continue; - covers[playlist.id] = { - 'ext': p.extension(path).toLowerCase(), - 'data': base64Encode(bytes), - }; - } catch (_) { - // Skip unreadable cover; the rest of the backup still succeeds. - } - } - return covers; - } - /// Returns cover file references for the streaming ZIP backup format. The /// backup writer reads each file directly instead of materializing every /// image as base64 in memory. @@ -852,8 +814,9 @@ class LibraryCollectionsNotifier extends Notifier { /// Replaces all collections (wishlist, loved, playlists, favorite artists) /// with the contents of a backup. [collectionsJson] uses the - /// [LibraryCollectionsState.toJson] shape; [coverImages] is the map produced - /// by [exportPlaylistCovers]. Cover images are rewritten into this device's + /// [LibraryCollectionsState.toJson] shape; [coverImages] is the backup's + /// playlist cover map: `ext` plus either a `path` to an extracted file or + /// legacy base64 `data`. Cover images are rewritten into this device's /// covers directory and their paths fixed up before persisting. Future restoreFromBackup( Map collectionsJson, { diff --git a/lib/providers/settings_provider.dart b/lib/providers/settings_provider.dart index afa779d2..bba1c66d 100644 --- a/lib/providers/settings_provider.dart +++ b/lib/providers/settings_provider.dart @@ -1073,16 +1073,6 @@ class SettingsNotifier extends Notifier { _saveSettings(); } - void setLocalLibraryPath(String path) { - state = state.copyWith(localLibraryPath: path); - _saveSettings(); - } - - void setLocalLibraryBookmark(String bookmark) { - state = state.copyWith(localLibraryBookmark: bookmark); - _saveSettings(); - } - void setLocalLibraryPathAndBookmark(String path, String bookmark) { state = state.copyWith( localLibraryPath: path, diff --git a/lib/services/history_database.dart b/lib/services/history_database.dart index acb3dceb..d2e17739 100644 --- a/lib/services/history_database.dart +++ b/lib/services/history_database.dart @@ -1091,18 +1091,6 @@ class HistoryDatabase { return results; } - Future deleteById(String id) async { - final db = await database; - await db.transaction((txn) async { - await txn.delete( - 'history_path_keys', - where: 'item_id = ?', - whereArgs: [id], - ); - await txn.delete('history', where: 'id = ?', whereArgs: [id]); - }); - } - Future clearAll() async { final db = await database; await db.transaction((txn) async { diff --git a/lib/services/library_database.dart b/lib/services/library_database.dart index 903ff608..39d0fe09 100644 --- a/lib/services/library_database.dart +++ b/lib/services/library_database.dart @@ -998,21 +998,6 @@ class LibraryDatabase { ); } - Future> getCoverPaths({int? limit, int? offset}) async { - final db = await database; - final rows = await db.query( - 'library', - columns: ['cover_path'], - where: 'cover_path IS NOT NULL AND cover_path != ""', - limit: limit, - offset: offset, - ); - return rows - .map((row) => row['cover_path'] as String?) - .whereType() - .toList(growable: false); - } - /// Physical copies sharing one ISRC, excluding inactive NAS sources and /// alternate index/URI references to the same file. Best quality comes first. Future> findIsrcDuplicateGroups() async { diff --git a/lib/services/m3u_playlist_service.dart b/lib/services/m3u_playlist_service.dart index 6b2860bb..edf1d32f 100644 --- a/lib/services/m3u_playlist_service.dart +++ b/lib/services/m3u_playlist_service.dart @@ -153,16 +153,6 @@ class M3uPlaylistService { } } - /// Writes the playlist to a shareable temp file named after the playlist. - static Future writeExportFile( - String playlistName, - String content, - ) async { - final file = await _exportFile(playlistName); - await file.writeAsString(content); - return file; - } - /// Serialize directly to a native worker file; Flutter only sends the fields /// represented in M3U, rather than an encoded playlist string. static Future writeExportEntries( diff --git a/lib/services/music_player_service.dart b/lib/services/music_player_service.dart index bbe0b551..e046f331 100644 --- a/lib/services/music_player_service.dart +++ b/lib/services/music_player_service.dart @@ -63,13 +63,6 @@ void configurePlaybackNotification({ Future restoreMusicAudioSessionAfterVideo() async => musicPlayerRuntime.handler?.restoreIosNowPlaying(); -/// Enables/disables ReplayGain volume normalization and re-applies it to the -/// track currently playing. -void setPlaybackNormalizationEnabled(bool enabled) => - musicPlayerRuntime.configure( - musicPlayerRuntime.settings.copyWith(playbackNormalization: enabled), - ); - void setPlaybackAutomationOptions({ required bool enabled, required bool pauseOnMute, @@ -101,20 +94,6 @@ void setUsbBitPerfectEnabled(bool enabled) => musicPlayerRuntime.configure( musicPlayerRuntime.settings.copyWith(usbBitPerfect: enabled), ); -void setUsbOutputOptions({ - required bool direct, - required bool allowDop, - bool allowFixedVolume = false, - bool dapExclusive = false, -}) => musicPlayerRuntime.configure( - musicPlayerRuntime.settings.copyWith( - usbDirect: direct, - usbDsdOverPcm: allowDop, - usbAllowFixedVolume: allowFixedVolume, - dapExclusive: dapExclusive, - ), -); - /// Gain and rate the player applies to the current track. class PlaybackProcessing { const PlaybackProcessing({ @@ -2287,8 +2266,6 @@ class MusicPlayerHandler extends BaseAudioHandler } } -MusicPlayerHandler? get musicPlayerHandler => musicPlayerRuntime.handler; - Future initMusicPlayer() => musicPlayerRuntime.initialize(); /// Restores the last persisted playback session (if any) into a freshly @@ -2397,10 +2374,3 @@ Future restorePlaybackSession(MusicPlayerRuntime runtime) async { _log.w('Failed to restore playback session: $e'); } } - -Stream musicPlayerMediaItemEvents() => - musicPlayerRuntime.mediaItemEvents(); -Stream musicPlayerPlaybackStateEvents() => - musicPlayerRuntime.playbackStateEvents(); -Stream> musicPlayerQueueEvents() => - musicPlayerRuntime.queueEvents(); diff --git a/lib/services/platform_bridge.dart b/lib/services/platform_bridge.dart index 46720bd2..ff3db418 100644 --- a/lib/services/platform_bridge.dart +++ b/lib/services/platform_bridge.dart @@ -1262,17 +1262,6 @@ class PlatformBridge { return result as bool? ?? false; } - static Future shareMultipleContentUris( - List uris, { - String title = '', - }) async { - final result = await _channel.invokeMethod('shareMultipleContentUris', { - 'uris': uris, - 'title': title, - }); - return result as bool? ?? false; - } - static Future getLyricsLRC( String spotifyId, String trackName, @@ -1372,12 +1361,6 @@ class PlatformBridge { }); } - static Future>> - getAvailableLyricsProviders() async { - final result = await _channel.invokeMethod('getAvailableLyricsProviders'); - return _decodeMapListResult(result, 'getAvailableLyricsProviders'); - } - /// Sets advanced lyrics fetch options used by provider-specific integrations. static Future setLyricsFetchOptions( Map options, @@ -2727,18 +2710,6 @@ class PlatformBridge { ); } - static List> _decodeMapListResult( - dynamic result, - String method, - ) { - return _decodeRequiredListResult(result, method).map((entry) { - if (entry is Map) return entry.cast(); - throw FormatException( - 'Expected map entry from $method, got ${entry.runtimeType}', - ); - }).toList(); - } - static Future>> _decodeMapListResultAsync( dynamic result, String method, diff --git a/lib/utils/logger.dart b/lib/utils/logger.dart index 0a1162cf..aa0f340e 100644 --- a/lib/utils/logger.dart +++ b/lib/utils/logger.dart @@ -468,18 +468,6 @@ class BufferedOutput extends LogOutput { } } -final log = Logger( - printer: PrettyPrinter( - methodCount: 0, - errorMethodCount: 5, - lineLength: 80, - colors: true, - printEmojis: false, - dateTimeFormat: DateTimeFormat.none, - ), - level: Level.debug, -); - class AppLogger { final String _tag; late final Logger? _logger;