mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-02 00:54:30 +02:00
Clean up progress logic
This commit is contained in:
parent
af2c609405
commit
dc8bc2fccd
2 changed files with 27 additions and 25 deletions
|
@ -169,15 +169,9 @@ class Database {
|
|||
}
|
||||
}
|
||||
|
||||
public func updateDownloadItemPartPercent(downloadItemPartId: String, percent: Double) {
|
||||
public func updateDownloadItemPart(_ part: DownloadItemPart) {
|
||||
Database.realmQueue.sync {
|
||||
try! instance.write {
|
||||
let part = instance.object(ofType: DownloadItemPart.self, forPrimaryKey: downloadItemPartId)
|
||||
guard var part = part else {
|
||||
NSLog("downloadItemPartId not found (\(downloadItemPartId)")
|
||||
return
|
||||
}
|
||||
part.progress = percent
|
||||
instance.add(part, update: .modified)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue