mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
Use new convenience method to get Item for root container from NCFPK
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
d74d23cedb
commit
6200cab957
1 changed files with 7 additions and 19 deletions
|
@ -85,10 +85,11 @@ import OSLog
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: NSFileProviderReplicatedExtension protocol methods
|
// MARK: - NSFileProviderReplicatedExtension protocol methods
|
||||||
|
|
||||||
func item(
|
func item(
|
||||||
for identifier: NSFileProviderItemIdentifier, request _: NSFileProviderRequest,
|
for identifier: NSFileProviderItemIdentifier,
|
||||||
|
request _: NSFileProviderRequest,
|
||||||
completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void
|
completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void
|
||||||
) -> Progress {
|
) -> Progress {
|
||||||
// resolve the given identifier to a record in the model
|
// resolve the given identifier to a record in the model
|
||||||
|
@ -96,8 +97,9 @@ import OSLog
|
||||||
Logger.fileProviderExtension.debug(
|
Logger.fileProviderExtension.debug(
|
||||||
"Received item request for item with identifier: \(identifier.rawValue, privacy: .public)"
|
"Received item request for item with identifier: \(identifier.rawValue, privacy: .public)"
|
||||||
)
|
)
|
||||||
|
|
||||||
if identifier == .rootContainer {
|
if identifier == .rootContainer {
|
||||||
guard let ncAccount else {
|
guard ncAccount != nil else {
|
||||||
Logger.fileProviderExtension.error(
|
Logger.fileProviderExtension.error(
|
||||||
"Not providing item: \(identifier.rawValue, privacy: .public) as account not set up yet"
|
"Not providing item: \(identifier.rawValue, privacy: .public) as account not set up yet"
|
||||||
)
|
)
|
||||||
|
@ -105,20 +107,7 @@ import OSLog
|
||||||
return Progress()
|
return Progress()
|
||||||
}
|
}
|
||||||
|
|
||||||
let metadata = ItemMetadata()
|
completionHandler(Item.rootContainer(ncKit: ncKit), nil)
|
||||||
|
|
||||||
metadata.account = ncAccount.ncKitAccount
|
|
||||||
metadata.directory = true
|
|
||||||
metadata.ocId = NSFileProviderItemIdentifier.rootContainer.rawValue
|
|
||||||
metadata.fileName = "root"
|
|
||||||
metadata.fileNameView = "root"
|
|
||||||
metadata.serverUrl = ncAccount.serverUrl
|
|
||||||
metadata.classFile = NKCommon.TypeClassFile.directory.rawValue
|
|
||||||
|
|
||||||
completionHandler(
|
|
||||||
Item(metadata: metadata, parentItemIdentifier: .rootContainer, ncKit: ncKit),
|
|
||||||
nil
|
|
||||||
)
|
|
||||||
return Progress()
|
return Progress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,8 +121,7 @@ import OSLog
|
||||||
}
|
}
|
||||||
|
|
||||||
completionHandler(
|
completionHandler(
|
||||||
Item(metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit),
|
Item(metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit), nil
|
||||||
nil
|
|
||||||
)
|
)
|
||||||
return Progress()
|
return Progress()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue