mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-23 04:34:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f6cbe4577 | ||
|
|
c94eac3673 | ||
|
|
acea9b0d1d | ||
|
|
3b15ab08e1 |
No files matched your search
+6
-24
@@ -25,21 +25,6 @@
|
||||
|
||||
#if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
|
||||
CF_EXPORT CFDictionaryRef DMCopyHTTPRequestHeaders(CFBundleRef appBundle, CFDataRef httpBodyData);
|
||||
|
||||
NSArray *SUGetAllDevMateURLHosts(void);
|
||||
NSArray *SUGetAllDevMateURLHosts(void)
|
||||
{
|
||||
static NSArray *sAllKnownDevMateURLHosts = nil;
|
||||
if (nil == sAllKnownDevMateURLHosts)
|
||||
{
|
||||
sAllKnownDevMateURLHosts = [[NSArray alloc] initWithObjects:
|
||||
@"updates.devmate.com",
|
||||
@"test.updates.aws.devmate.vpn",
|
||||
nil];
|
||||
}
|
||||
|
||||
return sAllKnownDevMateURLHosts;
|
||||
}
|
||||
#endif
|
||||
|
||||
@interface SUBasicUpdateDriver () <NSURLDownloadDelegate>; @end
|
||||
@@ -169,16 +154,13 @@ NSArray *SUGetAllDevMateURLHosts(void)
|
||||
- (void)updateURLRequestIfNeeds:(NSMutableURLRequest *)request
|
||||
{
|
||||
#if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
|
||||
if ([SUGetAllDevMateURLHosts() containsObject:[[request URL] host]])
|
||||
{
|
||||
CFBundleRef hostBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:[host bundlePath]]);
|
||||
NSDictionary *devmateHeaders = (NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL) ? : [NSDictionary new];
|
||||
[request setAllHTTPHeaderFields:(NSDictionary *)devmateHeaders];
|
||||
CFBundleRef hostBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:[host bundlePath]]);
|
||||
NSDictionary *devmateHeaders = (NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL) ? : [NSDictionary new];
|
||||
[request setAllHTTPHeaderFields:(NSDictionary *)devmateHeaders];
|
||||
|
||||
[devmateHeaders release];
|
||||
if (NULL != hostBundle)
|
||||
CFRelease(hostBundle);
|
||||
}
|
||||
[devmateHeaders release];
|
||||
if (NULL != hostBundle)
|
||||
CFRelease(hostBundle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+46
-7
@@ -102,7 +102,8 @@
|
||||
@property (readonly) NSMutableArray *updaters;
|
||||
@property (readonly) NSMutableDictionary *delegatesMap;
|
||||
@property (retain) SUUpdater *currentUpdater;
|
||||
@property (assign) BOOL currentUpdaterInProcess;
|
||||
@property (atomic, assign) dispatch_semaphore_t currentUpdaterSema;
|
||||
@property (nonatomic, retain) NSObject *semaphoreSynchronizer;
|
||||
@property (assign) BOOL shouldContinueCheck;
|
||||
@property (nonatomic, retain) NSMutableArray *resultUIDrivers;
|
||||
|
||||
@@ -112,6 +113,16 @@
|
||||
|
||||
@implementation SUUpdaterQueue
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
self.semaphoreSynchronizer = [[NSObject alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
for (SUUpdater *updater in self.updaters)
|
||||
@@ -120,6 +131,17 @@
|
||||
}
|
||||
[_updaters release];
|
||||
[_delegatesMap release];
|
||||
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (!self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
dispatch_release(self.currentUpdaterSema);
|
||||
self.currentUpdaterSema = nil;
|
||||
}
|
||||
}
|
||||
self.semaphoreSynchronizer = nil;
|
||||
|
||||
self.currentUpdater = nil;
|
||||
self.resultUIDrivers = nil;
|
||||
|
||||
@@ -232,7 +254,7 @@
|
||||
if (nil == updater)
|
||||
return;
|
||||
|
||||
if (updater == self.currentUpdater && self.currentUpdaterInProcess)
|
||||
if (updater == self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
NSLog(@"Could not remove updater while it's in progress.");
|
||||
return;
|
||||
@@ -274,9 +296,14 @@
|
||||
do
|
||||
{
|
||||
// in case if some of queued updaters is already in process
|
||||
while (self.currentUpdaterInProcess)
|
||||
if (self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5f]];
|
||||
dispatch_semaphore_wait(self.currentUpdaterSema, DISPATCH_TIME_FOREVER);
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
dispatch_release(self.currentUpdaterSema);
|
||||
self.currentUpdaterSema = nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.shouldContinueCheck)
|
||||
@@ -291,7 +318,11 @@
|
||||
if (nil == self.currentUpdater)
|
||||
break;
|
||||
|
||||
self.currentUpdaterInProcess = YES;
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (nil == self.currentUpdaterSema)
|
||||
self.currentUpdaterSema = dispatch_semaphore_create(0);
|
||||
}
|
||||
[self.currentUpdater performSelectorOnMainThread:NSSelectorFromString(selectorName)
|
||||
withObject:nil
|
||||
waitUntilDone:YES];
|
||||
@@ -339,7 +370,11 @@
|
||||
(self.currentUpdater == updater))
|
||||
{
|
||||
self.currentUpdater = updater;
|
||||
self.currentUpdaterInProcess = YES;
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (nil == self.currentUpdaterSema)
|
||||
self.currentUpdaterSema = dispatch_semaphore_create(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +383,11 @@
|
||||
if (self.currentUpdater == updater)
|
||||
{
|
||||
self.currentUpdater = nil;
|
||||
self.currentUpdaterInProcess = NO;
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (self.currentUpdaterSema)
|
||||
dispatch_semaphore_signal(self.currentUpdaterSema);
|
||||
}
|
||||
|
||||
SUBasicUpdateDriver *driver = [updater driver];
|
||||
do
|
||||
|
||||
@@ -1434,7 +1434,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "RESOURCES_PATH=\"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n\nif [ -e \"${RESOURCES_PATH}/pt_BR.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/pt-BR.lproj\"\n mv -f \"${RESOURCES_PATH}/pt_BR.lproj\" \"${RESOURCES_PATH}/pt-BR.lproj\"\nfi\n\nif [ -e \"${RESOURCES_PATH}/zh_CN.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hans.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_CN.lproj\" \"${RESOURCES_PATH}/zh-Hans.lproj\"\nfi\n\nif [ -e \"${RESOURCES_PATH}/zh_TW.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_TW.lproj\" \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\nfi\n\nRESOURCES_PATH=\"${RESOURCES_PATH}/finish_installation.app/Contents/Resources\"\n\nif [ -e \"${RESOURCES_PATH}/pt_BR.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/pt-BR.lproj\"\n mv -f \"${RESOURCES_PATH}/pt_BR.lproj\" \"${RESOURCES_PATH}/pt-BR.lproj\"\nfi\n\nif [ -e \"${RESOURCES_PATH}/zh_CN.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hans.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_CN.lproj\" \"${RESOURCES_PATH}/zh-Hans.lproj\"\nfi\n\nif [ -e \"${RESOURCES_PATH}/zh_TW.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_TW.lproj\" \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\nfi\n";
|
||||
shellScript = "IFS=$(echo -en \"\\n\\b\")\nRESOURCES_PATHS=(\n \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/finish_installation.app/Contents/Resources\"\n \"${BUILT_PRODUCTS_DIR}/com.devmate.UpdateInstaller.xpc/Contents/Resources\"\n \"${BUILT_PRODUCTS_DIR}/com.devmate.UpdateDownloader.xpc/Contents/Resources\")\n\nfor RESOURCES_PATH in \"${RESOURCES_PATHS[@]}\"\ndo\n echo \"Correcting... ${RESOURCES_PATH}\"\n if [ -e \"${RESOURCES_PATH}/pt_BR.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/pt-BR.lproj\"\n mv -f \"${RESOURCES_PATH}/pt_BR.lproj\" \"${RESOURCES_PATH}/pt-BR.lproj\"\n fi\n\n if [ -e \"${RESOURCES_PATH}/zh_CN.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hans.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_CN.lproj\" \"${RESOURCES_PATH}/zh-Hans.lproj\"\n fi\n\n if [ -e \"${RESOURCES_PATH}/zh_TW.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_TW.lproj\" \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n fi\ndone\n\n";
|
||||
};
|
||||
5D06E90D0FD68DA3005AE3F6 /* Fix Install Name */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
||||
Reference in new issue
Block a user