diff --git a/Classes/BITAuthenticationViewController.h b/Classes/BITAuthenticationViewController.h index d84c6ddb03..f359c2df8d 100644 --- a/Classes/BITAuthenticationViewController.h +++ b/Classes/BITAuthenticationViewController.h @@ -31,11 +31,11 @@ */ @property (nonatomic, assign) BOOL requirePassword; -/** configure if user can abort authentication or not +/** configure if user can skip authentication or not * * defaults to YES */ -@property (nonatomic, assign) BOOL showsCancelButton; +@property (nonatomic, assign) BOOL showsSkipButton; @property (nonatomic, weak) id delegate; @@ -44,11 +44,11 @@ @protocol BITAuthenticationViewControllerDelegate /** - * called then the user cancelled + * called then the user skipped the auth-dialgo * * @param viewController the delegating viewcontroller */ -- (void) authenticationViewControllerDidCancel:(UIViewController*) viewController; +- (void) authenticationViewControllerDidSkip:(UIViewController*) viewController; - (void) authenticationViewControllerDidTapWebButton:(UIViewController*) viewController; diff --git a/Classes/BITAuthenticationViewController.m b/Classes/BITAuthenticationViewController.m index 7af3114653..a740b5266a 100644 --- a/Classes/BITAuthenticationViewController.m +++ b/Classes/BITAuthenticationViewController.m @@ -28,7 +28,7 @@ if (self) { self.title = BITHockeyLocalizedString(@"HockeyAuthenticatorViewControllerTitle"); _delegate = delegate; - _showsCancelButton = YES; + _showsSkipButton = YES; } return self; } @@ -49,7 +49,7 @@ _statusBarStyle = [[UIApplication sharedApplication] statusBarStyle]; [[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque]; - [self updateCancelButton]; + [self updateSkipButton]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self @@ -65,18 +65,19 @@ } #pragma mark - Property overrides -- (void)setShowsCancelButton:(BOOL)showsCancelButton { - if(_showsCancelButton != showsCancelButton) { - _showsCancelButton = showsCancelButton; - [self updateCancelButton]; +- (void)setShowsSkipButton:(BOOL)showsSkipButton { + if(_showsSkipButton != showsSkipButton) { + _showsSkipButton = showsSkipButton; + [self updateSkipButton]; } } -- (void) updateCancelButton { - if(self.showsCancelButton) { - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self - action:@selector(dismissAction:)]; +- (void) updateSkipButton { + if(self.showsSkipButton) { + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BITHockeyLocalizedString(@"Skip") + style:UIBarButtonItemStyleBordered + target:self + action:@selector(dismissAction:)]; } else { self.navigationItem.leftBarButtonItem = nil; } @@ -264,7 +265,7 @@ #pragma mark - Actions - (void)dismissAction:(id)sender { - [self.delegate authenticationViewControllerDidCancel:self]; + [self.delegate authenticationViewControllerDidSkip:self]; } - (void)saveAction:(id)sender { diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 9b2e224fc3..cf7b6a6fbb 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -17,6 +17,7 @@ static NSString* const kBITAuthenticatorAuthTokenKey = @"BITAuthenticatorAuthTokenKey"; static NSString* const kBITAuthenticatorAuthTokenVendorIdentifierKey = @"BITAuthenticatorAuthTokenVendorIdentifierKey"; static NSString* const kBITAuthenticatorLastAuthenticatedVersionKey = @"BITAuthenticatorLastAuthenticatedVersionKey"; +static NSString* const kBITAuthenticatorDidSkipOptionalLogin = @"BITAuthenticatorDidSkipOptionalLogin"; @implementation BITAuthenticator { id _appDidBecomeActiveObserver; @@ -214,11 +215,11 @@ static NSString* const kBITAuthenticatorLastAuthenticatedVersionKey = @"BITAuthe switch (self.validationType) { case BITAuthenticatorValidationTypeNever: case BITAuthenticatorValidationTypeOptional: - viewController.showsCancelButton = YES; + viewController.showsSkipButton = YES; break; case BITAuthenticatorValidationTypeOnAppActive: case BITAuthenticatorValidationTypeOnFirstLaunch: - viewController.showsCancelButton = NO; + viewController.showsSkipButton = NO; break; } @@ -245,7 +246,7 @@ static NSString* const kBITAuthenticatorLastAuthenticatedVersionKey = @"BITAuthe } } #pragma mark - AuthenticationViewControllerDelegate -- (void) authenticationViewControllerDidCancel:(UIViewController*) viewController { +- (void) authenticationViewControllerDidSkip:(UIViewController *)viewController { [viewController dismissModalViewControllerAnimated:YES]; _authenticationController = nil; diff --git a/Support/HockeySDKTests/BITAuthenticatorTests.m b/Support/HockeySDKTests/BITAuthenticatorTests.m index 1303481a01..b054f5010f 100644 --- a/Support/HockeySDKTests/BITAuthenticatorTests.m +++ b/Support/HockeySDKTests/BITAuthenticatorTests.m @@ -200,7 +200,7 @@ static void *kInstallationIdentification = &kInstallationIdentification; }]; //fake delegate call from the viewcontroller - [_sut authenticationViewControllerDidCancel:nil]; + [_sut authenticationViewControllerDidSkip:nil]; assertThatBool(didAuthenticateCalled, equalToBool(YES)); assertThat(authenticationError, equalTo([NSError errorWithDomain:kBITAuthenticatorErrorDomain @@ -216,7 +216,7 @@ static void *kInstallationIdentification = &kInstallationIdentification; //this will prepare everything and show the viewcontroller [_sut authenticateWithCompletion:nil]; //fake delegate call from the viewcontroller - [_sut authenticationViewControllerDidCancel:nil]; + [_sut authenticationViewControllerDidSkip:nil]; assertThat(_sut.authenticationToken, equalTo(nil)); } @@ -230,7 +230,7 @@ static void *kInstallationIdentification = &kInstallationIdentification; context:kInstallationIdentification]; //fake delegate call from the viewcontroller - [_sut authenticationViewControllerDidCancel:nil]; + [_sut authenticationViewControllerDidSkip:nil]; assertThatBool(_KVOCalled, equalToBool(YES)); [_sut removeObserver:self forKeyPath:@"installationIdentification"]; }