Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved #defines to static constants

  • Loading branch information...
commit 66ed4beeef7fde2d476310d6b65a76781df5249f 1 parent 9bbe862
Adrian Kosmaczewski authored
View
3  Classes/AppDelegate/SBAppDelegate.m
@@ -34,9 +34,8 @@
#import "SBAppDelegate.h"
#import "SBHelpers.h"
+#import "SBExternals.h"
#import "Definitions.h"
-#import "AKOImageCache.h"
-#import "Reachability.h"
#import "SBRootController.h"
#import "SBSettingsController.h"
View
2  Classes/Controllers/SBCommentsController.m
@@ -35,7 +35,7 @@
#import "SBCommentsController.h"
#import "SBModels.h"
#import "SBHelpers.h"
-#import "AKOEditorrific.h"
+#import "SBExternals.h"
@interface SBCommentsController ()
View
2  Classes/Controllers/SBListController.m
@@ -35,8 +35,8 @@
#import "SBListController.h"
#import "SBModels.h"
#import "SBHelpers.h"
+#import "SBExternals.h"
#import "SBListTableViewCell.h"
-#import "AKOImageView.h"
@interface SBListController ()
View
50 Classes/Helpers/SBNetworkManager.h
@@ -34,28 +34,28 @@
#import <Foundation/Foundation.h>
-#define FatFreeCRMProxyDidFailWithErrorNotification @"FatFreeCRMProxyDidFailWithErrorNotification"
-#define FatFreeCRMProxyDidRetrieveTasksNotification @"FatFreeCRMProxyDidRetrieveTasksNotification"
-#define FatFreeCRMProxyDidMarkTaskAsDoneNotification @"FatFreeCRMProxyDidMarkTaskAsDoneNotification"
-#define FatFreeCRMProxyDidCreateTaskNotification @"FatFreeCRMProxyDidCreateTaskNotification"
-#define FatFreeCRMProxyDidRetrieveAccountsNotification @"FatFreeCRMProxyDidRetrieveAccountsNotification"
-#define FatFreeCRMProxyDidRetrieveOpportunitiesNotification @"FatFreeCRMProxyDidRetrieveOpportunitiesNotification"
-#define FatFreeCRMProxyDidRetrieveCampaignsNotification @"FatFreeCRMProxyDidRetrieveCampaignsNotification"
-#define FatFreeCRMProxyDidRetrieveLeadsNotification @"FatFreeCRMProxyDidRetrieveLeadsNotification"
-#define FatFreeCRMProxyDidRetrieveContactsNotification @"FatFreeCRMProxyDidRetrieveContactsNotification"
-#define FatFreeCRMProxyDidRetrieveCommentsNotification @"FatFreeCRMProxyDidRetrieveCommentsNotification"
-#define FatFreeCRMProxyDidPostCommentNotification @"FatFreeCRMProxyDidPostCommentNotification"
-#define FatFreeCRMProxyDidLoginNotification @"FatFreeCRMProxyDidLoginNotification"
-#define FatFreeCRMProxyDidFailLoginNotification @"FatFreeCRMProxyDidFailLoginNotification"
+extern NSString * const FatFreeCRMProxyDidFailWithErrorNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveTasksNotification;
+extern NSString * const FatFreeCRMProxyDidMarkTaskAsDoneNotification;
+extern NSString * const FatFreeCRMProxyDidCreateTaskNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveAccountsNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveOpportunitiesNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveCampaignsNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveLeadsNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveContactsNotification;
+extern NSString * const FatFreeCRMProxyDidRetrieveCommentsNotification;
+extern NSString * const FatFreeCRMProxyDidPostCommentNotification;
+extern NSString * const FatFreeCRMProxyDidLoginNotification;
+extern NSString * const FatFreeCRMProxyDidFailLoginNotification;
-#define FatFreeCRMProxyErrorKey @"FatFreeCRMProxyErrorKey"
-#define TASKS_OVERDUE_KEY @"tasksOverdue"
-#define TASKS_DUE_ASAP_KEY @"tasksDueASAP"
-#define TASKS_DUE_TODAY_KEY @"tasksDueToday"
-#define TASKS_DUE_TOMORROW_KEY @"tasksDueTomorrow"
-#define TASKS_DUE_THIS_WEEK_KEY @"tasksDueThisWeek"
-#define TASKS_DUE_NEXT_WEEK_KEY @"tasksDueNextWeek"
-#define TASKS_DUE_LATER_KEY @"tasksDueLater"
+extern NSString * const FatFreeCRMProxyErrorKey;
+extern NSString * const TASKS_OVERDUE_KEY;
+extern NSString * const TASKS_DUE_ASAP_KEY;
+extern NSString * const TASKS_DUE_TODAY_KEY;
+extern NSString * const TASKS_DUE_TOMORROW_KEY;
+extern NSString * const TASKS_DUE_THIS_WEEK_KEY;
+extern NSString * const TASKS_DUE_NEXT_WEEK_KEY;
+extern NSString * const TASKS_DUE_LATER_KEY;
@class ASINetworkQueue;
@class SBBaseEntity;
@@ -63,14 +63,6 @@
@class SBSettingsManager;
@interface SBNetworkManager : NSObject
-{
-@private
- ASINetworkQueue *_networkQueue;
- NSNotificationCenter *_notificationCenter;
- NSString *_server;
- NSString *_username;
- NSString *_password;
-}
@property (nonatomic, copy) NSString *server;
@property (nonatomic, copy) NSString *username;
View
54 Classes/Helpers/SBNetworkManager.m
@@ -34,22 +34,42 @@
#import "SBNetworkManager.h"
#import "SBAppDelegate.h"
-#import "SynthesizeSingleton.h"
#import "NSDate+Senbei.h"
-#import "ASINetworkQueue.h"
-#import "ASIHTTPRequest.h"
-#import "ASIFormDataRequest.h"
#import "Definitions.h"
-#import "TBXML.h"
+#import "SBExternals.h"
#import "SBModels.h"
#import "SBSettingsManager.h"
-#define PROFILE_REQUEST @"profile"
-#define COMMENTS_REQUEST @"comments"
-#define TASKS_REQUEST @"tasks"
-#define NEW_TASK_REQUEST @"task_new"
-#define TASK_DONE_REQUEST @"task_done"
-#define NEW_COMMENT_REQUEST @"new_comment"
+NSString * const FatFreeCRMProxyDidFailWithErrorNotification = @"FatFreeCRMProxyDidFailWithErrorNotification";
+NSString * const FatFreeCRMProxyDidRetrieveTasksNotification = @"FatFreeCRMProxyDidRetrieveTasksNotification";
+NSString * const FatFreeCRMProxyDidMarkTaskAsDoneNotification = @"FatFreeCRMProxyDidMarkTaskAsDoneNotification";
+NSString * const FatFreeCRMProxyDidCreateTaskNotification = @"FatFreeCRMProxyDidCreateTaskNotification";
+NSString * const FatFreeCRMProxyDidRetrieveAccountsNotification = @"FatFreeCRMProxyDidRetrieveAccountsNotification";
+NSString * const FatFreeCRMProxyDidRetrieveOpportunitiesNotification = @"FatFreeCRMProxyDidRetrieveOpportunitiesNotification";
+NSString * const FatFreeCRMProxyDidRetrieveCampaignsNotification = @"FatFreeCRMProxyDidRetrieveCampaignsNotification";
+NSString * const FatFreeCRMProxyDidRetrieveLeadsNotification = @"FatFreeCRMProxyDidRetrieveLeadsNotification";
+NSString * const FatFreeCRMProxyDidRetrieveContactsNotification = @"FatFreeCRMProxyDidRetrieveContactsNotification";
+NSString * const FatFreeCRMProxyDidRetrieveCommentsNotification = @"FatFreeCRMProxyDidRetrieveCommentsNotification";
+NSString * const FatFreeCRMProxyDidPostCommentNotification = @"FatFreeCRMProxyDidPostCommentNotification";
+NSString * const FatFreeCRMProxyDidLoginNotification = @"FatFreeCRMProxyDidLoginNotification";
+NSString * const FatFreeCRMProxyDidFailLoginNotification = @"FatFreeCRMProxyDidFailLoginNotification";
+
+NSString * const FatFreeCRMProxyErrorKey = @"FatFreeCRMProxyErrorKey";
+NSString * const TASKS_OVERDUE_KEY = @"tasksOverdue";
+NSString * const TASKS_DUE_ASAP_KEY = @"tasksDueASAP";
+NSString * const TASKS_DUE_TODAY_KEY = @"tasksDueToday";
+NSString * const TASKS_DUE_TOMORROW_KEY = @"tasksDueTomorrow";
+NSString * const TASKS_DUE_THIS_WEEK_KEY = @"tasksDueThisWeek";
+NSString * const TASKS_DUE_NEXT_WEEK_KEY = @"tasksDueNextWeek";
+NSString * const TASKS_DUE_LATER_KEY = @"tasksDueLater";
+
+
+static NSString *PROFILE_REQUEST = @"profile";
+static NSString *COMMENTS_REQUEST = @"comments";
+static NSString *TASKS_REQUEST = @"tasks";
+static NSString *NEW_TASK_REQUEST = @"task_new";
+static NSString *TASK_DONE_REQUEST = @"task_done";
+static NSString *NEW_COMMENT_REQUEST = @"new_comment";
@interface SBNetworkManager ()
@@ -109,12 +129,12 @@ - (id)init
- (void)dealloc
{
- self.server = nil;
- self.username = nil;
- self.password = nil;
- self.notificationCenter = nil;
- self.settingsManager = nil;
- self.networkQueue = nil;
+ [_server release];
+ [_username release];
+ [_password release];
+ [_notificationCenter release];
+ [_settingsManager release];
+ [_networkQueue release];
[super dealloc];
}
View
26 Classes/Helpers/SBSettingsManager.m
@@ -33,20 +33,21 @@
//
#import "SBSettingsManager.h"
-#import "SynthesizeSingleton.h"
+#import "SBExternals.h"
-#define SETTING_SERVER @"SETTING_SERVER"
-#define SETTING_USERNAME @"SETTING_USERNAME"
-#define SETTING_PASSWORD @"SETTING_PASSWORD"
-#define SETTING_FIRST_TIME_RUN @"SETTING_FIRST_TIME_RUN"
-#define SETTING_VERSION_NUMBER @"SETTING_VERSION_NUMBER"
-#define SETTING_TAB_ORDER @"SETTING_TAB_ORDER"
-#define SETTING_CURRENT_TAB @"SETTING_CURRENT_TAB"
-#define SETTING_USE_SELF_SIGNED_CERTIFICATE @"SETTING_USE_SELF_SIGNED_CERTIFICATE"
+static NSString *SETTING_SERVER = @"SETTING_SERVER";
+static NSString *SETTING_USERNAME = @"SETTING_USERNAME";
+static NSString *SETTING_PASSWORD = @"SETTING_PASSWORD";
+static NSString *SETTING_FIRST_TIME_RUN = @"SETTING_FIRST_TIME_RUN";
+static NSString *SETTING_VERSION_NUMBER = @"SETTING_VERSION_NUMBER";
+static NSString *SETTING_TAB_ORDER = @"SETTING_TAB_ORDER";
+static NSString *SETTING_CURRENT_TAB = @"SETTING_CURRENT_TAB";
+static NSString *SETTING_USE_SELF_SIGNED_CERTIFICATE = @"SETTING_USE_SELF_SIGNED_CERTIFICATE";
+
+static NSString *OLD_PREFERENCES_SERVER_URL = @"server_url";
+static NSString *OLD_PREFERENCES_USERNAME = @"username";
+static NSString *OLD_PREFERENCES_PASSWORD = @"password";
-#define OLD_PREFERENCES_SERVER_URL @"server_url"
-#define OLD_PREFERENCES_USERNAME @"username"
-#define OLD_PREFERENCES_PASSWORD @"password"
@interface SBSettingsManager ()
@@ -54,6 +55,7 @@ @interface SBSettingsManager ()
@end
+
@implementation SBSettingsManager
SYNTHESIZE_SINGLETON_FOR_CLASS(SBSettingsManager)
View
2  Classes/Models/SBBaseEntity.m
@@ -33,7 +33,7 @@
//
#import "SBBaseEntity.h"
-#import "GTMNSString+HTML.h"
+#import "SBExternals.h"
@implementation SBBaseEntity
View
7 Classes/Models/SBContact.m
@@ -33,12 +33,9 @@
//
#import "SBContact.h"
-#import "NSDate+Senbei.h"
-#import "NSString+Senbei.h"
-#import "NSURL+AKOCacheKey.h"
+#import "SBHelpers.h"
+#import "SBExternals.h"
#import "Definitions.h"
-#import "AKOImageCache.h"
-#import "SBSettingsManager.h"
void setPersonPropertyValue(ABRecordRef person, ABPropertyID property, CFStringRef label, NSString *value)
{
View
2  Classes/Views/SBListTableViewCell.m
@@ -33,7 +33,7 @@
//
#import "SBListTableViewCell.h"
-#import "AKOImageView.h"
+#import "SBExternals.h"
@implementation SBListTableViewCell
View
45 Externals/SBExternals.h
@@ -0,0 +1,45 @@
+//
+// SBExternals.h
+// Senbei
+//
+// Created by Adrian on 9/20/11.
+// Copyright (c) 2011, akosma software / Adrian Kosmaczewski
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. All advertising materials mentioning features or use of this software
+// must display the following acknowledgement:
+// This product includes software developed by akosma software.
+// 4. Neither the name of the akosma software nor the
+// names of its contributors may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY ADRIAN KOSMACZEWSKI ''AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL ADRIAN KOSMACZEWSKI BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#import "GTMNSString+HTML.h"
+#import "TBXML.h"
+#import "AKOEditorrific.h"
+#import "AKOImageCache.h"
+#import "AKOImageView.h"
+#import "NSURL+AKOCacheKey.h"
+#import "ASINetworkQueue.h"
+#import "ASIHTTPRequest.h"
+#import "ASIFormDataRequest.h"
+#import "Reachability.h"
+#import "SynthesizeSingleton.h"
View
2  Senbei.xcodeproj/project.pbxproj
@@ -138,6 +138,7 @@
3A1104A2111DEF4500729EB6 /* DemoLogins.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DemoLogins.plist; sourceTree = "<group>"; };
3A1F518E1122029C0081580E /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
3A23F54F1428813E00894EA2 /* SBModels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBModels.h; sourceTree = "<group>"; };
+ 3A23F5501428896800894EA2 /* SBExternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBExternals.h; sourceTree = "<group>"; };
3A29C08811075E2B00D887F1 /* SBCommentsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBCommentsController.h; sourceTree = "<group>"; };
3A29C08911075E2B00D887F1 /* SBCommentsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBCommentsController.m; sourceTree = "<group>"; };
3A29C08C11075E6100D887F1 /* SBCompanyAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBCompanyAccount.h; sourceTree = "<group>"; };
@@ -510,6 +511,7 @@
3A6D8CD711064A820089F21D /* Externals */ = {
isa = PBXGroup;
children = (
+ 3A23F5501428896800894EA2 /* SBExternals.h */,
3A5C54B11157A61500620375 /* Google Toolbox for Mac */,
3A5C53FD115781D500620375 /* TBXML */,
3AB721F711085642001F861D /* AKOEditorrific */,
Please sign in to comment.
Something went wrong with that request. Please try again.