mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Clean up properties and init/invalidate in FileProviderExtension
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
179a368f9f
commit
cac263f174
1 changed files with 11 additions and 7 deletions
|
@ -25,16 +25,17 @@ import OSLog
|
|||
lazy var ncKitBackground = NKBackground(nkCommonInstance: ncKit.nkCommonInstance)
|
||||
lazy var socketClient: LocalSocketClient? = {
|
||||
guard let containerUrl = pathForAppGroupContainer() else {
|
||||
Logger.fileProviderExtension.critical("Won't start client, no container url")
|
||||
return nil
|
||||
Logger.fileProviderExtension.critical("Won't start socket client, no container url")
|
||||
return nil;
|
||||
}
|
||||
|
||||
let socketPath = containerUrl.appendingPathComponent(
|
||||
".fileprovidersocket", conformingTo: .archive)
|
||||
let lineProcessor = FileProviderSocketLineProcessor(delegate: self)
|
||||
return LocalSocketClient(socketPath: socketPath.path, lineProcessor: lineProcessor)
|
||||
}()
|
||||
|
||||
let urlSessionIdentifier: String = "com.nextcloud.session.upload.fileproviderext"
|
||||
let urlSessionIdentifier = "com.nextcloud.session.upload.fileproviderext"
|
||||
let urlSessionMaximumConnectionsPerHost = 5
|
||||
lazy var urlSession: URLSession = {
|
||||
let configuration = URLSessionConfiguration.background(withIdentifier: urlSessionIdentifier)
|
||||
|
@ -46,8 +47,10 @@ import OSLog
|
|||
configuration.sharedContainerIdentifier = appGroupIdentifier
|
||||
|
||||
let session = URLSession(
|
||||
configuration: configuration, delegate: ncKitBackground,
|
||||
delegateQueue: OperationQueue.main)
|
||||
configuration: configuration,
|
||||
delegate: ncKitBackground,
|
||||
delegateQueue: OperationQueue.main
|
||||
)
|
||||
return session
|
||||
}()
|
||||
|
||||
|
@ -77,7 +80,8 @@ import OSLog
|
|||
func invalidate() {
|
||||
// TODO: cleanup any resources
|
||||
Logger.fileProviderExtension.debug(
|
||||
"Extension for domain \(self.domain.displayName, privacy: .public) is being torn down")
|
||||
"Extension for domain \(self.domain.displayName, privacy: .public) is being torn down"
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: NSFileProviderReplicatedExtension protocol methods
|
||||
|
|
Loading…
Reference in a new issue