2023-04-06 12:03:59 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import FileProvider
|
2024-01-22 09:40:47 +03:00
|
|
|
import Foundation
|
2023-04-06 12:03:59 +03:00
|
|
|
import NextcloudKit
|
2024-04-15 12:30:08 +03:00
|
|
|
import NextcloudFileProviderKit
|
2023-04-06 12:03:59 +03:00
|
|
|
import OSLog
|
|
|
|
|
|
|
|
extension FileProviderExtension: NSFileProviderThumbnailing {
|
2024-01-22 09:40:47 +03:00
|
|
|
func fetchThumbnails(
|
|
|
|
for itemIdentifiers: [NSFileProviderItemIdentifier],
|
|
|
|
requestedSize size: CGSize,
|
|
|
|
perThumbnailCompletionHandler: @escaping (
|
|
|
|
NSFileProviderItemIdentifier,
|
|
|
|
Data?,
|
|
|
|
Error?
|
|
|
|
) -> Void,
|
|
|
|
completionHandler: @escaping (Error?) -> Void
|
|
|
|
) -> Progress {
|
2024-04-15 14:30:09 +03:00
|
|
|
return NextcloudFileProviderKit.fetchThumbnails(
|
|
|
|
for: itemIdentifiers,
|
|
|
|
requestedSize: size,
|
2024-07-19 10:17:17 +03:00
|
|
|
usingRemoteInterface: self.ncKit,
|
2024-04-15 14:30:09 +03:00
|
|
|
perThumbnailCompletionHandler: perThumbnailCompletionHandler,
|
|
|
|
completionHandler: completionHandler
|
|
|
|
)
|
2023-04-06 12:03:59 +03:00
|
|
|
}
|
|
|
|
}
|