diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index c70b01238b..423131b9d6 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -110,23 +110,7 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut [self identifyWithCompletion:^(BOOL identified, NSError *error) { if(identified) { if([self needsValidation]) { - [self validateWithCompletion:^(BOOL validated, NSError *error) { - if(validated) { - [_authenticationController dismissViewControllerAnimated:YES completion:nil]; - _authenticationController = nil; - } else { - [self storeInstallationIdentifier:nil withType:self.identificationType]; - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:error.localizedDescription - delegate:nil - cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK") - otherButtonTitles:nil]; - [alertView show]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self authenticate]; - }); - } - }]; + [self validate]; } else { [_authenticationController dismissViewControllerAnimated:YES completion:nil]; _authenticationController = nil; @@ -219,6 +203,23 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut } #pragma mark - Validation + +- (void) validate { + [self validateWithCompletion:^(BOOL validated, NSError *error) { + if(validated) { + [_authenticationController dismissViewControllerAnimated:YES completion:nil]; + _authenticationController = nil; + } else { + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil + message:error.localizedDescription + delegate:self + cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK") + otherButtonTitles:nil]; + [alertView show]; + } + }]; +} + - (void) validateWithCompletion:(void (^)(BOOL validated, NSError *))completion { BOOL requirementsFulfilled = YES; NSError *error = nil; @@ -695,4 +696,9 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut self.validated = NO; } } + +#pragma mark - UIAlertViewDelegate +- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { + [self validate]; +} @end diff --git a/Classes/BITAuthenticator_Private.h b/Classes/BITAuthenticator_Private.h index 36f87fff52..38c0ef6c39 100644 --- a/Classes/BITAuthenticator_Private.h +++ b/Classes/BITAuthenticator_Private.h @@ -35,7 +35,7 @@ #import "BITAuthenticationViewController.h" @class BITHockeyAppClient; -@interface BITAuthenticator () +@interface BITAuthenticator () /** * must be set