Speedup the display of a chatroom.

On a relatively long, the time for loading the chatroom view decreases from 21 seconds to 7 seconds.
The main problem is that each the view is entered [tableView reloadData] was called three times.
This commit is contained in:
Simon Morlat 2018-02-23 22:17:48 +01:00
parent 2487741d7f
commit 52b468ec40
2 changed files with 6 additions and 1 deletions

View file

@ -36,6 +36,7 @@
OrderedDictionary *imageQualities;
BOOL scrollOnGrowingEnabled;
BOOL composingVisible;
BOOL isAppearing;
}
@property(nonatomic) LinphoneChatRoom *chatRoom;

View file

@ -37,6 +37,7 @@
[NSNumber numberWithFloat:0.5], NSLocalizedString(@"Average", nil),
[NSNumber numberWithFloat:0.0], NSLocalizedString(@"Minimum", nil), nil];
composingVisible = false;
isAppearing = false;
}
return self;
}
@ -109,6 +110,7 @@ static UICompositeViewDescription *compositeDescription = nil;
name:kLinphoneCallUpdate
object:nil];
[self configureForRoom:false];
isAppearing = true;
}
- (void)viewWillDisappear:(BOOL)animated {
@ -131,10 +133,12 @@ static UICompositeViewDescription *compositeDescription = nil;
[NSNotificationCenter.defaultCenter removeObserver:self];
PhoneMainView.instance.currentRoom = NULL;
isAppearing = FALSE;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
if (!isAppearing) return; //no need to do all that stuff if the view isn't yet appeared.
// force offset recomputing
[_messageField refreshHeight];
[self configureForRoom:true];
@ -168,7 +172,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if (_tableController.isEditing)
[_tableController setEditing:editing];
[[_tableController tableView] reloadData];
//[[_tableController tableView] reloadData];
BOOL fileSharingEnabled = linphone_core_get_file_transfer_server(LC) != NULL;
[_pictureButton setEnabled:fileSharingEnabled];