diff --git a/evernote-sdk-ios/ENSDK/ENSession.h b/evernote-sdk-ios/ENSDK/ENSession.h index c9c221a..9267de5 100644 --- a/evernote-sdk-ios/ENSDK/ENSession.h +++ b/evernote-sdk-ios/ENSDK/ENSession.h @@ -415,4 +415,15 @@ typedef NS_OPTIONS(NSUInteger, ENSessionSortOrder) { */ - (BOOL)viewNoteInEvernote:(ENNoteRef *)noteRef; +/** + * View this note in the Evernote app and call callbackURL when done + * + * @param noteRef The note to view + * @param callbackURL callback URL to open after done with the note, something like YOURAPP_URL_SCHEME://callback + * + * @return No means the Evernote app is not installed or not available. Yes does not guarantee that this note is successfuly opened, + * as the user could have logged into another account in the Evernote app. + */ +- (BOOL)viewNoteInEvernote:(ENNoteRef *)noteRef callbackURL:(NSString *)callbackURL; + @end diff --git a/evernote-sdk-ios/ENSDK/ENSession.m b/evernote-sdk-ios/ENSDK/ENSession.m index b11c8a2..43226a7 100644 --- a/evernote-sdk-ios/ENSDK/ENSession.m +++ b/evernote-sdk-ios/ENSDK/ENSession.m @@ -1614,6 +1614,15 @@ - (BOOL)viewNoteInEvernote:(ENNoteRef *)noteRef { return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:viewNoteURLScheme]]; } +- (BOOL)viewNoteInEvernote:(ENNoteRef *)noteRef callbackURL:(NSString *)callbackURL { + if (IsEvernoteInstalled() == NO) { + return NO; + } + + NSString *viewNoteURLScheme = [NSString stringWithFormat:@"evernote:///view/%d/%@/%@/%@/?callback=%@", self.userID, [self shardIdForNoteRef:noteRef], noteRef.guid, noteRef.guid, [callbackURL en_stringByUrlEncoding]]; + return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:viewNoteURLScheme]]; +} + #pragma mark - Private routines #pragma mark - API helpers