Skip to content

Commit

Permalink
refactored a few things and resources
Browse files Browse the repository at this point in the history
  • Loading branch information
calebd committed Jan 28, 2011
1 parent b4e0c98 commit 177aed1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions CrashPhone/CrashPhone.xcodeproj/project.pbxproj
Expand Up @@ -154,15 +154,15 @@
3B20D888128A321E000CE777 /* HTNotifier.strings */,
3B20D88C128A321E000CE777 /* HTNotifier.h */,
3B20D88D128A321E000CE777 /* HTNotifier.m */,
3B29FC1312B974DA00B7A6F6 /* HTNotifierDelegate.h */,
3B289A8912D27C910069E7FF /* HTNotifier_iOS.h */,
3B289A8A12D27C910069E7FF /* HTNotifier_iOS.m */,
3B289B4612D285CF0069E7FF /* HTNotifier_Mac.h */,
3B289B4712D285CF0069E7FF /* HTNotifier_Mac.m */,
3B29FC1312B974DA00B7A6F6 /* HTNotifierDelegate.h */,
3B29FC2F12B97F3C00B7A6F6 /* HTFunctions.h */,
3B29FC3012B97F3C00B7A6F6 /* HTFunctions.m */,
3B20D88A128A321E000CE777 /* HTNotice.h */,
3B20D88B128A321E000CE777 /* HTNotice.m */,
3B29FC2F12B97F3C00B7A6F6 /* HTFunctions.h */,
3B29FC3012B97F3C00B7A6F6 /* HTFunctions.m */,
);
name = hoptoadnotifier;
path = ../hoptoadnotifier;
Expand Down
4 changes: 2 additions & 2 deletions hoptoadnotifier/HTFunctions.h
Expand Up @@ -115,6 +115,6 @@ NSString * HTCurrentViewController();
NSString * HTVisibleViewControllerWithViewController(UIViewController *);
#endif

// library logging
// useful defines
#define HTLog(fmt, args...) NSLog(@"[Hoptoad] " fmt, ##args)

#define HTLocalizedString(key) NSLocalizedStringFromTable((key), @"HTNotifier", @"")
3 changes: 1 addition & 2 deletions hoptoadnotifier/HTNotice.m
Expand Up @@ -122,12 +122,12 @@ + (HTNotice *)readFromFile:(NSString *)file {
#pragma mark -
#pragma mark object methods
- (NSString *)hoptoadXMLString {
DDXMLElement *payload;
DDXMLElement *e1;
DDXMLElement *e2;
DDXMLElement *e3;

// setup payload
DDXMLElement *payload;
payload = [DDXMLElement elementWithName:@"notice"];
[payload addAttribute:[DDXMLElement attributeWithName:@"version" stringValue:@"2.0"]];

Expand Down Expand Up @@ -155,7 +155,6 @@ - (NSString *)hoptoadXMLString {
[e1 addChild:[DDXMLElement elementWithName:@"message" stringValue:reason]];
e2 = [DDXMLElement elementWithName:@"backtrace"];
NSArray *parsedStack = HTParseCallstack(self.callStack);
NSLog(@"%@", parsedStack);
for (NSDictionary *line in parsedStack) {
DDXMLElement *lineElement = [DDXMLElement elementWithName:@"line"];
[lineElement addAttribute:
Expand Down
10 changes: 7 additions & 3 deletions hoptoadnotifier/HTNotifier.h
Expand Up @@ -6,6 +6,12 @@
// Copyright 2010 GUI Cocoa, LLC. All rights reserved.
//

#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#else
#error [Hoptoad] Unsupported platform
#endif

#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>

Expand Down Expand Up @@ -71,7 +77,7 @@ extern NSString * const HTNotifierReleaseEnvironment;
other private user information without permission
*/
@property (nonatomic, retain) NSMutableDictionary *environmentInfo;
@property (nonatomic, readonly) NSMutableDictionary *environmentInfo;
/*
control whether notices are posted using SSL. your account
Expand Down Expand Up @@ -121,5 +127,3 @@ extern NSString * const HTNotifierReleaseEnvironment;
extern NSString * const HTNotifierDirectoryName;
extern NSString * const HTNotifierPathExtension;
extern NSString * const HTNotifierAlwaysSendKey;
#define HTLocalizedString(key) \
NSLocalizedStringFromTable((key), @"HTNotifier", @"")
18 changes: 9 additions & 9 deletions hoptoadnotifier/HTNotifier.m
Expand Up @@ -14,13 +14,13 @@
static HTNotifier * sharedNotifier = nil;
static NSString * const HTNotifierHostName = @"hoptoadapp.com";
#define HTNotifierURL [NSURL URLWithString: \
[NSString stringWithFormat: \
@"%@://%@%/notifier_api/v2/notices", \
(self.useSSL) ? @"https" : @"http", \
HTNotifierHostName]]
[NSString stringWithFormat: \
@"%@://%@%/notifier_api/v2/notices", \
(self.useSSL) ? @"https" : @"http", \
HTNotifierHostName]]
#define HTIsMultitaskingSupported \
[[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && \
[[UIDevice currentDevice] isMultitaskingSupported]
[[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && \
[[UIDevice currentDevice] isMultitaskingSupported]
#define HT_IOS_SDK_4 (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 4000)

// extern strings
Expand Down Expand Up @@ -71,8 +71,8 @@ - (id)initWithAPIKey:(NSString *)key environmentName:(NSString *)name {
// setup values
apiKey = [key copy];
environmentName = [HTStringByReplacingHoptoadVariablesInString(name) retain];
environmentInfo = [[NSMutableDictionary alloc] init];
self.useSSL = NO;
self.environmentInfo = [NSMutableDictionary dictionary];

// register defaults
[[NSUserDefaults standardUserDefaults] registerDefaults:
Expand Down Expand Up @@ -223,7 +223,7 @@ + (void)startNotifierWithAPIKey:(NSString *)key environmentName:(NSString *)name
// create
#if TARGET_OS_IPHONE
sharedNotifier = [[HTNotifier_iOS alloc] initWithAPIKey:key environmentName:name];
#elif TARGET_OS_MAC
#else
sharedNotifier = [[HTNotifier_Mac alloc] initWithAPIKey:key environmentName:name];
#endif

Expand Down Expand Up @@ -271,7 +271,7 @@ - (void)dealloc {
if (reachability != NULL) { CFRelease(reachability);reachability = NULL; }
[apiKey release];apiKey = nil;
[environmentName release];environmentName = nil;
self.environmentInfo = nil;
[environmentInfo release];environmentInfo = nil;

[super dealloc];
}
Expand Down

0 comments on commit 177aed1

Please sign in to comment.