mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Add getFileMetadataFromOcId method to NextcloudFilesDatabaseManager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5337d5d654
commit
8e90f66918
1 changed files with 6 additions and 2 deletions
|
@ -26,7 +26,6 @@ class NextcloudFilesDatabaseManager : NSObject {
|
|||
var databasePath: URL?
|
||||
|
||||
let schemaVersion: UInt64 = 100
|
||||
var validDatabase: Bool = false
|
||||
|
||||
override init() {
|
||||
self.relativeDatabaseFilePath = self.relativeDatabaseFolderPath + self.databaseFilename
|
||||
|
@ -61,11 +60,16 @@ class NextcloudFilesDatabaseManager : NSObject {
|
|||
do {
|
||||
let realm = try Realm()
|
||||
print("Successfully started Realm db for FileProviderExt")
|
||||
self.validDatabase = true
|
||||
} catch let error as NSError {
|
||||
print("Error opening Realm db: %@", error.localizedDescription)
|
||||
}
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
func getFileMetadataFromOcId(ocId: String) -> NextcloudFileMetadataTable? {
|
||||
let realm = try! Realm()
|
||||
realm.refresh()
|
||||
return realm.objects(NextcloudFileMetadataTable.self).filter("ocId == %@", ocId).first
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue