mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-02 09:04:40 +02:00
Fix server media progress JSON decoding
This commit is contained in:
parent
add64249cd
commit
a82474cf45
4 changed files with 31 additions and 25 deletions
|
@ -55,8 +55,14 @@ extension KeyedDecodingContainer {
|
|||
extension CAPPluginCall {
|
||||
func getJson<T: Decodable>(_ key: String, type: T.Type) -> T? {
|
||||
guard let value = getObject(key) else { return nil }
|
||||
guard let json = try? JSONSerialization.data(withJSONObject: value) else { return nil }
|
||||
return try? JSONDecoder().decode(type, from: json)
|
||||
do {
|
||||
let json = try JSONSerialization.data(withJSONObject: value)
|
||||
return try JSONDecoder().decode(type, from: json)
|
||||
} catch {
|
||||
NSLog("Failed to get json for \(key)")
|
||||
debugPrint(error)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue