mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
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:
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user