mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-31 16:14:59 +02:00
Refactor storage model to work with native Realm
This commit is contained in:
parent
b0905d0270
commit
d83e04c47b
33 changed files with 1580 additions and 1305 deletions
|
@ -131,14 +131,6 @@ class Database {
|
|||
try! realm.write { realm.add(localLibraryItem, update: .modified) }
|
||||
}
|
||||
|
||||
public func removeLocalLibraryItem(localLibraryItemId: String) {
|
||||
let realm = try! Realm()
|
||||
try! realm.write {
|
||||
let item = getLocalLibraryItem(localLibraryItemId: localLibraryItemId)
|
||||
realm.delete(item!)
|
||||
}
|
||||
}
|
||||
|
||||
public func getLocalFile(localFileId: String) -> LocalFile? {
|
||||
let realm = try! Realm()
|
||||
return realm.object(ofType: LocalFile.self, forPrimaryKey: localFileId)
|
||||
|
@ -164,11 +156,6 @@ class Database {
|
|||
return try! realm.write { realm.add(downloadItem, update: .modified) }
|
||||
}
|
||||
|
||||
public func removeDownloadItem(_ downloadItem: DownloadItem) {
|
||||
let realm = try! Realm()
|
||||
return try! realm.write { realm.delete(downloadItem) }
|
||||
}
|
||||
|
||||
public func getDeviceSettings() -> DeviceSettings {
|
||||
let realm = try! Realm()
|
||||
return realm.objects(DeviceSettings.self).first ?? getDefaultDeviceSettings()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue