From a98a5b32619830c9b6927ed899f7856efd327515 Mon Sep 17 00:00:00 2001
From: Aaron Madlon-Kay <aaron@madlon-kay.com>
Date: Thu, 13 Jun 2019 22:40:21 +0900
Subject: [PATCH] Remove Sparkle and auto-update

---
 Interfaces/English.lproj/MainMenu.xib    |   7 --
 Interfaces/English.lproj/Preferences.xib | 114 -----------------------
 Source/SPAppController.m                 |  27 ------
 Source/SPPreferenceController.h          |   1 -
 Source/SPPreferenceController.m          |  10 --
 sequel-pro.xcodeproj/project.pbxproj     |   6 --
 6 files changed, 165 deletions(-)

diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 40174585..aab94a22 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -28,12 +28,6 @@
                                     <action selector="openAboutPanel:" target="213" id="1037"/>
                                 </connections>
                             </menuItem>
-                            <menuItem title="Check for Updates..." id="794">
-                                <modifierMask key="keyEquivalentModifierMask"/>
-                                <connections>
-                                    <action selector="checkForUpdates:" target="795" id="830"/>
-                                </connections>
-                            </menuItem>
                             <menuItem isSeparatorItem="YES" id="199">
                                 <modifierMask key="keyEquivalentModifierMask" command="YES"/>
                             </menuItem>
@@ -1057,7 +1051,6 @@ CQ
             </connections>
         </menu>
         <customObject id="213" userLabel="SPAppController" customClass="SPAppController"/>
-        <customObject id="795" customClass="SUUpdater"/>
         <menu id="956" userLabel="Dock Menu">
             <items>
                 <menuItem title="New Connection Window..." keyEquivalent="n" id="960">
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib
index 2777afb3..5a690700 100644
--- a/Interfaces/English.lproj/Preferences.xib
+++ b/Interfaces/English.lproj/Preferences.xib
@@ -8,7 +8,6 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="SPPreferenceController">
             <connections>
-                <outlet property="autoUpdatePreferencePane" destination="2145" id="2149"/>
                 <outlet property="editorPreferencePane" destination="2144" id="2148"/>
                 <outlet property="generalPreferencePane" destination="2074" id="2076"/>
                 <outlet property="networkPreferencePane" destination="2146" id="2150"/>
@@ -56,11 +55,6 @@
                 <outlet property="view" destination="802" id="2152"/>
             </connections>
         </customObject>
-        <customObject id="2145" userLabel="Auto Update" customClass="SPAutoUpdatePreferencePane">
-            <connections>
-                <outlet property="view" destination="60" id="2153"/>
-            </connections>
-        </customObject>
         <customObject id="2146" userLabel="Network" customClass="SPNetworkPreferencePane">
             <connections>
                 <outlet property="hiddenFileView" destination="GEn-6y-U3F" id="r1S-eS-uJK"/>
@@ -70,7 +64,6 @@
                 <outlet property="view" destination="641" id="2154"/>
             </connections>
         </customObject>
-        <customObject id="331" userLabel="Updater" customClass="SUUpdater"/>
         <userDefaultsController representsSharedInstance="YES" id="117"/>
         <window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" oneShot="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="1" userLabel="PreferencesPanel">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
@@ -897,113 +890,6 @@ Line 2</string>
             </subviews>
             <point key="canvasLocation" x="200" y="537"/>
         </customView>
-        <customView id="60" userLabel="Auto Update">
-            <rect key="frame" x="0.0" y="0.0" width="580" height="180"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <userGuides>
-                <userLayoutGuide location="195" affinity="minX"/>
-            </userGuides>
-            <subviews>
-                <popUpButton verticalHuggingPriority="750" id="1353">
-                    <rect key="frame" x="201" y="105" width="172" height="26"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <popUpButtonCell key="cell" type="push" title="Weekly" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="604800" imageScaling="proportionallyDown" inset="2" selectedItem="1358" id="1354">
-                        <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                        <menu key="menu" title="OtherViews" id="1355">
-                            <items>
-                                <menuItem title="Hourly" tag="3600" id="1356"/>
-                                <menuItem title="Daily" tag="86400" id="1357"/>
-                                <menuItem title="Weekly" state="on" tag="604800" id="1358"/>
-                            </items>
-                        </menu>
-                    </popUpButtonCell>
-                    <connections>
-                        <binding destination="117" name="enabled" keyPath="values.SUEnableAutomaticChecks" id="1368"/>
-                        <binding destination="331" name="selectedTag" keyPath="updateCheckInterval" id="1361"/>
-                    </connections>
-                </popUpButton>
-                <textField verticalHuggingPriority="750" id="1351">
-                    <rect key="frame" x="17" y="111" width="181" height="17"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Frequency:" id="1352">
-                        <font key="font" metaFont="system"/>
-                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                </textField>
-                <box autoresizesSubviews="NO" verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1618">
-                    <rect key="frame" x="204" y="72" width="356" height="5"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
-                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
-                    <font key="titleFont" metaFont="system"/>
-                </box>
-                <textField verticalHuggingPriority="750" id="100">
-                    <rect key="frame" x="201" y="49" width="362" height="17"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Dienstag, 16. Januar 2007 17:31:40.000" id="101">
-                        <dateFormatter key="formatter" dateStyle="full" timeStyle="medium" id="102"/>
-                        <font key="font" metaFont="system"/>
-                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                    <connections>
-                        <binding destination="117" name="value" keyPath="values.SULastCheckTime" id="146"/>
-                    </connections>
-                </textField>
-                <textField verticalHuggingPriority="750" id="98">
-                    <rect key="frame" x="17" y="49" width="181" height="17"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Last check:" id="99">
-                        <font key="font" metaFont="system"/>
-                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                </textField>
-                <button verticalHuggingPriority="750" id="96">
-                    <rect key="frame" x="198" y="12" width="178" height="32"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <buttonCell key="cell" type="push" title="Check Now" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="97">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="checkForUpdates:" target="331" id="332"/>
-                    </connections>
-                </button>
-                <button id="94">
-                    <rect key="frame" x="202" y="144" width="360" height="18"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <buttonCell key="cell" type="check" title="Automatically check for updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="95">
-                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <binding destination="117" name="value" keyPath="values.SUEnableAutomaticChecks" id="145"/>
-                    </connections>
-                </button>
-                <button id="1615">
-                    <rect key="frame" x="203" y="81" width="359" height="18"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <buttonCell key="cell" type="check" title="Send anonymous system information" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="1616">
-                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <binding destination="117" name="enabled" keyPath="values.SUEnableAutomaticChecks" id="1625"/>
-                        <binding destination="117" name="value" keyPath="values.SUSendProfileInfo" id="1624"/>
-                    </connections>
-                </button>
-                <box autoresizesSubviews="NO" verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1620">
-                    <rect key="frame" x="204" y="135" width="356" height="5"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
-                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
-                    <font key="titleFont" metaFont="system"/>
-                </box>
-            </subviews>
-        </customView>
         <customView id="641" userLabel="Network">
             <rect key="frame" x="0.0" y="0.0" width="580" height="312"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 5116c94c..4d4848dc 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -52,7 +52,6 @@
 #import "SPOSInfo.h"
 
 #import <PSMTabBar/PSMTabBarControl.h>
-#import <Sparkle/Sparkle.h>
 
 @interface SPAppController ()
 
@@ -133,9 +132,6 @@
 	// Set up the prefs controller
 	prefsController = [[SPPreferenceController alloc] init];
 
-	// Set Sparkle delegate
-	[[SUUpdater sharedUpdater] setDelegate:self];
-
 	// Register SPAppController as services provider
 	[NSApp setServicesProvider:self];
 	
@@ -2216,29 +2212,6 @@
 	return [bundleKeyEquivalents objectForKey:scope];
 }
 
-/**
- * Sparkle updater delegate method. Called just before the updater relaunches Sequel Pro and we need to make
- * sure that no sheets are currently open, which will prevent the app from being quit. 
- */
-- (void)updaterWillRelaunchApplication:(SUUpdater *)updater
-{	
-	// Sparkle might call this on a background thread, but calling endSheet: from a bg thread is unhealthy
-	if(![NSThread isMainThread]) return [[self onMainThread] updaterWillRelaunchApplication:updater];
-
-	// Get all the currently open windows and their attached sheets if any
-	NSArray *windows = [NSApp windows];
-	
-	for (NSWindow *window in windows)
-	{
-		NSWindow *attachedSheet = [window attachedSheet];
-		
-		if (attachedSheet) {
-			[NSApp endSheet:attachedSheet returnCode:0];
-			[attachedSheet orderOut:nil];
-		}
-	}
-}
-
 /**
  * If Sequel Pro is terminating kill all running BASH scripts and release all HTML output controller.
  *
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 3434663e..f888a536 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -51,7 +51,6 @@
 	IBOutlet SPTablesPreferencePane  <SPPreferencePaneProtocol>       *tablesPreferencePane;
 	IBOutlet SPNotificationsPreferencePane <SPPreferencePaneProtocol> *notificationsPreferencePane;
 	IBOutlet SPEditorPreferencePane <SPPreferencePaneProtocol>        *editorPreferencePane;
-	IBOutlet SPAutoUpdatePreferencePane <SPPreferencePaneProtocol>    *autoUpdatePreferencePane;
 	IBOutlet SPNetworkPreferencePane <SPPreferencePaneProtocol>       *networkPreferencePane;
 
 	NSToolbar *toolbar;
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index c782c591..b0bc5029 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -48,7 +48,6 @@
 @synthesize tablesPreferencePane;
 @synthesize notificationsPreferencePane;
 @synthesize editorPreferencePane;
-@synthesize autoUpdatePreferencePane;
 @synthesize networkPreferencePane;
 @synthesize fontChangeTarget;
 
@@ -73,7 +72,6 @@
 					   tablesPreferencePane,
 					   notificationsPreferencePane,
 					   editorPreferencePane,
-					   autoUpdatePreferencePane,
 					   networkPreferencePane,
 					   nil];
 }
@@ -183,14 +181,6 @@
 	[editorItem setTarget:self];
 	[editorItem setAction:@selector(displayPreferencePane:)];
 	
-	// AutoUpdate preferences
-	autoUpdateItem = [[NSToolbarItem alloc] initWithItemIdentifier:[autoUpdatePreferencePane preferencePaneIdentifier]];
-
-	[autoUpdateItem setLabel:[autoUpdatePreferencePane preferencePaneName]];
-	[autoUpdateItem setImage:[autoUpdatePreferencePane preferencePaneIcon]];
-	[autoUpdateItem setTarget:self];
-	[autoUpdateItem setAction:@selector(displayPreferencePane:)];
-
 	// Network preferences
 	networkItem = [[NSToolbarItem alloc] initWithItemIdentifier:[networkPreferencePane preferencePaneIdentifier]];
 
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 08e1ac7d..c32c12e0 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -161,9 +161,7 @@
 		4D90B79E101E0CF200D116A1 /* SPUserManager.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 4D90B79B101E0CF200D116A1 /* SPUserManager.xcdatamodel */; };
 		4D90B79F101E0CF200D116A1 /* SPUserMO.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D90B79D101E0CF200D116A1 /* SPUserMO.m */; };
 		4D90B7A2101E0D1500D116A1 /* UserManagerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4D90B7A0101E0D1500D116A1 /* UserManagerView.xib */; };
-		4DECC3350EC2A170008D359E /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3320EC2A170008D359E /* Sparkle.framework */; };
 		4DECC3370EC2A170008D359E /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3340EC2A170008D359E /* Growl.framework */; };
-		4DECC48F0EC2B436008D359E /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3320EC2A170008D359E /* Sparkle.framework */; };
 		4DECC4910EC2B436008D359E /* Growl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3340EC2A170008D359E /* Growl.framework */; };
 		50082B3D1BF7CD2100746ECC /* ICUTemplateMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8AC0F909194002A3258 /* ICUTemplateMatcher.m */; };
 		50082B3E1BF7CD2100746ECC /* NSArray_DeepMutableCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8AE0F909194002A3258 /* NSArray_DeepMutableCopy.m */; };
@@ -617,7 +615,6 @@
 			files = (
 				58B907FB11BDA5A9000826E5 /* PSMTabBar.framework in Copy Frameworks */,
 				4DECC4910EC2B436008D359E /* Growl.framework in Copy Frameworks */,
-				4DECC48F0EC2B436008D359E /* Sparkle.framework in Copy Frameworks */,
 				586EBD5D11418D9400B3DE45 /* FeedbackReporter.framework in Copy Frameworks */,
 				58C6C71F11FBB18000A3F5E9 /* UniversalDetector.framework in Copy Frameworks */,
 				58DC0D7C12932AB200B76DA5 /* ShortcutRecorder.framework in Copy Frameworks */,
@@ -888,7 +885,6 @@
 		4D90B79C101E0CF200D116A1 /* SPUserMO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUserMO.h; sourceTree = "<group>"; };
 		4D90B79D101E0CF200D116A1 /* SPUserMO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUserMO.m; sourceTree = "<group>"; };
 		4D90B7A1101E0D1500D116A1 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/UserManagerView.xib; sourceTree = "<group>"; };
-		4DECC3320EC2A170008D359E /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = Frameworks/Sparkle.framework; sourceTree = "<group>"; };
 		4DECC3340EC2A170008D359E /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = Frameworks/Growl.framework; sourceTree = "<group>"; };
 		500C1F901BFB5F9F0095DC7F /* SPPrivilegesMO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPPrivilegesMO.h; sourceTree = "<group>"; };
 		500C1F911BFB5F9F0095DC7F /* SPPrivilegesMO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPrivilegesMO.m; sourceTree = "<group>"; };
@@ -1339,7 +1335,6 @@
 				296DC8BF0F9091DF002A3258 /* libicucore.dylib in Frameworks */,
 				8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
 				4DECC3370EC2A170008D359E /* Growl.framework in Frameworks */,
-				4DECC3350EC2A170008D359E /* Sparkle.framework in Frameworks */,
 				584D877815140F7B00F24774 /* SPMySQL.framework in Frameworks */,
 				586AAB1514FAD3AF007F82BF /* QueryKit.framework in Frameworks */,
 				296DC89F0F8FD336002A3258 /* WebKit.framework in Frameworks */,
@@ -1365,7 +1360,6 @@
 				58B9077D11BD9B64000826E5 /* Carbon.framework */,
 				1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */,
 				4DECC3340EC2A170008D359E /* Growl.framework */,
-				4DECC3320EC2A170008D359E /* Sparkle.framework */,
 				296DC89E0F8FD336002A3258 /* WebKit.framework */,
 				586EBD2311418D7C00B3DE45 /* FeedbackReporter.framework */,
 				58C6C71511FBB17200A3F5E9 /* UniversalDetector.framework */,
-- 
2.21.0

