aboutsummaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-05-14 21:33:49 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-05-14 21:33:49 -0700
commit4d4c38e55607ac8ee2819ff904834d5a9b8fa922 (patch)
treee7bef79bb23c4e0f7857338ac1d9d7bef416845f /example
parent703fd9afbc160b62fc77c276d350be5677f071bf (diff)
Avoid fetching attachment when the full message has already been fetched
Diffstat (limited to 'example')
-rw-r--r--example/mac/macExample/macExample/MCTMsgViewController.m10
1 files changed, 8 insertions, 2 deletions
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