Browse files

code cleanup

  • Loading branch information...
1 parent 61805b3 commit a9860a438a1b67e63c0ca12c82eafc6d4816019e @aporat aporat committed Jan 6, 2012
View
20 src/Three20Network/Three20Network.xcodeproj/project.pbxproj
@@ -7,13 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
- 662D819D126304DE005851C2 /* Xcode324iOS41TestSuiteWorkaround.m in Sources */ = {isa = PBXBuildFile; fileRef = 662D819C126304DE005851C2 /* Xcode324iOS41TestSuiteWorkaround.m */; };
664B29BF12848AA50008D569 /* TTErrorCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 664B29BC12848AA50008D569 /* TTErrorCodes.h */; settings = {ATTRIBUTES = (Public, ); }; };
664B29C312848AAD0008D569 /* TTErrorCodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 664B29C012848AAD0008D569 /* TTErrorCodes.m */; };
66F955B0126662E300BEF6F0 /* NetworkURLCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F955AF126662E300BEF6F0 /* NetworkURLCacheTests.m */; };
66F955BA1266647A00BEF6F0 /* both.png in Resources */ = {isa = PBXBuildFile; fileRef = 66F955B71266647A00BEF6F0 /* both.png */; };
66F955BB1266647A00BEF6F0 /* both@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 66F955B81266647A00BEF6F0 /* both@2x.png */; };
66F955BC1266647A00BEF6F0 /* only@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 66F955B91266647A00BEF6F0 /* only@2x.png */; };
+ 6D64C15914B7C9C100BF5E23 /* NetworkRequestTimeoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D64C15814B7C9C100BF5E23 /* NetworkRequestTimeoutTests.m */; };
6EE735F8118499D300A35176 /* Three20Network.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE735F7118499D300A35176 /* Three20Network.h */; settings = {ATTRIBUTES = (Public, ); }; };
6EE735FA118499FB00A35176 /* TTGlobalNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE735F9118499FB00A35176 /* TTGlobalNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; };
6EE735FC11849A0C00A35176 /* TTGlobalNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EE735FB11849A0C00A35176 /* TTGlobalNetwork.m */; };
@@ -45,7 +45,6 @@
6EE736C811849FAB00A35176 /* libThree20Core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE7366C11849C5800A35176 /* libThree20Core.a */; };
6EE739CD1184BAF600A35176 /* libThree20Network.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEF31F3A0F352DF5000DE5D2 /* libThree20Network.a */; };
6EF96405118EFCF0003902E7 /* TTURLRequestQueueInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EF96404118EFCF0003902E7 /* TTURLRequestQueueInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
- E1F076A1130521F7007CA6F1 /* NetworkRequestTimeoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F076A0130521F7007CA6F1 /* NetworkRequestTimeoutTests.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -87,13 +86,13 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
- 662D819C126304DE005851C2 /* Xcode324iOS41TestSuiteWorkaround.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Xcode324iOS41TestSuiteWorkaround.m; path = ../UnitTests/Xcode324iOS41TestSuiteWorkaround.m; sourceTree = SOURCE_ROOT; };
664B29BC12848AA50008D569 /* TTErrorCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TTErrorCodes.h; path = Headers/TTErrorCodes.h; sourceTree = "<group>"; };
664B29C012848AAD0008D569 /* TTErrorCodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TTErrorCodes.m; path = Sources/TTErrorCodes.m; sourceTree = "<group>"; };
66F955AF126662E300BEF6F0 /* NetworkURLCacheTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkURLCacheTests.m; path = UnitTests/NetworkURLCacheTests.m; sourceTree = "<group>"; };
66F955B71266647A00BEF6F0 /* both.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = both.png; path = UnitTests/Resources/both.png; sourceTree = "<group>"; };
66F955B81266647A00BEF6F0 /* both@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "both@2x.png"; path = "UnitTests/Resources/both@2x.png"; sourceTree = "<group>"; };
66F955B91266647A00BEF6F0 /* only@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "only@2x.png"; path = "UnitTests/Resources/only@2x.png"; sourceTree = "<group>"; };
+ 6D64C15814B7C9C100BF5E23 /* NetworkRequestTimeoutTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkRequestTimeoutTests.m; path = UnitTests/NetworkRequestTimeoutTests.m; sourceTree = "<group>"; };
6E64541F1184BDF900F08CB1 /* Project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Project.xcconfig; path = Configurations/Project.xcconfig; sourceTree = "<group>"; };
6EE735F7118499D300A35176 /* Three20Network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Three20Network.h; path = Headers/Three20Network.h; sourceTree = "<group>"; };
6EE735F9118499FB00A35176 /* TTGlobalNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TTGlobalNetwork.h; path = Headers/TTGlobalNetwork.h; sourceTree = "<group>"; };
@@ -130,7 +129,6 @@
6EE7366611849C5800A35176 /* Three20Core.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Three20Core.xcodeproj; path = ../Three20Core/Three20Core.xcodeproj; sourceTree = SOURCE_ROOT; };
6EF96404118EFCF0003902E7 /* TTURLRequestQueueInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TTURLRequestQueueInternal.h; path = Headers/TTURLRequestQueueInternal.h; sourceTree = "<group>"; };
BEF31F3A0F352DF5000DE5D2 /* libThree20Network.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libThree20Network.a; sourceTree = BUILT_PRODUCTS_DIR; };
- E1F076A0130521F7007CA6F1 /* NetworkRequestTimeoutTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkRequestTimeoutTests.m; sourceTree = "<group>"; };
EB9E6C6210B6A8F800DE563C /* NetworkUnitTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkUnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -177,23 +175,14 @@
name = CustomTemplate;
sourceTree = "<group>";
};
- 662D819B126304DE005851C2 /* Xcode 3.2.4 Workaround */ = {
- isa = PBXGroup;
- children = (
- 662D819C126304DE005851C2 /* Xcode324iOS41TestSuiteWorkaround.m */,
- );
- name = "Xcode 3.2.4 Workaround";
- sourceTree = "<group>";
- };
6E08B274118282F700DA1579 /* Tests */ = {
isa = PBXGroup;
children = (
6EE7364611849AF200A35176 /* Resources */,
6E08B27D118282F700DA1579 /* Mocks */,
- 662D819B126304DE005851C2 /* Xcode 3.2.4 Workaround */,
6EE7363B11849AA100A35176 /* NetworkModelTests.m */,
+ 6D64C15814B7C9C100BF5E23 /* NetworkRequestTimeoutTests.m */,
66F955AF126662E300BEF6F0 /* NetworkURLCacheTests.m */,
- E1F076A0130521F7007CA6F1 /* NetworkRequestTimeoutTests.m */,
);
name = Tests;
sourceTree = "<group>";
@@ -540,6 +529,7 @@
6EE7362E11849A4000A35176 /* TTURLRequestModel.m in Sources */,
6EE7362F11849A4000A35176 /* TTURLRequestQueue.m in Sources */,
664B29C312848AAD0008D569 /* TTErrorCodes.m in Sources */,
+ 6D64C15914B7C9C100BF5E23 /* NetworkRequestTimeoutTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -549,9 +539,7 @@
files = (
6EE7363A11849A9800A35176 /* MockModelDelegate.m in Sources */,
6EE7363C11849AA100A35176 /* NetworkModelTests.m in Sources */,
- 662D819D126304DE005851C2 /* Xcode324iOS41TestSuiteWorkaround.m in Sources */,
66F955B0126662E300BEF6F0 /* NetworkURLCacheTests.m in Sources */,
- E1F076A1130521F7007CA6F1 /* NetworkRequestTimeoutTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
0 ...ree20Network/NetworkRequestTimeoutTests.m → ...rk/UnitTests/NetworkRequestTimeoutTests.m
File renamed without changes.
View
7 src/Three20UI/Sources/TTViewController.m
@@ -110,13 +110,6 @@ - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[TTURLRequestQueue mainQueue].suspended = YES;
-
- // Ugly hack to work around UISearchBar's inability to resize its text field
- // to avoid being overlapped by the table section index
-// if (_searchController && !_searchController.active) {
-// [_searchController setActive:YES animated:NO];
-// [_searchController setActive:NO animated:NO];
-// }
}
View
183 src/UnitTests/Xcode324iOS41TestSuiteWorkaround.m
@@ -1,183 +0,0 @@
-//
-// Xcode324iOS41TestSuiteWorkaround.m
-//
-// This source file provides a work-around to enable running unit tests
-// against the iPhone Simulator in Xcode 3.2.4 with iOS SDK 4.1.
-//
-// This work-around is only needed when using Xcode 3.2.4 to target iOS 4.1.
-//
-// Copyright 2010 Apple Inc. All rights reserved.
-//
-
-/* Instructions:
-
- To use this workaround, add this source file to the Compile Sources
- build phase of your unit test bundle target. It will be applied
- automatically before your tests are run.
-
- This is a workaround for an Xcode internal error that will be reported in
- the build log when attempting to run unit tests against the iPhone Simulator
- for iOS 4.1. This is due to a mismatch between what Xcode expects the date
- format in "Test Suite 'name' started at date" and "Test Suite 'name'
- finished at date." messages to look like, and how iOS 4.1
- implements -[NSDate descriptionWithLocale:].
-
- The workaround works by exchanging the implementations of the
- -[SenTestRun startDate] and -[SenTestRun stopDate] methods for versions
- which return an NSDate subclass whose -descriptionWithLocale: method
- prints in a format compatible with what Xcode 3.2.4 expects.
-*/
-
-/*
- IMPORTANT: The following Apple material is supplied to you by Apple Inc.
- (“Apple”) in consideration of your agreement to the following terms. If you
- do not agree with these terms, do not use the Apple material. In consideration
- of your agreement to abide by the following terms, and subject to these terms,
- Apple grants you a non-exclusive license, under Apple’s copyrights in this
- original Apple material, to use, reproduce, install, modify and redistribute
- the Apple materials, in their original form as provided by Apple or as modified
- by you; provided that if you modify the Apple materials, then you must not
- attribute them to Apple. Except as expressly stated in this notice, no other
- rights or licenses, express or implied, are granted by Apple herein.
-
- The Apple Materials are provided by Apple on an "AS IS" basis. APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, OR ANY WARRANTY THAT THE APPLE MATERIALS WILL BE COMPATIBLE WITH
- FUTURE APPLE PRODUCTS, SOFTWARE OR SERVICES. IN NO EVENT SHALL APPLE BE LIABLE
- FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RELATING TO OR
- ARISING IN ANY WAY OUT OF THE USE OF THE APPLE MATERIALS BY YOU OR OTHERS,
- HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
- NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#import <Foundation/Foundation.h>
-#import <SenTestingKit/SenTestingKit.h>
-#import <objc/runtime.h>
-
-#if TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MAX_ALLOWED == __IPHONE_4_1)
-
-
-// An NSDate subclass whose -descriptionWithLocale: is compatible with Xcode 3.2.4's
-// unit test message parser.
-@interface Xcode324iOS41TestSuiteWorkaroundDate : NSDate {
-@private
- NSDate *_wrappedDate;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-+ (id)workaroundDateWrappingDate:(NSDate *)wrappedDate;
-
-@end
-
-
-@implementation Xcode324iOS41TestSuiteWorkaroundDate
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-+ (id)workaroundDateWrappingDate:(NSDate *)wrappedDate {
- return [[[self alloc] initWithTimeIntervalSinceReferenceDate:
- [wrappedDate timeIntervalSinceReferenceDate]]
- autorelease];
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (id)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)seconds {
- // required override (NSDate is a class cluster)
- self = [super init];
- if (self) {
- _wrappedDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:seconds];
- }
-
- return self;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)dealloc {
- [_wrappedDate release];
-
- [super dealloc];
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSTimeInterval)timeIntervalSinceReferenceDate {
- // required override (NSDate is a class cluster)
- return [_wrappedDate timeIntervalSinceReferenceDate];
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSString *)descriptionWithLocale:(id)locale {
- // append 4 digits to the result of -descriptionWithLocale: for Xcode's unit test message
- // parser
- NSString *originalDescription = [_wrappedDate descriptionWithLocale:locale];
- return [originalDescription stringByAppendingString:@" 0000"];
-}
-
-@end
-
-
-// Methods added to SenTestRun that are swizzled in place of the existing methods to
-// return instances of Xcode324iOS41TestSuiteWorkaroundDate instead of NSDate, so Xcode's
-// unit test message parser gets output in the format it expects.
-@interface SenTestRun (Xcode324iOS41TestSuiteWorkaroundMethods)
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSDate *)workaround_startDate;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSDate *)workaround_stopDate;
-
-@end
-
-
-@implementation SenTestRun (Xcode324iOS41TestSuiteWorkaroundMethods)
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-+ (void)load {
- Class senTestRunClass = objc_getClass("SenTestRun");
-
- // Exchange the implementations of -[SenTestRun startDate]
- // and -[SenTestRun workaround_startDate].
- Method originalStartDate = class_getInstanceMethod(senTestRunClass, @selector(startDate));
- Method workaroundStartDate = class_getInstanceMethod(senTestRunClass,
- @selector(workaround_startDate));
- method_exchangeImplementations(originalStartDate, workaroundStartDate);
-
- // Exchange the implementations of -[SenTestRun stopDate]
- // and -[SenTestRun workaround_stopDate].
- Method originalStopDate = class_getInstanceMethod(senTestRunClass, @selector(stopDate));
- Method workaroundStopDate = class_getInstanceMethod(senTestRunClass,
- @selector(workaround_stopDate));
- method_exchangeImplementations(originalStopDate, workaroundStopDate);
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSDate *)workaround_startDate {
- // The below invokes the original -startDate due to the use of method_exchangeImplementatons
- // in our +load.
- return [Xcode324iOS41TestSuiteWorkaroundDate workaroundDateWrappingDate:
- [self workaround_startDate]];
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (NSDate *)workaround_stopDate {
- // The below invokes the original -stopDate due to the use of method_exchangeImplementatons
- // in our +load.
- return [Xcode324iOS41TestSuiteWorkaroundDate workaroundDateWrappingDate:
- [self workaround_stopDate]];
-}
-
-@end
-
-#else
-#warning "This workaround is only needed when using Xcode 3.2.4 to target iOS 4.1."
-#endif

0 comments on commit a9860a4

Please sign in to comment.