From 4d4c38e55607ac8ee2819ff904834d5a9b8fa922 Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Tue, 14 May 2013 21:33:49 -0700 Subject: Avoid fetching attachment when the full message has already been fetched --- example/mac/macExample/macExample/MCTMsgViewController.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'example') diff --git a/example/mac/macExample/macExample/MCTMsgViewController.m b/example/mac/macExample/macExample/MCTMsgViewController.m index e0205867..421f9bcf 100644 --- a/example/mac/macExample/macExample/MCTMsgViewController.m +++ b/example/mac/macExample/macExample/MCTMsgViewController.m @@ -175,8 +175,14 @@ typedef void (^DownloadCallback)(NSError * error); - (NSData *) MCOMessageView:(MCOMessageView *)view dataForPartWithUniqueID:(NSString *)partUniqueID { - NSData * data = [_storage objectForKey:partUniqueID]; - return data; + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FetchFullMessageEnabled"]) { + MCOAttachment * attachment = (MCOAttachment *) [[_messageView message] partForUniqueID:partUniqueID]; + return [attachment data]; + } + else { + NSData * data = [_storage objectForKey:partUniqueID]; + return data; + } } - (void) MCOMessageView:(MCOMessageView *)view fetchDataForPartWithUniqueID:(NSString *)partUniqueID -- cgit v1.2.3