diff options
Diffstat (limited to 'example/ios/iOS UI Test/iOS UI Test/MasterViewController.m')
-rw-r--r-- | example/ios/iOS UI Test/iOS UI Test/MasterViewController.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m index 7a76efa7..bc8fbbbe 100644 --- a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m +++ b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m @@ -16,6 +16,7 @@ } @property (nonatomic, strong) MCOIMAPOperation *imapCheckOp; @property (nonatomic, strong) MCOIMAPSession *imapSession; +@property (nonatomic, strong) MCOIMAPFetchMessagesOperation *imapMessagesFetchOp; @end @implementation MasterViewController @@ -33,6 +34,37 @@ self.imapSession.username = username; self.imapSession.password = password; self.imapSession.connectionType = MCOConnectionTypeTLS; + + NSLog(@"checking account"); + __weak MasterViewController *weakSelf = self; + self.imapCheckOp = [self.imapSession checkAccountOperation]; + [self.imapCheckOp start:^(NSError *error) { + MasterViewController *strongSelf = weakSelf; + NSLog(@"finished checking account."); + if (error == nil) { + [strongSelf loadEmails]; + } else { + NSLog(@"error loading account: %@", error); + } + + strongSelf.imapCheckOp = nil; + }]; +} + +- (void)loadEmails { + MCOIMAPMessagesRequestKind requestKind = (MCOIMAPMessagesRequestKind) + (MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure | + MCOIMAPMessagesRequestKindInternalDate | MCOIMAPMessagesRequestKindHeaderSubject | + MCOIMAPMessagesRequestKindFlags); + self.imapMessagesFetchOp = [self.imapSession fetchMessagesByUIDOperationWithFolder:@"INBOX" + requestKind:requestKind + uids:[MCOIndexSet indexSetWithRange:MCORangeMake(1, UINT64_MAX)]]; + [self.imapMessagesFetchOp setProgress:^(unsigned int progress) { + NSLog(@"progress: %u", progress); + }]; + [self.imapMessagesFetchOp start:^(NSError *error, NSArray *messages, MCOIndexSet *vanishedMessages) { + NSLog(@"DONE"); + }]; } - (void)didReceiveMemoryWarning { |