Keep consistent coding style

This commit is contained in:
Bi11 committed 2017-01-11 23:11:02 +08:00
1 parent 5dda7462c1
commit d5f4c312ee
8 files changed
+89 -86

No files matched your search

+10 -10
View File
@@ -263,9 +263,9 @@
767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; };
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; };
E1545EC51E1D7E0200FAECE8 /* SUTouchBarProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = E1545EC31E1D7E0200FAECE8 /* SUTouchBarProvider.h */; };
E1545EC61E1D7E0200FAECE8 /* SUTouchBarProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarProvider.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; };
E1EC2A301E21667000245715 /* SUTouchBarProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarProvider.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; };
E1545EC51E1D7E0200FAECE8 /* SUTouchBarBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1545EC31E1D7E0200FAECE8 /* SUTouchBarBuilder.h */; };
E1545EC61E1D7E0200FAECE8 /* SUTouchBarBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarBuilder.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; };
E1EC2A301E21667000245715 /* SUTouchBarBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarBuilder.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; };
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; };
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; };
F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
@@ -798,8 +798,8 @@
A5BF4F1B1BC7668B007A052A /* SUTestWebServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTestWebServer.h; sourceTree = "<group>"; };
A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTestWebServer.m; sourceTree = "<group>"; };
C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.enc.dmg; sourceTree = "<group>"; };
E1545EC31E1D7E0200FAECE8 /* SUTouchBarProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarProvider.h; sourceTree = "<group>"; };
E1545EC41E1D7E0200FAECE8 /* SUTouchBarProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTouchBarProvider.m; sourceTree = "<group>"; };
E1545EC31E1D7E0200FAECE8 /* SUTouchBarBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarBuilder.h; sourceTree = "<group>"; };
E1545EC41E1D7E0200FAECE8 /* SUTouchBarBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTouchBarBuilder.m; sourceTree = "<group>"; };
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifierTest.m; sourceTree = "<group>"; };
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp.zip; sourceTree = "<group>"; };
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = "<group>"; };
@@ -1180,8 +1180,8 @@
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */,
7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */,
E1545EC31E1D7E0200FAECE8 /* SUTouchBarProvider.h */,
E1545EC41E1D7E0200FAECE8 /* SUTouchBarProvider.m */,
E1545EC31E1D7E0200FAECE8 /* SUTouchBarBuilder.h */,
E1545EC41E1D7E0200FAECE8 /* SUTouchBarBuilder.m */,
);
name = "User Interface";
sourceTree = "<group>";
@@ -1385,7 +1385,7 @@
6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */,
61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */,
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
E1545EC51E1D7E0200FAECE8 /* SUTouchBarProvider.h in Headers */,
E1545EC51E1D7E0200FAECE8 /* SUTouchBarBuilder.h in Headers */,
14652F8419A978C200959E44 /* SUExport.h in Headers */,
7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */,
722954C41D04E66F00ECF9CA /* SUFileOperationConstants.h in Headers */,
@@ -1870,7 +1870,7 @@
55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */,
55C14F20136EF84300649790 /* SUStatusController.m in Sources */,
55C14F23136EF86700649790 /* SUSystemProfiler.m in Sources */,
E1EC2A301E21667000245715 /* SUTouchBarProvider.m in Sources */,
E1EC2A301E21667000245715 /* SUTouchBarBuilder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2018,7 +2018,7 @@
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */,
61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */,
72316BE41E0E1C7F0039EFD9 /* SUSystemUpdateInfo.m in Sources */,
E1545EC61E1D7E0200FAECE8 /* SUTouchBarProvider.m in Sources */,
E1545EC61E1D7E0200FAECE8 /* SUTouchBarBuilder.m in Sources */,
61B93A3D0DD02D7000DCD2F8 /* SUUIBasedUpdateDriver.m in Sources */,
61299A8E09CA790200B7442F /* SUUnarchiver.m in Sources */,
722589DB1E0B19F4005EA0B9 /* SUUnarchiverNotifier.m in Sources */,
+9 -11
View File
@@ -11,7 +11,7 @@
#import "SUAppcastItem.h"
#import "SUApplicationInfo.h"
#import "SUHost.h"
#import "SUTouchBarProvider.h"
#import "SUTouchBarBuilder.h"
@interface SUAutomaticUpdateAlert ()
@property (strong) void(^completionBlock)(SUAutomaticInstallationChoice);
@@ -21,7 +21,7 @@
@property (weak) IBOutlet NSButton *skipButton;
@property (weak) IBOutlet NSButton *laterButton;
@property (weak) IBOutlet NSButton *installButton;
@property (strong) SUTouchBarProvider *touchBarProvider;
@property (strong) SUTouchBarBuilder *touchBarBuilder;
@end
@implementation SUAutomaticUpdateAlert
@@ -31,7 +31,7 @@
@synthesize skipButton;
@synthesize laterButton;
@synthesize installButton;
@synthesize touchBarProvider;
@synthesize touchBarBuilder;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUAutomaticInstallationChoice))block
{
@@ -109,14 +109,12 @@
- (NSTouchBar *)makeTouchBar
{
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
[self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO];
[self.touchBarProvider addSpace];
[self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO];
[self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES];
[self.touchBarProvider addSpace];
[self.touchBarProvider addSpace];
return self.touchBarProvider.touchBar;
self.touchBarBuilder = [[SUTouchBarBuilder alloc] initWithIdentifier:self.className];
[self.touchBarBuilder addButtonUsingButton:self.skipButton isDefault:NO];
[self.touchBarBuilder addSpace];
[self.touchBarBuilder addButtonUsingButton:self.laterButton isDefault:NO];
[self.touchBarBuilder addButtonUsingButton:self.installButton isDefault:YES];
return self.touchBarBuilder.touchBar;
}
@end
+6 -6
View File
@@ -11,13 +11,13 @@
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUApplicationInfo.h"
#import "SUTouchBarProvider.h"
#import "SUTouchBarBuilder.h"
@interface SUStatusController ()
@property (copy) NSString *title, *buttonTitle;
@property (strong) SUHost *host;
@property NSButton *touchBarButton;
@property (strong) SUTouchBarProvider *touchBarProvider;
@property (strong) SUTouchBarBuilder *touchBarBuilder;
@end
@implementation SUStatusController
@@ -31,7 +31,7 @@
@synthesize progressBar;
@synthesize statusTextField;
@synthesize touchBarButton;
@synthesize touchBarProvider;
@synthesize touchBarBuilder;
- (instancetype)initWithHost:(SUHost *)aHost
{
@@ -134,9 +134,9 @@
- (NSTouchBar *)makeTouchBar
{
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
self.touchBarButton = [self.touchBarProvider addButtonWithButton:self.actionButton isDefault:[self.actionButton.keyEquivalent isEqualToString:@"\r"]];
return self.touchBarProvider.touchBar;
self.touchBarBuilder = [[SUTouchBarBuilder alloc] initWithIdentifier:self.className];
self.touchBarButton = [self.touchBarBuilder addButtonUsingButton:self.actionButton isDefault:[self.actionButton.keyEquivalent isEqualToString:@"\r"]];
return self.touchBarBuilder.touchBar;
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SUTouchBarBuilder.h
// Sparkle
//
// Created by Yuxin Wang on 05/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class NSTouchBar;
NS_ASSUME_NONNULL_BEGIN
@interface SUTouchBarBuilder : NSObject
@property (strong, readonly) NSTouchBar *touchBar;
- (instancetype)initWithIdentifier:(NSString *)identifier;
- (NSButton *)addButtonUsingButton:(NSButton *)button isDefault:(BOOL)isDefault;
- (void)addSpace;
@end
NS_ASSUME_NONNULL_END
+23 -20
View File
@@ -1,41 +1,41 @@
//
// SUTouchBarProvider.m
// SUTouchBarBuilder.m
// Sparkle
//
// Created by Yuxin Wang on 05/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import "SUTouchBarProvider.h"
#import "SUTouchBarBuilder.h"
#import "SUConstants.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101202
@interface SUTouchBarProvider() <NSTouchBarDelegate>
@interface SUTouchBarBuilder() <NSTouchBarDelegate>
@property (copy) NSString* indentifier;
@property NSMutableArray<NSTouchBarItem*> *touchBarItems;
@property (nonatomic, copy) NSString* indentifier;
@property (nonatomic) NSMutableArray<NSTouchBarItem*> *touchBarItems;
@end
@implementation SUTouchBarProvider
@implementation SUTouchBarBuilder
@synthesize indentifier;
@synthesize touchBarItems;
@synthesize touchBar;
@synthesize indentifier = _indentifier;
@synthesize touchBarItems = _touchBarItems;
@synthesize touchBar = _touchBar;
-(instancetype)initWithIdentifier:(NSString *)anIdentifier
- (instancetype)initWithIdentifier:(NSString *)anIdentifier
{
if (!(self = [super init]))
return self;
indentifier = [NSString stringWithFormat:@"%@.%@", SUBundleIdentifier, anIdentifier];
touchBarItems = [NSMutableArray array];
_indentifier = [NSString stringWithFormat:@"%@.%@", SUBundleIdentifier, anIdentifier];
_touchBarItems = [NSMutableArray array];
touchBar = [[NSTouchBar alloc] init];
touchBar.defaultItemIdentifiers = @[indentifier,];
touchBar.principalItemIdentifier = indentifier;
touchBar.delegate = self;
_touchBar = [[NSTouchBar alloc] init];
_touchBar.defaultItemIdentifiers = @[_indentifier,];
_touchBar.principalItemIdentifier = _indentifier;
_touchBar.delegate = self;
return self;
}
@@ -47,13 +47,16 @@
return nil;
}
-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault
- (NSButton *)addButtonUsingButton:(NSButton *)button isDefault:(BOOL)isDefault
{
NSString *itemId = [self.indentifier stringByAppendingFormat:@".button-%lu", self.touchBarItems.count];
NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:itemId];
NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action];
buttonCopy.tag = button.tag;
// A modal NSWindow may empty its default button's keyEquivalent when it shows.
// We have to set the default button explicitly.
if (isDefault) {
buttonCopy.keyEquivalent = @"\r";
}
@@ -66,7 +69,7 @@
return buttonCopy;
}
-(void)addSpace
- (void)addSpace
{
NSTouchBarItem *item = [[NSTouchBarItem alloc] initWithIdentifier:NSTouchBarItemIdentifierFixedSpaceLarge];
[self.touchBarItems addObject:item];
@@ -76,7 +79,7 @@
#else
@implementation SUTouchBarProvider
@implementation SUTouchBarBuilder
@synthesize touchBar;
@@ -84,7 +87,7 @@
return nil;
}
-(NSButton *)addButtonWithButton:(NSButton *)button {
-(NSButton *)addButtonUsingButton:(NSButton *)button isDefault:(BOOL)isDefault{
return nil;
}
-21
View File
@@ -1,21 +0,0 @@
//
// SUTouchBarProvider.h
// Sparkle
//
// Created by Yuxin Wang on 05/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class NSTouchBar;
@interface SUTouchBarProvider : NSObject
@property (strong, readonly) NSTouchBar *touchBar;
-(instancetype)initWithIdentifier:(NSString *)identifier;
-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault;
-(void)addSpace;
@end
+9 -11
View File
@@ -21,7 +21,7 @@
#import "SUAppcastItem.h"
#import "SUApplicationInfo.h"
#import "SUSystemUpdateInfo.h"
#import "SUTouchBarProvider.h"
#import "SUTouchBarBuilder.h"
// WebKit protocols are not explicitly declared until 10.11 SDK, so
// declare dummy protocols to keep the build working on earlier SDKs.
@@ -48,7 +48,7 @@
@property (weak) IBOutlet NSButton *installButton;
@property (weak) IBOutlet NSButton *skipButton;
@property (weak) IBOutlet NSButton *laterButton;
@property (strong) SUTouchBarProvider *touchBarProvider;
@property (strong) SUTouchBarBuilder *touchBarBuilder;
@end
@@ -71,7 +71,7 @@
@synthesize skipButton;
@synthesize laterButton;
@synthesize touchBarProvider;
@synthesize touchBarBuilder;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUUpdateAlertChoice))block
{
@@ -326,14 +326,12 @@
- (NSTouchBar *)makeTouchBar
{
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
[self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO];
[self.touchBarProvider addSpace];
[self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO];
[self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES];
[self.touchBarProvider addSpace];
[self.touchBarProvider addSpace];
return self.touchBarProvider.touchBar;
self.touchBarBuilder = [[SUTouchBarBuilder alloc] initWithIdentifier:self.className];
[self.touchBarBuilder addButtonUsingButton:self.skipButton isDefault:NO];
[self.touchBarBuilder addSpace];
[self.touchBarBuilder addButtonUsingButton:self.laterButton isDefault:NO];
[self.touchBarBuilder addButtonUsingButton:self.installButton isDefault:YES];
return self.touchBarBuilder.touchBar;
}
@end
+7 -7
View File
@@ -13,7 +13,7 @@
#import "SUConstants.h"
#import "SULocalizations.h"
#import "SUApplicationInfo.h"
#import "SUTouchBarProvider.h"
#import "SUTouchBarBuilder.h"
@interface SUUpdatePermissionPrompt ()
@@ -28,7 +28,7 @@
@property (weak) IBOutlet NSTableView *profileTableView;
@property (weak) IBOutlet NSButton *cancelButton;
@property (weak) IBOutlet NSButton *checkButton;
@property (strong) SUTouchBarProvider *touchBarProvider;
@property (strong) SUTouchBarBuilder *touchBarBuilder;
@property (nonatomic, readonly) void (^reply)(SUUpdatePermissionResponse *);
@@ -47,7 +47,7 @@
@synthesize profileTableView;
@synthesize cancelButton;
@synthesize checkButton;
@synthesize touchBarProvider;
@synthesize touchBarBuilder;
- (BOOL)shouldAskAboutProfile
{
@@ -169,10 +169,10 @@
- (NSTouchBar *)makeTouchBar
{
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
[self.touchBarProvider addButtonWithButton:self.cancelButton isDefault:NO];
[self.touchBarProvider addButtonWithButton:self.checkButton isDefault:YES];
return self.touchBarProvider.touchBar;
self.touchBarBuilder = [[SUTouchBarBuilder alloc] initWithIdentifier:self.className];
[self.touchBarBuilder addButtonUsingButton:self.cancelButton isDefault:NO];
[self.touchBarBuilder addButtonUsingButton:self.checkButton isDefault:YES];
return self.touchBarBuilder.touchBar;
}
@end