Skip to content

Commit

Permalink
Fix download bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuslos committed Jan 5, 2024
1 parent f0c3b68 commit 0c55f18
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public extension OfflineManager {
let playlistTrackIds = reduceToChildrenIds(parents: playlists)

let tracks = try getOfflineTracks()
let orphaned = tracks.filter { albumTrackIds.contains($0.id) || playlistTrackIds.contains($0.id) }
let orphaned = tracks.filter { !albumTrackIds.contains($0.id) && !playlistTrackIds.contains($0.id) }

for orphan in orphaned {
delete(track: orphan)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import AFBaseKit
extension OfflineManager {
@MainActor
func download(track: Track) {
if let existing = try? getOfflineTrack(trackId: track.id) {
if (try? getOfflineTrack(trackId: track.id)) != nil {
return
}

Expand Down
4 changes: 1 addition & 3 deletions iOS/Presentation/Views/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ struct AccountSheet: View {
Text("account.logout")
}
Button(role: .destructive) {
Task {
try await OfflineManager.shared.deleteAll()
}
try! OfflineManager.shared.deleteAll()
} label: {
Text("account.deleteDownloads")
}
Expand Down

0 comments on commit 0c55f18

Please sign in to comment.