Skip to content

Commit

Permalink
[MB-1085] Prefix all constants in public headers with UA & removed un…
Browse files Browse the repository at this point in the history
…used constant.
  • Loading branch information
hcrowell committed Apr 16, 2015
1 parent a2b8282 commit 6c42abb
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 49 deletions.
2 changes: 0 additions & 2 deletions Airship/Common/UAActionArguments.h
Expand Up @@ -25,8 +25,6 @@

#import <Foundation/Foundation.h>

#define kPendingPushActionDefaultsKey @"com.urbanairship.action.pending"

/**
* Represents the possible situations.
*/
Expand Down
2 changes: 1 addition & 1 deletion Airship/Common/UAActionRegistry.m
Expand Up @@ -268,7 +268,7 @@ - (void)registerDefaultActions {
// Incoming in-app message action
UAIncomingInAppMessageAction *iamAction = [[UAIncomingInAppMessageAction alloc] init];
[self registerReservedAction:iamAction name:kUAIncomingInAppMessageActionDefaultRegistryName predicate:^(UAActionArguments *args){
IF_IOS7_OR_GREATER(return YES;)
UA_IF_IOS7_OR_GREATER(return YES;)

// In-App Messages will not work on iOS 6 or below
return NO;
Expand Down
4 changes: 2 additions & 2 deletions Airship/Common/UAConfig.m
Expand Up @@ -38,8 +38,8 @@ - (void)dealloc {
- (instancetype)init {
self = [super init];
if (self) {
self.deviceAPIURL = kAirshipProductionServer;
self.analyticsURL = kAnalyticsProductionServer;
self.deviceAPIURL = kUAAirshipProductionServer;
self.analyticsURL = kUAAnalyticsProductionServer;
self.landingPageContentURL = kUAProductionLandingPageContentURL;
self.developmentLogLevel = UALogLevelDebug;
self.productionLogLevel = UALogLevelError;
Expand Down
8 changes: 4 additions & 4 deletions Airship/Common/UAEvent.h
Expand Up @@ -26,11 +26,11 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define kEventAppInitSize (NSUInteger) 450//397 w/ push ID, no inbox ID
#define kEventAppExitSize (NSUInteger) 200//136 w/ only network type
#define kUAEventAppInitSize (NSUInteger) 450//397 w/ push ID, no inbox ID
#define kUAEventAppExitSize (NSUInteger) 200//136 w/ only network type

#define kEventDeviceRegistrationSize (NSUInteger) 200//153 w/ only user info
#define kEventPushReceivedSize (NSUInteger) 200//160 w/ uuid push info
#define kUAEventDeviceRegistrationSize (NSUInteger) 200//153 w/ only user info
#define kUAEventPushReceivedSize (NSUInteger) 200//160 w/ uuid push info

/**
* This base class encapsulates analytics events.
Expand Down
2 changes: 1 addition & 1 deletion Airship/Common/UAEventAppExit.m
Expand Up @@ -52,7 +52,7 @@ - (NSString *)eventType {
}

- (NSUInteger)estimatedSize {
return kEventAppExitSize;
return kUAEventAppExitSize;
}

@end
2 changes: 1 addition & 1 deletion Airship/Common/UAEventAppInit.m
Expand Up @@ -76,7 +76,7 @@ - (NSString *)eventType {
}

- (NSUInteger)estimatedSize {
return kEventAppInitSize;
return kUAEventAppInitSize;
}

@end
2 changes: 1 addition & 1 deletion Airship/Common/UAEventDeviceRegistration.m
Expand Up @@ -49,7 +49,7 @@ - (NSString *)eventType {
}

- (NSUInteger)estimatedSize {
return kEventDeviceRegistrationSize;
return kUAEventDeviceRegistrationSize;
}

@end
2 changes: 1 addition & 1 deletion Airship/Common/UAEventPushReceived.m
Expand Up @@ -56,7 +56,7 @@ - (NSString *)eventType {
}

- (NSUInteger)estimatedSize {
return kEventPushReceivedSize;
return kUAEventPushReceivedSize;
}

@end
8 changes: 4 additions & 4 deletions Airship/Common/UAGlobal.h
Expand Up @@ -100,8 +100,8 @@ extern UALogLevel uaLogLevel; // Default is UALogLevelError
#define UALOG UA_LDEBUG

// constants
#define kAirshipProductionServer @"https://device-api.urbanairship.com"
#define kAnalyticsProductionServer @"https://combine.urbanairship.com"
#define kUAAirshipProductionServer @"https://device-api.urbanairship.com"
#define kUAAnalyticsProductionServer @"https://combine.urbanairship.com"
#define kUAProductionLandingPageContentURL @"https://dl.urbanairship.com/aaa"

#ifdef _UA_VERSION
Expand All @@ -124,13 +124,13 @@ return VERSION_STR; \
@end

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
#define IF_IOS7_OR_GREATER(...) \
#define UA_IF_IOS7_OR_GREATER(...) \
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) \
{ \
__VA_ARGS__ \
}
#else
#define IF_IOS_7_OR_GREATER(...)
#define UA_IF_IOS7_OR_GREATER(...)
#endif

#define UA_SUPPRESS_PERFORM_SELECTOR_LEAK_WARNING(THE_CODE) \
Expand Down
2 changes: 1 addition & 1 deletion Airship/Common/UAShareAction.m
Expand Up @@ -45,7 +45,7 @@ - (BOOL)acceptsArguments:(UAActionArguments *)arguments {
return NO;
}

IF_IOS7_OR_GREATER(return YES;)
UA_IF_IOS7_OR_GREATER(return YES;)

// Reject if on iOS 6.x (unsupported).
return NO;
Expand Down
6 changes: 3 additions & 3 deletions Airship/Inbox/UAInboxDBManager.h
Expand Up @@ -30,10 +30,10 @@
@class UAInboxMessage;
@class UAConfig;

#define OLD_DB_NAME @"UAInbox.db"
#define UA_OLD_DB_NAME @"UAInbox.db"

#define CORE_DATA_STORE_NAME @"Inbox-%@.sqlite"
#define CORE_DATA_DIRECTORY_NAME @"UAInbox"
#define UA_CORE_DATA_STORE_NAME @"Inbox-%@.sqlite"
#define UA_CORE_DATA_DIRECTORY_NAME @"UAInbox"

/**
* The UAInboxDBManager singleton provides access to the Rich Push Inbox data.
Expand Down
6 changes: 3 additions & 3 deletions Airship/Inbox/UAInboxDBManager.m
Expand Up @@ -37,7 +37,7 @@ @implementation UAInboxDBManager
- (instancetype)initWithConfig:(UAConfig *)config {
self = [super init];
if (self) {
NSString *databaseName = [NSString stringWithFormat:CORE_DATA_STORE_NAME, config.appKey];
NSString *databaseName = [NSString stringWithFormat:UA_CORE_DATA_STORE_NAME, config.appKey];
self.storeURL = [[self createStoreURL] URLByAppendingPathComponent:databaseName];

// Delete the old directory if it exists
Expand Down Expand Up @@ -258,7 +258,7 @@ - (void)updateMessage:(UAInboxMessage *)message withDictionary:(NSDictionary *)d
- (void)deleteOldDatabaseIfExists {
NSArray *libraryDirectories = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libraryDirectory = [libraryDirectories objectAtIndex:0];
NSString *dbPath = [libraryDirectory stringByAppendingPathComponent:OLD_DB_NAME];
NSString *dbPath = [libraryDirectory stringByAppendingPathComponent:UA_OLD_DB_NAME];

if ([[NSFileManager defaultManager] fileExistsAtPath:dbPath]) {
[[NSFileManager defaultManager] removeItemAtPath:dbPath error:nil];
Expand Down Expand Up @@ -300,7 +300,7 @@ - (NSURL *)createStoreURL {
NSFileManager *fm = [NSFileManager defaultManager];

NSURL *libraryDirectoryURL = [[fm URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *directoryURL = [libraryDirectoryURL URLByAppendingPathComponent: CORE_DATA_DIRECTORY_NAME];
NSURL *directoryURL = [libraryDirectoryURL URLByAppendingPathComponent: UA_CORE_DATA_DIRECTORY_NAME];

// Create the store directory if it doesnt exist
if (![fm fileExistsAtPath:[directoryURL path]]) {
Expand Down
12 changes: 6 additions & 6 deletions AirshipLib/AirshipLogicTests/UAEventTest.m
Expand Up @@ -140,7 +140,7 @@ - (void)testAppInitEvent {
UAEventAppInit *event = [UAEventAppInit event];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"app_init", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventAppInitSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventAppInitSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");

}
Expand Down Expand Up @@ -177,7 +177,7 @@ - (void)testAppForegroundEvent {
UAEventAppForeground *event = [UAEventAppForeground event];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"app_foreground", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventAppInitSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventAppInitSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");

}
Expand All @@ -198,7 +198,7 @@ - (void)testAppExitEvent {
UAEventAppExit *event = [UAEventAppExit event];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"app_exit", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventAppExitSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventAppExitSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");
}

Expand All @@ -211,7 +211,7 @@ - (void)UAEventAppBackground {
UAEventAppBackground *event = [UAEventAppBackground event];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"app_background", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventAppExitSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventAppExitSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");
}

Expand All @@ -230,7 +230,7 @@ - (void)testRegistrationEvent {
UAEventDeviceRegistration *event = [UAEventDeviceRegistration event];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"device_registration", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventDeviceRegistrationSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventDeviceRegistrationSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");
}

Expand All @@ -249,7 +249,7 @@ - (void)testPushReceivedEvent {
UAEventPushReceived *event = [UAEventPushReceived eventWithNotification:notification];
XCTAssertEqualObjects(event.data, expectedData, @"Event data is unexpected.");
XCTAssertEqualObjects(event.eventType, @"push_received", @"Event type is unexpected.");
XCTAssertEqual(event.estimatedSize, kEventPushReceivedSize, @"Event is reporting wrong estimated size.");
XCTAssertEqual(event.estimatedSize, kUAEventPushReceivedSize, @"Event is reporting wrong estimated size.");
XCTAssertNotNil(event.eventID, @"Event should have an ID");
}

Expand Down
18 changes: 9 additions & 9 deletions TestCommon/LocationTest/UALocationTestUtils.h
Expand Up @@ -25,15 +25,15 @@

#import <CoreLocation/CoreLocation.h>

#define kTestLatPDX 45.525352839897
#define kTestLongPDX -122.682115697712
#define kTestLatSFO 37.772643
#define kTestLongSFO -122.406095
#define kTestAlt 100.0
#define kTestHorizontalAccuracy 5.0
#define kTestVerticalAccuracy 5.0
#define kTestDistanceFilter 10.0
#define kTestDesiredAccuracy 5.0
#define kUATestLatPDX 45.525352839897
#define kUATestLongPDX -122.682115697712
#define kUATestLatSFO 37.772643
#define kUATestLongSFO -122.406095
#define kUATestAlt 100.0
#define kUATestHorizontalAccuracy 5.0
#define kUATestVerticalAccuracy 5.0
#define kUATestDistanceFilter 10.0
#define kUATestDesiredAccuracy 5.0

@interface UALocationTestUtils : NSObject

Expand Down
20 changes: 10 additions & 10 deletions TestCommon/LocationTest/UALocationTestUtils.m
Expand Up @@ -28,30 +28,30 @@
@implementation UALocationTestUtils

+ (CLLocation *)testLocationPDX {
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(kTestLatPDX, kTestLongPDX);
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(kUATestLatPDX, kUATestLongPDX);
CLLocation *location = [[CLLocation alloc] initWithCoordinate:coord
altitude:kTestAlt
horizontalAccuracy:kTestHorizontalAccuracy
verticalAccuracy:kTestVerticalAccuracy
altitude:kUATestAlt
horizontalAccuracy:kUATestHorizontalAccuracy
verticalAccuracy:kUATestVerticalAccuracy
timestamp:[NSDate date]];
return location;
}

+ (CLLocation *)testLocationSFO {
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(kTestLatSFO, kTestLongSFO);
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(kUATestLatSFO, kUATestLongSFO);
CLLocation *location = [[CLLocation alloc] initWithCoordinate:coord
altitude:kTestAlt
horizontalAccuracy:kTestHorizontalAccuracy
verticalAccuracy:kTestVerticalAccuracy
altitude:kUATestAlt
horizontalAccuracy:kUATestHorizontalAccuracy
verticalAccuracy:kUATestVerticalAccuracy
timestamp:[NSDate date]];
return location;
}


+ (CLLocationManager *)testLocationManager {
CLLocationManager *manager = [[CLLocationManager alloc] init];
manager.desiredAccuracy = kTestDesiredAccuracy;
manager.distanceFilter = kTestDistanceFilter;
manager.desiredAccuracy = kUATestDesiredAccuracy;
manager.distanceFilter = kUATestDistanceFilter;
return manager;
}
@end

0 comments on commit 6c42abb

Please sign in to comment.