Keep pointer to FileProviderExtension around in ClientCommunicationService

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-11-21 10:40:54 +08:00
parent 22c176af8a
commit a2d69fcf7c
4 changed files with 12 additions and 4 deletions

View file

@ -19,7 +19,7 @@ import NextcloudKit
import OSLog
extension FileProviderExtension {
func sendFileProviderDomainIdentifier() {
@objc func sendFileProviderDomainIdentifier() {
let command = "FILE_PROVIDER_DOMAIN_IDENTIFIER_REQUEST_REPLY"
let argument = domain.identifier.rawValue
let message = command + ":" + argument + "\n"
@ -75,7 +75,7 @@ extension FileProviderExtension {
signalEnumeratorAfterAccountSetup()
}
func removeAccountConfig() {
@objc func removeAccountConfig() {
Logger.fileProviderExtension.info(
"Received instruction to remove account data for user \(self.ncAccount!.username, privacy: .public) at server \(self.ncAccount!.serverUrl, privacy: .public)"
)

View file

@ -17,7 +17,7 @@ import NCDesktopClientSocketKit
import NextcloudKit
import OSLog
class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKCommonDelegate {
@objc class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKCommonDelegate {
let domain: NSFileProviderDomain
let ncKit = NextcloudKit()
let appGroupIdentifier = Bundle.main.object(forInfoDictionaryKey: "SocketApiPrefix") as? String

View file

@ -17,9 +17,14 @@
NS_ASSUME_NONNULL_BEGIN
@class FileProviderExtension;
@interface ClientCommunicationService : NSObject<NSFileProviderServiceSource>
@property (readonly) NSXPCListener *listener;
@property (readonly) FileProviderExtension *extension;
- (instancetype)initWithFileProviderExtension:(FileProviderExtension *)extension;
@end

View file

@ -14,16 +14,19 @@
#import "ClientCommunicationService.h"
#import "FileProviderExt-Swift.h"
@implementation ClientCommunicationService
@synthesize serviceName = _serviceName;
- (instancetype)init
- (instancetype)initWithFileProviderExtension:(FileProviderExtension *)extension
{
self = [super init];
if (self) {
_serviceName = @"com.nextcloud.desktopclient.ClientCommunicationService";
_listener = NSXPCListener.anonymousListener;
_extension = extension;
}
return self;
}