Permalink
Browse files

Implemented Sparkle framework integration for Core Data project templ…

…ate.
  • Loading branch information...
1 parent 58dd221 commit 4f5733aa12129fa5787bd33ed566a2e935279f4a @tomaz committed Jun 3, 2010
Showing with 2,463 additions and 7 deletions.
  1. +66 −4 Project Templates/Application/Cocoa Application/Core Data Application/Controller/MainMenu.xib
  2. +1 −0 ...emplates/Application/Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Headers
  3. +1 −0 ...plates/Application/Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Resources
  4. +1 −0 ...emplates/Application/Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Sparkle
  5. +33 −0 ...coa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h
  6. +47 −0 ...Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
  7. +118 −0 ...coa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h
  8. +27 −0 ...re Data Application/Frameworks/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h
  9. +21 −0 ...Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h
  10. +24 −0 ...oa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/Info.plist
  11. +7 −0 ...a Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/License.txt
  12. +174 −0 .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist
  13. +56 −0 .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib
  14. +20 −0 ...ion/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib
  15. BIN ... Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
  16. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  17. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib
  18. BIN ...works/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  19. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib
  20. +20 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib
  21. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib
  22. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  23. +20 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/info.nib
  24. BIN ...rks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  25. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings
  26. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  27. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib
  28. BIN ...works/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  29. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib
  30. +20 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib
  31. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
  32. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  33. +21 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/info.nib
  34. BIN ...rks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  35. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
  36. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  37. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib
  38. BIN ...works/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  39. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib
  40. +20 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib
  41. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib
  42. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  43. +20 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/info.nib
  44. BIN ...rks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  45. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings
  46. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  47. +16 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib
  48. BIN ...works/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  49. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib
  50. +16 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib
  51. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib
  52. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  53. +16 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib
  54. BIN ...rks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  55. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings
  56. +1 −0 ...a Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj
  57. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  58. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib
  59. BIN ...works/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  60. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib
  61. +20 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib
  62. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib
  63. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  64. +20 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/info.nib
  65. BIN ...rks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  66. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings
  67. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  68. +18 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib
  69. BIN ...works/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  70. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib
  71. +16 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib
  72. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib
  73. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  74. +16 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib
  75. BIN ...rks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  76. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings
  77. BIN ...ocoa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/relaunch
  78. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  79. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib
  80. BIN ...works/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  81. +67 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib
  82. +20 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib
  83. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib
  84. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  85. +18 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib
  86. BIN ...rks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  87. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings
  88. +50 −0 ...Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  89. +20 −0 ...on/Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib
  90. BIN ...works/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  91. +39 −0 ...lication/Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib
  92. +18 −0 ...Application/Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib
  93. BIN ...ion/Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib
  94. +59 −0 ...ameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  95. +20 −0 .../Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib
  96. BIN ...rks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  97. BIN .../Core Data Application/Frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings
  98. BIN ...plication/Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/A/Sparkle
  99. +1 −0 ...Application/Cocoa Application/Core Data Application/Frameworks/Sparkle.framework/Versions/Current
  100. +1 −0 Project Templates/Application/Cocoa Application/Core Data Application/Resources/dsa_pub.pem
  101. +8 −0 ...ates/Application/Cocoa Application/Core Data Application/___PROJECTNAMEASIDENTIFIER___-Info.plist
  102. +1 −1 ...pplication/Cocoa Application/Core Data Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist
  103. +20 −2 ...s/Application/Cocoa Application/Core Data Application/___PROJECTNAME___.xcodeproj/project.pbxproj
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="29"/>
+ <integer value="57"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -71,6 +71,14 @@
<reference key="NSOnImage" ref="893455832"/>
<reference key="NSMixedImage" ref="424226900"/>
</object>
+ <object class="NSMenuItem" id="488066364">
+ <reference key="NSMenu" ref="123765298"/>
+ <string key="NSTitle">Check for Updates</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="893455832"/>
+ <reference key="NSMixedImage" ref="424226900"/>
+ </object>
<object class="NSMenuItem" id="791044830">
<reference key="NSMenu" ref="123765298"/>
<bool key="NSIsDisabled">YES</bool>
@@ -1127,6 +1135,9 @@
<object class="NSCustomObject" id="39582327">
<string key="NSClassName">NSFontManager</string>
</object>
+ <object class="NSCustomObject" id="494086469">
+ <string key="NSClassName">SUUpdater</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -1707,6 +1718,14 @@
</object>
<int key="connectionID">521</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">checkForUpdates:</string>
+ <reference key="source" ref="494086469"/>
+ <reference key="destination" ref="488066364"/>
+ </object>
+ <int key="connectionID">524</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1776,6 +1795,7 @@
<reference ref="901869444"/>
<reference ref="163840636"/>
<reference ref="791044830"/>
+ <reference ref="488066364"/>
</object>
<reference key="parent" ref="376192112"/>
</object>
@@ -2598,6 +2618,17 @@
<reference key="object" ref="954120217"/>
<reference key="parent" ref="508081226"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">522</int>
+ <reference key="object" ref="488066364"/>
+ <reference key="parent" ref="123765298"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">523</int>
+ <reference key="object" ref="494086469"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Updater</string>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2752,6 +2783,8 @@
<string>519.IBEditorWindowLastContentRect</string>
<string>519.IBPluginDependency</string>
<string>520.IBPluginDependency</string>
+ <string>522.IBPluginDependency</string>
+ <string>523.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
@@ -2924,8 +2957,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{85, 781}, {245, 183}}</string>
+ <string>{{196, 633}, {275, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2961,7 +2996,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">521</int>
+ <int key="maxID">524</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3380,6 +3415,20 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Sparkle.framework/Headers/SUAppcast.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="645543665">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Sparkle.framework/Headers/SUUpdater.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
@@ -3460,6 +3509,19 @@
<string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string>
</object>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">SUUpdater</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">checkForUpdates:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">delegate</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <reference key="sourceIdentifier" ref="645543665"/>
+ </object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
@@ -3472,7 +3534,7 @@
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../../CocoaApp.xcodeproj</string>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../___PROJECTNAME___.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
@@ -0,0 +1,33 @@
+//
+// SUAppcast.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCAST_H
+#define SUAPPCAST_H
+
+@class SUAppcastItem;
+@interface SUAppcast : NSObject {
+ NSArray *items;
+ NSString *userAgentString;
+ id delegate;
+ NSMutableData *incrementalData;
+}
+
+- (void)fetchAppcastFromURL:(NSURL *)url;
+- (void)setDelegate:delegate;
+- (void)setUserAgentString:(NSString *)userAgentString;
+
+- (NSArray *)items;
+
+@end
+
+@interface NSObject (SUAppcastDelegate)
+- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
+- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
+@end
+
+#endif
@@ -0,0 +1,47 @@
+//
+// SUAppcastItem.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCASTITEM_H
+#define SUAPPCASTITEM_H
+
+@interface SUAppcastItem : NSObject {
+ NSString *title;
+ NSDate *date;
+ NSString *itemDescription;
+
+ NSURL *releaseNotesURL;
+
+ NSString *DSASignature;
+ NSString *minimumSystemVersion;
+
+ NSURL *fileURL;
+ NSString *versionString;
+ NSString *displayVersionString;
+
+ NSDictionary *propertiesDictionary;
+}
+
+// Initializes with data from a dictionary provided by the RSS class.
+- initWithDictionary:(NSDictionary *)dict;
+
+- (NSString *)title;
+- (NSString *)versionString;
+- (NSString *)displayVersionString;
+- (NSDate *)date;
+- (NSString *)itemDescription;
+- (NSURL *)releaseNotesURL;
+- (NSURL *)fileURL;
+- (NSString *)DSASignature;
+- (NSString *)minimumSystemVersion;
+
+// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
+- (NSDictionary *)propertiesDictionary;
+
+@end
+
+#endif
@@ -0,0 +1,118 @@
+//
+// SUUpdater.h
+// Sparkle
+//
+// Created by Andy Matuschak on 1/4/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUUPDATER_H
+#define SUUPDATER_H
+
+#import <Sparkle/SUVersionComparisonProtocol.h>
+
+@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
+@interface SUUpdater : NSObject {
+ NSTimer *checkTimer;
+ SUUpdateDriver *driver;
+
+ SUHost *host;
+ IBOutlet id delegate;
+}
+
++ (SUUpdater *)sharedUpdater;
++ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
+- (NSBundle *)hostBundle;
+
+- (void)setDelegate:(id)delegate;
+- delegate;
+
+- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
+- (BOOL)automaticallyChecksForUpdates;
+
+- (void)setUpdateCheckInterval:(NSTimeInterval)interval;
+- (NSTimeInterval)updateCheckInterval;
+
+- (void)setFeedURL:(NSURL *)feedURL;
+- (NSURL *)feedURL;
+
+- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
+- (BOOL)sendsSystemProfile;
+
+- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
+- (BOOL)automaticallyDownloadsUpdates;
+
+// This IBAction is meant for a main menu item. Hook up any menu item to this action,
+// and Sparkle will check for updates and report back its findings verbosely.
+- (IBAction)checkForUpdates:sender;
+
+// This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
+// in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
+// update is found, it will be downloaded and prepped for installation.
+- (void)checkForUpdatesInBackground;
+
+// Date of last update check. Returns null if no check has been performed.
+- (NSDate*)lastUpdateCheckDate;
+
+// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
+// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
+- (void)checkForUpdateInformation;
+
+// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
+- (void)resetUpdateCycle;
+
+- (BOOL)updateInProgress;
+@end
+
+@interface NSObject (SUUpdaterDelegateInformalProtocol)
+// This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
+- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
+
+// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
+- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
+
+// Implement this if you want to do some special handling with the appcast once it finishes loading.
+- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
+
+// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
+// a valid update, if any, in the given appcast.
+- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
+
+// Sent when a valid update is found by the update driver.
+- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
+
+// Sent when a valid update is not found.
+- (void)updaterDidNotFindUpdate:(SUUpdater *)update;
+
+// Sent immediately before installing the specified update.
+- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
+
+// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
+- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
+
+// Called immediately before relaunching.
+- (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
+
+// This method allows you to provide a custom version comparator.
+// If you don't implement this method or return nil, the standard version comparator will be used.
+- (id <SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater;
+
+// Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle.
+- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
+
+@end
+
+// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
+#ifdef DEBUG
+#define SU_MIN_CHECK_INTERVAL 60
+#else
+#define SU_MIN_CHECK_INTERVAL 60*60
+#endif
+
+#ifdef DEBUG
+#define SU_DEFAULT_CHECK_INTERVAL 60
+#else
+#define SU_DEFAULT_CHECK_INTERVAL 60*60*24
+#endif
+
+#endif
@@ -0,0 +1,27 @@
+//
+// SUVersionComparisonProtocol.h
+// Sparkle
+//
+// Created by Andy Matuschak on 12/21/07.
+// Copyright 2007 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUVERSIONCOMPARISONPROTOCOL_H
+#define SUVERSIONCOMPARISONPROTOCOL_H
+
+/*!
+ @protocol
+ @abstract Implement this protocol to provide version comparison facilities for Sparkle.
+*/
+@protocol SUVersionComparison
+
+/*!
+ @method
+ @abstract An abstract method to compare two version strings.
+ @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent.
+*/
+- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
+
+@end
+
+#endif
Oops, something went wrong.

0 comments on commit 4f5733a

Please sign in to comment.