mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-06 02:55:58 +02:00
Merge pull request #362 from ronaldheft/fix-ios-mark-as-read-crash
Fix marking local book as read crashing iOS app
This commit is contained in:
commit
57777f2f4b
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