Skip to content
Browse files

Merge master in, and Fix some hiccups for iOS 6.1

  • Loading branch information...
2 parents c264d5c + e397f5d commit bc3ace02b9ff77e91e0dfb006af4631e0cf438fa @BaseInfinity BaseInfinity committed Feb 5, 2013
Showing with 572 additions and 434 deletions.
  1. +2 −2 Classes/BookmarksViewController.m
  2. +2 −2 Classes/{AreasViewController.h → CategoriesViewController.h}
  3. +22 −16 Classes/{AreasViewController.m → CategoriesViewController.m}
  4. 0 Classes/{AreasViewController.xib → CategoriesViewController.xib}
  5. +1 −1 Classes/Config.m
  6. +2 −1 Classes/DetailGridViewController.m
  7. +5 −39 Classes/DetailIntroViewController.xib
  8. +2 −2 Classes/DetailViewController.m
  9. +12 −76 Classes/DetailViewController.xib
  10. +1 −1 Classes/GridViewController/DMPGridViewController.m
  11. +1 −1 Classes/Guide.h
  12. +3 −3 Classes/Guide.m
  13. +19 −0 Classes/GuideEmbed.h
  14. +34 −0 Classes/GuideEmbed.m
  15. +17 −21 Classes/GuideIntroViewController.m
  16. +35 −19 Classes/{GuideIntroView.xib → GuideIntroViewController.xib}
  17. +4 −0 Classes/GuideStep.h
  18. +24 −7 Classes/GuideStep.m
  19. +4 −0 Classes/GuideStepViewController.h
  20. +112 −31 Classes/GuideStepViewController.m
  21. +17 −16 Classes/{GuideStepView.xib → GuideStepViewController.xib}
  22. +33 −21 Classes/{GuideStepView~ipad.xib → GuideStepViewController~ipad.xib}
  23. +18 −0 Classes/GuideVideo.h
  24. +39 −0 Classes/GuideVideo.m
  25. +9 −16 Classes/GuideViewController.m
  26. +5 −4 Classes/ListViewController.m
  27. +2 −2 Classes/iFixitAPI.h
  28. +18 −18 Classes/iFixitAPI.m
  29. +2 −2 Classes/iFixitAppDelegate.h
  30. +13 −13 Classes/iFixitAppDelegate.m
  31. +2 −2 Classes/iPhoneDeviceViewController.h
  32. +12 −49 Classes/iPhoneDeviceViewController.m
  33. 0 Classes/{iPhoneDeviceView.xib → iPhoneDeviceViewController.xib}
  34. BIN Default-568h@2x.png
  35. 0 Graphics/{NoImage_300x225.jpg → NoImage.jpg}
  36. 0 Graphics/{NoImage_592x444.jpg → NoImage@2x.jpg}
  37. BIN Graphics/Sites/iFixit/Default-568h@2x.png
  38. +100 −69 iFixit.xcodeproj/project.pbxproj
View
4 Classes/BookmarksViewController.m
@@ -51,14 +51,14 @@ - (void)refreshHierarchy {
NSArray *allBookmarks = [[GuideBookmarks sharedBookmarks].guides allValues];
for (NSDictionary *guideData in allBookmarks) {
Guide *guide = [Guide guideWithDictionary:guideData];
- NSMutableArray *guides = [b objectForKey:guide.device];
+ NSMutableArray *guides = [b objectForKey:guide.topic];
if (guides) {
[guides addObject:guide];
}
else {
guides = [NSMutableArray arrayWithObject:guide];
- [b setObject:guides forKey:guide.device];
+ [b setObject:guides forKey:guide.topic];
}
}
View
4 Classes/AreasViewController.h → Classes/CategoriesViewController.h
@@ -1,5 +1,5 @@
//
-// AreasViewController.h
+// CategoriesViewController.h
// iFixit
//
// Created by David Patierno on 8/6/10.
@@ -8,7 +8,7 @@
@class DetailViewController;
-@interface AreasViewController : UITableViewController <UISearchBarDelegate, UIAlertViewDelegate, UITextFieldDelegate>
+@interface CategoriesViewController : UITableViewController <UISearchBarDelegate, UIAlertViewDelegate, UITextFieldDelegate>
@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
View
38 Classes/AreasViewController.m → Classes/CategoriesViewController.m
@@ -1,5 +1,5 @@
//
-// AreasViewController.m
+// CategoriesViewController.m
// iFixit
//
// Created by David Patierno on 8/6/10.
@@ -8,17 +8,17 @@
#import "iFixitAppDelegate.h"
#import "Config.h"
-#import "AreasViewController.h"
+#import "CategoriesViewController.h"
#import "DetailViewController.h"
#import "iPhoneDeviceViewController.h"
#import "DetailGridViewController.h"
-@implementation AreasViewController
+@implementation CategoriesViewController
@synthesize delegate, searchBar, searching, searchResults, detailViewController, data, tree, keys, leafs, noResults, inPopover;
- (id)init {
- if ((self = [super initWithNibName:@"AreasViewController" bundle:nil])) {
+ if ((self = [super initWithNibName:nil bundle:nil])) {
self.tree = nil;
searching = NO;
self.searchResults = [NSArray array];
@@ -52,6 +52,7 @@ - (void)viewDidLoad {
else {
UIImage *titleImage = [UIImage imageNamed:@"titleImage.png"];
UIImageView *imageTitle = [[UIImageView alloc] initWithImage:titleImage];
+ imageTitle.contentMode = UIViewContentModeScaleAspectFit;
self.navigationItem.titleView = imageTitle;
[imageTitle release];
}
@@ -75,6 +76,8 @@ - (void)viewDidLoad {
self.navigationItem.leftBarButtonItem = button;
[button release];
}
+
+ self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
}
- (void)showLoading {
@@ -100,7 +103,7 @@ - (void)showRefreshButton {
}
- (void)getAreas {
[self showLoading];
- [[iFixitAPI sharedInstance] getAreas:nil forObject:self withSelector:@selector(gotAreas:)];
+ [[iFixitAPI sharedInstance] getCategories:nil forObject:self withSelector:@selector(gotAreas:)];
}
- (void)gotAreas:(NSDictionary *)areas {
@@ -113,7 +116,7 @@ - (void)gotAreas:(NSDictionary *)areas {
else {
// If there is no area hierarchy, show a guide list instead
if ([areas isKindOfClass:[NSArray class]] && ![areas count]) {
- iPhoneDeviceViewController *dvc = [[iPhoneDeviceViewController alloc] initWithDevice:nil];
+ iPhoneDeviceViewController *dvc = [[iPhoneDeviceViewController alloc] initWithTopic:nil];
[self.navigationController pushViewController:dvc animated:YES];
[dvc release];
}
@@ -127,28 +130,31 @@ - (void)setTitle:(NSString *)title {
self.navigationItem.titleView = nil;
}
+// This is a deprecated method as of iOS 6.0, keeping this in to support older iOS versions
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// CGRect frame = self.navigationItem.titleView.frame;
if ([Config currentConfig].site == ConfigMake || [Config currentConfig].site == ConfigMakeDev) {
} else if ([Config currentConfig].site == ConfigZeal) {
-
+
CGRect frame = self.navigationItem.titleView.frame;
- if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
+ // Only resize the image title on iPhone/iTouch in landscape
+ if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
frame.size.width = 100;
frame.size.height = 25;
} else {
frame.size.width = 137;
frame.size.height = 35;
+
}
-
+
self.navigationItem.titleView.frame = frame;
-
+
} else {
CGRect frame = self.navigationItem.titleView.frame;
- if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
+ if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
frame.size.width = 75;
frame.size.height = 24;
}
@@ -267,7 +273,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (inPopover)
return;
-
+
// Make room for the toolbar
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad || UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 44, 0);
@@ -296,8 +302,8 @@ - (void)setData:(NSDictionary *)dict {
// Separate the leafs.
self.tree = [NSMutableDictionary dictionaryWithDictionary:dict];
- self.leafs = [[tree objectForKey:@"DEVICES"] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
- [tree removeObjectForKey:@"DEVICES"];
+ self.leafs = [[tree objectForKey:@"TOPICS"] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+ [tree removeObjectForKey:@"TOPICS"];
self.keys = [[tree allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
}
@@ -444,7 +450,7 @@ - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath
}
}
else if (indexPath.section == 1 - base && [keys count] && !searching) {
- AreasViewController *vc = [[AreasViewController alloc] init];
+ CategoriesViewController *vc = [[CategoriesViewController alloc] init];
vc.inPopover = inPopover;
vc.detailViewController = detailViewController;
@@ -487,7 +493,7 @@ - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath
// iPhone: Push a webView onto the stack.
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
- iPhoneDeviceViewController *vc = [[iPhoneDeviceViewController alloc] initWithDevice:title];
+ iPhoneDeviceViewController *vc = [[iPhoneDeviceViewController alloc] initWithTopic:title];
vc.title = display_title;
[self.navigationController pushViewController:vc animated:YES];
[vc release];
View
0 Classes/AreasViewController.xib → Classes/CategoriesViewController.xib
File renamed without changes.
View
2 Classes/Config.m
@@ -96,7 +96,7 @@ - (void)setSite:(NSInteger)theSite {
self.introCSS = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ifixit_intro" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
self.stepCSS = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ifixit_step" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
break;
- // Dozuki
+ // Dozuki, Zeal
case ConfigZeal:
default:
self.backgroundColor = [UIColor blackColor];
View
3 Classes/DetailGridViewController.m
@@ -51,7 +51,7 @@ - (void)showLoading {
- (void)loadDevice {
[self showLoading];
- [[iFixitAPI sharedInstance] getDevice:_device forObject:self withSelector:@selector(gotDevice:)];
+ [[iFixitAPI sharedInstance] getTopic:_device forObject:self withSelector:@selector(gotDevice:)];
}
- (void)gotDevice:(NSDictionary *)data {
@@ -143,6 +143,7 @@ - (NSInteger)numberOfCellsForGridViewController:(DMPGridViewController *)gridVie
- (NSString *)gridViewController:(DMPGridViewController *)gridViewController imageURLForCellAtIndex:(NSUInteger)index {
if (![_guides count])
return nil;
+
return [[[_guides objectAtIndex:index] valueForKey:@"image_url"] stringByAppendingString:@".medium"];
}
- (NSString *)gridViewController:(DMPGridViewController *)gridViewController titleForCellAtIndex:(NSUInteger)index {
View
44 Classes/DetailIntroViewController.xib
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
- <int key="IBDocument.SystemTarget">1536</int>
+ <int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">11G63</string>
- <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+ <string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">1929</string>
+ <string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
@@ -41,7 +41,6 @@
<int key="NSvFlags">290</int>
<string key="NSFrame">{{0, 143}, {768, 768}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="485070877"/>
<string key="NSReuseIdentifierKey">_NS:569</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -56,7 +55,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{26, 10}, {379, 144}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="465954004"/>
<string key="NSReuseIdentifierKey">_NS:569</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -71,7 +69,6 @@
<int key="NSvFlags">-2147483355</int>
<string key="NSFrame">{{40, 193}, {688, 150}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:345</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -108,7 +105,6 @@
</array>
<string key="NSFrame">{{0, 64}, {768, 911}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="622062036"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -222,37 +218,7 @@
<nil key="sourceID"/>
<int key="maxID">9</int>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <array class="NSMutableArray" key="referencedPartialClassDescriptions">
- <object class="IBPartialClassDescription">
- <string key="className">DetailIntroViewController</string>
- <string key="superclassName">UIViewController</string>
- <dictionary class="NSMutableDictionary" key="outlets">
- <string key="image">UIImageView</string>
- <string key="siteLabel">UILabel</string>
- <string key="text">UIImageView</string>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
- <object class="IBToOneOutletInfo" key="image">
- <string key="name">image</string>
- <string key="candidateClassName">UIImageView</string>
- </object>
- <object class="IBToOneOutletInfo" key="siteLabel">
- <string key="name">siteLabel</string>
- <string key="candidateClassName">UILabel</string>
- </object>
- <object class="IBToOneOutletInfo" key="text">
- <string key="name">text</string>
- <string key="candidateClassName">UIImageView</string>
- </object>
- </dictionary>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/DetailIntroViewController.h</string>
- </object>
- </object>
- </array>
- </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
@@ -261,6 +227,6 @@
<string key="detailViewFist.png">{768, 768}</string>
<string key="detailViewText.png">{379, 144}</string>
</dictionary>
- <string key="IBCocoaTouchPluginVersion">1929</string>
+ <string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
View
4 Classes/DetailViewController.m
@@ -9,7 +9,7 @@
#import "iFixitAppDelegate.h"
#import "Config.h"
#import "DetailViewController.h"
-#import "AreasViewController.h"
+#import "CategoriesViewController.h"
#import "ListViewController.h"
#import "GuideCatchingWebView.h"
#import "WBProgressHUD.h"
@@ -32,7 +32,7 @@ - (id)init {
gridViewController.gridDelegate = self;
// Initialize the Browse button.
- AreasViewController *avc = [[AreasViewController alloc] init];
+ CategoriesViewController *avc = [[CategoriesViewController alloc] init];
avc.inPopover = YES;
ListViewController *lvc = [[ListViewController alloc] initWithRootViewController:avc];
avc.detailViewController = self;
View
88 Classes/DetailViewController.xib
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">11G63</string>
+ <string key="IBDocument.InterfaceBuilderVersion">3079</string>
+ <string key="IBDocument.AppKitVersion">1138.51</string>
+ <string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
+ <string key="NS.object.0">2077</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBUIWebView</string>
+ <string>IBProxyObject</string>
<string>IBUIToolbar</string>
<string>IBUIView</string>
- <string>IBProxyObject</string>
+ <string>IBUIWebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -45,7 +45,6 @@
<int key="NSvFlags">290</int>
<string key="NSFrameSize">{1024, 44}</string>
<reference key="NSSuperview" ref="647120888"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="742861885"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
@@ -63,7 +62,6 @@
<int key="NSvFlags">311</int>
<string key="NSFrame">{{0, 44}, {1024, 704}}</string>
<reference key="NSSuperview" ref="647120888"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="704696610"/>
<object class="NSColor" key="IBUIBackgroundColor" id="483207819">
<int key="NSColorSpace">1</int>
@@ -77,16 +75,13 @@
<int key="NSvFlags">-2147483337</int>
<string key="NSFrame">{{0, 44}, {1024, 704}}</string>
<reference key="NSSuperview" ref="647120888"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<reference key="IBUIBackgroundColor" ref="483207819"/>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIScalesPageToFit">YES</bool>
</object>
</object>
<string key="NSFrame">{{0, 20}, {1024, 748}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="410698538"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -223,7 +218,7 @@
<string>90.CustomClassName</string>
<string>90.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>DetailViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -251,78 +246,19 @@
<nil key="sourceID"/>
<int key="maxID">94</int>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">DetailViewController</string>
- <string key="superclassName">UIViewController</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>answersWebView</string>
- <string>toolbar</string>
- <string>wikiWebView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>GuideCatchingWebView</string>
- <string>UIToolbar</string>
- <string>GuideCatchingWebView</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>answersWebView</string>
- <string>toolbar</string>
- <string>wikiWebView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">answersWebView</string>
- <string key="candidateClassName">GuideCatchingWebView</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">toolbar</string>
- <string key="candidateClassName">UIToolbar</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">wikiWebView</string>
- <string key="candidateClassName">GuideCatchingWebView</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/DetailViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">GuideCatchingWebView</string>
- <string key="superclassName">UIWebView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/GuideCatchingWebView.h</string>
- </object>
- </object>
- </object>
- </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1280" key="NS.object.0"/>
+ <real value="1536" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">2077</string>
</data>
</archive>
View
2 Classes/GridViewController/DMPGridViewController.m
@@ -120,7 +120,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
// Image
if ([_delegate respondsToSelector:@selector(gridViewController:imageURLForCellAtIndex:)]) {
NSURL *url = [NSURL URLWithString:[_delegate gridViewController:self imageURLForCellAtIndex:offset + i]];
- [gridCell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"collectionsImagePlaceholder.png"]];
+ [gridCell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"NoImage.jpg"]];
}
else if ([_delegate respondsToSelector:@selector(gridViewController:imageForCellAtIndex:)]) {
UIImage *image = [_delegate gridViewController:self imageForCellAtIndex:offset + i];
View
2 Classes/Guide.h
@@ -15,7 +15,7 @@
@property (nonatomic, retain) NSDictionary *data;
@property (nonatomic) NSInteger guideid;
@property (nonatomic, retain) NSString *title;
-@property (nonatomic, retain) NSString *device;
+@property (nonatomic, retain) NSString *topic;
@property (nonatomic, retain) NSString *subject;
@property (nonatomic, retain) NSString *author;
@property (nonatomic, retain) NSString *timeRequired;
View
6 Classes/Guide.m
@@ -11,7 +11,7 @@
@implementation Guide
-@synthesize data, guideid, device, subject, title, author, timeRequired, difficulty, introduction, introduction_rendered, summary, image;
+@synthesize data, guideid, topic, subject, title, author, timeRequired, difficulty, introduction, introduction_rendered, summary, image;
@synthesize documents, parts, tools, flags;
@synthesize prereqs, steps;
@@ -37,7 +37,7 @@ + (Guide *)guideWithDictionary:(NSDictionary *)dict {
// Meta information
guide.title = [guideData valueForKey:@"title"];
- guide.device = [dict valueForKey:@"device"];
+ guide.topic = [dict valueForKey:@"topic"];
guide.subject = [guideData valueForKey:@"subject"];
guide.author = [guideData valueForKey:@"author"];
guide.timeRequired = [guideData valueForKey:@"time"];
@@ -70,7 +70,7 @@ + (Guide *)guideWithDictionary:(NSDictionary *)dict {
- (void)dealloc {
[data release];
[title release];
- [device release];
+ [topic release];
[subject release];
[author release];
[timeRequired release];
View
19 Classes/GuideEmbed.h
@@ -0,0 +1,19 @@
+//
+// GuideEmbed.h
+// iFixit
+//
+// Created by David Patierno on 11/16/12.
+// Copyright 2012 iFixit. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface GuideEmbed : NSObject
+
+@property (nonatomic, copy) NSString *url;
+@property (nonatomic, copy) NSString *type;
+@property (nonatomic, assign) CGSize size;
+
++ (GuideEmbed *)guideEmbedWithDictionary:(NSDictionary *)dict;
+
+@end
View
34 Classes/GuideEmbed.m
@@ -0,0 +1,34 @@
+//
+// GuideEmbed.m
+// iFixit
+//
+// Created by David Patierno on 11/16/12.
+// Copyright 2012 iFixit. All rights reserved.
+//
+
+#import "GuideEmbed.h"
+
+@implementation GuideEmbed
+
+@synthesize url = _url,
+ size = _size,
+ type = _type;
+
++ (GuideEmbed *)guideEmbedWithDictionary:(NSDictionary *)dict {
+ GuideEmbed *guideEmbed = [[GuideEmbed alloc] init];
+ NSString *url = [dict valueForKey:@"url"];
+ guideEmbed.url = [NSString stringWithFormat:@"%@&format=json", url, nil];
+ guideEmbed.type = [dict valueForKey:@"type"];
+ guideEmbed.size = CGSizeMake([[dict valueForKey:@"width"] floatValue],
+ [[dict valueForKey:@"height"] floatValue]);
+ return [guideEmbed autorelease];
+}
+
+- (void)dealloc {
+ [_url release];
+ [_type release];
+
+ [super dealloc];
+}
+
+@end
View
38 Classes/GuideIntroViewController.m
@@ -24,7 +24,7 @@ @implementation GuideIntroViewController
// Load the view nib and initialize the guide.
- (id)initWithGuide:(Guide *)guide {
- if ((self = [super initWithNibName:@"GuideIntroView" bundle:nil])) {
+ if ((self = [super initWithNibName:nil bundle:nil])) {
self.guide = guide;
self.huge = nil;
}
@@ -88,24 +88,24 @@ - (void)viewDidLoad {
self.view.backgroundColor = bgColor;
webView.modalDelegate = delegate;
- webView.backgroundColor = bgColor;
+ webView.backgroundColor = bgColor;
webView.opaque = NO;
- // Load the intro contents as HTML.
- NSString *header = [NSString stringWithFormat:@"<html><head><style type=\"text/css\"> %@ </style></head><body class=\"%@\">",
- [Config currentConfig].introCSS,
- ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? @"big" : @"small"];
- NSString *footer = @"</body></html>";
+ // Load the intro contents as HTML.
+ NSString *header = [NSString stringWithFormat:@"<html><head><style type=\"text/css\"> %@ </style></head><body class=\"%@\">",
+ [Config currentConfig].introCSS,
+ ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? @"big" : @"small"];
+ NSString *footer = @"</body></html>";
- NSString *body = self.guide.introduction_rendered;
+ NSString *body = self.guide.introduction_rendered;
//NSString *body = guide.introduction;
self.html = [NSString stringWithFormat:@"%@%@%@", header, body, footer];
- [webView loadHTMLString:html baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [Config host]]]];
+ [webView loadHTMLString:html baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [Config host]]]];
[self removeWebViewShadows];
- [device setText:self.guide.device];
+ [device setText:self.guide.topic];
// Add a shadow to the image
[self addViewShadow:mainImage];
@@ -116,10 +116,10 @@ - (void)viewDidLoad {
// Because the web view has a white background, it starts hidden.
// After the content is loaded, we wait a small amount of time before showing it to prevent flicker.
- (void)webViewDidFinishLoad:(UIWebView *)webView {
- [self performSelector:@selector(showWebView:) withObject:nil afterDelay:0.2];
+ [self performSelector:@selector(showWebView:) withObject:nil afterDelay:0.2];
}
- (void)showWebView:(id)sender {
- webView.hidden = NO;
+ webView.hidden = NO;
}
- (IBAction)zoomImage:(id)sender {
@@ -147,6 +147,8 @@ - (void)layoutLandscape {
}
}
- (void)layoutPortrait {
+ CGSize screenSize = [UIScreen mainScreen].bounds.size;
+
// iPad
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
swipeLabel.frame = CGRectMake(340.0, 790.0, 375.0, 84.0);
@@ -155,8 +157,10 @@ - (void)layoutPortrait {
// iPhone
else {
CGRect frame = webView.frame;
- frame.size.height = 305;
+ frame.size.height = screenSize.height - 175;// 305;
webView.frame = frame;
+
+ swipeLabel.frame = CGRectMake(0.0, screenSize.height - 20.0, 320.0, 45.0);
}
}
@@ -172,14 +176,6 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
[webView loadHTMLString:html baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [Config host]]]];
}
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-
- (void)viewDidUnload {
[self setOverlayView:nil];
[self setHeaderTextDozuki:nil];
View
54 Classes/GuideIntroView.xib → Classes/GuideIntroViewController.xib
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12C3006</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2844</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
+ <string key="NS.object.0">1930</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBUIWebView</string>
+ <string>IBProxyObject</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
- <string>IBProxyObject</string>
+ <string>IBUIWebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -43,7 +43,7 @@
<object class="IBUIImageView" id="564839461">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
- <string key="NSFrameSize">{320, 372}</string>
+ <string key="NSFrameSize">{320, 504}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="650426670"/>
@@ -56,7 +56,7 @@
<object class="IBUIWebView" id="650426670">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrame">{{0, 20}, {320, 285}}</string>
+ <string key="NSFrame">{{0, 20}, {320, 417}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="280862770"/>
@@ -87,7 +87,7 @@
</object>
</object>
</object>
- <string key="NSFrame">{{0, 302}, {320, 45}}</string>
+ <string key="NSFrame">{{0, 434}, {320, 45}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="258741309"/>
@@ -99,7 +99,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
- <string key="NSFrame">{{0, 64}, {320, 372}}</string>
+ <string key="NSFrame">{{0, 64}, {320, 504}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="564839461"/>
@@ -115,8 +115,24 @@
<int key="IBUIBarStyle">1</int>
<bool key="IBUIPrompted">NO</bool>
</object>
- <object class="IBUISimulatedToolbarMetrics" key="IBUISimulatedBottomBarMetrics">
- <int key="IBUIBarStyle">1</int>
+ <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
+ <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
+ <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ <integer value="3"/>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{320, 568}</string>
+ <string>{568, 320}</string>
+ </object>
+ </object>
+ <string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
+ <string key="IBUIDisplayName">Retina 4 Full Screen</string>
+ <int key="IBUIType">2</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
@@ -231,7 +247,7 @@
<string>3.CustomClassName</string>
<string>3.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>GuideIntroViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -257,7 +273,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">18</int>
+ <int key="maxID">26</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -286,7 +302,7 @@
<string>swipeLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UILabel</string>
<string>UIImageView</string>
@@ -311,7 +327,7 @@
<string>swipeLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">device</string>
@@ -366,6 +382,6 @@
<string key="NS.key.0">swipeToBeginiPhone.png</string>
<string key="NS.object.0">{182, 23}</string>
</object>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">1930</string>
</data>
</archive>
View
4 Classes/GuideStep.h
@@ -7,7 +7,9 @@
//
#import <Foundation/Foundation.h>
+#import "GuideEmbed.h"
#import "GuideImage.h"
+#import "GuideVideo.h"
#import "GuideStepLine.h"
@interface GuideStep : NSObject
@@ -16,6 +18,8 @@
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSMutableArray *lines;
@property (nonatomic, retain) NSMutableArray *images;
+@property (nonatomic, retain) GuideVideo *video;
+@property (nonatomic, retain) GuideEmbed *embed;
+ (GuideStep *)guideStepWithDictionary:(NSDictionary *)dict;
View
31 Classes/GuideStep.m
@@ -11,20 +11,35 @@
@implementation GuideStep
-@synthesize number, title, lines, images;
+@synthesize number, title, lines, images, video, embed;
+ (GuideStep *)guideStepWithDictionary:(NSDictionary *)dict {
GuideStep *guideStep = [[GuideStep alloc] init];
guideStep.number = [[dict valueForKey:@"number"] integerValue];
guideStep.title = [dict valueForKey:@"title"];
- // Images
- guideStep.images = [NSMutableArray array];
- NSArray *images = [dict valueForKey:@"images"];
- for (NSDictionary *image in images)
- [guideStep.images addObject:[GuideImage guideImageWithDictionary:image]];
-
+ // Media
+ NSDictionary *media = [dict valueForKey:@"media"];
+
+ // Possible types: image, video, embed
+ // If *media is empty, then there will be no
+ // type so we want to default to an image type
+ NSString *type = (media.count > 0) ? [media objectForKey:@"type"] : @"image";
+
+ if ([type isEqual:@"image"]) {
+ guideStep.images = [NSMutableArray array];
+ NSArray *images = [media valueForKey:@"image"];
+ for (NSDictionary *image in images)
+ [guideStep.images addObject:[GuideImage guideImageWithDictionary:image]];
+ } else if ([type isEqual:@"video"]) {
+ NSDictionary *video = [media objectForKey:@"video"];
+ guideStep.video = [GuideVideo guideVideoWithDictionary:video];
+ } else if ([type isEqual:@"embed"]) {
+ NSDictionary *embed = [media objectForKey:@"embed"];
+ guideStep.embed = [GuideEmbed guideEmbedWithDictionary:embed];
+ }
+
// Lines
guideStep.lines = [NSMutableArray array];
NSArray *lines = [dict valueForKey:@"lines"];
@@ -38,6 +53,8 @@ - (void)dealloc {
[title release];
[lines release];
[images release];
+ [video release];
+ [embed release];
[super dealloc];
}
View
4 Classes/GuideStepViewController.h
@@ -6,6 +6,8 @@
// Copyright 2010 iFixit. All rights reserved.
//
+#import <MediaPlayer/MediaPlayer.h>
+
@class GuideStep;
@class GuideCatchingWebView;
@@ -16,6 +18,8 @@
@property (nonatomic, retain) IBOutlet UILabel *titleLabel;
@property (nonatomic, retain) IBOutlet UIButton *mainImage;
@property (nonatomic, retain) IBOutlet GuideCatchingWebView *webView;
+@property (nonatomic, retain) MPMoviePlayerController *moviePlayer;
+@property (nonatomic, retain) UIWebView *embedView;
@property (nonatomic, retain) IBOutlet UIButton *image1;
@property (nonatomic, retain) IBOutlet UIButton *image2;
View
143 Classes/GuideStepViewController.m
@@ -7,6 +7,11 @@
//
#import "GuideStepViewController.h"
+
+#import <QuartzCore/QuartzCore.h>
+
+#import "ASIHTTPRequest.h"
+#import "JSON.h"
#import "GuideImageViewController.h"
#import "GuideCatchingWebView.h"
#import "GuideStep.h"
@@ -15,16 +20,15 @@
#import "SDWebImageDownloader.h"
#import "UIButton+WebCache.h"
#import "SVWebViewController.h"
-#import <QuartzCore/QuartzCore.h>
@implementation GuideStepViewController
-@synthesize delegate, step=_step, titleLabel, mainImage, webView;
+@synthesize delegate, step=_step, titleLabel, mainImage, webView, moviePlayer, embedView;
@synthesize image1, image2, image3, numImagesLoaded, bigImages, html;
// Load the view nib and initialize the pageNumber ivar.
- (id)initWithStep:(GuideStep *)step {
- if ((self = [super initWithNibName:@"GuideStepView" bundle:nil])) {
+ if ((self = [super initWithNibName:nil bundle:nil])) {
self.step = step;
self.numImagesLoaded = 0;
self.bigImages = [NSMutableArray array];
@@ -62,14 +66,14 @@ - (void)viewDidLoad {
self.view.backgroundColor = bgColor;
webView.modalDelegate = delegate;
- webView.backgroundColor = bgColor;
+ webView.backgroundColor = bgColor;
webView.opaque = NO;
- NSString *stepTitle = [NSString stringWithFormat:@"Step %d", self.step.number];
- if (![self.step.title isEqual:@""])
- stepTitle = [NSString stringWithFormat:@"%@ - %@", stepTitle, self.step.title];
+ NSString *stepTitle = [NSString stringWithFormat:@"Step %d", self.step.number];
+ if (![self.step.title isEqual:@""])
+ stepTitle = [NSString stringWithFormat:@"%@ - %@", stepTitle, self.step.title];
- [titleLabel setText:stepTitle];
+ [titleLabel setText:stepTitle];
titleLabel.textColor = [Config currentConfig].textColor;
// Load the step contents as HTML.
@@ -97,14 +101,80 @@ - (void)viewDidLoad {
[webView loadHTMLString:html baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [Config host]]]];
[self removeWebViewShadows];
-
- // Add a shadow to the images
- [self addViewShadow:mainImage];
- [self addViewShadow:image1];
- [self addViewShadow:image2];
- [self addViewShadow:image3];
-
- [self startImageDownloads];
+
+ // Images
+ if (self.step.images) {
+ // Add a shadow to the images
+ [self addViewShadow:mainImage];
+ [self addViewShadow:image1];
+ [self addViewShadow:image2];
+ [self addViewShadow:image3];
+
+ [self startImageDownloads];
+ }
+ // Videos
+ else if (self.step.video) {
+ CGRect frame = mainImage.frame;
+ frame.origin.x = 10.0;
+
+ NSURL *url = [NSURL URLWithString:self.step.video.url];
+ self.moviePlayer = [[[MPMoviePlayerController alloc] init] autorelease];
+ moviePlayer.shouldAutoplay = NO;
+ moviePlayer.contentURL = url;
+ moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
+ moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
+ // Play full screen on iPhones and iPods.
+ moviePlayer.fullscreen = [UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad;
+ [moviePlayer.view setFrame:frame];
+ [moviePlayer prepareToPlay];
+ [self.view addSubview:moviePlayer.view];
+ }
+ // Embeds
+ else if (self.step.embed) {
+ CGRect frame = mainImage.frame;
+ frame.origin.x = 10.0;
+
+ self.embedView = [[[UIWebView alloc] initWithFrame:frame] autorelease];
+ self.embedView.backgroundColor = [UIColor clearColor];
+ self.embedView.opaque = NO;
+ [self.view addSubview:embedView];
+
+ NSString *oembedURL = [NSString stringWithFormat:@"%@&maxwidth=%d&maxheight=%d",
+ self.step.embed.url,
+ (int)self.embedView.frame.size.width,
+ (int)self.embedView.frame.size.height];
+ NSURL *url = [NSURL URLWithString:oembedURL];
+ [ASIHTTPRequest requestWithURL:url];
+
+ __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
+ [request setCompletionBlock:^{
+ NSDictionary *json = [[request responseString] JSONValue];
+ NSString *embedHtml = [json objectForKey:@"html"];
+ NSString *header = [NSString stringWithFormat:@"<html><head><style type=\"text/css\"> %@ </style></head><body>",
+ [Config currentConfig].stepCSS, nil];
+ NSString *htmlString = [NSString stringWithFormat:@"%@ %@", header, embedHtml, nil];
+
+ [embedView loadHTMLString:htmlString
+ baseURL:[NSURL URLWithString:[json objectForKey:@"provider_url"]]];
+ }];
+ [request startAsynchronous];
+ }
+
+ // Fix for rotation while playing video.
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(_moviePlayerWillExitFullscreen:)
+ name:MPMoviePlayerWillExitFullscreenNotification
+ object:nil];
+
+}
+
+- (void)_moviePlayerWillExitFullscreen:(NSNotification *)notification {
+ [self.delegate willRotateToInterfaceOrientation:self.interfaceOrientation duration:0];
+}
+
+
+- (void)viewWillDisappear:(BOOL)animated {
+ [moviePlayer stop];
}
- (void)startImageDownloads {
@@ -175,8 +245,13 @@ - (void)layoutLandscape {
webView.frame = CGRectMake(620.0, 103.0, 404.0, 562.0);
titleLabel.frame = CGRectMake(30.0, 30.0, 975.0, 65.0);
titleLabel.textAlignment = UITextAlignmentRight;
-
- CGRect frame = image1.frame;
+
+ CGRect frame = mainImage.frame;
+ frame.origin.x = 10.0;
+ moviePlayer.view.frame = frame;
+ embedView.frame = frame;
+
+ frame = image1.frame;
frame.origin.y = 560.0;
frame.origin.x = 20.0;
@@ -190,6 +265,8 @@ - (void)layoutLandscape {
}
// iPhone
else {
+ CGSize screenSize = [UIScreen mainScreen].bounds.size;
+
// These dimensions represent the object's position BEFORE rotation,
// and are automatically tweaked during animation with respect to their resize masks.
CGRect frame = image1.frame;
@@ -204,7 +281,7 @@ - (void)layoutLandscape {
frame.origin.x = 160;
image3.frame = frame;
- webView.frame = CGRectMake(230, 0, 250, 236);
+ webView.frame = CGRectMake(230, 0, screenSize.height - 230, 236);
}
}
- (void)layoutPortrait {
@@ -215,7 +292,12 @@ - (void)layoutPortrait {
titleLabel.frame = CGRectMake(30.0, 489.0, 708.0, 65.0);
titleLabel.textAlignment = UITextAlignmentLeft;
- CGRect frame = image1.frame;
+ CGRect frame = mainImage.frame;
+ frame.origin.x = 10.0;
+ moviePlayer.view.frame = frame;
+ embedView.frame = frame;
+
+ frame = image1.frame;
frame.origin.x = 626.0;
frame.origin.y = 30.0;
@@ -229,6 +311,8 @@ - (void)layoutPortrait {
}
// iPhone
else {
+ CGSize screenSize = [UIScreen mainScreen].bounds.size;
+
// These dimensions represent the object's position BEFORE rotation,
// and are automatically tweaked during animation with respect to their resize masks.
CGRect frame = image1.frame;
@@ -243,7 +327,7 @@ - (void)layoutPortrait {
frame.origin.y = 115;
image3.frame = frame;
- webView.frame = CGRectMake(0, 168, 320, 225);
+ webView.frame = CGRectMake(0, 168, 320, screenSize.height - 255);
}
}
@@ -259,20 +343,13 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
[webView loadHTMLString:html baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [Config host]]]];
}
-
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-
- (void)viewDidUnload {
[super viewDidUnload];
self.titleLabel = nil;
self.mainImage = nil;
self.webView = nil;
+ self.moviePlayer = nil;
+ self.embedView = nil;
self.image1 = nil;
self.image2 = nil;
self.image3 = nil;
@@ -295,7 +372,11 @@ - (void)dealloc {
[image1 release];
[image2 release];
[image3 release];
-
+ [moviePlayer release];
+ [embedView release];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
[super dealloc];
}
View
33 Classes/GuideStepView.xib → Classes/GuideStepViewController.xib
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">11G63</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+ <string key="IBDocument.AppKitVersion">1138.51</string>
+ <string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
+ <string key="NS.object.0">1929</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBUIWebView</string>
+ <string>IBProxyObject</string>
<string>IBUIButton</string>
<string>IBUIView</string>
- <string>IBProxyObject</string>
+ <string>IBUIWebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -142,6 +142,7 @@
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="920761207"/>
+ <reference key="IBUINormalBackgroundImage" ref="793613333"/>
<reference key="IBUIFontDescription" ref="408026252"/>
<reference key="IBUIFont" ref="520135055"/>
</object>
@@ -292,10 +293,10 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="523736486"/>
- <reference ref="149214910"/>
- <reference ref="112558424"/>
<reference ref="332616857"/>
<reference ref="729705696"/>
+ <reference ref="149214910"/>
+ <reference ref="112558424"/>
</object>
<reference key="parent" ref="0"/>
</object>
@@ -353,7 +354,7 @@
<string>7.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>GuideStepViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -403,7 +404,7 @@
<string>changeImage:</string>
<string>zoomImage:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>id</string>
@@ -416,7 +417,7 @@
<string>changeImage:</string>
<string>zoomImage:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">changeImage:</string>
@@ -439,7 +440,7 @@
<string>titleLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>UIButton</string>
@@ -460,7 +461,7 @@
<string>titleLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">image1</string>
@@ -507,6 +508,6 @@
<string key="NS.key.0">NoImage_300x225.jpg</string>
<string key="NS.object.0">{300, 225}</string>
</object>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">1929</string>
</data>
</archive>
View
54 Classes/GuideStepView~ipad.xib → Classes/GuideStepViewController~ipad.xib
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">11G63</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+ <string key="IBDocument.AppKitVersion">1138.51</string>
+ <string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
+ <string key="NS.object.0">1929</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBUIWebView</string>
+ <string>IBProxyObject</string>
<string>IBUIButton</string>
- <string>IBUIView</string>
<string>IBUILabel</string>
- <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ <string>IBUIWebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -52,7 +52,6 @@
<string key="NSFrame">{{620, 103}, {404, 562}}</string>
<reference key="NSSuperview" ref="421469842"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor" id="560708408">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
@@ -204,6 +203,10 @@
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="551398038"/>
+ <object class="NSCustomResource" key="IBUINormalBackgroundImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NoImage_592x444.jpg</string>
+ </object>
<reference key="IBUIFontDescription" ref="513236487"/>
<reference key="IBUIFont" ref="65993919"/>
</object>
@@ -434,7 +437,7 @@
<string>7.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>GuideStepViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -486,7 +489,7 @@
<string>changeImage:</string>
<string>zoomImage:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>id</string>
@@ -499,7 +502,7 @@
<string>changeImage:</string>
<string>zoomImage:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">changeImage:</string>
@@ -522,14 +525,14 @@
<string>titleLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>UIButton</string>
<string>UIButton</string>
<string>UIButton</string>
<string>UILabel</string>
- <string>UIWebView</string>
+ <string>GuideCatchingWebView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -543,7 +546,7 @@
<string>titleLabel</string>
<string>webView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">image1</string>
@@ -567,7 +570,7 @@
</object>
<object class="IBToOneOutletInfo">
<string key="name">webView</string>
- <string key="candidateClassName">UIWebView</string>
+ <string key="candidateClassName">GuideCatchingWebView</string>
</object>
</object>
</object>
@@ -582,7 +585,7 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1280" key="NS.object.0"/>
+ <real value="1536" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
@@ -591,9 +594,18 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <string key="NS.key.0">NoImage_300x225.jpg</string>
- <string key="NS.object.0">{300, 225}</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NoImage_300x225.jpg</string>
+ <string>NoImage_592x444.jpg</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{300, 225}</string>
+ <string>{592, 444}</string>
+ </object>
</object>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">1929</string>
</data>
</archive>
View
18 Classes/GuideVideo.h
@@ -0,0 +1,18 @@
+//
+// GuideVideo.h
+// iFixit
+//
+// Created by David Patierno on 11/16/12.
+// Copyright 2012 iFixit. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface GuideVideo : NSObject
+
+@property (nonatomic, copy) NSString *url;
+@property (nonatomic, assign) CGSize size;
+
++ (GuideVideo *)guideVideoWithDictionary:(NSDictionary *)dict;
+
+@end
View
39 Classes/GuideVideo.m
@@ -0,0 +1,39 @@
+//
+// GuideVideo.m
+// iFixit
+//
+// Created by David Patierno on 11/16/12.
+// Copyright 2012 iFixit. All rights reserved.
+//
+
+#import "GuideVideo.h"
+
+@implementation GuideVideo
+
+@synthesize url = _url,
+ size = _size;
+
++ (GuideVideo *)guideVideoWithDictionary:(NSDictionary *)dict {
+ NSArray *encodings = [dict valueForKey:@"encoding"];
+
+ for (NSDictionary *encoding in encodings) {
+ // Just grab the first mp4 available.
+ if ([[encoding objectForKey:@"format"] isEqual:@"mp4"]) {
+ GuideVideo *guideVideo = [[GuideVideo alloc] init];
+ guideVideo.url = [encoding valueForKey:@"url"];
+ guideVideo.size = CGSizeMake([[encoding valueForKey:@"width"] floatValue],
+ [[encoding valueForKey:@"height"] floatValue]);
+ return [guideVideo autorelease];
+ }
+ }
+
+ return nil;
+}
+
+- (void)dealloc {
+ [_url release];
+
+ [super dealloc];
+}
+
+@end
View
25 Classes/GuideViewController.m
@@ -108,31 +108,32 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
}
- (void)adjustScrollViewContentSizeForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- NSInteger numPages = [self.guide.steps count] + 1;
+ NSInteger numPages = [self.guide.steps count] + 1;
CGRect frame;
+ CGSize screenSize = [UIScreen mainScreen].bounds.size;
// iPad
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
// Landscape
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
spinner.frame = CGRectMake(494.0, 333.0, 37.0, 37.0);
- frame = CGRectMake(0, 44, 1024, 768 - 44);
+ frame = CGRectMake(0, 44, screenSize.height, screenSize.width - 44);
}
// Portrait
else {
spinner.frame = CGRectMake(365.0, 450.0, 37.0, 37.0);
- frame = CGRectMake(0, 44, 768, 1024 - 44);
+ frame = CGRectMake(0, 44, screenSize.width, screenSize.height - 44);
}
}
// iPhone
else {
// Landscape
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
- frame = CGRectMake(0, 44, 480, 320 - 44);
+ frame = CGRectMake(0, 44, screenSize.height, screenSize.width - 44);
}
// Portrait
else {
- frame = CGRectMake(0, 44, 320, 480 - 64);
+ frame = CGRectMake(0, 44, screenSize.width, screenSize.height - 64);
}
}
@@ -226,7 +227,7 @@ - (void)loadScrollViewWithPage:(int)page {
if (page < 0 || page >= pageControl.numberOfPages)
return;
- NSInteger stepNumber = page - 1;
+ NSInteger stepNumber = page - 1;
// replace the placeholder if necessary
UIViewController *controller = [viewControllers objectAtIndex:page];
@@ -271,14 +272,15 @@ - (void)scrollViewDidScroll:(UIScrollView *)sender {
// load the visible page and the page on either side of it (to avoid flashes when the user starts scrolling)
//[self performSelector:@selector(preloadForCurrentPage:) withObject:[NSNumber numberWithInt:page] afterDelay:0.1];
- [self preloadForCurrentPage:[NSNumber numberWithInt:page]];
+ [self preloadForCurrentPage:[NSNumber numberWithInt:page]];
// Unload the views+controllers which are no longer visible
for (int i = 2; i < pageControl.numberOfPages; i++) {
float distance = fabs(page - i + 1);
if (distance > 2.0) {
UIViewController *vc = [viewControllers objectAtIndex:i];
if ((NSNull *)vc != [NSNull null]) {
+ [vc viewWillDisappear:NO];
[vc.view removeFromSuperview];
vc.view = nil;
[viewControllers replaceObjectAtIndex:i withObject:[NSNull null]];
@@ -352,15 +354,6 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
[self showPage:pageControl.currentPage];
}
-
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-
- (void)viewDidUnload {
[super viewDidUnload];
self.spinner = nil;
View
9 Classes/ListViewController.m
@@ -48,17 +48,18 @@ - (void)viewDidLoad {
// Add the toolbar with bookmarks toggle.
UIToolbar *toolbar = [[UIToolbar alloc] init];
-
+ CGSize screenSize = [UIScreen mainScreen].bounds.size;
+
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
int diff = 20 + 44;
// Adjust for the tab bar.
iFixitAppDelegate *appDelegate = (iFixitAppDelegate*)[UIApplication sharedApplication].delegate;
if (appDelegate.showsTabBar)
diff += 49;
- toolbar.frame = CGRectMake(0, 768 - diff, 320, 44);
+ toolbar.frame = CGRectMake(0, screenSize.width - diff, 320, 44);
}
else {
- toolbar.frame = CGRectMake(0, 480 - 43, 320, 44);
+ toolbar.frame = CGRectMake(0, screenSize.height - 43, screenSize.width, 44);
toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
@@ -100,7 +101,7 @@ - (void)toggleBookmarks:(UISegmentedControl *)toggle {
}
else {
iFixitAppDelegate *appDelegate = (iFixitAppDelegate*)[[UIApplication sharedApplication] delegate];
- self.viewControllers = [NSArray arrayWithObject:appDelegate.areasViewController];
+ self.viewControllers = [NSArray arrayWithObject:appDelegate.categoriesViewController];
}
}
// Bookmarks
View
4 Classes/iFixitAPI.h
@@ -20,11 +20,11 @@
- (void)getSitesWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset forObject:(id)object withSelector:(SEL)selector;
- (void)getCollectionsWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset forObject:(id)object withSelector:(SEL)selector;
- (void)getGuide:(NSInteger)guideid forObject:(id)object withSelector:(SEL)selector;
-- (void)getAreas:(NSString *)parent forObject:(id)object withSelector:(SEL)selector;
+- (void)getCategories:(NSString *)parent forObject:(id)object withSelector:(SEL)selector;
- (void)getGuides:(NSString *)type forObject:(id)object withSelector:(SEL)selector;
- (void)getGuidesByIds:(NSArray *)guideids forObject:(id)object withSelector:(SEL)selector;
- (void)getSearchResults:(NSString *)search forObject:(id)object withSelector:(SEL)selector;
-- (void)getDevice:(NSString *)device forObject:(id)object withSelector:(SEL)selector;
+- (void)getTopic:(NSString *)device forObject:(id)object withSelector:(SEL)selector;
// Session management
- (void)loginWithSessionId:(NSString *)sessionId forObject:(id)object withSelector:(SEL)selector;
View
36 Classes/iFixitAPI.m
@@ -67,7 +67,7 @@ + (iFixitAPI *)sharedInstance {
}
- (void)getSitesWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset forObject:(id)object withSelector:(SEL)selector {
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/sites?limit=%d&offset=%d", [Config host], limit, offset];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/sites?limit=%d&offset=%d", [Config host], limit, offset];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -81,7 +81,7 @@ - (void)getSitesWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset forObje
}
- (void)getCollectionsWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset forObject:(id)object withSelector:(SEL)selector {
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/collections?limit=%d&offset=%d", [Config host], limit, offset];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/collections?limit=%d&offset=%d", [Config host], limit, offset];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -95,7 +95,7 @@ - (void)getCollectionsWithLimit:(NSUInteger)limit andOffset:(NSUInteger)offset f
}
- (void)getGuide:(NSInteger)guideid forObject:(id)object withSelector:(SEL)selector {
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/guide/%d", [Config host], guideid];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/guide/%d", [Config host], guideid];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -109,7 +109,7 @@ - (void)getGuide:(NSInteger)guideid forObject:(id)object withSelector:(SEL)selec
[request startAsynchronous];
}
-- (void)getAreas:(NSString *)parent forObject:(id)object withSelector:(SEL)selector {
+- (void)getCategories:(NSString *)parent forObject:(id)object withSelector:(SEL)selector {
if (!parent)
parent = @"";
@@ -118,7 +118,7 @@ - (void)getAreas:(NSString *)parent forObject:(id)object withSelector:(SEL)selec
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
requireGuides = @"?requireGuides=yes";
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/areas/%@%@", [Config host], parent, requireGuides];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/categories/%@%@", [Config host], parent, requireGuides];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -131,9 +131,9 @@ - (void)getAreas:(NSString *)parent forObject:(id)object withSelector:(SEL)selec
[request startAsynchronous];
}
-- (void)getDevice:(NSString *)device forObject:(id)object withSelector:(SEL)selector {
+- (void)getTopic:(NSString *)device forObject:(id)object withSelector:(SEL)selector {
device = [device stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/device/%@", [Config host], device];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/topic/%@", [Config host], device];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -149,7 +149,7 @@ - (void)getDevice:(NSString *)device forObject:(id)object withSelector:(SEL)sele
- (void)getGuides:(NSString *)type forObject:(id)object withSelector:(SEL)selector {
int limit = [type isEqual:@"featured"] ? 9 : 100;
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/guides/%@?limit=%d", [Config host], type, limit];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/guides/%@?limit=%d", [Config host], type, limit];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -164,7 +164,7 @@ - (void)getGuides:(NSString *)type forObject:(id)object withSelector:(SEL)select
- (void)getGuidesByIds:(NSArray *)guideids forObject:(id)object withSelector:(SEL)selector {
NSString *guideidsString = [guideids componentsJoinedByString:@","];
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/guides?guideids=%@", [Config host], guideidsString];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/guides?guideids=%@", [Config host], guideidsString];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -182,7 +182,7 @@ - (void)getSearchResults:(NSString *)search forObject:(id)object withSelector:(S
search = [search stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];
search = [search stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"];
- NSString *url = [NSString stringWithFormat:@"http://%@/api/0.1/search/%@?filter=device&limit=50", [Config host], search];
+ NSString *url = [NSString stringWithFormat:@"http://%@/api/1.0/search/%@?filter=device&limit=50", [Config host], search];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setCompletionBlock:^{
@@ -218,7 +218,7 @@ - (void)loginWithSessionId:(NSString *)sessionId forObject:(id)object withSelect
// .dozuki.com hosts force SSL, so we match that here. Otherwise, for SSO sites with custom domains,
// SSL doesn't exist so we just use HTTP.
NSString *s = ([Config currentConfig].sso && [Config currentConfig].custom_domain) ? @"" : @"s";
- NSString *url = [NSString stringWithFormat:@"http%@://%@/api/0.1/login", s, [Config host]];
+ NSString *url = [NSString stringWithFormat:@"http%@://%@/api/1.0/login", s, [Config host]];
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
[request setRequestMethod:@"POST"];
@@ -240,10 +240,10 @@ - (void)loginWithSessionId:(NSString *)sessionId forObject:(id)object withSelect
- (void)loginWithLogin:(NSString *)login andPassword:(NSString *)password forObject:(id)object withSelector:(SEL)selector {
[TestFlight passCheckpoint:@"Login"];
- NSString *url = [NSString stringWithFormat:@"https://%@/api/0.1/login", [Config host]];
+ NSString *url = [NSString stringWithFormat:@"https://%@/api/1.0/login", [Config host]];
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
- if ([Config currentConfig].dozuki && [Config currentConfig].site != ConfigMake && [Config currentConfig].site != ConfigIFixit)
+