Permalink
Browse files

Improve memory handling, add basic analytics

  • Loading branch information...
1 parent 31145fd commit 33d7c2acf2bc8ef15d3617abfccd566a343a6375 @dmpatierno dmpatierno committed Sep 29, 2011
Showing with 1,621 additions and 1,445 deletions.
  1. +2 −13 Classes/AreasViewController.h
  2. +15 −5 Classes/AreasViewController.m
  3. +2 −1 Classes/BookmarksViewController.h
  4. +6 −5 Classes/BookmarksViewController.m
  5. +1 −11 Classes/Config.h
  6. +1 −10 Classes/DetailViewController.h
  7. +14 −4 Classes/DetailViewController.m
  8. +1 −22 Classes/Guide.h
  9. +24 −0 Classes/Guide.m
  10. +0 −10 Classes/GuideBookmarks.h
  11. +9 −5 Classes/GuideBookmarks.m
  12. +2 −6 Classes/GuideCatchingWebView.h
  13. +6 −5 Classes/GuideCatchingWebView.m
  14. +1 −13 Classes/GuideImage.h
  15. +10 −6 Classes/GuideImage.m
  16. +0 −4 Classes/GuideImageViewController.h
  17. +3 −1 Classes/GuideImageViewController.m
  18. +106 −357 Classes/GuideIntroView.xib
  19. +3 −16 Classes/GuideIntroViewController.h
  20. +32 −21 Classes/GuideIntroViewController.m
  21. +598 −0 Classes/GuideIntroView~ipad.xib
  22. +1 −6 Classes/GuideStep.h
  23. +5 −2 Classes/GuideStep.m
  24. +1 −9 Classes/GuideStepLine.h
  25. +6 −0 Classes/GuideStepLine.m
  26. 0 Classes/{SmallGuideStepView.xib → GuideStepView.xib}
  27. +3 −19 Classes/GuideStepViewController.h
  28. +41 −35 Classes/GuideStepViewController.m
  29. +126 −163 Classes/GuideView.xib
  30. +4 −15 Classes/GuideViewController.h
  31. +61 −56 Classes/GuideViewController.m
  32. +163 −126 Classes/{SmallGuideView.xib → GuideView~ipad.xib}
  33. +1 −4 Classes/ListViewController.h
  34. +9 −11 Classes/ListViewController.m
  35. +1 −15 Classes/LoginViewController.h
  36. +14 −15 Classes/LoginViewController.m
  37. +0 −347 Classes/SmallGuideIntroView.xib
  38. +1 −29 Classes/SplashViewController.h
  39. +53 −1 Classes/SplashViewController.m
  40. +1 −7 Classes/User.h
  41. +10 −1 Classes/User.m
  42. +1 −1 Classes/iFixitAPI.m
  43. +1 −13 Classes/iFixitAppDelegate.h
  44. +55 −25 Classes/iFixitAppDelegate.m
  45. +4 −2 Classes/iPhoneDeviceViewController.m
  46. +182 −0 GAnalytics/GANTracker.h
  47. BIN GAnalytics/libGoogleAnalytics.a
  48. 0 GuideStepView.xib → GuideStepView~ipad.xib
  49. +41 −28 iFixit.xcodeproj/project.pbxproj
@@ -8,20 +8,9 @@
@class DetailViewController;
-@interface AreasViewController : UITableViewController <UISearchBarDelegate, UIAlertViewDelegate, UITextFieldDelegate> {
- id delegate;
- UISearchBar *searchBar;
- BOOL searching;
- NSArray *searchResults;
+@interface AreasViewController : UITableViewController <UISearchBarDelegate, UIAlertViewDelegate, UITextFieldDelegate>
- DetailViewController *detailViewController;
- NSDictionary *data;
- NSMutableDictionary *tree;
- NSArray *keys;
- NSArray *leafs;
-}
-
-@property (nonatomic, retain) id delegate;
+@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
@property BOOL searching;
@property (nonatomic, retain) NSArray *searchResults;
@@ -145,7 +145,7 @@ - (void)searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar {
[searchBar setShowsCancelButton:YES animated:YES];
// Animate the table up.
- if (![iFixitAppDelegate isIPad]) {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
[UIView beginAnimations:@"showSearch" context:nil];
[UIView setAnimationDuration:0.3];
CGRect bounds = self.navigationController.view.bounds;
@@ -165,7 +165,7 @@ - (void)searchBarTextDidEndEditing:(UISearchBar *)theSearchBar {
[searchBar setShowsCancelButton:NO animated:YES];
// Animate the table back down.
- if (![iFixitAppDelegate isIPad]) {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
[UIView beginAnimations:@"showSearch" context:nil];
[UIView setAnimationDuration:0.3];
CGRect bounds = self.navigationController.view.bounds;
@@ -195,7 +195,7 @@ - (void)gotSearchResults:(NSDictionary *)results {
if ([[results objectForKey:@"search"] isEqual:searchBar.text]) {
// Remove non-device results from iPhone+iPod search
- if (![iFixitAppDelegate isIPad]) {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
NSArray *list = [results objectForKey:@"results"];
NSMutableArray *devicesOnly = [NSMutableArray array];
@@ -371,7 +371,7 @@ - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath
}
// iPhone: Push a webView onto the stack.
- if (![iFixitAppDelegate isIPad]) {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
iPhoneDeviceViewController *vc = [[iPhoneDeviceViewController alloc] initWithDevice:title];
vc.title = display_title;
[self.navigationController pushViewController:vc animated:YES];
@@ -380,7 +380,7 @@ - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath
}
// iPad: Show the device in detailViewController
- if ([iFixitAppDelegate isIPad]) {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
[(iFixitAppDelegate *)[[UIApplication sharedApplication] delegate] showBrowser];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[detailViewController.webView loadRequest:request];
@@ -404,13 +404,23 @@ - (void)didReceiveMemoryWarning {
}
- (void)viewDidUnload {
+ [super viewDidUnload];
+ self.searchBar = nil;
+ self.detailViewController = nil;
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
}
- (void)dealloc {
+ [searchBar release];
+ [searchResults release];
[detailViewController release];
+ [data release];
+ [tree release];
+ [keys release];
+ [leafs release];
+
[super dealloc];
}
@@ -6,9 +6,10 @@
// Copyright 2011 iFixit. All rights reserved.
//
-@class LoginViewController;
#import "LoginViewControllerDelegate.h"
+@class LoginViewController;
+
@interface BookmarksViewController : UITableViewController <LoginViewControllerDelegate, UIActionSheetDelegate>
@property (nonatomic, retain) NSMutableDictionary *bookmarks;
@@ -101,14 +101,14 @@ - (void)refreshHierarchy {
}
- (void)dealloc {
- self.bookmarks = nil;
- self.lvc = nil;
+ [bookmarks release];
+ [lvc release];
+ [devices release];
[super dealloc];
}
-- (void)didReceiveMemoryWarning
-{
+- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
@@ -295,8 +295,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
Guide *guide = [[bookmarks objectForKey:key] objectAtIndex:indexPath.row];
//[(iFixitAppDelegate *)[[UIApplication sharedApplication] delegate] showGuide:guide];
- GuideViewController *vc = [GuideViewController initWithGuide:guide];
+ GuideViewController *vc = [[GuideViewController alloc] initWithGuide:guide];
[self.navigationController presentModalViewController:vc animated:YES];
+ [vc release];
// Refresh any changes.
[[GuideBookmarks sharedBookmarks] addGuideid:[NSNumber numberWithInt:guide.guideid]];
View
@@ -14,17 +14,7 @@ enum {
ConfigDozuki
};
-@interface Config : NSObject {
- BOOL dozuki;
- NSInteger site;
- NSString *host;
- NSString *baseURL;
- UIColor *backgroundColor;
- UIColor *textColor;
- UIColor *toolbarColor;
- NSString *introCSS;
- NSString *stepCSS;
-}
+@interface Config : NSObject
@property (nonatomic) BOOL dozuki;
@property (nonatomic) NSInteger site;
@@ -10,16 +10,7 @@
@class GuideCatchingWebView;
@class WBProgressHUD;
-@interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate, UIWebViewDelegate, UIAlertViewDelegate> {
- UIPopoverController *popoverController;
- UIToolbar *toolbar;
-
- GuideCatchingWebView *webView;
- WBProgressHUD *loading;
- NSURL *lastURL;
- UIBarButtonItem *backButton;
- UIBarButtonItem *fwdButton;
-}
+@interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate, UIWebViewDelegate, UIAlertViewDelegate>
@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
@property (nonatomic, retain) IBOutlet GuideCatchingWebView *webView;
@@ -211,10 +211,14 @@ - (void)webViewDidStartLoad:(UIWebView *)theWebView {
}
- (void)viewDidUnload {
+ [super viewDidUnload];
+
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- self.popoverController = nil;
- self.loading = nil;
+ self.toolbar = nil;
+ self.webView = nil;
+ self.backButton = nil;
+ self.fwdButton = nil;
}
- (IBAction)showSplash:(UIBarButtonItem *)button {
@@ -234,9 +238,15 @@ - (void)didReceiveMemoryWarning {
*/
- (void)dealloc {
- self.loading = nil;
- [popoverController release];
+ webView.delegate = nil;
+
[toolbar release];
+ [webView release];
+ [loading release];
+ [lastURL release];
+ [backButton release];
+ [fwdButton release];
+ [popoverController release];
[super dealloc];
}
View
@@ -10,28 +10,7 @@
#import "GuideStep.h"
#import "GuideStepLine.h"
-@interface Guide : NSObject {
- NSDictionary *data;
- NSInteger guideid;
- NSString *title;
- NSString *device;
- NSString *subject;
- NSString *author;
- NSString *timeRequired;
- NSString *difficulty;
- NSString *introduction;
- NSString *summary;
- NSString *introduction_rendered;
- GuideImage *image;
-
- NSMutableArray *documents;
- NSMutableArray *parts;
- NSMutableArray *tools;
- NSMutableArray *flags;
-
- NSMutableArray *prereqs;
- NSMutableArray *steps;
-}
+@interface Guide : NSObject
@property (nonatomic, retain) NSDictionary *data;
@property (nonatomic) NSInteger guideid;
View
@@ -68,4 +68,28 @@ + (Guide *)guideWithDictionary:(NSDictionary *)dict {
return [guide autorelease];
}
+- (void)dealloc {
+ [data release];
+ [title release];
+ [device release];
+ [subject release];
+ [author release];
+ [timeRequired release];
+ [difficulty release];
+ [introduction release];
+ [summary release];
+ [introduction_rendered release];
+ [image release];
+
+ [documents release];
+ [parts release];
+ [tools release];
+ [flags release];
+
+ [prereqs release];
+ [steps release];
+
+ [super dealloc];
+}
+
@end
View
@@ -14,16 +14,6 @@
@class GuideBookmarker;
@interface GuideBookmarks : NSObject <SDWebImageManagerDelegate> {
- NSMutableDictionary *guides;
- NSMutableDictionary *images;
- NSMutableDictionary *queue;
-
- NSString *guidesFilePath;
- NSString *imagesFilePath;
- NSString *queueFilePath;
-
- NSString *currentItem;
- GuideBookmarker *bookmarker;
NSInteger imagesDownloaded;
NSInteger imagesRemaining;
}
View
@@ -336,11 +336,15 @@ - (id)init {
}
- (void)dealloc {
- self.guides = nil;
- self.images = nil;
- self.queue = nil;
- self.currentItem = nil;
- self.bookmarker = nil;
+ [guides release];
+ [images release];
+ [queue release];
+ [guidesFilePath release];
+ [imagesFilePath release];
+ [queueFilePath release];
+ [currentItem release];
+ [bookmarker release];
+
[super dealloc];
}
@@ -6,13 +6,9 @@
// Copyright 2011 iFixit. All rights reserved.
//
-@interface GuideCatchingWebView : UIWebView <UIWebViewDelegate, UIAlertViewDelegate> {
- id<UIWebViewDelegate> externalDelegate;
- NSNumberFormatter *formatter;
- NSURL *externalURL;
-}
+@interface GuideCatchingWebView : UIWebView <UIWebViewDelegate, UIAlertViewDelegate>
-@property (nonatomic, retain) id<UIWebViewDelegate> externalDelegate;
+@property (nonatomic, assign) id<UIWebViewDelegate> externalDelegate;
@property (nonatomic, retain) NSNumberFormatter *formatter;
@property (nonatomic, retain) NSURL *externalURL;
@@ -63,8 +63,9 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
iFixitAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
if (guideid != -1) {
- GuideViewController *vc = [GuideViewController initWithGuideid:guideid];
+ GuideViewController *vc = [[GuideViewController alloc] initWithGuideid:guideid];
[delegate.areasViewController presentModalViewController:vc animated:YES];
+ [vc release];
return NO;
}
@@ -95,7 +96,8 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
}
if (!hasCustomHeader) {
- NSString *device = [iFixitAppDelegate isIPad] ? @"Wide iFixit" : @"Thin iFixit";
+ NSString *device = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ?
+ @"Wide iFixit" : @"Thin iFixit";
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString *mobileClient = [NSString stringWithFormat:@"%@ %@", device, version];
@@ -125,9 +127,8 @@ - (void)webViewDidStartLoad:(UIWebView *)webView {
}
- (void)dealloc {
- self.externalDelegate = nil;
- self.formatter = nil;
- self.externalURL = nil;
+ [formatter release];
+ [externalURL release];
[super dealloc];
}
View
@@ -6,19 +6,7 @@
// Copyright 2010 iFixit. All rights reserved.
//
-#import <Foundation/Foundation.h>
-
-
-@interface GuideImage : NSObject {
- NSNumber *imageid;
- NSString *url;
- UIImage *mini;
- UIImage *thumbnail;
- UIImage *standard;
- UIImage *medium;
- UIImage *large;
- UIImage *huge;
-}
+@interface GuideImage : NSObject
@property (nonatomic, retain) NSNumber *imageid;
@property (nonatomic, retain) NSString *url;
View
@@ -25,12 +25,16 @@ - (NSURL *)URLForSize:(NSString *)size {
}
- (void)dealloc {
- [mini release];
- [thumbnail release];
- [medium release];
- [large release];
- [huge release];
- [super dealloc];
+ [imageid release];
+ [url release];
+ [mini release];
+ [thumbnail release];
+ [standard release];
+ [medium release];
+ [large release];
+ [huge release];
+
+ [super dealloc];
}
@end
Oops, something went wrong.

0 comments on commit 33d7c2a

Please sign in to comment.