Allow popup titlebar user driver to update other bundles

This commit is contained in:
Zorg committed 2016-08-13 08:49:47 -04:00
1 parent 6fb7b4a18b
commit b58773cb5e
6 files changed
+16 -10

No files matched your search

+2 -2
View File
@@ -156,7 +156,7 @@
724BB3B11D3484B2005D534A /* SPUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SPUSystemAuthorization.m */; };
724BB3B21D34862A005D534A /* SPUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SPUSystemAuthorization.m */; };
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
725602D51C83551C00DAA70E /* SPUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SPUApplicationInfo.h */; };
725602D51C83551C00DAA70E /* SPUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SPUApplicationInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
725602D61C83551C00DAA70E /* SPUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SPUApplicationInfo.m */; };
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SPUUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9581C7121830064365A /* SPUStandardUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1853,6 +1853,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
725602D51C83551C00DAA70E /* SPUApplicationInfo.h in Headers */,
72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */,
725F977B1C8A896F00265BE4 /* SPUUserDriverCoreComponent.h in Headers */,
72F9EC481D5EA904004AC8B6 /* SPUUpdaterDelegate.h in Headers */,
@@ -1885,7 +1886,6 @@
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
14652F8419A978C200959E44 /* SUExport.h in Headers */,
7267E5FD1D3DD1B700D1BF90 /* SUDownloadedUpdate.h in Headers */,
725602D51C83551C00DAA70E /* SPUApplicationInfo.h in Headers */,
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */,
+2 -1
View File
@@ -7,10 +7,11 @@
//
#import <Cocoa/Cocoa.h>
#import "SUExport.h"
NS_ASSUME_NONNULL_BEGIN
@interface SPUApplicationInfo : NSObject
SU_EXPORT @interface SPUApplicationInfo : NSObject
+ (BOOL)isBackgroundApplication:(NSApplication *)application;
+1
View File
@@ -26,6 +26,7 @@
#import "SPUUserDriver.h"
#import "SPUStandardUserDriver.h"
#import "SPUStandardUserDriverDelegate.h"
#import "SPUApplicationInfo.h"
#import "SPUUserDriverCoreComponent.h"
#import "SPUDownloadData.h"
+1 -1
View File
@@ -13,6 +13,6 @@
@interface SUPopUpTitlebarUserDriver : NSObject <SPUUserDriver, SPUStandardUserDriverProtocol>
- (instancetype)initWithWindow:(NSWindow *)window delegate:(id<SPUStandardUserDriverDelegate>)delegate;
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle window:(NSWindow *)window delegate:(id<SPUStandardUserDriverDelegate>)delegate;
@end
+6 -2
View File
@@ -14,6 +14,7 @@
@interface SUPopUpTitlebarUserDriver()
@property (nonatomic, readonly) NSBundle *hostBundle;
@property (nonatomic, readonly) NSWindow *window;
@property (nonatomic, readonly) SPUUserDriverCoreComponent *coreComponent;
@property (nonatomic) NSTitlebarAccessoryViewController *accessoryViewController;
@@ -28,6 +29,7 @@
@implementation SUPopUpTitlebarUserDriver
@synthesize delegate = _delegate;
@synthesize hostBundle = _hostBundle;
@synthesize window = _window;
@synthesize coreComponent = _coreComponent;
@synthesize accessoryViewController = _accessoryViewController;
@@ -37,10 +39,11 @@
@synthesize expectedContentLength = _expectedContentLength;
@synthesize contentLengthDownloaded = _contentLengthDownloaded;
- (instancetype)initWithWindow:(NSWindow *)window delegate:(id<SPUStandardUserDriverDelegate>)delegate
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle window:(NSWindow *)window delegate:(id<SPUStandardUserDriverDelegate>)delegate
{
self = [super init];
if (self != nil) {
_hostBundle = hostBundle;
_window = window;
_delegate = delegate;
_coreComponent = [[SPUUserDriverCoreComponent alloc] initWithDelegate:delegate];
@@ -316,7 +319,8 @@
// In case our termination request fails or is delayed
[self removeUpdateButton];
[[NSApplication sharedApplication] terminate:nil];
NSRunningApplication *runningApplication = [SPUApplicationInfo runningApplicationWithBundle:self.hostBundle];
[runningApplication terminate];
});
}
@@ -29,18 +29,18 @@
- (void)windowDidLoad
{
NSBundle *mainBundle = [NSBundle mainBundle];
NSBundle *hostBundle = [NSBundle mainBundle];
// If the user is holding down command, we use the popup title user driver instead
id<SPUUserDriver, SPUStandardUserDriverProtocol> userDriver;
if (([NSEvent modifierFlags] & NSCommandKeyMask) != 0) {
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:self.window delegate:nil];
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithHostBundle:hostBundle window:self.window delegate:nil];
} else {
userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:mainBundle delegate:nil];
userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:nil];
}
self.userDriver = userDriver;
self.updater = [[SPUUpdater alloc] initWithHostBundle:mainBundle userDriver:userDriver delegate:nil];
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle userDriver:userDriver delegate:nil];
NSError *updaterError = nil;
if (![self.updater startUpdater:&updaterError]) {