Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdescy committed Apr 7, 2016
2 parents 7b7bc46 + 7d0af94 commit 3838785
Show file tree
Hide file tree
Showing 52 changed files with 6,778 additions and 5,316 deletions.
1 change: 1 addition & 0 deletions Sparkle.framework/Versions/A/Headers/SUAppcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SU_EXPORT @interface SUAppcast : NSObject<NSURLDownloadDelegate>
@property (copy) NSDictionary *httpHeaders;

- (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *))err;
- (SUAppcast *)copyWithoutDeltaUpdates;

@property (readonly, copy) NSArray *items;
@end
Expand Down
4 changes: 3 additions & 1 deletion Sparkle.framework/Versions/A/Headers/SUUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import "SUVersionComparisonProtocol.h"
#import "SUVersionDisplayProtocol.h"

@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
@class SUAppcastItem, SUAppcast;

@protocol SUUpdaterDelegate;

Expand Down Expand Up @@ -54,6 +54,8 @@ SU_EXPORT @interface SUUpdater : NSObject

@property BOOL automaticallyDownloadsUpdates;

@property (nonatomic, copy) NSString *decryptionPassword;

/*!
Explicitly checks for updates and displays a progress dialog while doing so.
Expand Down
3 changes: 2 additions & 1 deletion Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

@property (copy, readonly) NSString *archivePath;
@property (copy, readonly) NSString *updateHostBundlePath;
@property (copy, readonly) NSString *decryptionPassword;
@property (weak) id<SUUnarchiverDelegate> delegate;

+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host;
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host withPassword:(NSString *)decryptionPassword;

- (void)start;
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15E27e</string>
<string>15E49a</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,29 +17,29 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.13.1 git-2afc553</string>
<string>1.14.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.13.1</string>
<string>1.14.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7C68</string>
<string>7C1002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15C43</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0720</string>
<string>0721</string>
<key>DTXcodeBuild</key>
<string>7C68</string>
<string>7C1002</string>
<key>LSBackgroundOnly</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 6 additions & 6 deletions Sparkle.framework/Versions/A/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15E27e</string>
<string>15E49a</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,28 +17,28 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.13.1 git-2afc553</string>
<string>1.14.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.13.1</string>
<string>1.14.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7C68</string>
<string>7C1002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15C43</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0720</string>
<string>0721</string>
<key>DTXcodeBuild</key>
<string>7C68</string>
<string>7C1002</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings
Binary file not shown.
Binary file not shown.
Binary file modified Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings
Binary file not shown.
Binary file modified Sparkle.framework/Versions/A/Sparkle
Binary file not shown.
16 changes: 16 additions & 0 deletions TodoTxtMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
003F95B61AA40FB400A1FF47 /* TTMTask_DecrementDueDate_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 003F95B51AA40FB400A1FF47 /* TTMTask_DecrementDueDate_UnitTests.m */; };
0050D6841996AA38008F349B /* TTMTasklistMetadata_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0050D6831996AA38008F349B /* TTMTasklistMetadata_UnitTests.m */; };
006062D818EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */; };
0064E6441C9CEE6600B9A6C0 /* NSDate+RelativeDates.m in Sources */ = {isa = PBXBuildFile; fileRef = 0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */; };
006B26461A81C82D00B0E47A /* TTMFindReplace.xib in Resources */ = {isa = PBXBuildFile; fileRef = 006B26451A81C82D00B0E47A /* TTMFindReplace.xib */; };
006BA79E19DB9CFD00C8F408 /* TTMTasklistMetadata.xib in Resources */ = {isa = PBXBuildFile; fileRef = 006BA79D19DB9CFD00C8F408 /* TTMTasklistMetadata.xib */; };
007B835F1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */; };
Expand All @@ -67,6 +68,8 @@
00B4CBC918B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B4CBC818B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m */; };
00B8C82518E48FFF008D9E48 /* TTMFieldEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B8C82418E48FFF008D9E48 /* TTMFieldEditor.m */; };
00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */; };
00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */; };
00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */; };
00EAAB9718E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */; };
00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */; };
00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9C18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m */; };
Expand Down Expand Up @@ -145,6 +148,8 @@
0050D6831996AA38008F349B /* TTMTasklistMetadata_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTasklistMetadata_UnitTests.m; sourceTree = "<group>"; };
006062D618EC6B0800D147F2 /* NSUserDefaults+myColorSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+myColorSupport.h"; sourceTree = "<group>"; };
006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+myColorSupport.m"; sourceTree = "<group>"; };
0064E6421C9CEE6600B9A6C0 /* NSDate+RelativeDates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+RelativeDates.h"; sourceTree = "<group>"; };
0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+RelativeDates.m"; sourceTree = "<group>"; };
006B26451A81C82D00B0E47A /* TTMFindReplace.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TTMFindReplace.xib; sourceTree = "<group>"; };
006BA79D19DB9CFD00C8F408 /* TTMTasklistMetadata.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TTMTasklistMetadata.xib; sourceTree = "<group>"; };
007B835D1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorThresholdRowTemplate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -183,6 +188,9 @@
00B8C82418E48FFF008D9E48 /* TTMFieldEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMFieldEditor.m; sourceTree = "<group>"; };
00D102B41991ABBE00D30237 /* TTMTasklistMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMTasklistMetadata.h; sourceTree = "<group>"; };
00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTasklistMetadata.m; sourceTree = "<group>"; };
00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTask_IsHidden_UnitTests.m; sourceTree = "<group>"; };
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorHiddenRowTemplate.h; sourceTree = "<group>"; };
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorHiddenRowTemplate.m; sourceTree = "<group>"; };
00EAAB9518E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDateRowTemplate.h; sourceTree = "<group>"; };
00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorDateRowTemplate.m; sourceTree = "<group>"; };
00EAAB9818E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDueRowTemplate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -251,6 +259,8 @@
00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */,
007B835D1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.h */,
007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */,
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */,
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */,
);
name = Filters;
sourceTree = "<group>";
Expand All @@ -276,6 +286,8 @@
006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */,
003F959C1AA2C42700A1FF47 /* NSMutableAttributableString+ColorRegExMatches.h */,
003F959D1AA2C42700A1FF47 /* NSMutableAttributableString+ColorRegExMatches.m */,
0064E6421C9CEE6600B9A6C0 /* NSDate+RelativeDates.h */,
0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -386,6 +398,7 @@
003F95AF1AA3FE4400A1FF47 /* TTMTask_AppendText_UnitTests.m */,
003F95B11AA4016200A1FF47 /* TTMTask_PrependText_UnitTests.m */,
00B4CBC818B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m */,
00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */,
);
path = TodoTxtMacTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -563,6 +576,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0064E6441C9CEE6600B9A6C0 /* NSDate+RelativeDates.m in Sources */,
002EAE5918DBD24C008E7517 /* TTMAppController.m in Sources */,
00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */,
002EAE5E18DCAE5C008E7517 /* TTMFilterPredicates.m in Sources */,
Expand All @@ -583,6 +597,7 @@
00F811EF18D53F7300379B99 /* TTMPreferencesController.m in Sources */,
00165B2618DBD1EC00E137B8 /* TTMFiltersController.m in Sources */,
00FB47861A733E6100F8D2B3 /* TTMDocumentStatusBarText.m in Sources */,
00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */,
00B8C82518E48FFF008D9E48 /* TTMFieldEditor.m in Sources */,
00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */,
);
Expand Down Expand Up @@ -616,6 +631,7 @@
003F95B21AA4016200A1FF47 /* TTMTask_PrependText_UnitTests.m in Sources */,
003F959B1AA2B7A600A1FF47 /* TTMTask_RemoveDueDate_UnitTests.m in Sources */,
002218D81AA0D80800D6F3A0 /* TTMTask_Init_UnitTests.m in Sources */,
00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */,
003F95AA1AA3F9C700A1FF47 /* TTMTask_IncrementThresholdDate_UnitTests.m in Sources */,
002218E01AA1387900D6F3A0 /* TTMTask_ThresholdDate_UnitTests.m in Sources */,
003F95B01AA3FE4400A1FF47 /* TTMTask_AppendText_UnitTests.m in Sources */,
Expand Down
9 changes: 7 additions & 2 deletions TodoTxtMac/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
Expand Down Expand Up @@ -182,6 +182,11 @@
<action selector="copy:" target="-1" id="224"/>
</connections>
</menuItem>
<menuItem title="Copy Task to New Task" tag="7000" keyEquivalent="C" id="aGg-gt-UIO">
<connections>
<action selector="copyTaskToNewTask:" target="-1" id="X2j-OZ-tBd"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="203">
<connections>
<action selector="paste:" target="-1" id="226"/>
Expand Down
57 changes: 57 additions & 0 deletions TodoTxtMac/NSDate+RelativeDates.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* @author Michael Descy
* @copyright 2014-2016 Michael Descy
* @discussion Dual-licensed under the GNU General Public License and the MIT License
*
*
*
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
* @license The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#import <Foundation/Foundation.h>

@interface NSDate (RelativeDates)

- (NSDate*)advanceDateByWeekdays:(NSInteger)numberOfWeekdays;
- (NSDate*)advanceDateByNumberOfCalendarUnits:(NSInteger)numberOfCalendarUnits
calendarUnit:(NSCalendarUnit)calendarUnit;
- (BOOL)isWeekendDay;
- (BOOL)isWeekday;

@end
89 changes: 89 additions & 0 deletions TodoTxtMac/NSDate+RelativeDates.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* @author Michael Descy
* @copyright 2014-2015 Michael Descy
* @discussion Dual-licensed under the GNU General Public License and the MIT License
*
*
*
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
* @license The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#import "NSDate+RelativeDates.h"

@implementation NSDate (RelativeDates)

- (NSCalendar*)currentCalendar {
return [NSCalendar currentCalendar];
}

- (NSDate*)advanceDateByWeekdays:(NSInteger)numberOfWeekdays {
NSDate *relativeDate = self;
NSInteger weekdaysLeft = numberOfWeekdays;

while (weekdaysLeft > 0) {
NSDate *newDate = [relativeDate advanceDateByNumberOfCalendarUnits:1 calendarUnit:NSCalendarUnitDay];
if (newDate == nil) {
return relativeDate;
}
relativeDate = newDate;
if ([relativeDate isWeekday]) {
weekdaysLeft -= 1;
}
}
return relativeDate;
}

- (NSDate*)advanceDateByNumberOfCalendarUnits:(NSInteger)numberOfCalendarUnits
calendarUnit:(NSCalendarUnit)calendarUnit {
return [[self currentCalendar] dateByAddingUnit:calendarUnit
value:numberOfCalendarUnits
toDate:self
options:NSCalendarMatchFirst];
}

- (BOOL)isWeekendDay {
long weekday = [[self currentCalendar] component:NSCalendarUnitWeekday fromDate:self];
return (weekday == 1 || weekday == 7);
}

- (BOOL)isWeekday {
return ![self isWeekendDay];
}

@end
2 changes: 2 additions & 0 deletions TodoTxtMac/TTMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
@0, @"levelsOfUndo",
@YES, @"allowUndoOfArchiveCommand",
@NO, @"hideFutureTasks",
@NO, @"closingLastWindowClosesApplication",
@NO, @"hideHiddenTasks",
nil];
}
return dict;
Expand Down
Loading

0 comments on commit 3838785

Please sign in to comment.