mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Merge branch '1.17.x' into ui-separation-and-xpc
This commit is contained in:
commit
0b32116f65
9 files changed
+184
-5
No files matched your search
@@ -159,6 +159,9 @@
|
||||
723B5DA71CF7AB0100365F95 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA01CF7AB0100365F95 /* main.m */; };
|
||||
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA31CF7AB0100365F95 /* SPUDownloader.m */; };
|
||||
723B5DAA1CF7AB6A00365F95 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA31CF7AB0100365F95 /* SPUDownloader.m */; };
|
||||
723C8A541E2D60DB00C14942 /* SUTouchBarButtonGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */; };
|
||||
723C8A551E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */; };
|
||||
723C8A561E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */; };
|
||||
72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
72464F711E1F326A00FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
72464F721E1F327C00FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
@@ -993,6 +996,8 @@
|
||||
723B5DA31CF7AB0100365F95 /* SPUDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUDownloader.m; path = Downloader/SPUDownloader.m; sourceTree = SOURCE_ROOT; };
|
||||
723B5DA41CF7AB0100365F95 /* SPUDownloaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUDownloaderDelegate.h; path = Downloader/SPUDownloaderDelegate.h; sourceTree = SOURCE_ROOT; };
|
||||
723B5DA51CF7AB0100365F95 /* SPUDownloaderProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUDownloaderProtocol.h; path = Downloader/SPUDownloaderProtocol.h; sourceTree = SOURCE_ROOT; };
|
||||
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarButtonGroup.h; sourceTree = "<group>"; };
|
||||
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTouchBarButtonGroup.m; sourceTree = "<group>"; };
|
||||
7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUpdaterController.h; sourceTree = "<group>"; };
|
||||
7246E0A21C83B685003B4E75 /* SPUStandardUpdaterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUStandardUpdaterController.m; sourceTree = "<group>"; };
|
||||
724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "org.sparkle-project.InstallerConnection.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -1640,6 +1645,8 @@
|
||||
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */,
|
||||
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
|
||||
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
|
||||
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */,
|
||||
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */,
|
||||
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
|
||||
);
|
||||
name = "User Interface";
|
||||
@@ -2085,6 +2092,7 @@
|
||||
721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */,
|
||||
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */,
|
||||
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */,
|
||||
723C8A541E2D60DB00C14942 /* SUTouchBarButtonGroup.h in Headers */,
|
||||
72B767D21C9C7B9300A07552 /* SPUProbingUpdateDriver.h in Headers */,
|
||||
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */,
|
||||
726E075C1CA3A6D6001A286B /* SPUSecureCoding.h in Headers */,
|
||||
@@ -3011,6 +3019,7 @@
|
||||
72D954831CBAD34F006F28BD /* main.m in Sources */,
|
||||
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */,
|
||||
7267E5DC1D3D8F1E00D1BF90 /* SPUMessageTypes.m in Sources */,
|
||||
723C8A561E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */,
|
||||
721652621D3C44A100FD13D8 /* SPUSystemAuthorization.m in Sources */,
|
||||
7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */,
|
||||
720595EF1D700568000572E8 /* SUApplicationInfo.m in Sources */,
|
||||
@@ -3226,6 +3235,7 @@
|
||||
7246E0A41C83B685003B4E75 /* SPUStandardUpdaterController.m in Sources */,
|
||||
725CB95B1C7121830064365A /* SPUStandardUserDriver.m in Sources */,
|
||||
724BB3B01D3482BA005D534A /* SPUSystemAuthorization.m in Sources */,
|
||||
723C8A551E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */,
|
||||
72B767DB1C9CD2E400A07552 /* SPUUIBasedUpdateDriver.m in Sources */,
|
||||
72DBA37E1D60CC34002594A8 /* SPUUpdatePermissionRequest.m in Sources */,
|
||||
61B5F8EE09C4CE3C00B25A18 /* SPUUpdater.m in Sources */,
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<window title="Set in Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
|
||||
<window identifier="SUStatus" title="Set in Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
|
||||
<windowStyleMask key="styleMask" titled="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="200" y="222" width="400" height="107"/>
|
||||
|
||||
Vendored
+34
-1
@@ -11,10 +11,14 @@
|
||||
#import "SUApplicationInfo.h"
|
||||
#import "SULocalizations.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
#import "SUTouchBarButtonGroup.h"
|
||||
|
||||
@interface SUStatusController ()
|
||||
static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUStatusController";
|
||||
|
||||
@interface SUStatusController () <NSTouchBarDelegate>
|
||||
@property (copy) NSString *title, *buttonTitle;
|
||||
@property (strong) SUHost *host;
|
||||
@property NSButton *touchBarButton;
|
||||
@end
|
||||
|
||||
@implementation SUStatusController
|
||||
@@ -27,6 +31,7 @@
|
||||
@synthesize actionButton;
|
||||
@synthesize progressBar;
|
||||
@synthesize statusTextField;
|
||||
@synthesize touchBarButton;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)aHost
|
||||
{
|
||||
@@ -93,6 +98,10 @@
|
||||
[self.actionButton setTarget:target];
|
||||
[self.actionButton setAction:action];
|
||||
[self.actionButton setKeyEquivalent:isDefault ? @"\r" : @""];
|
||||
|
||||
self.touchBarButton.target = self.actionButton.target;
|
||||
self.touchBarButton.action = self.actionButton.action;
|
||||
self.touchBarButton.keyEquivalent = self.actionButton.keyEquivalent;
|
||||
|
||||
// 06/05/2008 Alex: Avoid a crash when cancelling during the extraction
|
||||
[self setButtonEnabled:(target != nil)];
|
||||
@@ -123,4 +132,28 @@
|
||||
[self.progressBar setUsesThreadedAnimation:YES];
|
||||
}
|
||||
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
NSTouchBar *touchBar = [[NSTouchBar alloc] init];
|
||||
touchBar.defaultItemIdentifiers = @[ SUStatusControllerTouchBarIndentifier,];
|
||||
touchBar.principalItemIdentifier = SUStatusControllerTouchBarIndentifier;
|
||||
touchBar.delegate = self;
|
||||
return touchBar;
|
||||
}
|
||||
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
if ([identifier isEqualToString:SUStatusControllerTouchBarIndentifier]) {
|
||||
NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
|
||||
SUTouchBarButtonGroup *group = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.actionButton,]];
|
||||
item.viewController = group;
|
||||
self.touchBarButton = group.buttons.firstObject;
|
||||
[self.touchBarButton bind:@"title" toObject:self.actionButton withKeyPath:@"title" options:nil];
|
||||
[self.touchBarButton bind:@"enabled" toObject:self.actionButton withKeyPath:@"enabled" options:nil];
|
||||
return item;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// SUTouchBarButtonGroup.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Yuxin Wang on 05/01/2017.
|
||||
// Copyright © 2017 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class NSTouchBar;
|
||||
@class NSTouchBarItem;
|
||||
@class NSCustomTouchBarItem;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUTouchBarButtonGroup : NSViewController
|
||||
|
||||
@property (nonatomic, readonly, copy) NSArray<NSButton *> *buttons;
|
||||
|
||||
- (instancetype)initByReferencingButtons:(NSArray<NSButton *> *)buttons;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// SUTouchBarButtonGroup.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Yuxin Wang on 05/01/2017.
|
||||
// Copyright © 2017 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUTouchBarButtonGroup.h"
|
||||
|
||||
@implementation SUTouchBarButtonGroup
|
||||
|
||||
@synthesize buttons = _buttons;
|
||||
|
||||
- (instancetype)initByReferencingButtons:(NSArray<NSButton *> *)buttons
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return self;
|
||||
|
||||
NSView *buttonGroup = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||
self.view = buttonGroup;
|
||||
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray array];
|
||||
NSMutableArray<NSButton *> *buttonCopies = [NSMutableArray arrayWithCapacity:buttons.count];
|
||||
|
||||
for (NSUInteger i = 0; i < buttons.count; i++) {
|
||||
NSButton *button = buttons[i];
|
||||
NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action];
|
||||
buttonCopy.tag = button.tag;
|
||||
buttonCopy.enabled = button.enabled;
|
||||
|
||||
if (i == 0) {
|
||||
buttonCopy.keyEquivalent = @"\r";
|
||||
}
|
||||
|
||||
buttonCopy.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
[buttonCopies addObject:buttonCopy];
|
||||
[buttonGroup addSubview:buttonCopy];
|
||||
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
|
||||
if (i == 0) {
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]];
|
||||
} else {
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:buttonCopies[i-1] attribute:NSLayoutAttributeLeading multiplier:1.0 constant:(i == 1) ? -8 : -32]];
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:buttonCopies[i-1] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]];
|
||||
constraints.lastObject.priority = 250;
|
||||
}
|
||||
if (i == buttons.count - 1) {
|
||||
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]];
|
||||
}
|
||||
}
|
||||
[NSLayoutConstraint activateConstraints:constraints];
|
||||
|
||||
_buttons = buttonCopies;
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Vendored
+24
-1
@@ -22,6 +22,10 @@
|
||||
#import "SPUDownloadData.h"
|
||||
#import "SUApplicationInfo.h"
|
||||
#import "SPUUpdaterSettings.h"
|
||||
#import "SUSystemUpdateInfo.h"
|
||||
#import "SUTouchBarButtonGroup.h"
|
||||
|
||||
static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdateAlert";
|
||||
|
||||
// WebKit protocols are not explicitly declared until 10.11 SDK, so
|
||||
// declare dummy protocols to keep the build working on earlier SDKs.
|
||||
@@ -32,7 +36,7 @@
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate>
|
||||
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate, NSTouchBarDelegate>
|
||||
|
||||
@property (strong) SUAppcastItem *updateItem;
|
||||
@property (nonatomic) BOOL alreadyDownloaded;
|
||||
@@ -442,4 +446,23 @@
|
||||
return webViewMenuItems;
|
||||
}
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
NSTouchBar *touchBar = [[NSTouchBar alloc] init];
|
||||
touchBar.defaultItemIdentifiers = @[SUUpdateAlertTouchBarIndentifier,];
|
||||
touchBar.principalItemIdentifier = SUUpdateAlertTouchBarIndentifier;
|
||||
touchBar.delegate = self;
|
||||
return touchBar;
|
||||
}
|
||||
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
if ([identifier isEqualToString:SUUpdateAlertTouchBarIndentifier]) {
|
||||
NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
|
||||
item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.installButton, self.laterButton, self.skipButton]];
|
||||
return item;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+27
-1
@@ -14,8 +14,11 @@
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUApplicationInfo.h"
|
||||
#import "SUTouchBarButtonGroup.h"
|
||||
|
||||
@interface SUUpdatePermissionPrompt ()
|
||||
static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdatePermissionPrompt";
|
||||
|
||||
@interface SUUpdatePermissionPrompt () <NSTouchBarDelegate>
|
||||
|
||||
@property (assign) BOOL isShowingMoreInfo;
|
||||
@property (assign) BOOL shouldSendProfile;
|
||||
@@ -26,6 +29,8 @@
|
||||
@property (weak) IBOutlet NSView *moreInfoView;
|
||||
@property (weak) IBOutlet NSButton *moreInfoButton;
|
||||
@property (weak) IBOutlet NSTableView *profileTableView;
|
||||
@property (weak) IBOutlet NSButton *cancelButton;
|
||||
@property (weak) IBOutlet NSButton *checkButton;
|
||||
|
||||
@property (nonatomic, readonly) void (^reply)(SUUpdatePermissionResponse *);
|
||||
|
||||
@@ -42,6 +47,8 @@
|
||||
@synthesize moreInfoView;
|
||||
@synthesize moreInfoButton;
|
||||
@synthesize profileTableView;
|
||||
@synthesize cancelButton;
|
||||
@synthesize checkButton;
|
||||
|
||||
- (instancetype)initPromptWithHost:(SUHost *)theHost request:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
{
|
||||
@@ -161,4 +168,23 @@
|
||||
[NSApp stopModal];
|
||||
}
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
NSTouchBar *touchBar = [[NSTouchBar alloc] init];
|
||||
touchBar.defaultItemIdentifiers = @[SUUpdatePermissionPromptTouchBarIndentifier,];
|
||||
touchBar.principalItemIdentifier = SUUpdatePermissionPromptTouchBarIndentifier;
|
||||
touchBar.delegate = self;
|
||||
return touchBar;
|
||||
}
|
||||
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
if ([identifier isEqualToString:SUUpdatePermissionPromptTouchBarIndentifier]) {
|
||||
NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
|
||||
item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.checkButton, self.cancelButton]];
|
||||
return item;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -8,6 +8,8 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt">
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="14" id="gmk-EB-rHf"/>
|
||||
<outlet property="checkButton" destination="13" id="JAM-bi-JDs"/>
|
||||
<outlet property="descriptionTextField" destination="33" id="133"/>
|
||||
<outlet property="moreInfoButton" destination="71" id="132"/>
|
||||
<outlet property="moreInfoView" destination="39" id="127"/>
|
||||
|
||||
@@ -89,7 +89,7 @@ class SUTestApplicationTest: XCTestCase
|
||||
app.dialogs["SUUpdateAlert"].staticTexts["Software Update"].click()
|
||||
|
||||
app.dialogs["SUUpdateAlert"].buttons["Install Update"].click()
|
||||
app.buttons["Install and Relaunch"].click()
|
||||
app.windows["SUStatus"].buttons["Install and Relaunch"].click()
|
||||
|
||||
// Wait for the new updated app to finish launching so we can test if it's the frontmost app
|
||||
sleep(3)
|
||||
|
||||
Reference in new issue
Block a user