mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Add service for remote message port
This allows the updater to communicate to the installer without an additional entitlement
This commit is contained in:
1 parent
c4800182a2
commit
97a8568491
13 files changed
+429
-62
No files matched your search
@@ -0,0 +1,6 @@
|
||||
// RemoteMessagePort only
|
||||
|
||||
INFOPLIST_FILE = RemoteMessagePort/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.RemoteMessagePort
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>RemoteMessagePort</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Sparkle Project. All rights reserved.</string>
|
||||
<key>XPCService</key>
|
||||
<dict>
|
||||
<key>ServiceType</key>
|
||||
<string>Application</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// main.m
|
||||
// RemoteMessagePort
|
||||
//
|
||||
// Created by Mayur Pawashe on 4/3/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SURemoteMessagePort.h"
|
||||
|
||||
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
|
||||
@end
|
||||
|
||||
@implementation ServiceDelegate
|
||||
|
||||
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
|
||||
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
|
||||
|
||||
// Configure the connection.
|
||||
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SURemoteMessagePort)];
|
||||
|
||||
newConnection.exportedObject = [[SURemoteMessagePort alloc] init];
|
||||
|
||||
// Resuming the connection allows the system to deliver more incoming messages.
|
||||
[newConnection resume];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int __unused argc, const char * __unused argv[])
|
||||
{
|
||||
// Create the delegate for the service.
|
||||
ServiceDelegate *delegate = [ServiceDelegate new];
|
||||
|
||||
// Set up the one NSXPCListener for this service. It will handle all incoming connections.
|
||||
NSXPCListener *listener = [NSXPCListener serviceListener];
|
||||
listener.delegate = delegate;
|
||||
|
||||
// Resuming the serviceListener starts this service. This method does not return.
|
||||
[listener resume];
|
||||
return 0;
|
||||
}
|
||||
@@ -257,6 +257,12 @@
|
||||
72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767E41C9CFD7200A07552 /* SUAutomaticUpdateDriver.h */; };
|
||||
72B767E71C9CFD7200A07552 /* SUAutomaticUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767E51C9CFD7200A07552 /* SUAutomaticUpdateDriver.m */; };
|
||||
72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; };
|
||||
72E41A391CB209CA003D47E0 /* SURemoteMessagePortProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */; };
|
||||
72E41A451CB20BA7003D47E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E41A441CB20BA7003D47E0 /* main.m */; };
|
||||
72E41A491CB20BA7003D47E0 /* RemoteMessagePort.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 72E41A3E1CB20BA7003D47E0 /* RemoteMessagePort.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72E41A501CB210AE003D47E0 /* SURemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746441C91212400FC134E /* SURemoteMessagePort.m */; };
|
||||
72E41A531CB21125003D47E0 /* SUXPCRemoteMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */; };
|
||||
72E41A541CB21125003D47E0 /* SUXPCRemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */; };
|
||||
72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E45CF21B640CDD005C701A /* SUTestApplicationDelegate.m */; };
|
||||
72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */; };
|
||||
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; };
|
||||
@@ -398,6 +404,13 @@
|
||||
remoteGlobalIDString = 728638F21CAF5A5F00783084;
|
||||
remoteInfo = AppcastDownloader;
|
||||
};
|
||||
72E41A471CB20BA7003D47E0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 72E41A3D1CB20BA7003D47E0;
|
||||
remoteInfo = RemoteMessagePort;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -439,6 +452,7 @@
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
72E41A491CB20BA7003D47E0 /* RemoteMessagePort.xpc in Embed XPC Services */,
|
||||
726E07B81CAF08D6001A286B /* InstallerLauncher.xpc in Embed XPC Services */,
|
||||
726E07FA1CAF37BD001A286B /* UpdateDownloader.xpc in Embed XPC Services */,
|
||||
728638FE1CAF5A5F00783084 /* AppcastDownloader.xpc in Embed XPC Services */,
|
||||
@@ -817,6 +831,13 @@
|
||||
72B767E11C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCoreBasedUpdateDriver.m; sourceTree = "<group>"; };
|
||||
72B767E41C9CFD7200A07552 /* SUAutomaticUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAutomaticUpdateDriver.h; sourceTree = "<group>"; };
|
||||
72B767E51C9CFD7200A07552 /* SUAutomaticUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAutomaticUpdateDriver.m; sourceTree = "<group>"; };
|
||||
72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SURemoteMessagePortProtocol.h; path = Sparkle/SURemoteMessagePortProtocol.h; sourceTree = SOURCE_ROOT; };
|
||||
72E41A3E1CB20BA7003D47E0 /* RemoteMessagePort.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = RemoteMessagePort.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
72E41A441CB20BA7003D47E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
72E41A461CB20BA7003D47E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUXPCRemoteMessagePort.h; path = Sparkle/SUXPCRemoteMessagePort.h; sourceTree = SOURCE_ROOT; };
|
||||
72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUXPCRemoteMessagePort.m; path = Sparkle/SUXPCRemoteMessagePort.m; sourceTree = SOURCE_ROOT; };
|
||||
72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigRemoteMessagePort.xcconfig; sourceTree = "<group>"; };
|
||||
72E45CF11B640CDD005C701A /* SUTestApplicationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTestApplicationDelegate.h; sourceTree = "<group>"; };
|
||||
72E45CF21B640CDD005C701A /* SUTestApplicationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTestApplicationDelegate.m; sourceTree = "<group>"; };
|
||||
72E45CF41B640DAE005C701A /* SUUpdateSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateSettingsWindowController.h; sourceTree = "<group>"; };
|
||||
@@ -938,6 +959,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
72E41A3B1CB20BA7003D47E0 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DC2EF560486A6940098B216 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -966,6 +994,7 @@
|
||||
726E07AD1CAF08D6001A286B /* InstallerLauncher.xpc */,
|
||||
726E07EF1CAF37BD001A286B /* UpdateDownloader.xpc */,
|
||||
728638F31CAF5A5F00783084 /* AppcastDownloader.xpc */,
|
||||
72E41A3E1CB20BA7003D47E0 /* RemoteMessagePort.xpc */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -1081,6 +1110,7 @@
|
||||
children = (
|
||||
61299B3909CB055000B7442F /* Appcast Support */,
|
||||
55C14BD5136EEFD000649790 /* Autoupdate */,
|
||||
729746481C91483B00FC134E /* IPC */,
|
||||
089C1665FE841158C02AAC07 /* Framework Resources */,
|
||||
61B5F8F309C4CE5900B25A18 /* Other Sources */,
|
||||
61F83F6E0DBFE07A006FDD30 /* Update Control */,
|
||||
@@ -1123,7 +1153,6 @@
|
||||
7297461F1C8E8D9A00FC134E /* TerminationListener.m */,
|
||||
726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */,
|
||||
726E075F1CA4E9A5001A286B /* SUInstallationInputData.m */,
|
||||
729746481C91483B00FC134E /* IPC */,
|
||||
);
|
||||
path = Autoupdate;
|
||||
sourceTree = "<group>";
|
||||
@@ -1426,16 +1455,21 @@
|
||||
729746481C91483B00FC134E /* IPC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
72E41A3F1CB20BA7003D47E0 /* RemoteMessagePort */,
|
||||
7297463E1C9119F300FC134E /* SULocalMessagePort.h */,
|
||||
7297463F1C9119F300FC134E /* SULocalMessagePort.m */,
|
||||
72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */,
|
||||
729746431C91212400FC134E /* SURemoteMessagePort.h */,
|
||||
729746441C91212400FC134E /* SURemoteMessagePort.m */,
|
||||
72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */,
|
||||
72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */,
|
||||
729746551C936D5E00FC134E /* SUMessageTypes.h */,
|
||||
729746561C936D5E00FC134E /* SUMessageTypes.m */,
|
||||
726E075A1CA3A6D6001A286B /* SUSecureCoding.h */,
|
||||
726E075B1CA3A6D6001A286B /* SUSecureCoding.m */,
|
||||
);
|
||||
name = IPC;
|
||||
path = Autoupdate;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
72B767E81C9D114F00A07552 /* Update Drivers */ = {
|
||||
@@ -1454,6 +1488,16 @@
|
||||
name = "Update Drivers";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
72E41A3F1CB20BA7003D47E0 /* RemoteMessagePort */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
72E41A441CB20BA7003D47E0 /* main.m */,
|
||||
72E41A461CB20BA7003D47E0 /* Info.plist */,
|
||||
);
|
||||
name = RemoteMessagePort;
|
||||
path = ../../RemoteMessagePort;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FA1941C40D94A6EA00DD942E /* Configurations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1488,6 +1532,7 @@
|
||||
726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */,
|
||||
728638EE1CAF589C00783084 /* ConfigUpdateDownloader.xcconfig */,
|
||||
728639041CAF614000783084 /* ConfigAppcastDownloader.xcconfig */,
|
||||
72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */,
|
||||
14732BC91960F70A00593899 /* make-release-package.sh */,
|
||||
14652F7919A93E5F00959E44 /* set-git-version-info.sh */,
|
||||
146EC84E19A68CF8004A50C5 /* Sparkle.podspec */,
|
||||
@@ -1540,6 +1585,7 @@
|
||||
726E07E91CAF30C0001A286B /* SUUpdaterPermission.h in Headers */,
|
||||
618FA5010DAE88B40026945C /* SUInstaller.h in Headers */,
|
||||
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
|
||||
72E41A531CB21125003D47E0 /* SUXPCRemoteMessagePort.h in Headers */,
|
||||
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
|
||||
72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */,
|
||||
618FA5220DAE8E8A0026945C /* SUPackageInstaller.h in Headers */,
|
||||
@@ -1551,6 +1597,7 @@
|
||||
72B767E21C9CE90A00A07552 /* SUCoreBasedUpdateDriver.h in Headers */,
|
||||
61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */,
|
||||
7229E1B91C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h in Headers */,
|
||||
72E41A391CB209CA003D47E0 /* SURemoteMessagePortProtocol.h in Headers */,
|
||||
725F977B1C8A896F00265BE4 /* SUUserDriverCoreComponent.h in Headers */,
|
||||
729746451C91212400FC134E /* SURemoteMessagePort.h in Headers */,
|
||||
6196CFF909C72148000DC222 /* SUStatusController.h in Headers */,
|
||||
@@ -1768,6 +1815,23 @@
|
||||
productReference = 728638F31CAF5A5F00783084 /* AppcastDownloader.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
72E41A3D1CB20BA7003D47E0 /* RemoteMessagePort */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 72E41A4A1CB20BA7003D47E0 /* Build configuration list for PBXNativeTarget "RemoteMessagePort" */;
|
||||
buildPhases = (
|
||||
72E41A3A1CB20BA7003D47E0 /* Sources */,
|
||||
72E41A3B1CB20BA7003D47E0 /* Frameworks */,
|
||||
72E41A3C1CB20BA7003D47E0 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RemoteMessagePort;
|
||||
productName = RemoteMessagePort;
|
||||
productReference = 72E41A3E1CB20BA7003D47E0 /* RemoteMessagePort.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
8DC2EF4F0486A6940098B216 /* Sparkle */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Sparkle" */;
|
||||
@@ -1789,6 +1853,7 @@
|
||||
726E07B71CAF08D6001A286B /* PBXTargetDependency */,
|
||||
726E07F91CAF37BD001A286B /* PBXTargetDependency */,
|
||||
728638FD1CAF5A5F00783084 /* PBXTargetDependency */,
|
||||
72E41A481CB20BA7003D47E0 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Sparkle;
|
||||
productInstallPath = "$(HOME)/Library/Frameworks";
|
||||
@@ -1848,6 +1913,9 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
72E41A3D1CB20BA7003D47E0 = {
|
||||
CreatedOnToolsVersion = 7.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */;
|
||||
@@ -1911,6 +1979,7 @@
|
||||
726E07AC1CAF08D6001A286B /* InstallerLauncher */,
|
||||
726E07EE1CAF37BD001A286B /* UpdateDownloader */,
|
||||
728638F21CAF5A5F00783084 /* AppcastDownloader */,
|
||||
72E41A3D1CB20BA7003D47E0 /* RemoteMessagePort */,
|
||||
61B5F90109C4CEE200B25A18 /* Sparkle Test App */,
|
||||
726E4A151C86C88F00C57C6A /* TestAppHelper */,
|
||||
612279D80DB5470200AB99EA /* Sparkle Unit Tests */,
|
||||
@@ -2003,6 +2072,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
72E41A3C1CB20BA7003D47E0 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DC2EF520486A6940098B216 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -2259,6 +2335,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
72E41A3A1CB20BA7003D47E0 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
72E41A501CB210AE003D47E0 /* SURemoteMessagePort.m in Sources */,
|
||||
72E41A451CB20BA7003D47E0 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DC2EF540486A6940098B216 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -2281,6 +2366,7 @@
|
||||
729746411C9119F300FC134E /* SULocalMessagePort.m in Sources */,
|
||||
726E07611CA4E9A5001A286B /* SUInstallationInputData.m in Sources */,
|
||||
7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */,
|
||||
72E41A541CB21125003D47E0 /* SUXPCRemoteMessagePort.m in Sources */,
|
||||
726E07EA1CAF30C0001A286B /* SUUpdaterPermission.m in Sources */,
|
||||
725CB95B1C7121830064365A /* SUStandardUserDriver.m in Sources */,
|
||||
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */,
|
||||
@@ -2396,6 +2482,11 @@
|
||||
target = 728638F21CAF5A5F00783084 /* AppcastDownloader */;
|
||||
targetProxy = 728638FC1CAF5A5F00783084 /* PBXContainerItemProxy */;
|
||||
};
|
||||
72E41A481CB20BA7003D47E0 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 72E41A3D1CB20BA7003D47E0 /* RemoteMessagePort */;
|
||||
targetProxy = 72E41A471CB20BA7003D47E0 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
@@ -2859,6 +2950,27 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
72E41A4B1CB20BA7003D47E0 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
72E41A4C1CB20BA7003D47E0 /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
72E41A4D1CB20BA7003D47E0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -3000,6 +3112,16 @@
|
||||
728639021CAF5A5F00783084 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
72E41A4A1CB20BA7003D47E0 /* Build configuration list for PBXNativeTarget "RemoteMessagePort" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
72E41A4B1CB20BA7003D47E0 /* Debug */,
|
||||
72E41A4C1CB20BA7003D47E0 /* Coverage */,
|
||||
72E41A4D1CB20BA7003D47E0 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
Vendored
+14
-10
@@ -130,16 +130,20 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
[self.remotePort connectWithLookupCompletion:^(BOOL success) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
completionHandler(success);
|
||||
});
|
||||
} invalidationHandler:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
AppInstaller *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
if (strongSelf.remotePort != nil && !strongSelf.willCompleteInstallation) {
|
||||
SULog(@"Invalidation on remote port being called, and installation is not close enough to completion!");
|
||||
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
}
|
||||
strongSelf.remotePort = nil;
|
||||
|
||||
if (success) {
|
||||
[weakSelf.remotePort setInvalidationHandler:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
AppInstaller *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
if (strongSelf.remotePort != nil && !strongSelf.willCompleteInstallation) {
|
||||
SULog(@"Invalidation on remote port being called, and installation is not close enough to completion!");
|
||||
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
}
|
||||
strongSelf.remotePort = nil;
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
Vendored
+25
-17
@@ -10,7 +10,8 @@
|
||||
#import "SULog.h"
|
||||
#import "SUMessageTypes.h"
|
||||
#import "SULocalMessagePort.h"
|
||||
#import "SURemoteMessagePort.h"
|
||||
#import "SUXPCRemoteMessagePort.h"
|
||||
#import "SURemoteMessagePortProtocol.h"
|
||||
#import "SUUpdaterDelegate.h"
|
||||
#import "SUAppcastItem.h"
|
||||
#import "SULog.h"
|
||||
@@ -34,7 +35,7 @@
|
||||
@property (nonatomic, weak, readonly) id<SUInstallerDriverDelegate> delegate;
|
||||
@property (nonatomic) SUInstallerMessageType currentStage;
|
||||
@property (nonatomic) SULocalMessagePort *localPort;
|
||||
@property (nonatomic) SURemoteMessagePort *remotePort;
|
||||
@property (nonatomic) id <SURemoteMessagePort> remotePort;
|
||||
@property (nonatomic) BOOL postponedOnce;
|
||||
@property (nonatomic, weak, readonly) id updater;
|
||||
@property (nonatomic, weak, readonly) id<SUUpdaterDelegate> updaterDelegate;
|
||||
@@ -138,25 +139,32 @@
|
||||
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
self.remotePort = [[SURemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
self.remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
|
||||
__weak SUInstallerDriver *weakSelf = self;
|
||||
|
||||
[self.remotePort connectWithLookupCompletion:^(BOOL lookupSuccess) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
completionHandler(lookupSuccess);
|
||||
});
|
||||
} invalidationHandler:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.remotePort != nil) {
|
||||
NSError *remoteError =
|
||||
[NSError
|
||||
errorWithDomain:SUSparkleErrorDomain
|
||||
code:SUInstallationError
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater"
|
||||
}
|
||||
];
|
||||
[self.delegate installerIsRequestingAbortInstallWithError:remoteError];
|
||||
|
||||
if (lookupSuccess) {
|
||||
[weakSelf.remotePort setInvalidationHandler:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
SUInstallerDriver *strongSelf = weakSelf;
|
||||
if (strongSelf.remotePort != nil) {
|
||||
NSError *remoteError =
|
||||
[NSError
|
||||
errorWithDomain:SUSparkleErrorDomain
|
||||
code:SUInstallationError
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater"
|
||||
}
|
||||
];
|
||||
[strongSelf.delegate installerIsRequestingAbortInstallWithError:remoteError];
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
Vendored
+5
-6
@@ -8,7 +8,8 @@
|
||||
|
||||
#import "SUProbeInstallStatus.h"
|
||||
#import "SULocalMessagePort.h"
|
||||
#import "SURemoteMessagePort.h"
|
||||
#import "SUXPCRemoteMessagePort.h"
|
||||
#import "SURemoteMessagePortProtocol.h"
|
||||
#import "SUHost.h"
|
||||
#import "SUMessageTypes.h"
|
||||
#import "SUAppcastItem.h"
|
||||
@@ -21,14 +22,14 @@
|
||||
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
SURemoteMessagePort *remotePort = [[SURemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
id <SURemoteMessagePort> remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
|
||||
[remotePort connectWithLookupCompletion:^(BOOL success) {
|
||||
if (success) {
|
||||
[remotePort invalidate];
|
||||
}
|
||||
completionHandler(success);
|
||||
} invalidationHandler:^{}];
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)probeInstallerUpdateItemForHost:(SUHost *)host completion:(void (^)(SUAppcastItem * _Nullable))completionHandler
|
||||
@@ -36,7 +37,7 @@
|
||||
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
SURemoteMessagePort *remotePort = [[SURemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
id <SURemoteMessagePort> remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
|
||||
[remotePort connectWithLookupCompletion:^(BOOL lookupSuccess) {
|
||||
if (!lookupSuccess) {
|
||||
@@ -59,8 +60,6 @@
|
||||
}
|
||||
}];
|
||||
}
|
||||
} invalidationHandler:^{
|
||||
completionHandler(nil);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-9
@@ -7,21 +7,15 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SURemoteMessagePortProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SURemoteMessagePort : NSObject
|
||||
@interface SURemoteMessagePort : NSObject <SURemoteMessagePort>
|
||||
|
||||
- (instancetype)init;
|
||||
- (instancetype)initWithServiceName:(NSString *)serviceName;
|
||||
|
||||
- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler invalidationHandler:(void (^)(void))invalidationHandler;
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler;
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+29
-15
@@ -19,7 +19,7 @@ static dispatch_queue_t gMessageQueue;
|
||||
|
||||
@property (nonatomic, copy) NSString *serviceName;
|
||||
@property (nonatomic) CFMessagePortRef messagePort;
|
||||
@property (nonatomic, copy) void (^invalidationHandler)(void);
|
||||
@property (nonatomic, copy) void (^invalidationCallback)(void);
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,14 +27,12 @@ static dispatch_queue_t gMessageQueue;
|
||||
|
||||
@synthesize serviceName = _serviceName;
|
||||
@synthesize messagePort = _messagePort;
|
||||
@synthesize invalidationHandler = _invalidationHandler;
|
||||
@synthesize invalidationCallback = _invalidationCallback;
|
||||
|
||||
- (instancetype)initWithServiceName:(NSString *)serviceName
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_serviceName = [serviceName copy];
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
gMessagePortsTable = [[NSMutableDictionary alloc] init];
|
||||
@@ -44,13 +42,21 @@ static dispatch_queue_t gMessageQueue;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler invalidationHandler:(void (^)(void))invalidationHandler
|
||||
- (instancetype)initWithServiceName:(NSString *)serviceName
|
||||
{
|
||||
self = [self init];
|
||||
if (self != nil) {
|
||||
_serviceName = [serviceName copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler
|
||||
{
|
||||
dispatch_async(gMessageQueue, ^{
|
||||
NSMutableArray<SURemoteMessagePort *> *existingMessagePorts = [gMessagePortsTable objectForKey:self.serviceName];
|
||||
if (existingMessagePorts != nil && existingMessagePorts.count > 0) {
|
||||
self.messagePort = existingMessagePorts[0].messagePort;
|
||||
self.invalidationHandler = [invalidationHandler copy];
|
||||
|
||||
[existingMessagePorts addObject:self];
|
||||
|
||||
@@ -61,21 +67,29 @@ static dispatch_queue_t gMessageQueue;
|
||||
lookupCompletionHandler(NO);
|
||||
} else {
|
||||
self.messagePort = messagePort;
|
||||
self.invalidationHandler = [invalidationHandler copy];
|
||||
|
||||
NSMutableArray<SURemoteMessagePort *> *newMessagePorts = [[NSMutableArray alloc] init];
|
||||
[newMessagePorts addObject:self];
|
||||
[gMessagePortsTable setObject:newMessagePorts forKey:self.serviceName];
|
||||
|
||||
// Note: do not add messagePort to dispatch queue or run loop: it will complain that one shouldn't be added for remote ports
|
||||
CFMessagePortSetInvalidationCallBack(messagePort, messageInvalidationCallback);
|
||||
|
||||
lookupCompletionHandler(YES);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler
|
||||
{
|
||||
dispatch_async(gMessageQueue, ^{
|
||||
if (self.messagePort != NULL) {
|
||||
self.invalidationCallback = [invalidationHandler copy];
|
||||
|
||||
// Note: do not add messagePort to dispatch queue or run loop: it will complain that one shouldn't be added for remote ports
|
||||
CFMessagePortSetInvalidationCallBack(self.messagePort, messageInvalidationCallback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data expectingReply:(BOOL)expectingReply completion:(void (^)(BOOL success, NSData * _Nullable replyData))completionHandler
|
||||
{
|
||||
dispatch_async(gMessageQueue, ^{
|
||||
@@ -110,7 +124,7 @@ static dispatch_queue_t gMessageQueue;
|
||||
- (void)invalidate
|
||||
{
|
||||
dispatch_async(gMessageQueue, ^{
|
||||
self.invalidationHandler = nil;
|
||||
self.invalidationCallback = nil;
|
||||
|
||||
if (self.messagePort != NULL) {
|
||||
NSMutableArray<SURemoteMessagePort *> *messagePorts = [gMessagePortsTable objectForKey:self.serviceName];
|
||||
@@ -137,9 +151,9 @@ static void messageInvalidationCallback(CFMessagePortRef messagePort, void * __u
|
||||
dispatch_async(gMessageQueue, ^{
|
||||
if (serviceName != nil) {
|
||||
for (SURemoteMessagePort *remoteMessagePort in [gMessagePortsTable objectForKey:serviceName]) {
|
||||
if (remoteMessagePort.invalidationHandler != nil) {
|
||||
remoteMessagePort.invalidationHandler();
|
||||
remoteMessagePort.invalidationHandler = nil;
|
||||
if (remoteMessagePort.invalidationCallback != nil) {
|
||||
remoteMessagePort.invalidationCallback();
|
||||
remoteMessagePort.invalidationCallback = nil;
|
||||
}
|
||||
remoteMessagePort.messagePort = NULL;
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// SURemoteMessagePortProtocol.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 4/3/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SURemoteMessagePort <NSObject>
|
||||
|
||||
- (void)setServiceName:(NSString *)serviceName;
|
||||
|
||||
- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler;
|
||||
|
||||
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler;
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler;
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// SUXPCRemoteMessagePort.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 4/3/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SURemoteMessagePortProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUXPCRemoteMessagePort : NSObject <SURemoteMessagePort>
|
||||
|
||||
- (instancetype)initWithServiceName:(NSString *)serviceName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// SUXPCRemoteMessagePort.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 4/3/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUXPCRemoteMessagePort.h"
|
||||
#import "SURemoteMessagePort.h"
|
||||
|
||||
@interface SUXPCRemoteMessagePort ()
|
||||
|
||||
@property (nonatomic, readonly) NSXPCConnection *connection;
|
||||
@property (nonatomic, copy) void (^invalidationHandler)(void);
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUXPCRemoteMessagePort
|
||||
|
||||
@synthesize connection = _connection;
|
||||
@synthesize invalidationHandler = _invalidationHandler;
|
||||
|
||||
- (instancetype)initWithServiceName:(NSString *)serviceName
|
||||
{
|
||||
self = [self init];
|
||||
if (self != nil) {
|
||||
_connection = [[NSXPCConnection alloc] initWithServiceName:@"org.sparkle-project.RemoteMessagePort"];
|
||||
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SURemoteMessagePort)];
|
||||
|
||||
__weak SUXPCRemoteMessagePort *weakSelf = self;
|
||||
_connection.invalidationHandler = ^{
|
||||
[weakSelf invokeInvalidation];
|
||||
};
|
||||
|
||||
_connection.interruptionHandler = ^{
|
||||
[weakSelf invokeInvalidation];
|
||||
[weakSelf.connection invalidate];
|
||||
};
|
||||
|
||||
[_connection resume];
|
||||
|
||||
[self setServiceName:serviceName];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setServiceName:(NSString *)serviceName
|
||||
{
|
||||
[self.connection.remoteObjectProxy setServiceName:serviceName];
|
||||
}
|
||||
|
||||
- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler
|
||||
{
|
||||
[self.connection.remoteObjectProxy connectWithLookupCompletion:^(BOOL success) {
|
||||
lookupCompletionHandler(success);
|
||||
if (!success) {
|
||||
[self.connection invalidate];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)invokeInvalidation
|
||||
{
|
||||
if (self != nil && self.invalidationHandler != nil) {
|
||||
self.invalidationHandler();
|
||||
self.invalidationHandler = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler
|
||||
{
|
||||
_invalidationHandler = [invalidationHandler copy];
|
||||
|
||||
__weak SUXPCRemoteMessagePort *weakSelf = self;
|
||||
[self.connection.remoteObjectProxy setInvalidationHandler:^{
|
||||
[weakSelf invokeInvalidation];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler
|
||||
{
|
||||
[self.connection.remoteObjectProxy sendMessageWithIdentifier:identifier data:data completion:completionHandler];
|
||||
}
|
||||
|
||||
- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler
|
||||
{
|
||||
[self.connection.remoteObjectProxy sendMessageWithIdentifier:identifier data:data reply:replyHandler];
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
[self.connection.remoteObjectProxy invalidate];
|
||||
[self.connection invalidate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -6,10 +6,6 @@
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
|
||||
<array>
|
||||
<string>org.sparkle-project.SparkleTestApp-sparkle-installer</string>
|
||||
</array>
|
||||
<key>com.apple.security.temporary-exception.shared-preference.read-write</key>
|
||||
<array>
|
||||
<string>org.sparkle-project.SparkleTestApp</string>
|
||||
|
||||
Reference in new issue
Block a user