mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-29 15:28:48 +02:00
refactor(providers): remove dead lookup/history APIs and dedup provider resolution
Delete the verbatim-duplicate LocalLibraryLookup class + provider, the unused localLibrarySummaryProvider, notifier search()/getCount()/existsInLibrary wrapper, and the now-orphaned LibraryDatabase.search(); the notifier's async getById/findExisting lookups (the real ones) stay. Drop dead download-history removeBySpotifyId/getDatabaseCount and the orphaned history deleteBySpotifyId, and fold the byte-identical addToHistory/ adoptNativeHistoryItem into one _persistHistoryItem keeping distinct log text. Delete dead extension_provider members (ensureSpotifyWebExtensionReady, enabledExtensions, getExtension, resolveProviderDisplayName, URLHandler.matchesURL, Extension.hasBrowseCategories) and collapse resolveEffectiveDownloadService/ MetadataProvider into one predicate-parameterized helper.
This commit is contained in:
@@ -765,31 +765,6 @@ class HistoryDatabase {
|
||||
});
|
||||
}
|
||||
|
||||
Future<int> deleteBySpotifyId(String spotifyId) async {
|
||||
final db = await database;
|
||||
final rows = await db.query(
|
||||
'history',
|
||||
columns: ['id'],
|
||||
where: 'spotify_id = ?',
|
||||
whereArgs: [spotifyId],
|
||||
);
|
||||
final ids = rows.map((row) => row['id'] as String).toList(growable: false);
|
||||
return db.transaction<int>((txn) async {
|
||||
for (final id in ids) {
|
||||
await txn.delete(
|
||||
'history_path_keys',
|
||||
where: 'item_id = ?',
|
||||
whereArgs: [id],
|
||||
);
|
||||
}
|
||||
return txn.delete(
|
||||
'history',
|
||||
where: 'spotify_id = ?',
|
||||
whereArgs: [spotifyId],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> clearAll() async {
|
||||
final db = await database;
|
||||
await db.transaction((txn) async {
|
||||
|
||||
@@ -1862,23 +1862,6 @@ class LibraryDatabase {
|
||||
return Sqflite.firstIntValue(result) ?? 0;
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> search(
|
||||
String query, {
|
||||
int limit = 50,
|
||||
}) async {
|
||||
final db = await database;
|
||||
final searchQuery = '%${_escapeLikePattern(query.toLowerCase())}%';
|
||||
final rows = await db.query(
|
||||
'library',
|
||||
where:
|
||||
"LOWER(track_name) LIKE ? ESCAPE '\\' OR LOWER(artist_name) LIKE ? ESCAPE '\\' OR LOWER(album_name) LIKE ? ESCAPE '\\'",
|
||||
whereArgs: [searchQuery, searchQuery, searchQuery],
|
||||
orderBy: 'track_name',
|
||||
limit: limit,
|
||||
);
|
||||
return rows.map(_dbRowToJson).toList();
|
||||
}
|
||||
|
||||
Future<void> close() async {
|
||||
final db = await database;
|
||||
await db.close();
|
||||
|
||||
Reference in New Issue
Block a user