Indenting macro conditionals

This commit is contained in:
Mattt Thompson 2012-11-06 09:21:41 -08:00
parent d5bd23ca17
commit 5ec794dc4d
8 changed files with 97 additions and 107 deletions

View file

@ -81,15 +81,15 @@ typedef enum {
AFNetworkReachabilityStatusReachableViaWiFi = 2, AFNetworkReachabilityStatusReachableViaWiFi = 2,
} AFNetworkReachabilityStatus; } AFNetworkReachabilityStatus;
#else #else
#warning SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available. #warning SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available.
#endif #endif
#ifndef __UTTYPE__ #ifndef __UTTYPE__
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#warning MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. #warning MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available.
#else #else
#warning CoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. #warning CoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available.
#endif #endif
#endif #endif
typedef enum { typedef enum {

View file

@ -28,15 +28,15 @@
#import <Availability.h> #import <Availability.h>
#ifdef _SYSTEMCONFIGURATION_H #ifdef _SYSTEMCONFIGURATION_H
#import <netinet/in.h> #import <netinet/in.h>
#import <netinet6/in6.h> #import <netinet6/in6.h>
#import <arpa/inet.h> #import <arpa/inet.h>
#import <ifaddrs.h> #import <ifaddrs.h>
#import <netdb.h> #import <netdb.h>
#endif #endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#ifdef _SYSTEMCONFIGURATION_H #ifdef _SYSTEMCONFIGURATION_H

View file

@ -25,9 +25,9 @@
// Workaround for change in imp_implementationWithBlock() with Xcode 4.5 // Workaround for change in imp_implementationWithBlock() with Xcode 4.5
#if defined(__IPHONE_6_0) || defined(__MAC_10_8) #if defined(__IPHONE_6_0) || defined(__MAC_10_8)
#define AF_CAST_TO_BLOCK id #define AF_CAST_TO_BLOCK id
#else #else
#define AF_CAST_TO_BLOCK __bridge void * #define AF_CAST_TO_BLOCK __bridge void *
#endif #endif
NSSet * AFContentTypesFromHTTPHeader(NSString *string) { NSSet * AFContentTypesFromHTTPHeader(NSString *string) {

View file

@ -26,9 +26,9 @@
#import <Availability.h> #import <Availability.h>
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#elif __MAC_OS_X_VERSION_MIN_REQUIRED #elif __MAC_OS_X_VERSION_MIN_REQUIRED
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#endif #endif
/** /**

View file

@ -24,21 +24,20 @@
#import <Availability.h> #import <Availability.h>
#ifndef _AFNETWORKING_ #ifndef _AFNETWORKING_
#define _AFNETWORKING_ #define _AFNETWORKING_
#import "AFURLConnectionOperation.h" #import "AFURLConnectionOperation.h"
#import "AFHTTPRequestOperation.h" #import "AFHTTPRequestOperation.h"
#import "AFJSONRequestOperation.h" #import "AFJSONRequestOperation.h"
#import "AFXMLRequestOperation.h" #import "AFXMLRequestOperation.h"
#import "AFPropertyListRequestOperation.h" #import "AFPropertyListRequestOperation.h"
#import "AFHTTPClient.h" #import "AFHTTPClient.h"
#import "AFImageRequestOperation.h" #import "AFImageRequestOperation.h"
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import "AFNetworkActivityIndicatorManager.h"
#import "UIImageView+AFNetworking.h"
#endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import "AFNetworkActivityIndicatorManager.h"
#import "UIImageView+AFNetworking.h"
#endif
#endif /* _AFNETWORKING_ */ #endif /* _AFNETWORKING_ */

View file

@ -21,8 +21,9 @@
// THE SOFTWARE. // THE SOFTWARE.
#import "AFURLConnectionOperation.h" #import "AFURLConnectionOperation.h"
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#if !__has_feature(objc_arc) #if !__has_feature(objc_arc)

View file

@ -23,28 +23,22 @@
#import <Availability.h> #import <Availability.h>
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h> @interface AppDelegate : NSObject <UIApplicationDelegate>
@interface AppDelegate : NSObject <UIApplicationDelegate> { @property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UINavigationController *navigationController;
}
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UINavigationController *navigationController;
@end
@end
#else #else
#import <Cocoa/Cocoa.h>
#import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate>
@interface AppDelegate : NSObject <NSApplicationDelegate> @property (strong) IBOutlet NSWindow *window;
@property (strong) IBOutlet NSTableView *tableView;
@property (strong) IBOutlet NSWindow *window; @property (strong) IBOutlet NSArrayController *postsArrayController;
@property (strong) IBOutlet NSTableView *tableView;
@property (strong) IBOutlet NSArrayController *postsArrayController;
@end
@end
#endif #endif

View file

@ -23,75 +23,71 @@
#import "AppDelegate.h" #import "AppDelegate.h"
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import "GlobalTimelineViewController.h"
#import "GlobalTimelineViewController.h" #import "AFNetworkActivityIndicatorManager.h"
#import "AFNetworkActivityIndicatorManager.h" @implementation AppDelegate
@synthesize window = _window;
@synthesize navigationController = _navigationController;
@implementation AppDelegate - (BOOL)application:(UIApplication *)application
@synthesize window = _window; didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@synthesize navigationController = _navigationController; {
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
- (BOOL)application:(UIApplication *)application [NSURLCache setSharedURLCache:URLCache];
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; UITableViewController *viewController = [[GlobalTimelineViewController alloc] initWithStyle:UITableViewStylePlain];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
UITableViewController *viewController = [[GlobalTimelineViewController alloc] initWithStyle:UITableViewStylePlain]; self.navigationController.navigationBar.tintColor = [UIColor darkGrayColor];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.navigationController.navigationBar.tintColor = [UIColor darkGrayColor]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.navigationController;
self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible]; return YES;
}
return YES;
}
@end
@end
#else #else
#import "Post.h"
#import "User.h"
#import "Post.h" @implementation AppDelegate
#import "User.h"
@implementation AppDelegate @synthesize window = _window;
@synthesize tableView = _tableView;
@synthesize postsArrayController = _postsArrayController;
@synthesize window = _window; - (void)applicationDidFinishLaunching:(NSNotification *)notification {
@synthesize tableView = _tableView; NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
@synthesize postsArrayController = _postsArrayController; [NSURLCache setSharedURLCache:URLCache];
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
[self.window makeKeyAndOrderFront:self];
[Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
if (error) {
[[NSAlert alertWithMessageText:NSLocalizedString(@"Error", nil) defaultButton:NSLocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@",[error localizedDescription]] runModal];
}
self.postsArrayController.content = posts; [self.window makeKeyAndOrderFront:self];
}];
[Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
[[NSNotificationCenter defaultCenter] addObserverForName:kUserProfileImageDidLoadNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { if (error) {
[self.tableView reloadData]; [[NSAlert alertWithMessageText:NSLocalizedString(@"Error", nil) defaultButton:NSLocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@",[error localizedDescription]] runModal];
}]; }
}
self.postsArrayController.content = posts;
}];
[[NSNotificationCenter defaultCenter] addObserverForName:kUserProfileImageDidLoadNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
[self.tableView reloadData];
}];
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)application - (BOOL)applicationShouldHandleReopen:(NSApplication *)application
hasVisibleWindows:(BOOL)flag hasVisibleWindows:(BOOL)flag
{ {
[self.window makeKeyAndOrderFront:self]; [self.window makeKeyAndOrderFront:self];
return YES; return YES;
} }
@end @end
#endif
#endif