Skip to content

Commit 113560f

Browse files
committed
fix: fixed offline storage leak
1 parent 14c7e22 commit 113560f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/services/playlist_download_service.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,21 @@ class OfflinePlaylistService {
286286
return playlistSongs.any((s) => s['ytid'] == songId);
287287
});
288288

289-
// Also check if song is in user's liked songs or custom playlists
289+
// Also check if song is in user's liked songs or OTHER custom playlists
290290
final isInLikedSongs = userLikedSongsList.any(
291291
(s) => s['ytid'] == songId,
292292
);
293-
final isInCustomPlaylists = getUserCustomPlaylists().any((p) {
293+
final isInOtherCustomPlaylists = getUserCustomPlaylists()
294+
.where((p) => p['ytid']?.toString() != normalizedPlaylistId)
295+
.any((p) {
294296
final customPlaylistSongs = p['list'] as List<dynamic>? ?? [];
295297
return customPlaylistSongs.any((s) => s['ytid'] == songId);
296298
});
297299

298300
// Only remove if not used elsewhere
299301
if (!isUsedInOtherPlaylists &&
300302
!isInLikedSongs &&
301-
!isInCustomPlaylists) {
303+
!isInOtherCustomPlaylists) {
302304
await removeSongFromOffline(songId);
303305
}
304306
} catch (e, stackTrace) {

0 commit comments

Comments
 (0)