refactor(services): remove members with no caller

Delete Dart members that have no reference in lib, test or integration_test:
unused player configuration helpers and event streams, two PlatformBridge
wrappers, database and export helpers, the unused global logger and the
now pointless 'hide log' imports.
This commit is contained in:
zarzet committed 2026-10-18 22:12:29 +07:00
1 parent e41e6ec432
commit ec1b84e6de
11 files changed
+5 -162

No files matched your search

-2
View File
@@ -588,8 +588,6 @@ class ExtensionHealthStatus {
[],
);
}
bool get isSupported => status != 'unsupported';
}
class ExtensionHealthCheckStatus {
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -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';
@@ -778,50 +778,12 @@ class LibraryCollectionsNotifier extends Notifier<LibraryCollectionsState> {
_invalidatePlaylistPickerSummaries();
});
/// Returns the full collections snapshot (wishlist, loved, playlists,
/// favorite artists) for a backup, ensuring data is loaded first.
Future<Map<String, dynamic>> exportCollections() async {
await _ensureLoaded();
await ensurePlaylistsLoaded(state.playlists.map((playlist) => playlist.id));
return exportLibraryCollectionsState(state);
}
Future<String> 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<Map<String, Map<String, String>>> exportPlaylistCovers() async {
await _ensureLoaded();
final covers = <String, Map<String, String>>{};
final playlists = List<UserPlaylistCollection>.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<LibraryCollectionsState> {
/// 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<void> restoreFromBackup(
Map<String, dynamic> collectionsJson, {
-10
View File
@@ -1073,16 +1073,6 @@ class SettingsNotifier extends Notifier<AppSettings> {
_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,
-12
View File
@@ -1091,18 +1091,6 @@ class HistoryDatabase {
return results;
}
Future<void> 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<void> clearAll() async {
final db = await database;
await db.transaction((txn) async {
-15
View File
@@ -998,21 +998,6 @@ class LibraryDatabase {
);
}
Future<List<String>> 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<String>()
.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<List<IsrcDuplicateGroup>> findIsrcDuplicateGroups() async {
-10
View File
@@ -153,16 +153,6 @@ class M3uPlaylistService {
}
}
/// Writes the playlist to a shareable temp file named after the playlist.
static Future<File> 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<File> writeExportEntries(
-30
View File
@@ -63,13 +63,6 @@ void configurePlaybackNotification({
Future<void> 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<MusicPlayerHandler> initMusicPlayer() => musicPlayerRuntime.initialize();
/// Restores the last persisted playback session (if any) into a freshly
@@ -2397,10 +2374,3 @@ Future<void> restorePlaybackSession(MusicPlayerRuntime runtime) async {
_log.w('Failed to restore playback session: $e');
}
}
Stream<MediaItem?> musicPlayerMediaItemEvents() =>
musicPlayerRuntime.mediaItemEvents();
Stream<PlaybackState> musicPlayerPlaybackStateEvents() =>
musicPlayerRuntime.playbackStateEvents();
Stream<List<MediaItem>> musicPlayerQueueEvents() =>
musicPlayerRuntime.queueEvents();
-29
View File
@@ -1262,17 +1262,6 @@ class PlatformBridge {
return result as bool? ?? false;
}
static Future<bool> shareMultipleContentUris(
List<String> uris, {
String title = '',
}) async {
final result = await _channel.invokeMethod('shareMultipleContentUris', {
'uris': uris,
'title': title,
});
return result as bool? ?? false;
}
static Future<String> getLyricsLRC(
String spotifyId,
String trackName,
@@ -1372,12 +1361,6 @@ class PlatformBridge {
});
}
static Future<List<Map<String, dynamic>>>
getAvailableLyricsProviders() async {
final result = await _channel.invokeMethod('getAvailableLyricsProviders');
return _decodeMapListResult(result, 'getAvailableLyricsProviders');
}
/// Sets advanced lyrics fetch options used by provider-specific integrations.
static Future<void> setLyricsFetchOptions(
Map<String, dynamic> options,
@@ -2727,18 +2710,6 @@ class PlatformBridge {
);
}
static List<Map<String, dynamic>> _decodeMapListResult(
dynamic result,
String method,
) {
return _decodeRequiredListResult(result, method).map((entry) {
if (entry is Map) return entry.cast<String, dynamic>();
throw FormatException(
'Expected map entry from $method, got ${entry.runtimeType}',
);
}).toList();
}
static Future<List<Map<String, dynamic>>> _decodeMapListResultAsync(
dynamic result,
String method,
-12
View File
@@ -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;