diff --git a/sample-with-framework/Applozic/Applozic/ALMQTTService.m b/sample-with-framework/Applozic/Applozic/ALMQTTService.m index 13ded41c4..b3a17ddca 100644 --- a/sample-with-framework/Applozic/Applozic/ALMQTTService.m +++ b/sample-with-framework/Applozic/Applozic/ALMQTTService.m @@ -117,23 +117,20 @@ - (void)subAckReceived:(MQTTSession *)session msgID:(UInt16)msgID grantedQoss:(N - (void)connected:(MQTTSession *)session { - NSLog(@"####delegate callback for connected."); + } - (void)connectionClosed:(MQTTSession *)session { - NSLog(@"####disconnect from mqtt"); + } - (void)handleEvent:(MQTTSession *)session event:(MQTTSessionEvent)eventCode error:(NSError *)error { - NSLog(@"####inside handleEvent"); } - (void)received:(MQTTSession *)session type:(int)type qos:(MQTTQosLevel)qos retained:(BOOL)retained duped:(BOOL)duped mid:(UInt16)mid data:(NSData *)data { - NSLog(@"###MQTTreceived command"); - NSLog(@"####type: %i", type); - NSLog(@"####data: %@", data); + } diff --git a/sample-with-framework/Applozic/Applozic/ALMessageDBService.m b/sample-with-framework/Applozic/Applozic/ALMessageDBService.m index 0c440e8be..1bdff6158 100644 --- a/sample-with-framework/Applozic/Applozic/ALMessageDBService.m +++ b/sample-with-framework/Applozic/Applozic/ALMessageDBService.m @@ -255,10 +255,6 @@ - (NSArray *)getUnreadMessages:(NSString *) contactId [fetchRequest setPredicate:predicate]; NSError *fetchError = nil; NSArray *result = [dbHandler.managedObjectContext executeFetchRequest:fetchRequest error:&fetchError]; - if ([contactId isEqualToString:@"applozic"]) { - NSLog(@"the fetch request %@",fetchRequest); - NSLog(@"COUNT VALUE: %lu", result.count); - } return result; } diff --git a/sample-with-framework/Applozic/Applozic/ViewControllers/ALChatViewController.m b/sample-with-framework/Applozic/Applozic/ViewControllers/ALChatViewController.m index 94ce029ad..143f9561e 100644 --- a/sample-with-framework/Applozic/Applozic/ViewControllers/ALChatViewController.m +++ b/sample-with-framework/Applozic/Applozic/ViewControllers/ALChatViewController.m @@ -448,6 +448,7 @@ -(void) loadChatView [self.mTableView reloadData]; + if (isLoadEarlierTapped) { if ((theArray != nil && theArray.count < self.rp )|| self.mMessageListArray.count == self.mTotalCount) { self.mTableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectZero]; @@ -470,10 +471,13 @@ -(void) loadChatView } self.startIndex = theArray.count; - if (self.mMessageListArray.count != 0) { + /*if (self.mMessageListArray.count != 0) { CGRect theFrame = [self.mTableView rectForRowAtIndexPath:[NSIndexPath indexPathForRow:theArray.count-1 inSection:0]]; [self.mTableView setContentOffset:CGPointMake(0, theFrame.origin.y)]; - } + }*/ + dispatch_async(dispatch_get_main_queue(), ^{ + [super scrollTableViewToBottomWithAnimation:YES]; + }); } } @@ -922,7 +926,6 @@ -(void)fetchAndRefresh:(BOOL)flag{ dispatch_async(dispatch_get_main_queue(), ^{ [super scrollTableViewToBottomWithAnimation:YES]; [self setTitle]; - }); NSLog(@"FETCH AND REFRESH METHOD"); } @@ -954,7 +957,6 @@ -(void)individualNotificationhandler:(NSNotification *) notification -(void) syncCall:(NSString *) contactId updateUI:(NSNumber *) updateUI alertValue: (NSString *) alertValue { if ([self.contactIds isEqualToString:contactId]) { - //[self fetchAndRefresh]; NSLog(@"current contact thread is opened"); [self fetchAndRefresh:YES]; //[self processMarkRead]; @@ -1013,19 +1015,17 @@ -(void)handleNotification:(UIGestureRecognizer*)gestureRecognizer{ } - (IBAction)loadEarlierButtonAction:(id)sender { - [self processLoadEarlierMessages]; - } -(void)processLoadEarlierMessages{ NSString *time; - if(self.mMessageListArray.count > 0 && self.mMessageListArray != NULL){ + if(self.mMessageListArray.count > 0 && self.mMessageListArray != NULL) { ALMessage * theMessage = self.mMessageListArray[0]; time = theMessage.createdAtTime; } - else{ + else { time = NULL; } [ALMessageService getMessageListForUser:self.contactIds startIndex:@"0" pageSize:@"50" endTimeInTimeStamp:time withCompletion:^(NSMutableArray *messages, NSError *error){ diff --git a/sample-with-framework/Applozic/Applozic/ViewControllers/ALMessagesViewController.m b/sample-with-framework/Applozic/Applozic/ViewControllers/ALMessagesViewController.m index 6a58ee0f7..a83cf0a52 100644 --- a/sample-with-framework/Applozic/Applozic/ViewControllers/ALMessagesViewController.m +++ b/sample-with-framework/Applozic/Applozic/ViewControllers/ALMessagesViewController.m @@ -253,7 +253,6 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS ALMessageDBService* messageDBService = [[ALMessageDBService alloc]init]; self.unreadCount=[messageDBService getUnreadMessages:[alContact userId]]; - NSLog(@"unread count for userId: %@ is %ld", [alContact userId], (unsigned long)self.unreadCount.count); // NSLog(@"self.unreadCount Array of ||%@|| withCount ||%lu|| is %@",[alContact userId],(unsigned long)self.unreadCount.count,self.unreadCount);