Created
November 8, 2012 23:10
-
-
Save sonsongithub/4042482 to your computer and use it in GitHub Desktop.
Patch for evernote-sdk-ios(391ca643c5b1cd02e9fa869a6b0760436ea452ed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Common subdirectories: ./evernote-sdk-ios/3rdParty and ./Evernote/3rdParty | |
Common subdirectories: ./evernote-sdk-ios/EDAM and ./Evernote/EDAM | |
diff -c ./evernote-sdk-ios/EvernoteSession.h ./Evernote/EvernoteSession.h | |
*** ./evernote-sdk-ios/EvernoteSession.h 2012-09-05 21:47:00.000000000 +0900 | |
--- ./Evernote/EvernoteSession.h 2012-11-08 06:07:05.000000000 +0900 | |
*************** | |
*** 66,71 **** | |
--- 66,74 ---- | |
// Shared dispatch queue for API operations. | |
@property (nonatomic, readonly) dispatch_queue_t queue; | |
+ // View controller for authenticating with web browser | |
+ @property (nonatomic, strong) UIViewController *ownAuthenticationViewController; | |
+ | |
// Set up the shared session. | |
// @"sandbox.evernote.com" should be used for testing; | |
// @"www.evernote.com" for production apps. | |
diff -c ./evernote-sdk-ios/EvernoteSession.m ./Evernote/EvernoteSession.m | |
*** ./evernote-sdk-ios/EvernoteSession.m 2012-09-05 21:47:00.000000000 +0900 | |
--- ./Evernote/EvernoteSession.m 2012-11-09 05:49:03.000000000 +0900 | |
*************** | |
*** 331,337 **** | |
--- 331,341 ---- | |
- (BOOL)handleOpenURL:(NSURL *)url | |
{ | |
+ #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 | |
+ [self.ownAuthenticationViewController dismissViewControllerAnimated:YES completion:nil]; | |
+ #else | |
[self.viewController dismissModalViewControllerAnimated:YES]; | |
+ #endif | |
// only handle our specific oauth_callback URLs | |
if (![[url absoluteString] hasPrefix:[self oauthCallback]]) { | |
*************** | |
*** 456,468 **** | |
delegate:self] autorelease]; | |
UINavigationController *oauthNavController = [[[UINavigationController alloc] initWithRootViewController:oauthViewController] autorelease]; | |
// use a formsheet on iPad | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
oauthViewController.modalPresentationStyle = UIModalPresentationFormSheet; | |
oauthNavController.modalPresentationStyle = UIModalPresentationFormSheet; | |
} | |
! | |
[self.viewController presentModalViewController:oauthNavController animated:YES]; | |
} | |
- (void)saveCredentialsWithEdamUserId:(NSString *)edamUserId | |
--- 460,477 ---- | |
delegate:self] autorelease]; | |
UINavigationController *oauthNavController = [[[UINavigationController alloc] initWithRootViewController:oauthViewController] autorelease]; | |
+ self.ownAuthenticationViewController = oauthViewController; | |
+ | |
// use a formsheet on iPad | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
oauthViewController.modalPresentationStyle = UIModalPresentationFormSheet; | |
oauthNavController.modalPresentationStyle = UIModalPresentationFormSheet; | |
} | |
! #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 | |
! [self.viewController presentViewController:oauthNavController animated:YES completion:nil]; | |
! #else | |
[self.viewController presentModalViewController:oauthNavController animated:YES]; | |
+ #endif | |
} | |
- (void)saveCredentialsWithEdamUserId:(NSString *)edamUserId | |
*************** | |
*** 520,539 **** | |
- (void)oauthViewControllerDidCancel:(ENOAuthViewController *)sender | |
{ | |
! [self.viewController dismissModalViewControllerAnimated:YES]; | |
[self completeAuthenticationWithError:nil]; | |
} | |
- (void)oauthViewController:(ENOAuthViewController *)sender didFailWithError:(NSError *)error | |
{ | |
[self.viewController dismissModalViewControllerAnimated:YES]; | |
[self completeAuthenticationWithError:error]; | |
} | |
- (void)oauthViewController:(ENOAuthViewController *)sender receivedOAuthCallbackURL:(NSURL *)url | |
{ | |
[self.viewController dismissModalViewControllerAnimated:YES]; | |
! | |
// OAuth step 3: got authorization from the user, now get a real token. | |
NSDictionary *parameters = [EvernoteSession parametersFromQueryString:url.query]; | |
NSString *oauthToken = [parameters objectForKey:@"oauth_token"]; | |
--- 529,559 ---- | |
- (void)oauthViewControllerDidCancel:(ENOAuthViewController *)sender | |
{ | |
! #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 | |
! [self.ownAuthenticationViewController dismissViewControllerAnimated:YES completion:nil]; | |
! #else | |
! [self.viewController dismissModalViewControllerAnimated:YES]; | |
! #endif | |
[self completeAuthenticationWithError:nil]; | |
} | |
- (void)oauthViewController:(ENOAuthViewController *)sender didFailWithError:(NSError *)error | |
{ | |
+ #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 | |
+ [self.ownAuthenticationViewController dismissViewControllerAnimated:YES completion:nil]; | |
+ #else | |
[self.viewController dismissModalViewControllerAnimated:YES]; | |
+ #endif | |
[self completeAuthenticationWithError:error]; | |
} | |
- (void)oauthViewController:(ENOAuthViewController *)sender receivedOAuthCallbackURL:(NSURL *)url | |
{ | |
+ #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 | |
+ [self.ownAuthenticationViewController dismissViewControllerAnimated:YES completion:nil]; | |
+ #else | |
[self.viewController dismissModalViewControllerAnimated:YES]; | |
! #endif | |
// OAuth step 3: got authorization from the user, now get a real token. | |
NSDictionary *parameters = [EvernoteSession parametersFromQueryString:url.query]; | |
NSString *oauthToken = [parameters objectForKey:@"oauth_token"]; | |
Common subdirectories: ./evernote-sdk-ios/internal and ./Evernote/internal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment