Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bugfixes, private login tweaks

  • Loading branch information...
commit a8c0073fab85de8bb044d835ac9fbf8445f5b957 1 parent 435c40e
@dmpatierno dmpatierno authored
View
14 Classes/LoginBackgroundViewController.h
@@ -0,0 +1,14 @@
+//
+// LoginBackgroundViewController.h
+// iFixit
+//
+// Created by David Patierno on 2/13/12.
+// Copyright (c) 2012 iFixit. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+// Blank background for presenting a modal sheet.
+@interface LoginBackgroundViewController : UIViewController
+
+@end
View
30 Classes/LoginBackgroundViewController.m
@@ -0,0 +1,30 @@
+//
+// LoginBackgroundViewController.m
+// iFixit
+//
+// Created by David Patierno on 2/13/12.
+// Copyright (c) 2012 iFixit. All rights reserved.
+//
+
+#import "LoginBackgroundViewController.h"
+
+#import "Config.h"
+
+@implementation LoginBackgroundViewController
+
+- (void)viewDidLoad {
+ UIColor *bgColor = [Config currentConfig].backgroundColor;
+ if ([bgColor isEqual:[UIColor whiteColor]])
+ bgColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"concreteBackgroundWhite.png"]];
+ else
+ bgColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"concreteBackground.png"]];
+ self.view.backgroundColor = bgColor;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
+ return YES;
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+}
+
+@end
View
28 Classes/LoginViewController.m
@@ -7,6 +7,7 @@
//
#import "LoginViewController.h"
+#import "LoginBackgroundViewController.h"
#import "WBProgressHUD.h"
#import "iFixitAPI.h"
#import "BookmarksViewController.h"
@@ -86,10 +87,16 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField {
- (void)showLoading {
if (!loading) {
- const CGRect rect = CGRectMake(80, 60, 160, 120);
- self.loading = [[[WBProgressHUD alloc] initWithFrame:rect] autorelease];
+ self.loading = [[[WBProgressHUD alloc] init] autorelease];
}
+ CGFloat width = 160;
+ CGFloat height = 120;
+ self.loading.frame = CGRectMake((self.view.frame.size.width - width) / 2.0,
+ (self.view.frame.size.height - height) / 4.0,
+ width,
+ height);
+
// Hide the keyboard and prevent further editing.
self.view.userInteractionEnabled = NO;
[self.view endEditing:YES];
@@ -172,6 +179,11 @@ - (UIView *)createActionButtons {
[lb setBackgroundImage:[[UIImage imageNamed:@"login.png"] stretchableImageWithLeftCapWidth:150 topCapHeight:22] forState:UIControlStateNormal];
[lb setContentMode:UIViewContentModeScaleToFill];
[lb addTarget:self action:@selector(sendLogin) forControlEvents:UIControlEventTouchUpInside];
+
+ // Adjust the frame for modal sheet presentation.
+ if ([[[[UIApplication sharedApplication].delegate window] rootViewController] isKindOfClass:[LoginBackgroundViewController class]]) {
+ lb.frame = CGRectMake(30, 0, 260, 45);
+ }
// Register
UIButton *rb = [[UIButton alloc] initWithFrame:CGRectMake(10, 55, 300, 45)];
@@ -222,7 +234,7 @@ - (UIView *)createActionButtons {
[container addSubview:loginButton];
- if (![Config currentConfig].sso) {
+ if (![Config currentConfig].sso && ![Config currentConfig].private) {
[container addSubview:registerButton];
[container addSubview:cancelButton];
[container addSubview:googleButton];
@@ -330,8 +342,9 @@ - (void)viewDidUnload {
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
+ return YES;
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
#pragma mark - Table view data source
@@ -358,7 +371,7 @@ - (UITextField *)inputFieldForRow:(NSInteger)row {
inputField.font = [UIFont systemFontOfSize:16.0];
inputField.adjustsFontSizeToFitWidth = YES;
inputField.textColor = [UIColor darkGrayColor];
- CGRect rect = CGRectMake(120, 12, 175, 20);
+ CGRect rect = CGRectMake(120, 12, 175, 30);
if (row == 0) {
if (emailField) {
@@ -451,7 +464,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
[v removeFromSuperview];
}
- [cell addSubview:[self inputFieldForRow:indexPath.row]];
+ [cell.contentView addSubview:[self inputFieldForRow:indexPath.row]];
return cell;
}
@@ -504,7 +517,6 @@ - (void)sendRegister {
}
- (void)loginResults:(NSDictionary *)results {
- NSLog(@"%@", delegate);
if ([results objectForKey:@"error"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[results objectForKey:@"msg"]
View
9 Classes/SSOViewController.m
@@ -21,6 +21,15 @@ + (id)viewControllerForURL:(NSString *)url delegate:(id<LoginViewControllerDeleg
[storage deleteCookie:cookie];
}
+ // Set a custom cookie for simple success SSO redirect: sso-origin=SHOW_SUCCESS
+ NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:
+ [NSDictionary dictionaryWithObjectsAndKeys:@"sso-origin", NSHTTPCookieName,
+ @"SHOW_SUCCESS", NSHTTPCookieValue,
+ [Config host], NSHTTPCookieDomain,
+ @"/", NSHTTPCookiePath,
+ nil]];
+ [storage setCookie:cookie];
+
SSOViewController* vc = [[SSOViewController alloc] initWithAddress:url];
vc.delegate = delegate;
return [vc autorelease];
View
6 Classes/iFixitAPI.m
@@ -289,6 +289,12 @@ - (void)registerWithLogin:(NSString *)login andPassword:(NSString *)password and
}
- (void)logout {
+ // Clear all cookies.
+ NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+ for (NSHTTPCookie *cookie in [storage cookies]) {
+ [storage deleteCookie:cookie];
+ }
+
self.user = nil;
[self saveSession];
// Reset GuideBookmarks static object.
View
26 Classes/iFixitAppDelegate.m
@@ -20,6 +20,7 @@
#import "GuideBookmarks.h"
#import "Guide.h"
#import "LoginViewController.h"
+#import "LoginBackgroundViewController.h"
#import "UIColor+Hex.h"
#import "GANTracker.h"
@@ -129,14 +130,37 @@ - (void)showSiteSplash {
}
UIViewController *root = nil;
+ UINavigationController *nvc = nil;
if ([Config currentConfig].private) {
// Private sites require immediate login.
LoginViewController *vc = [[LoginViewController alloc] init];
vc.message = @"Private site. Authentication required.";
vc.delegate = self;
- root = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];
+ nvc = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];
+ nvc.modalPresentationStyle = UIModalPresentationFormSheet;
+ nvc.navigationBar.tintColor = [Config currentConfig].toolbarColor;
[vc release];
+
+ UIImage *icon = [UIImage imageNamed:@"backtosites.png"];
+ UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStyleBordered
+ target:self
+ action:@selector(showDozukiSplash)];
+ vc.navigationItem.leftBarButtonItem = button;
+ [button release];
+
+ // iPad: display in form sheet
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
+ root = [[[LoginBackgroundViewController alloc] init] autorelease];
+ self.window.rootViewController = root;
+ [window makeKeyAndVisible];
+ [root presentModalViewController:nvc animated:NO];
+ return;
+ }
+ else {
+ // iPhone: set as root
+ root = nvc;
+ }
}
else {
root = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ?
View
2  css/make_intro.css
@@ -10,7 +10,7 @@ body.small {
}
a, a:visited {
- color: #7fc7e7;
+ color: #003366;
}
div.parts {
View
2  css/make_step.css
@@ -6,7 +6,7 @@ html, body {
}
a, a:visited {
- color: #7fc7e7;
+ color: #003366;
}
body {
View
2  iFixit-Info.plist
@@ -24,7 +24,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>34</string>
+ <string>36</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
View
8 iFixit.xcodeproj/project.pbxproj
@@ -74,6 +74,7 @@
DA3E3E3B133C1A8E0070615F /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA3E3E3A133C1A8E0070615F /* MainWindow.xib */; };
DA53FA73141366AA00D5388F /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = DA53FA72141366AA00D5388F /* RegexKitLite.m */; };
DA53FA75141368BB00D5388F /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DA53FA74141368BB00D5388F /* libicucore.dylib */; };
+ DA58CB3414EA17F400A2CBAB /* LoginBackgroundViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA58CB3314EA17F400A2CBAB /* LoginBackgroundViewController.m */; };
DA59293813FB253B00504CD3 /* DozukiSplashViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA59293613FB253B00504CD3 /* DozukiSplashViewController.m */; };
DA59293913FB253B00504CD3 /* DozukiSplashView~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA59293713FB253B00504CD3 /* DozukiSplashView~ipad.xib */; };
DA59296F13FB28B600504CD3 /* DozukiInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA59296D13FB28B600504CD3 /* DozukiInfoViewController.m */; };
@@ -295,6 +296,8 @@
DA53FA71141366AA00D5388F /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegexKitLite.h; sourceTree = "<group>"; };
DA53FA72141366AA00D5388F /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegexKitLite.m; sourceTree = "<group>"; };
DA53FA74141368BB00D5388F /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
+ DA58CB3214EA17F400A2CBAB /* LoginBackgroundViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginBackgroundViewController.h; sourceTree = "<group>"; };
+ DA58CB3314EA17F400A2CBAB /* LoginBackgroundViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginBackgroundViewController.m; sourceTree = "<group>"; };
DA59293513FB253B00504CD3 /* DozukiSplashViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DozukiSplashViewController.h; sourceTree = "<group>"; };
DA59293613FB253B00504CD3 /* DozukiSplashViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DozukiSplashViewController.m; sourceTree = "<group>"; };
DA59293713FB253B00504CD3 /* DozukiSplashView~ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "DozukiSplashView~ipad.xib"; sourceTree = "<group>"; };
@@ -926,6 +929,8 @@
DAB93438137228AD00B6AA9A /* LoginViewController.h */,
DAB93439137228AD00B6AA9A /* LoginViewController.m */,
DAD77267138EAC4F00D107B8 /* LoginViewControllerDelegate.h */,
+ DA58CB3214EA17F400A2CBAB /* LoginBackgroundViewController.h */,
+ DA58CB3314EA17F400A2CBAB /* LoginBackgroundViewController.m */,
DACD8FD514DDD7B80020A06C /* OpenIDViewController.h */,
DACD8FD614DDD7B80020A06C /* OpenIDViewController.m */,
DA9B290514E88E640093273B /* SSOViewController.h */,
@@ -1209,6 +1214,7 @@
DA3562991476F65200683947 /* DetailIntroViewController.m in Sources */,
DACD8FD714DDD7B80020A06C /* OpenIDViewController.m in Sources */,
DA9B290714E88E650093273B /* SSOViewController.m in Sources */,
+ DA58CB3414EA17F400A2CBAB /* LoginBackgroundViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1355,7 +1361,7 @@
"\"$(SRCROOT)/GAnalytics\"",
);
PRODUCT_NAME = iFixit;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "DA1FC9DB-4286-415A-BC2A-8CA9EC1197F6";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "93BA536F-E5EF-4345-90AE-F3BBDD665B95";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Ad-Hoc";
Please sign in to comment.
Something went wrong with that request. Please try again.