Skip to content

Commit

Permalink
Let groundwork for Sparkle
Browse files Browse the repository at this point in the history
What’s in this commit:

- Removed the TEXTUAL_BUILT_WITH_FORCED_BETA_LIFESPAN define and code
associated with it.
- Split the Developer ID configuration profile off into a “Base
Configuration” file which all others inherit from now instead of
inheriting from the Developer ID configuration profile.
- Changed it so that the Info.plist file is copied to the .tmp folder
and is modified there so that the Info.plist does not get accidentally
changed in a commit when the version information in it is dynamically
generated.
- Included the Sparkle framework, though not used yet. I
  • Loading branch information
emsquared committed Feb 17, 2015
1 parent bb5d846 commit 7026780
Show file tree
Hide file tree
Showing 185 changed files with 1,047 additions and 157 deletions.
51 changes: 2 additions & 49 deletions Classes/Controllers/TXMasterController.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@

#import "TextualApplication.h"

#ifdef TEXTUAL_BUILT_WITH_FORCED_BETA_LIFESPAN
#import "BuildConfig.h"

#define _betaTesterMaxApplicationLifespan 5184000 // 60 days
#endif

#define KInternetEventClass 1196773964
#define KAEGetURL 1196773964

#ifdef TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED
#if TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED == 1
#define _hockeyAppApplicationIdentifier @"93d6d315ace023a30793e8c52a02f920"
#endif

Expand Down Expand Up @@ -166,47 +160,12 @@ - (void)checkForOtherCopiesOfTextualRunning
}
}

#ifdef TEXTUAL_BUILT_WITH_FORCED_BETA_LIFESPAN
- (void)presentBetaTesterDialog
{
NSTimeInterval currentTime = [NSDate epochTime];

NSTimeInterval buildTime = [TXBundleBuildDate integerValue];

NSTimeInterval timeSpent = (currentTime - buildTime);
NSTimeInterval timeleft = (_betaTesterMaxApplicationLifespan - timeSpent);

if (timeSpent > _betaTesterMaxApplicationLifespan) {
(void)[TLOPopupPrompts dialogWindowWithQuestion:TXTLS(@"BasicLanguage[1243][2]")
title:TXTLS(@"BasicLanguage[1243][1]")
defaultButton:TXTLS(@"BasicLanguage[1243][3]")
alternateButton:nil
suppressionKey:nil
suppressionText:nil];

self.skipTerminateSave = YES;
self.applicationIsTerminating = YES;

[RZSharedApplication() terminate:nil];
} else {
NSString *formattedTime = TXHumanReadableTimeInterval(timeleft, YES, (NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit));

(void)[TLOPopupPrompts dialogWindowWithQuestion:TXTLS(@"BasicLanguage[1242][2]", formattedTime)
title:TXTLS(@"BasicLanguage[1242][1]")
defaultButton:TXTLS(@"BasicLanguage[1242][3]")
alternateButton:nil
suppressionKey:nil
suppressionText:nil];
}
}
#endif

#pragma mark -
#pragma mark NSApplication Delegate

- (void)awakeHockeyApp
{
#ifdef TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED
#if TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED == 1
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:_hockeyAppApplicationIdentifier delegate:self];
[[BITHockeyManager sharedHockeyManager] startManager];
#endif
Expand All @@ -218,12 +177,6 @@ - (void)applicationDidFinishLaunching
[self checkForOtherCopiesOfTextualRunning];
#endif

#ifdef TEXTUAL_BUILT_WITH_FORCED_BETA_LIFESPAN
[self presentBetaTesterDialog];

[mainWindow() makeKeyAndOrderFront:nil];
#endif

[self awakeHockeyApp];

if ([worldController() clientCount] < 1) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controllers/TXMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2812,7 +2812,7 @@ - (void)toggleMainWindowAppearance:(id)sender

- (IBAction)simulateCrash:(id)sender
{
#ifdef TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED
#if TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED == 1
[[[BITHockeyManager sharedHockeyManager] crashManager] generateTestCrash];
#endif
}
Expand Down
3 changes: 0 additions & 3 deletions Classes/Headers/StaticDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ typedef void (^TXEmtpyBlockDataType)(void);
#define TEXTUAL_DEPRECATED_ASSERT NSAssert1(NO, @"Deprecated Method: %s", __PRETTY_FUNCTION__);
#define TEXTUAL_DEPRECATED_ASSERT_C NSCAssert1(NO, @"Deprecated Method: %s", __PRETTY_FUNCTION__);

/* Include a forced lifespan for beta builds. */
// #define TEXTUAL_BUILT_WITH_FORCED_BETA_LIFESPAN

/* Defines for script support instead of importing the
entire Carbon framework for three items. */
#ifndef kASAppleScriptSuite
Expand Down
2 changes: 1 addition & 1 deletion Classes/Headers/TXMasterController.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#import "TextualApplication.h"

#ifdef TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED
#if TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED == 1
@interface TXMasterController : NSObject <NSApplicationDelegate, BITHockeyManagerDelegate>
#else
@interface TXMasterController : NSObject <NSApplicationDelegate>
Expand Down
6 changes: 5 additions & 1 deletion Classes/Headers/TextualApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,14 @@
#import "StaticDefinitions.h"

/* Import frameworks based on defines. */
#ifdef TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED
#if TEXTUAL_BUILT_WITH_HOCKEYAPP_SDK_ENABLED == 1
#import <HockeySDK/HockeySDK.h>
#endif

#if TEXTUAL_BUILT_WITH_SPARKLE_ENABLED == 1
#import <Sparkle/Sparkle.h>
#endif

/* Protocol defenitions. (see file) */
#import "TDCSharedProtocolDefinitions.h"

Expand Down
8 changes: 5 additions & 3 deletions Classes/Helpers/Plugin Architecture/THOPluginItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

@implementation THOPluginItem

#define TXBundleMininumBundleVersionForLoadingExtensions @"5.0.0"

#define OINE(o) NSObjectIsNotEmpty(o)

#define VOCT(o, t) [o isKindOfClass:[t class]]
Expand All @@ -66,13 +68,13 @@ - (BOOL)loadBundle:(NSBundle *)bundle
LogToConsole(@"For example, to support this version and later, add the value:");
LogToConsole(@" ");
LogToConsole(@" <key>MinimumTextualVersion</key>");
LogToConsole(@" <string>%@</string>", TXBundleBuildVersionForComparisons);
LogToConsole(@" <string>%@</string>", TXBundleMininumBundleVersionForLoadingExtensions);
LogToConsole(@" ");
LogToConsole(@"Failure to provide a minimum version is currently only a warning, but in the future, Textual will");
LogToConsole(@"refuse to load bundles that do not specify a minimum version to load within.");
LogToConsole(@"-------------- WARNING -------------- ");
} else {
NSComparisonResult comparisonResult = [comparisonVersion compare:TXBundleBuildVersionForComparisons options:NSNumericSearch];
NSComparisonResult comparisonResult = [comparisonVersion compare:TXBundleMininumBundleVersionForLoadingExtensions options:NSNumericSearch];

if (comparisonResult == NSOrderedDescending) {
LogToConsole(@"-------------- ERROR -------------- ");
Expand All @@ -81,7 +83,7 @@ - (BOOL)loadBundle:(NSBundle *)bundle
LogToConsole(@" Bundle Path: %@", [bundle bundlePath]);
LogToConsole(@" ");
LogToConsole(@" Minimum version specified by bundle: %@", comparisonVersion);
LogToConsole(@" Version used by Textual for comparison: %@", TXBundleBuildVersionForComparisons);
LogToConsole(@" Version used by Textual for comparison: %@", TXBundleMininumBundleVersionForLoadingExtensions);
LogToConsole(@" ");
LogToConsole(@"-------------- ERROR -------------- ");

Expand Down
2 changes: 1 addition & 1 deletion Classes/Preferences/Themes/TPCThemeSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ - (void)reloadWithPath:(NSString *)path
NSDictionary *templateVersions = [self dictionaryForKeys:@"Template Engine Versions" fromDictionary:styleSettings];

if (templateVersions) {
NSInteger targetVersion = [templateVersions integerForKey:TXBundleBuildVersionForComparisons];
NSInteger targetVersion = [templateVersions integerForKey:[TPCApplicationInfo applicationVersionShort]];

if (NSNumberInRange(targetVersion, _templateEngineVersionMinimum, _templateEngineVersionMaximum)) {
templateEngineVersion = targetVersion;
Expand Down
1 change: 1 addition & 0 deletions Frameworks/Sparkle.framework/Headers
1 change: 1 addition & 0 deletions Frameworks/Sparkle.framework/Modules
1 change: 1 addition & 0 deletions Frameworks/Sparkle.framework/Resources
1 change: 1 addition & 0 deletions Frameworks/Sparkle.framework/Sparkle
33 changes: 33 additions & 0 deletions Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h
Original file line number Diff line number Diff line change
@@ -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

#import <Foundation/NSURLDownload.h>
#import "SUExport.h"

@protocol SUAppcastDelegate;

@class SUAppcastItem;
SU_EXPORT @interface SUAppcast : NSObject <NSURLDownloadDelegate>

@property (weak) id<SUAppcastDelegate> delegate;
@property (copy) NSString *userAgentString;

- (void)fetchAppcastFromURL:(NSURL *)url;

@property (readonly, copy) NSArray *items;
@end

@protocol SUAppcastDelegate <NSObject>
- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
@end

#endif
42 changes: 42 additions & 0 deletions Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// SUAppcastItem.h
// Sparkle
//
// Created by Andy Matuschak on 3/12/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//

#ifndef SUAPPCASTITEM_H
#define SUAPPCASTITEM_H

#include "SUExport.h"

SU_EXPORT @interface SUAppcastItem : NSObject
@property (copy, readonly) NSString *title;
@property (copy, readonly) NSDate *date;
@property (copy, readonly) NSString *itemDescription;
@property (strong, readonly) NSURL *releaseNotesURL;
@property (copy, readonly) NSString *DSASignature;
@property (copy, readonly) NSString *minimumSystemVersion;
@property (copy, readonly) NSString *maximumSystemVersion;
@property (strong, readonly) NSURL *fileURL;
@property (copy, readonly) NSString *versionString;
@property (copy, readonly) NSString *displayVersionString;
@property (copy, readonly) NSDictionary *deltaUpdates;
@property (strong, readonly) NSURL *infoURL;

// Initializes with data from a dictionary provided by the RSS class.
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString **)error;

@property (getter=isDeltaUpdate, readonly) BOOL deltaUpdate;
@property (getter=isCriticalUpdate, readonly) BOOL criticalUpdate;

// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
@property (readonly, copy) NSDictionary *propertiesDictionary;

- (NSURL *)infoURL;

@end

#endif
44 changes: 44 additions & 0 deletions Frameworks/Sparkle.framework/Versions/A/Headers/SUErrors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// SUErrors.h
// Sparkle
//
// Created by C.W. Betts on 10/13/14.
// Copyright (c) 2014 Sparkle Project. All rights reserved.
//

#ifndef SUERRORS_H
#define SUERRORS_H

#import <Foundation/Foundation.h>
#import "SUExport.h"

/**
* Error domain used by Sparkle
*/
SU_EXPORT extern NSString *const SUSparkleErrorDomain;

typedef NS_ENUM(OSStatus, SUError) {
// Appcast phase errors.
SUAppcastParseError = 1000,
SUNoUpdateError = 1001,
SUAppcastError = 1002,
SURunningFromDiskImageError = 1003,

// Downlaod phase errors.
SUTemporaryDirectoryError = 2000,

// Extraction phase errors.
SUUnarchivingError = 3000,
SUSignatureError = 3001,

// Installation phase errors.
SUFileCopyFailure = 4000,
SUAuthenticationFailure = 4001,
SUMissingUpdateError = 4002,
SUMissingInstallerToolError = 4003,
SURelaunchError = 4004,
SUInstallationError = 4005,
SUDowngradeError = 4006
};

#endif
18 changes: 18 additions & 0 deletions Frameworks/Sparkle.framework/Versions/A/Headers/SUExport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// SUExport.h
// Sparkle
//
// Created by Jake Petroules on 2014-08-23.
// Copyright (c) 2014 Sparkle Project. All rights reserved.
//

#ifndef SUEXPORT_H
#define SUEXPORT_H

#ifdef BUILDING_SPARKLE
#define SU_EXPORT __attribute__((visibility("default")))
#else
#define SU_EXPORT
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// SUStandardVersionComparator.h
// Sparkle
//
// Created by Andy Matuschak on 12/21/07.
// Copyright 2007 Andy Matuschak. All rights reserved.
//

#ifndef SUSTANDARDVERSIONCOMPARATOR_H
#define SUSTANDARDVERSIONCOMPARATOR_H

#import "SUExport.h"
#import "SUVersionComparisonProtocol.h"

/*!
Sparkle's default version comparator.
This comparator is adapted from MacPAD, by Kevin Ballard.
It's "dumb" in that it does essentially string comparison,
in components split by character type.
*/
SU_EXPORT @interface SUStandardVersionComparator : NSObject <SUVersionComparison>

/*!
Returns a singleton instance of the comparator.
*/
+ (SUStandardVersionComparator *)defaultComparator;

/*!
Compares version strings through textual analysis.
See the implementation for more details.
*/
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
@end

#endif
Loading

0 comments on commit 7026780

Please sign in to comment.