Skip to content

Commit

Permalink
Merge auto-update into forward!
Browse files Browse the repository at this point in the history
  • Loading branch information
douglashill committed Dec 22, 2018
2 parents 9c7da6a + 14e87ad commit fdf2977
Show file tree
Hide file tree
Showing 45 changed files with 86 additions and 2,117 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.DS_Store
xcuserdata
project.xcworkspace
build
1 change: 0 additions & 1 deletion GitUp/Application/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
@property(nonatomic, strong) IBOutlet NSWindow* preferencesWindow;
@property(nonatomic, weak) IBOutlet NSToolbar* preferencesToolbar;
@property(nonatomic, weak) IBOutlet NSTabView* preferencesTabView;
@property(nonatomic, weak) IBOutlet NSPopUpButton* channelPopUpButton;

@property(nonatomic, strong) IBOutlet NSWindow* cloneWindow;
@property(nonatomic, weak) IBOutlet NSTextField* cloneURLTextField;
Expand Down
59 changes: 5 additions & 54 deletions GitUp/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#import <Security/Security.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
#import <HockeySDK/HockeySDK.h>
#pragma clang diagnostic pop
#import <Sparkle/Sparkle.h>

#import <GitUpKit/XLFacilityMacros.h>
Expand All @@ -28,9 +24,6 @@
#import "Common.h"
#import "ToolProtocol.h"

#define OFFICIAL 0
#define OFFICIAL_RELEASE !DEBUG && OFFICIAL

#define __ENABLE_SUDDEN_TERMINATION__ 1

#define kNotificationUserInfoKey_Action @"action" // NSString
Expand Down Expand Up @@ -102,7 +95,6 @@ + (void)initialize {
GICommitMessageViewUserDefaultsKey_ContinuousSpellChecking : @(YES),
GICommitMessageViewUserDefaultsKey_SmartInsertDelete : @(YES),
GIUserDefaultKey_FontSize : @(GIDefaultFontSize),
kUserDefaultsKey_ReleaseChannel : kReleaseChannel_Stable,
kUserDefaultsKey_CheckInterval : @(15 * 60),
kUserDefaultsKey_FirstLaunch : @(YES),
kUserDefaultsKey_DiffWhitespaceMode : @(kGCLiveRepositoryDiffWhitespaceMode_Normal),
Expand Down Expand Up @@ -271,26 +263,9 @@ - (void)awakeFromNib {
_preferencesToolbar.selectedItemIdentifier = kPreferencePaneIdentifier_General;
[self selectPreferencePane:nil];

[_channelPopUpButton.menu removeAllItems];
for (NSString* string in @[ kReleaseChannel_Stable, kReleaseChannel_Continuous ]) {
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(string, nil) action:NULL keyEquivalent:@""];
item.representedObject = string;
[_channelPopUpButton.menu addItem:item];
}

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_willShowRecentPopUpMenu:) name:NSPopUpButtonWillPopUpNotification object:_recentPopUpButton];
}

- (void)_updatePreferencePanel {
NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
for (NSMenuItem* item in _channelPopUpButton.menu.itemArray) {
if ([item.representedObject isEqualToString:channel]) {
[_channelPopUpButton selectItem:item];
break;
}
}
}

- (void)_showNotificationWithTitle:(NSString*)title action:(SEL)action message:(NSString*)message {
NSUserNotification* notification = [[NSUserNotification alloc] init];
if (action) {
Expand Down Expand Up @@ -321,22 +296,14 @@ - (void)applicationWillFinishLaunching:(NSNotification*)notification {
// Initialize custom subclass of NSDocumentController
[DocumentController sharedDocumentController];

#if OFFICIAL_RELEASE
// Initialize HockeyApp
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"65233b0e034e4fcbaf6754afba3b2b23"];
[[BITHockeyManager sharedHockeyManager] setDisableMetricsManager:YES];
[[BITHockeyManager sharedHockeyManager] setDisableFeedbackManager:YES];
[[BITHockeyManager sharedHockeyManager] startManager];
#endif

[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
andSelector:@selector(_getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
}

- (void)applicationDidFinishLaunching:(NSNotification*)notification {
#if OFFICIAL_RELEASE
#if !DEBUG
// Initialize Sparkle and check for update immediately
if (![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKey_DisableSparkle]) {
_updater = [SUUpdater sharedUpdater];
Expand Down Expand Up @@ -481,17 +448,6 @@ - (IBAction)openDocument:(id)sender {
[[NSDocumentController sharedDocumentController] openDocument:sender];
}

- (IBAction)changeReleaseChannel:(id)sender {
NSString* oldChannel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
NSString* newChannel = _channelPopUpButton.selectedItem.representedObject;
if (![newChannel isEqualToString:oldChannel]) {
[[NSUserDefaults standardUserDefaults] setObject:newChannel forKey:kUserDefaultsKey_ReleaseChannel];

_manualCheck = NO;
[_updater checkForUpdatesInBackground];
}
}

- (IBAction)viewWiki:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:kURL_Wiki]];
}
Expand Down Expand Up @@ -519,7 +475,6 @@ - (IBAction)showAboutPanel:(id)sender {
}

- (IBAction)showPreferences:(id)sender {
[self _updatePreferencePanel];
[_preferencesWindow makeKeyAndOrderFront:nil];
}

Expand Down Expand Up @@ -734,13 +689,11 @@ - (void)repository:(GCRepository*)repository didFinishTransferWithURL:(NSURL*)ur
#pragma mark - SUUpdaterDelegate

- (NSString*)feedURLStringForUpdater:(SUUpdater*)updater {
NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
return [NSString stringWithFormat:kURL_AppCast, channel];
return kURL_AppCast;
}

- (void)updater:(SUUpdater*)updater didFindValidUpdate:(SUAppcastItem*)item {
NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
XLOG_INFO(@"Did find app update on channel “%@” for version %@", channel, item.versionString);
XLOG_INFO(@"Did find app update for version %@", item.versionString);
if (_manualCheck) {
let alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"A GitUp update is available!", nil);
Expand All @@ -752,8 +705,7 @@ - (void)updater:(SUUpdater*)updater didFindValidUpdate:(SUAppcastItem*)item {
}

- (void)updaterDidNotFindUpdate:(SUUpdater*)updater {
NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
XLOG_VERBOSE(@"App is up-to-date at version %@ on channel '%@'", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"], channel);
XLOG_VERBOSE(@"App is up-to-date at version %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]);
if (_manualCheck) {
let alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"GitUp is already up-to-date!", nil);
Expand All @@ -764,9 +716,8 @@ - (void)updaterDidNotFindUpdate:(SUUpdater*)updater {
}

- (void)updater:(SUUpdater*)updater didAbortWithError:(NSError*)error {
NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel];
if (![error.domain isEqualToString:SUSparkleErrorDomain] || (error.code != SUNoUpdateError)) {
XLOG_ERROR(@"App update on channel “%@aborted: %@", channel, error);
XLOG_ERROR(@"App update aborted: %@", error);
}
}

Expand Down
6 changes: 1 addition & 5 deletions GitUp/Application/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@

#define MAKE_ERROR(message) [NSError errorWithDomain:@"App" code:-1 userInfo:@{NSLocalizedDescriptionKey : message}]

#define kReleaseChannel_Stable @"stable"
#define kReleaseChannel_Continuous @"continuous"

#define kUserDefaultsKey_FirstLaunch @"FirstLaunch" // BOOL
#define kUserDefaultsKey_SkipInstallCLT @"SkipInstallCLT" // BOOL
#define kUserDefaultsKey_LastVersion @"LastVersion" // NSUInteger
#define kUserDefaultsKey_ReleaseChannel @"ReleaseChannel" // NSString
#define kUserDefaultsKey_CheckInterval @"CheckInterval" // NSInteger
#define kUserDefaultsKey_SimpleCommit @"SimpleCommit" // BOOL
#define kUserDefaultsKey_DisableSparkle @"DisableSparkle" // BOOL
Expand All @@ -32,7 +28,7 @@
#define kRepositoryUserInfoKey_MainWindowFrame @"MainWindowFrame" // NSString
#define kRepositoryUserInfoKey_IndexDiffs @"IndexDiffs" // BOOL

#define kURL_AppCast @"https://s3-us-west-2.amazonaws.com/gitup-builds/%@/appcast.xml"
#define kURL_AppCast @"https://douglashill.s3.amazonaws.com/GitUp-appcast.xml"

#define kURL_Issues @"https://github.com/douglashill/GitUp/issues"
#define kURL_Wiki @"https://github.com/git-up/GitUp/wiki"
Expand Down
39 changes: 1 addition & 38 deletions GitUp/Application/en.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -275,38 +275,11 @@ You must close and reopen any opened repositories in GitUp after changing this s
</subviews>
</view>
</tabViewItem>
<tabViewItem label="{500, 262}" identifier="advanced" id="Qdl-lQ-O4q">
<tabViewItem label="{500, 182}" identifier="advanced" id="Qdl-lQ-O4q">
<view key="view" id="8CG-H0-Xhk">
<rect key="frame" x="0.0" y="0.0" width="500" height="400"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton verticalHuggingPriority="750" id="7N4-S9-iWL">
<rect key="frame" x="136" y="192" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="&lt;RELEASE CHANNEL&gt;" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="xdx-IX-FK6" id="Sdr-Ep-kPW">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" autoenablesItems="NO" id="0Z3-9j-kDN">
<items>
<menuItem title="&lt;RELEASE CHANNEL&gt;" state="on" id="xdx-IX-FK6">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="changeReleaseChannel:" target="Voe-Tx-rLC" id="qGn-WN-qQh"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="mi3-Eg-51i">
<rect key="frame" x="12" y="198" width="120" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Release Channel:" id="M0A-b6-dhN">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="b9G-MU-MDn">
<rect key="frame" x="12" y="295" width="120" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -316,15 +289,6 @@ You must close and reopen any opened repositories in GitUp after changing this s
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="PtA-hG-Qmn">
<rect key="frame" x="137" y="154" width="345" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="The &quot;Continuous&quot; release channel installs builds directly from GitUp Continuous Integration. Use at your own risk!" id="qB2-E4-Yuu">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="w2N-io-xkS">
<rect key="frame" x="137" y="295" width="130" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand Down Expand Up @@ -485,7 +449,6 @@ You must close and reopen any opened repositories in GitUp after changing this s
<outlet property="authenticationPasswordTextField" destination="Uio-D2-Dnt" id="nNT-Jn-Q9Y"/>
<outlet property="authenticationURLTextField" destination="fBP-U8-T31" id="JUd-Sw-FSA"/>
<outlet property="authenticationWindow" destination="mcM-YD-UN9" id="ZkH-zK-43f"/>
<outlet property="channelPopUpButton" destination="7N4-S9-iWL" id="Ols-8n-NyQ"/>
<outlet property="cloneRecursiveButton" destination="V3d-LG-L26" id="iSp-hX-Jc0"/>
<outlet property="cloneURLTextField" destination="KgY-GJ-dY0" id="qXq-61-cKm"/>
<outlet property="cloneWindow" destination="6SP-eN-0Kv" id="Bd8-7b-vpr"/>
Expand Down
4 changes: 0 additions & 4 deletions GitUp/GitUp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
E2C338D719F85C2E00063D95 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2C338D619F85C2E00063D95 /* Cocoa.framework */; };
E2C5672D1A6D98BC00ECFE07 /* WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C5672C1A6D98BC00ECFE07 /* WindowController.m */; };
E2E3C9A21D771E9D00AA9A62 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2E3C9A11D771E9D00AA9A62 /* SystemConfiguration.framework */; };
E2E3C9A41D77227F00AA9A62 /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2E3C9A31D77227F00AA9A62 /* HockeySDK.framework */; };
E2E3C9A51D77228F00AA9A62 /* HockeySDK.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = E2E3C9A31D77227F00AA9A62 /* HockeySDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -97,7 +95,6 @@
dstSubfolderSpec = 10;
files = (
E267E1F31B84D93300BAB377 /* Sparkle.framework in Copy Frameworks */,
E2E3C9A51D77228F00AA9A62 /* HockeySDK.framework in Copy Frameworks */,
E28A16E61B87023C00218332 /* GitUpKit.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
Expand Down Expand Up @@ -170,7 +167,6 @@
E2C338D719F85C2E00063D95 /* Cocoa.framework in Frameworks */,
E267E26B1B84E07E00BAB377 /* Security.framework in Frameworks */,
E28A16E51B87023200218332 /* GitUpKit.framework in Frameworks */,
E2E3C9A41D77227F00AA9A62 /* HockeySDK.framework in Frameworks */,
E2653D251A5B2FBD006A9871 /* Sparkle.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 0 additions & 1 deletion GitUp/Third-Party/HockeySDK.framework/Headers

This file was deleted.

1 change: 0 additions & 1 deletion GitUp/Third-Party/HockeySDK.framework/HockeySDK

This file was deleted.

1 change: 0 additions & 1 deletion GitUp/Third-Party/HockeySDK.framework/Modules

This file was deleted.

1 change: 0 additions & 1 deletion GitUp/Third-Party/HockeySDK.framework/Resources

This file was deleted.

This file was deleted.

Loading

0 comments on commit fdf2977

Please sign in to comment.