Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSNumber *)maxServerResultCount {
- return @(200);
- }
- - (void)updateCallRecordsInternal
- {
- LogMethodName();
- self.regetHistoryRequired = NO;
- self.updatingHistoryNow = YES;
- [self fireWsMethodRequested];
- NSNumber *minMasterId = self.maxMasterId;
- [self.webService fetchRecentActivityWithTypes:@"VOICE"
- minMasterID:minMasterId
- quantity:self.maxServerResultCount
- compressRecentActivityList:YES
- completion:^(WSMethodCompletionStatus completionStatus, id result)
- {
- @synchronized (self) {
- self.updatingHistoryNow = NO;
- }
- if (completionStatus == WSMethodCompletionStatusOk) {
- WSFetchRecentActivityResult *recentActivityResult = result;
- NSLog(@"---> Server Records count: %d", recentActivityResult.recentActivity.count);
- NSLog(@"-->Last record:\n -->%@", recentActivityResult.recentActivity.lastObject);
- [self addAllRecentActivityRecords:recentActivityResult.recentActivity];
- //Continue to loading records until count of received records
- //lower than max server records count per one request
- WSServerRecentActivityRecord *lastRecord = recentActivityResult.recentActivity.lastObject;
- if (recentActivityResult.recentActivity.count == self.maxServerResultCount.unsignedLongLongValue && lastRecord) {
- self.prevMinMasterId = lastRecord.masterId;
- [self updateCallRecordsInternal];
- } else {
- [self fireWsMethodReceived];
- }
- // if (recentActivityResult.recentActivity.count > 0) {
- // NSNumber *maxMasterId = self.maxMasterId;
- // if (![maxMasterId isEqualToNumber:@(0)]) {
- // self.prevMinMasterId = self.maxMasterId;
- // }
- // }
- }
- else if (completionStatus == WSMethodCompletionStatusCanceled) {
- NSAssert(NO, @"WSMethodCompletionStatusCanceled");
- // do nothing
- }
- else {
- NSAssert(NO, @"couldn't retrieve recent activity records");
- LogError(@"couldn't retrieve recent activity records: '%@'", ((NSException *)result).reason);
- }
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement