mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-03 17:44:51 +02:00
Fix marking as read crashing app
This commit is contained in:
parent
003285f567
commit
41753cd853
1 changed files with 12 additions and 0 deletions
|
@ -157,7 +157,19 @@ extension LocalMediaProgress {
|
|||
}
|
||||
}
|
||||
|
||||
static func getLocalMediaProgressId(localLibraryItemId: String?, localEpisodeId: String?) -> String? {
|
||||
if let itemId = localLibraryItemId, let episodeId = localEpisodeId {
|
||||
return "\(itemId)-\(episodeId)"
|
||||
} else if let itemId = localLibraryItemId {
|
||||
return itemId
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
static func fetchOrCreateLocalMediaProgress(localMediaProgressId: String?, localLibraryItemId: String?, localEpisodeId: String?) throws -> LocalMediaProgress? {
|
||||
let localMediaProgressId = localMediaProgressId != nil ? localMediaProgressId : LocalMediaProgress.getLocalMediaProgressId(localLibraryItemId: localLibraryItemId, localEpisodeId: localEpisodeId)
|
||||
|
||||
let realm = try Realm()
|
||||
return try realm.write { () -> LocalMediaProgress? in
|
||||
if let localMediaProgressId = localMediaProgressId {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue