redo BITAuthenticator interface

given the good feedback we got, this is take 2
of the BITAuthenticator interface.
It's simplified, cleaned up and now allows full
control over the authentication process.
Major changes:
* manual mode
  Authenticator provides the bits to show the
  viewController to identify the user as well as to
  trigger validation on behalf of the developer.
* process separation
  identification and app-usage-restriction are now
  2 completely separated things.
* public identifier
  Authenticator now allows the developer to query
  parts of the information, e.g. the UDID or the user's
  emailaddy once identified
This commit is contained in:
Stephan Diederich
2013-09-23 23:15:56 +02:00
parent 5ac00ff174
commit c2c6558687
10 changed files with 618 additions and 833 deletions

View File

@@ -34,9 +34,9 @@
@interface BITAuthenticationViewController ()<UITextFieldDelegate> {
UIStatusBarStyle _statusBarStyle;
__weak UITextField *_emailField;
}
@property (nonatomic, copy) NSString *email;
@property (nonatomic, copy) NSString *password;
@end
@@ -48,7 +48,6 @@
if (self) {
self.title = BITHockeyLocalizedString(@"HockeyAuthenticatorViewControllerTitle");
_delegate = delegate;
_showsSkipButton = YES;
}
return self;
}
@@ -85,22 +84,8 @@
}
#pragma mark - Property overrides
- (void)setShowsSkipButton:(BOOL)showsSkipButton {
if(_showsSkipButton != showsSkipButton) {
_showsSkipButton = showsSkipButton;
[self updateBarButtons];
}
}
- (void) updateBarButtons {
if(self.showsSkipButton) {
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BITHockeyLocalizedString(@"Skip")
style:UIBarButtonItemStyleBordered
target:self
action:@selector(dismissAction:)];
} else {
self.navigationItem.leftBarButtonItem = nil;
}
if(self.showsLoginViaWebButton) {
self.navigationItem.rightBarButtonItem = nil;
} else {
@@ -149,6 +134,13 @@
- (IBAction) handleWebLoginButton:(id)sender {
[self.delegate authenticationViewControllerDidTapWebButton:self];
}
- (void)setEmail:(NSString *)email {
_email = email;
if(self.isViewLoaded) {
_emailField.text = email;
}
}
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
@@ -222,6 +214,7 @@
if (0 == [indexPath row]) {
textField.placeholder = BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerEmailPlaceholder");
textField.text = self.email;
_emailField = textField;
textField.keyboardType = UIKeyboardTypeEmailAddress;
if ([self requirePassword])
@@ -296,10 +289,6 @@
}
#pragma mark - Actions
- (void)dismissAction:(id)sender {
[self.delegate authenticationViewControllerDidSkip:self];
}
- (void)saveAction:(id)sender {
[self setLoginUIEnabled:NO];