From 462c56ef38a11d2ddfd8eb6b3fbf0e529444929d Mon Sep 17 00:00:00 2001 From: Jeevanandam M Date: Fri, 12 Sep 2014 10:45:53 -0700 Subject: [PATCH] #68 - addressing strange behaviour caused by Yosemite support implementation --- .../xcschemes/ReplyWithHeader.xcscheme | 3 ++ ReplyWithHeader/MHQuotedMailOriginal.m | 42 ++++++++++++++++--- .../Resources/en.lproj/MailHeader-Info.plist | 4 +- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/ReplyWithHeader.xcodeproj/xcshareddata/xcschemes/ReplyWithHeader.xcscheme b/ReplyWithHeader.xcodeproj/xcshareddata/xcschemes/ReplyWithHeader.xcscheme index 3b78e17..1ffdd9b 100644 --- a/ReplyWithHeader.xcodeproj/xcshareddata/xcschemes/ReplyWithHeader.xcscheme +++ b/ReplyWithHeader.xcodeproj/xcshareddata/xcschemes/ReplyWithHeader.xcscheme @@ -39,6 +39,9 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> + + = 0 ) + if (textNodeLocation >= 0) { if (isBlockquotePresent) // include inside blockquote { - DOMNode *nodeRef = [self getElementByName:TAG_BLOCKQUOTE]; + DOMNode *nodeRef = [self getBlockquoteTagNode]; [nodeRef insertBefore:headerFragment refChild:[nodeRef firstChild]]; [nodeRef insertBefore:headerBorder refChild:[nodeRef firstChild]]; } @@ -164,7 +164,7 @@ - (id)initWithMailMessage:(id)mailMessage msgComposeType:(int)composeType dhc = [originalEmail childNodes]; //identifying blockquote tag - isBlockquotePresent = [self isTagPresent:TAG_BLOCKQUOTE]; + isBlockquotePresent = [self isBlockquoteTagPresent]; //[self isTagPresent:TAG_BLOCKQUOTE]; //now get the quoted content and remove the first part (where it says "On ... X wrote" // "... message" @@ -295,7 +295,7 @@ - (void)removeHTMLHeaderPrefix while ( textRange.location == NSNotFound ) { - [emailDocument removeChild:[nodeList item:0]]; + [emailDocument removeChild:[emailDocument firstChild]]; textRange = [[[emailDocument firstChild] stringValue] rangeOfString:searchString]; } } @@ -365,6 +365,38 @@ - (void)prepareQuotedPlainText } } +- (BOOL)isBlockquoteTagPresent +{ + BOOL present = FALSE; + + for (int i=0; i < dhc.length; i++) + { + if ([[[dhc item:i] nodeName] isEqualToString:TAG_BLOCKQUOTE]) + { + present = TRUE; + MHLog(@"%@ Node found at %d", TAG_BLOCKQUOTE, i); + break; + } + } + + return present; +} + +- (DOMNode *)getBlockquoteTagNode +{ + MHLog(@"No of child nodes: %d", dhc.length); + for (int i=0; i < dhc.length; i++) + { + if ([[[dhc item:i] nodeName] isEqualToString:TAG_BLOCKQUOTE]) + { + MHLog(@"getBlockquoteTagNode:: %@ Node found at %d", TAG_BLOCKQUOTE, i); + return [dhc item:i]; + } + } + + return nil; +} + - (BOOL)isTagPresent:(NSString *)tagName { BOOL tag = FALSE; diff --git a/ReplyWithHeader/Resources/en.lproj/MailHeader-Info.plist b/ReplyWithHeader/Resources/en.lproj/MailHeader-Info.plist index d35110f..7f73dcc 100644 --- a/ReplyWithHeader/Resources/en.lproj/MailHeader-Info.plist +++ b/ReplyWithHeader/Resources/en.lproj/MailHeader-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 4.6 + 4.7 CFBundleSignature ???? CFBundleVersion - 4.6 + 4.7 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} MHAppCastURL