add URL for HockeyApps identification site to public interface

This commit is contained in:
Stephan Diederich 2013-09-24 22:33:22 +02:00
parent b22a42101e
commit 4f4ed09cd4
2 changed files with 14 additions and 2 deletions

View File

@ -220,6 +220,12 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
*/ */
@property (nonatomic, strong) NSURL *webpageURL; @property (nonatomic, strong) NSURL *webpageURL;
/**
* URL to query the device's id via external webpage
* Built with the baseURL set in `webpageURL`.
*/
- (NSURL*) deviceAuthenticationURL;
/** /**
* The url-scheme used to idenfify via `BITAuthenticatorIdentificationTypeDevice` * The url-scheme used to idenfify via `BITAuthenticatorIdentificationTypeDevice`
* *

View File

@ -479,9 +479,15 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
return authToken; return authToken;
} }
- (NSURL *)deviceAuthenticationURL {
return [self.webpageURL URLByAppendingPathComponent:[NSString stringWithFormat:@"apps/%@/authorize", self.encodedAppIdentifier]];
}
- (void)authenticationViewControllerDidTapWebButton:(UIViewController *)viewController { - (void)authenticationViewControllerDidTapWebButton:(UIViewController *)viewController {
NSURL *hockeyWebbasedLoginURL = [self.webpageURL URLByAppendingPathComponent:[NSString stringWithFormat:@"apps/%@/authorize", self.encodedAppIdentifier]]; NSURL *url = [self deviceAuthenticationURL];
[[UIApplication sharedApplication] openURL:hockeyWebbasedLoginURL]; if(url) {
[[UIApplication sharedApplication] openURL:url];
}
} }
- (BOOL) handleOpenURL:(NSURL *) url - (BOOL) handleOpenURL:(NSURL *) url