Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change-Id: I66df10ea12ede4eeb7c7bfd8799561febfdfa4c2
  • Loading branch information
everic committed Jan 29, 2015
1 parent 136b462 commit 869b21e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion evernote-sdk-ios/ENSDK/Private/ENOAuthAuthenticator.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ @interface ENOAuthAuthenticator () <ENOAuthViewControllerDelegate, ENLoadingView
@property (nonatomic, copy) NSString * tokenSecret;
@property (nonatomic, assign) BOOL isMultitaskLoginDisabled;
@property (nonatomic, assign) BOOL isSwitchingInProgress;
@property (nonatomic, assign) BOOL isActiveBecauseOfCallback;

@property (nonatomic, assign) BOOL userSelectedLinkedAppNotebook;

Expand Down Expand Up @@ -314,7 +315,8 @@ - (void)handleDidBecomeActive{

if (state == ENOAuthAuthenticatorStateLoggedOut ||
state == ENOAuthAuthenticatorStateAuthenticated ||
state == ENOAuthAuthenticatorStateGotCallback) {
state == ENOAuthAuthenticatorStateGotCallback ||
self.isActiveBecauseOfCallback) {
return;
}
[self gotCallbackURL:nil];
Expand Down Expand Up @@ -646,11 +648,21 @@ - (BOOL)handleOpenURL:(NSURL *)url {
// Check if we need to switch profiles
else if ([hostName isEqualToString:[url scheme]] == YES
&& [@"incorrectProfile" isEqualToString:[url host]] == YES) {
[self enableIsActiveBecauseOfCallback];
return [self canHandleSwitchProfileURL:url];
}
return canHandle;
}

- (void)enableIsActiveBecauseOfCallback {
self.isActiveBecauseOfCallback = YES;
[self performSelector:@selector(disableIsActiveBecauseOfCallback) withObject:nil afterDelay:2.0];
}

- (void)disableIsActiveBecauseOfCallback {
self.isActiveBecauseOfCallback = NO;
}

- (BOOL) canHandleSwitchProfileURL:(NSURL *)url {
NSString *requestURL = [url path];
NSArray *components = [requestURL componentsSeparatedByString:@"/"];
Expand Down

0 comments on commit 869b21e

Please sign in to comment.