Implement Milestone 7.2 offline audio downloads

This commit is contained in:
diyaa
2026-05-30 07:11:20 +02:00
parent 6e73c1878e
commit 56f030e651
19 changed files with 1822 additions and 31 deletions
@@ -0,0 +1,37 @@
import Foundation
public enum RemoteTrackDownloadStatus: String, Codable, Hashable, Sendable, CaseIterable {
case notDownloaded
case downloading
case downloaded
case failed
}
public struct RemoteTrackDownloadState: Codable, Hashable, Sendable {
public var remoteTrackId: String
public var assetId: String
public var localFilePath: String
public var downloadedAt: Date?
public var downloadStatus: RemoteTrackDownloadStatus
public var lastDownloadError: String?
public init(
remoteTrackId: String,
assetId: String,
localFilePath: String = "",
downloadedAt: Date? = nil,
downloadStatus: RemoteTrackDownloadStatus,
lastDownloadError: String? = nil
) {
self.remoteTrackId = remoteTrackId
self.assetId = assetId
self.localFilePath = localFilePath
self.downloadedAt = downloadedAt
self.downloadStatus = downloadStatus
self.lastDownloadError = lastDownloadError
}
public var hasLocalFile: Bool {
!localFilePath.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
}