let authenticator set the description of the viewController

This commit is contained in:
Stephan Diederich
2013-10-08 23:04:09 +02:00
parent 82cc66c454
commit ddaab3246c
3 changed files with 18 additions and 7 deletions

View File

@@ -47,6 +47,12 @@
*/
@property (nonatomic, assign) BOOL showsLoginViaWebButton;
/**
* Description shown on top of view. Should tell why this view
* was presented and what's next.
*/
@property (nonatomic, copy) NSString* tableViewTitle;
/**
* can be set to YES to also require the users password
*

View File

@@ -142,6 +142,13 @@
_emailField.text = email;
}
}
- (void)setTableViewTitle:(NSString *)viewDescription {
_tableViewTitle = [viewDescription copy];
if(self.isViewLoaded) {
[self.tableView reloadData];
}
}
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
@@ -181,13 +188,7 @@
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
if (section == 0) {
if(self.showsLoginViaWebButton) {
return BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerWebLoginDescription");
} else if(self.requirePassword) {
return BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerDataEmailAndPasswordDescription");
} else {
return BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerDataEmailDescription");
}
return self.tableViewTitle;
}
return nil;

View File

@@ -172,11 +172,14 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
case BITAuthenticatorIdentificationTypeHockeyAppUser:
viewController = [[BITAuthenticationViewController alloc] initWithDelegate:self];
viewController.requirePassword = YES;
viewController.tableViewTitle = BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerDataEmailAndPasswordDescription");
break;
case BITAuthenticatorIdentificationTypeDevice:
viewController = [[BITAuthenticationViewController alloc] initWithDelegate:self];
viewController.requirePassword = NO;
viewController.showsLoginViaWebButton = YES;
viewController.tableViewTitle = BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerWebLoginDescription");
break;
break;
case BITAuthenticatorIdentificationTypeHockeyAppEmail:
if(nil == self.authenticationSecret) {
@@ -188,6 +191,7 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
}
viewController = [[BITAuthenticationViewController alloc] initWithDelegate:self];
viewController.requirePassword = NO;
viewController.tableViewTitle = BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerDataEmailDescription");
break;
}