]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Added working socket connection between desktop client local socket server and app...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 26 Dec 2022 23:18:00 +0000 (00:18 +0100)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 12 May 2023 05:21:08 +0000 (13:21 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExt.entitlements
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Info.plist
shell_integration/MacOSX/NextcloudIntegration/NCDesktopClientSocketKit/LocalSocketClient.m
shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj
src/gui/macOS/fileprovider.h

index f3997007cc055625acbce2cd74479348c85b04f6..5d2a36d31b72d0073fc9b8b96b9ca66f7a499976 100644 (file)
@@ -2,8 +2,6 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-       <key>com.apple.application-identifier</key>
-       <string>$(AppIdentifierPrefix)$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.application-groups</key>
index f32c49b87ee26b6cca02432961dc7020847f3e88..c30fa4c3f3208695cb0c0bc4db4120f2990b5688 100644 (file)
  */
 
 import FileProvider
+import OSLog
+import NCDesktopClientSocketKit
 
 class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension {
     let domain: NSFileProviderDomain
+    let socketClient: LocalSocketClient
     
     required init(domain: NSFileProviderDomain) {
         self.domain = domain
         // The containing application must create a domain using `NSFileProviderManager.add(_:, completionHandler:)`. The system will then launch the application extension process, call `FileProviderExtension.init(domain:)` to instantiate the extension for that domain, and call methods on the instance.
+
+        let bundle = Bundle(for: type(of: self))
+        guard let fileProviderSocketApiPrefix = bundle.object(forInfoDictionaryKey: "SocketApiPrefix") as? String else {
+            NSLog("Could not start file provider socket client properly as SocketApiPrefix is missing")
+            self.socketClient = LocalSocketClient()
+            super.init()
+            return;
+        }
+
+        let containerUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: fileProviderSocketApiPrefix)
+        let socketPath = containerUrl?.appendingPathComponent(".fileprovidersocket", conformingTo: .archive)
+        self.socketClient = LocalSocketClient(socketPath: socketPath?.path, lineProcessor: nil)
+        self.socketClient.start();
         super.init()
     }
     
index 5072333ecc901a233f99c8ba32938a919f0292cd..6bce8a51a8a9480057476a5533ae94bc2c1855d7 100644 (file)
@@ -13,5 +13,7 @@
                <key>NSExtensionPrincipalClass</key>
                <string>$(PRODUCT_MODULE_NAME).FileProviderExtension</string>
        </dict>
+       <key>SocketApiPrefix</key>
+       <string>$(OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX)$(OC_APPLICATION_REV_DOMAIN)</string>
 </dict>
 </plist>
index f6a50b7c7af9c7113420b8b90e8ee2e0074e4dab..16468d8211aed89acefb117d1657719b61485d31 100644 (file)
@@ -40,7 +40,7 @@
 - (instancetype)initWithSocketPath:(NSString*)socketPath
                      lineProcessor:(id<LineProcessor>)lineProcessor
 {
-    NSLog(@"Initiating local socket client.");
+    NSLog(@"Initiating local socket client pointing to %@", socketPath);
     self = [super init];
     
     if(self) {
index d8a9ba2bd7a2ec88b5a97f4ec3a30b566069f6d8..7a215a8c99593a05111b50a564a4c1f4e7551625 100644 (file)
                                TargetAttributes = {
                                        538E396627F4765000FA63D5 = {
                                                CreatedOnToolsVersion = 13.3;
-                                               ProvisioningStyle = Manual;
+                                               DevelopmentTeam = C4QUVLMPQU;
+                                               ProvisioningStyle = Automatic;
                                        };
                                        53903D0B2956164F00D0B308 = {
                                                CreatedOnToolsVersion = 14.2;
                                CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
                                CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
                                CODE_SIGN_ENTITLEMENTS = FileProviderExt/FileProviderExt.entitlements;
-                               CODE_SIGN_IDENTITY = "-";
-                               CODE_SIGN_STYLE = Manual;
+                               CODE_SIGN_IDENTITY = "Apple Development";
+                               CODE_SIGN_STYLE = Automatic;
                                COPY_PHASE_STRIP = NO;
                                CURRENT_PROJECT_VERSION = 1;
                                DEBUG_INFORMATION_FORMAT = dwarf;
-                               DEVELOPMENT_TEAM = "";
+                               DEVELOPMENT_TEAM = C4QUVLMPQU;
                                GCC_C_LANGUAGE_STANDARD = gnu11;
                                GCC_DYNAMIC_NO_PIC = NO;
                                GCC_OPTIMIZATION_LEVEL = 0;
                                CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
                                CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
                                CODE_SIGN_ENTITLEMENTS = FileProviderExt/FileProviderExt.entitlements;
-                               CODE_SIGN_IDENTITY = "-";
-                               CODE_SIGN_STYLE = Manual;
+                               CODE_SIGN_IDENTITY = "Apple Development";
+                               CODE_SIGN_STYLE = Automatic;
                                COPY_PHASE_STRIP = NO;
                                CURRENT_PROJECT_VERSION = 1;
                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               DEVELOPMENT_TEAM = "";
+                               DEVELOPMENT_TEAM = C4QUVLMPQU;
                                ENABLE_NS_ASSERTIONS = NO;
                                GCC_C_LANGUAGE_STANDARD = gnu11;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
index 24ec7f702c476939b387db1c25d04d775ec16dea..484cee22375aaa725ebd1e7c0d979534165e49b7 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <QObject>
 
+#include "fileprovidersocketserver.h"
+
 namespace OCC {
 
 namespace Mac {
@@ -31,6 +33,7 @@ public:
 
 private:
     explicit FileProvider(QObject *parent = nullptr);
+    FileProviderSocketServer _socketServer;
 };
 
 } // namespace Mac