adding in new flow for the login page

This commit is contained in:
Roy Yang 2012-06-13 12:19:35 -07:00
parent a70b95d56f
commit f4253d2be6
15 changed files with 1109 additions and 530 deletions

View file

@ -36,12 +36,24 @@
- (void)checkPassword;
- (void)registerAccount;
- (IBAction)selectLoginSignup;
- (IBAction)selectSignUp;
- (IBAction)selectLogin;
- (void)animateLoop;
@property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (nonatomic, retain) IBOutlet UITextField *usernameInput;
@property (nonatomic, retain) IBOutlet UITextField *passwordInput;
@property (nonatomic, retain) IBOutlet UITextField *emailInput;
@property (retain, nonatomic) IBOutlet UITextField *signUpUsernameInput;
@property (retain, nonatomic) IBOutlet UITextField *signUpPasswordInput;
@property (retain, nonatomic) IBOutlet UIButton *selectSignUpButton;
@property (retain, nonatomic) IBOutlet UIButton *selectLoginButton;
@property (retain, nonatomic) IBOutlet UIView *signUpView;
@property (retain, nonatomic) IBOutlet UIView *logInView;
@property (nonatomic, retain) NSMutableData * jsonString;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;

View file

@ -11,6 +11,7 @@
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"
#import "JSON.h"
#import <QuartzCore/QuartzCore.h>
@implementation LoginViewController
@ -18,6 +19,12 @@
@synthesize usernameInput;
@synthesize passwordInput;
@synthesize emailInput;
@synthesize signUpUsernameInput;
@synthesize signUpPasswordInput;
@synthesize selectSignUpButton;
@synthesize selectLoginButton;
@synthesize signUpView;
@synthesize logInView;
@synthesize jsonString;
@synthesize activityIndicator;
@synthesize authenticatingLabel;
@ -35,16 +42,45 @@
[appDelegate hideNavigationBar:NO];
}
return self;
}
}
- (void)viewDidLoad {
[usernameInput becomeFirstResponder];
[appDelegate hideNavigationBar:NO];
self.usernameInput.borderStyle = UITextBorderStyleRoundedRect;
self.passwordInput.borderStyle = UITextBorderStyleRoundedRect;
self.emailInput.borderStyle = UITextBorderStyleRoundedRect;
self.signUpPasswordInput.borderStyle = UITextBorderStyleRoundedRect;
self.signUpUsernameInput.borderStyle = UITextBorderStyleRoundedRect;
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
self.signUpView.frame = CGRectMake(134, 180, 500, 300);
self.logInView.frame = CGRectMake(902, 180, 500, 300);
self.selectSignUpButton.frame = CGRectMake(134, 80, 250, 50);
self.selectLoginButton.frame = CGRectMake(384, 80, 250, 50);
} else {
self.signUpView.frame = CGRectMake(134 + 128, 80, 500, 300);
self.logInView.frame = CGRectMake(902 + 128, 80, 500, 300);
self.selectSignUpButton.frame = CGRectMake(134 + 128, 20, 250, 50);
self.selectLoginButton.frame = CGRectMake(384 + 128, 20, 250, 50);
}
[super viewDidLoad];
}
- (void)viewDidUnload {
[self setSignUpView:nil];
[self setLogInView:nil];
[self setSignUpUsernameInput:nil];
[self setSignUpPasswordInput:nil];
[self setSelectSignUpButton:nil];
[self setSelectLoginButton:nil];
[super viewDidUnload];
}
- (void)viewWillAppear:(BOOL)animated {
[self.errorLabel setHidden:YES];
[self.authenticatingLabel setHidden:YES];
@ -70,14 +106,44 @@
// Release any cached data, images, etc that aren't in use.
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)){
self.signUpView.frame = CGRectMake(self.signUpView.frame.origin.x - 128, 180, 500, 300);
self.logInView.frame = CGRectMake(self.logInView.frame.origin.x - 128, 180, 500, 300);
self.selectSignUpButton.frame = CGRectMake(134, 80, 250, 50);
self.selectLoginButton.frame = CGRectMake(384, 80, 250, 50);
}else{
self.signUpView.frame = CGRectMake(self.signUpView.frame.origin.x + 128, 80, 500, 300);
self.logInView.frame = CGRectMake(self.logInView.frame.origin.x + 128, 80, 500, 300);
self.selectSignUpButton.frame = CGRectMake(134 + 128, 20, 250, 50);
self.selectLoginButton.frame = CGRectMake(384 + 128, 20, 250, 50);
}
}
}
- (void)dealloc {
[appDelegate release];
[usernameInput release];
[passwordInput release];
[emailInput release];
[jsonString release];
[signUpView release];
[logInView release];
[signUpUsernameInput release];
[signUpPasswordInput release];
[selectSignUpButton release];
[selectLoginButton release];
[super dealloc];
}
#pragma mark -
#pragma mark Login
@ -202,17 +268,46 @@
[self animateLoop];
}
- (IBAction)selectSignUp {
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
[UIView animateWithDuration:0.35 animations:^{
self.signUpView.frame = CGRectMake(134, 180, 500, 300);
self.logInView.frame = CGRectMake(902, 180, 500, 300);
}];
} else {
[UIView animateWithDuration:0.35 animations:^{
self.signUpView.frame = CGRectMake(134 + 128, 80, 500, 300);
self.logInView.frame = CGRectMake(902 + 128, 80, 500, 300);
}];
}
}
- (IBAction)selectLogin {
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
[UIView animateWithDuration:0.35 animations:^{
self.signUpView.frame = CGRectMake(-634, 180, 500, 300);
self.logInView.frame = CGRectMake(134, 180, 500, 300);
}];
} else {
[UIView animateWithDuration:0.35 animations:^{
self.signUpView.frame = CGRectMake(-634 + 128, 80, 500, 300);
self.logInView.frame = CGRectMake(134 + 128, 80, 500, 300);
}];
}
}
- (void)animateLoop {
if ([self.loginControl selectedSegmentIndex] == 0) {
[UIView animateWithDuration:0.5 animations:^{
// Login
usernameInput.frame = CGRectMake(20, 67, 280, 31);
usernameInput.frame = CGRectMake(186, 388, 400, 44);
usernameOrEmailLabel.alpha = 1.0;
passwordInput.frame = CGRectMake(20, 129, 280, 31);
passwordLabel.frame = CGRectMake(21, 106, 212, 22);
passwordOptionalLabel.frame = CGRectMake(199, 112, 101, 16);
passwordInput.frame = CGRectMake(186, 496, 400, 44);
passwordLabel.frame = CGRectMake(186, 460, 120, 22);
passwordOptionalLabel.frame = CGRectMake(483, 466, 101, 16);
emailInput.alpha = 0.0;
emailLabel.alpha = 0.0;
@ -225,13 +320,13 @@
} else {
[UIView animateWithDuration:0.5 animations:^{
// Signup
usernameInput.frame = CGRectMake(20, 67, 130, 31);
usernameInput.frame = CGRectMake(186, 388, 190, 44);
usernameOrEmailLabel.alpha = 0.0;
passwordInput.frame = CGRectMake(170, 67, 130, 31);
passwordLabel.frame = CGRectMake(171, 44, 212, 22);
passwordOptionalLabel.frame = CGRectMake(199, 50, 101, 16);
passwordInput.frame = CGRectMake(396, 388, 190, 44);
passwordLabel.frame = CGRectMake(396, 353, 120, 22);
passwordOptionalLabel.frame = CGRectMake(483, 359, 101, 16);
emailInput.alpha = 1.0;
emailLabel.alpha = 1.0;
@ -243,5 +338,4 @@
[usernameInput becomeFirstResponder];
}
}
@end

View file

@ -105,7 +105,7 @@
- (void)hideNavigationBar:(BOOL)animated;
- (void)showNavigationBar:(BOOL)animated;
- (void)setTitle:(NSString *)title;
- (void)showOriginalStory:(NSURL *)url;
- (void)showOriginalStory:(NSURL *)url fromOriginalButton:(BOOL)fromOriginalButton;
- (void)closeOriginalStory;
- (int)indexOfNextStory;

View file

@ -142,8 +142,13 @@
#pragma mark Views
- (void)showLogin {
UINavigationController *navController = self.navigationController;
[navController presentModalViewController:loginViewController animated:YES];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.navigationController presentModalViewController:loginViewController animated:YES];
} else {
[self.navigationController presentModalViewController:loginViewController animated:YES];
}
}
- (void)showAdd {
@ -291,7 +296,13 @@
[label release];
}
- (void)showOriginalStory:(NSURL *)url {
- (void)showOriginalStory:(NSURL *)url
fromOriginalButton:(BOOL)fromOriginalButton {
if (fromOriginalButton) {
[MBProgressHUD hideHUDForView:originalStoryViewController.view animated:YES];
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:originalStoryViewController.view animated:YES];
HUD.labelText = @"On its way...";
}
self.activeOriginalStoryURL = url;
UINavigationController *navController = self.navigationController;
[navController presentModalViewController:originalStoryViewController animated:YES];

View file

@ -121,6 +121,7 @@
appDelegate.detailViewController.navigationItem.titleView = nil;
appDelegate.detailViewController.navigationItem.title = @"NewsBlur";
appDelegate.detailViewController.navigationItem.rightBarButtonItem = nil;
}
- (void)viewDidAppear:(BOOL)animated {

View file

@ -184,6 +184,7 @@
}
- (void)webViewDidFinishLoad:(UIWebView *)aWebView
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[self updateButtons];
[self updateTitle:aWebView];

View file

@ -479,7 +479,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
- (void)showOriginalSubview:(id)sender {
NSURL *url = [NSURL URLWithString:[appDelegate.activeStory
objectForKey:@"story_permalink"]];
[appDelegate showOriginalStory:url];
[appDelegate showOriginalStory:url fromOriginalButton: YES];
}
@end

View file

@ -59,6 +59,12 @@
4307BEE41565EDF8007A932A /* warning.png in Resources */ = {isa = PBXBuildFile; fileRef = 4307BE7F1565EDF8007A932A /* warning.png */; };
4307BEE61565EDF8007A932A /* world.png in Resources */ = {isa = PBXBuildFile; fileRef = 4307BE801565EDF8007A932A /* world.png */; };
4307BEFE1565EEBC007A932A /* Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4307BEFD1565EEBC007A932A /* Base64.m */; };
433323B015886FA80025064D /* logo_newsblur.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323AF15886FA80025064D /* logo_newsblur.png */; };
433323B8158901A40025064D /* fountain_pen.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323B6158901A40025064D /* fountain_pen.png */; };
433323B9158901A40025064D /* fountain_pen@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323B7158901A40025064D /* fountain_pen@2x.png */; };
433323BB158901C10025064D /* login_background.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323BA158901C10025064D /* login_background.png */; };
433323BE1589022C0025064D /* user.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323BC1589022C0025064D /* user.png */; };
433323BF1589022C0025064D /* user@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323BD1589022C0025064D /* user@2x.png */; };
433D247E1582EEB400AE9E72 /* AddSiteAutocompleteCell~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 43D045271565BC150085F811 /* AddSiteAutocompleteCell~ipad.xib */; };
433D247F1582EEB900AE9E72 /* AddSiteViewController~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 43D045261565BC150085F811 /* AddSiteViewController~ipad.xib */; };
433D24801582EEBB00AE9E72 /* FeedDetailTableCell~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 43D045231565BC150085F811 /* FeedDetailTableCell~ipad.xib */; };
@ -246,6 +252,12 @@
4307BE801565EDF8007A932A /* world.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = world.png; sourceTree = "<group>"; };
4307BEFC1565EEBC007A932A /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
4307BEFD1565EEBC007A932A /* Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Base64.m; sourceTree = "<group>"; };
433323AF15886FA80025064D /* logo_newsblur.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_newsblur.png; sourceTree = "<group>"; };
433323B6158901A40025064D /* fountain_pen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = fountain_pen.png; sourceTree = "<group>"; };
433323B7158901A40025064D /* fountain_pen@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "fountain_pen@2x.png"; sourceTree = "<group>"; };
433323BA158901C10025064D /* login_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = login_background.png; sourceTree = "<group>"; };
433323BC1589022C0025064D /* user.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = user.png; sourceTree = "<group>"; };
433323BD1589022C0025064D /* user@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "user@2x.png"; sourceTree = "<group>"; };
43B8F018156603170008733D /* AddSiteAutocompleteCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddSiteAutocompleteCell.xib; sourceTree = "<group>"; };
43B8F019156603170008733D /* AddSiteViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddSiteViewController.xib; sourceTree = "<group>"; };
43B8F01A156603170008733D /* FeedDetailTableCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FeedDetailTableCell.xib; sourceTree = "<group>"; };
@ -256,7 +268,7 @@
43B8F01F156603170008733D /* NewsBlurViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NewsBlurViewController.xib; sourceTree = "<group>"; };
43B8F020156603170008733D /* OriginalStoryViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OriginalStoryViewController.xib; sourceTree = "<group>"; };
43B8F021156603170008733D /* StoryDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StoryDetailViewController.xib; sourceTree = "<group>"; };
43C1E63D1583DA3F006874F1 /* SplitStoryDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; name = SplitStoryDetailViewController.h; path = ../SplitStoryDetailViewController.h; sourceTree = "<group>"; };
43C1E63D1583DA3F006874F1 /* SplitStoryDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SplitStoryDetailViewController.h; path = ../SplitStoryDetailViewController.h; sourceTree = "<group>"; };
43C1E63E1583DA3F006874F1 /* SplitStoryDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SplitStoryDetailViewController.m; path = ../SplitStoryDetailViewController.m; sourceTree = "<group>"; };
43C1E63F1583DA3F006874F1 /* SplitStoryDetailViewController~ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "SplitStoryDetailViewController~ipad.xib"; sourceTree = "<group>"; };
43D0451F1565BC150085F811 /* MainWindow~ipad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow~ipad.xib"; path = "Resources-iPad/MainWindow~ipad.xib"; sourceTree = "<group>"; };
@ -669,6 +681,19 @@
path = Resources;
sourceTree = "<group>";
};
433323B5158901A40025064D /* Images */ = {
isa = PBXGroup;
children = (
433323BC1589022C0025064D /* user.png */,
433323BD1589022C0025064D /* user@2x.png */,
433323BA158901C10025064D /* login_background.png */,
433323B6158901A40025064D /* fountain_pen.png */,
433323B7158901A40025064D /* fountain_pen@2x.png */,
);
name = Images;
path = "Resources-iPad/Images";
sourceTree = "<group>";
};
43B8F017156603170008733D /* Resources-iPhone */ = {
isa = PBXGroup;
children = (
@ -689,6 +714,8 @@
43D0451C1565BC090085F811 /* Resources-iPad */ = {
isa = PBXGroup;
children = (
433323B5158901A40025064D /* Images */,
433323AF15886FA80025064D /* logo_newsblur.png */,
43D045271565BC150085F811 /* AddSiteAutocompleteCell~ipad.xib */,
43D045261565BC150085F811 /* AddSiteViewController~ipad.xib */,
43D045231565BC150085F811 /* FeedDetailTableCell~ipad.xib */,
@ -1225,6 +1252,12 @@
433D24861582EECA00AE9E72 /* OriginalStoryViewController~ipad.xib in Resources */,
433D24871582EECD00AE9E72 /* StoryDetailViewController~ipad.xib in Resources */,
43C1E6411583DA3F006874F1 /* SplitStoryDetailViewController~ipad.xib in Resources */,
433323B015886FA80025064D /* logo_newsblur.png in Resources */,
433323B8158901A40025064D /* fountain_pen.png in Resources */,
433323B9158901A40025064D /* fountain_pen@2x.png in Resources */,
433323BB158901C10025064D /* login_background.png in Resources */,
433323BE1589022C0025064D /* user.png in Resources */,
433323BF1589022C0025064D /* user@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB