Report download progress to the UI

This commit is contained in:
ronaldheft 2022-08-06 18:21:11 -04:00
parent d5d65e244b
commit af2c609405
3 changed files with 47 additions and 7 deletions

View file

@ -28,6 +28,10 @@ struct DownloadItem: Realmable, Codable {
static func indexedProperties() -> [String] {
["libraryItemId"]
}
private enum CodingKeys : String, CodingKey {
case id, libraryItemId, episodeId, userMediaProgress, serverConnectionConfigId, serverAddress, serverUserId, mediaType, itemTitle, downloadItemParts
}
}
extension DownloadItem {
@ -58,17 +62,20 @@ struct DownloadItemPart: Realmable, Codable {
var uri: String?
var destinationUri: String?
var finalDestinationUri: String?
var downloadId: Int?
var progress: Int = 0
var progress: Double = 0
var task: URLSessionDownloadTask!
private enum CodingKeys : String, CodingKey {
case id, progress
static func primaryKey() -> String? {
return "id"
}
static func ignoredProperties() -> [String] {
["task"]
}
private enum CodingKeys : String, CodingKey {
case id, filename, completed, moved, failed, progress
}
}
extension DownloadItemPart {