mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
38 lines
1.1 KiB
Swift
38 lines
1.1 KiB
Swift
/*
|
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
import FileProvider
|
|
import Foundation
|
|
import NextcloudKit
|
|
import NextcloudFileProviderKit
|
|
import OSLog
|
|
|
|
extension FileProviderExtension: NSFileProviderThumbnailing {
|
|
func fetchThumbnails(
|
|
for itemIdentifiers: [NSFileProviderItemIdentifier],
|
|
requestedSize size: CGSize,
|
|
perThumbnailCompletionHandler: @escaping (
|
|
NSFileProviderItemIdentifier,
|
|
Data?,
|
|
Error?
|
|
) -> Void,
|
|
completionHandler: @escaping (Error?) -> Void
|
|
) -> Progress {
|
|
guard let ncAccount else {
|
|
completionHandler(NSFileProviderError(.notAuthenticated))
|
|
return Progress()
|
|
}
|
|
|
|
return NextcloudFileProviderKit.fetchThumbnails(
|
|
for: itemIdentifiers,
|
|
requestedSize: size,
|
|
account: ncAccount,
|
|
usingRemoteInterface: self.ncKit,
|
|
perThumbnailCompletionHandler: perThumbnailCompletionHandler,
|
|
completionHandler: completionHandler
|
|
)
|
|
}
|
|
}
|