Fix regression in previous commitment related to SYIOS-26: The app can work offline when debackgrounded but not when restarting from cold

This commit is contained in:
giomfo 2015-01-06 10:36:57 +01:00
parent 18cc725611
commit 1f2966cdd0

View file

@ -117,9 +117,6 @@
// Refresh display
[self configureView];
[[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"isResumeDone" options:0 context:nil];
// Add observer to force refresh when a recent last description is updated thanks to back pagination
// (This happens when the current last event description is blank, a back pagination is triggered to display non empty description)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(configureView) name:kRecentRoomUpdatedByBackPagination object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
@ -136,7 +133,6 @@
_preSelectedRoomId = nil;
[[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kRecentRoomUpdatedByBackPagination object:nil];
}
- (void)viewDidAppear:(BOOL)animated {
@ -228,6 +224,7 @@
MatrixHandler *mxHandler = [MatrixHandler sharedHandler];
[self startActivityIndicator];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kRecentRoomUpdatedByBackPagination object:nil];
if (mxHandler.mxSession) {
// Check matrix handler status
@ -334,7 +331,11 @@
[self.tableView reloadData];
}
if (!recents) {
if (recents) {
// Add observer to force refresh when a recent last description is updated thanks to back pagination
// (This happens when the current last event description is blank, a back pagination is triggered to display non empty description)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onRecentRoomUpdatedByBackPagination) name:kRecentRoomUpdatedByBackPagination object:nil];
} else {
// Remove potential listener
if (recentsListener && mxHandler.mxSession) {
[mxHandler.mxSession removeListener:recentsListener];
@ -345,6 +346,10 @@
[self updateTitleView];
}
- (void)onRecentRoomUpdatedByBackPagination {
[self.tableView reloadData];
}
- (void)updateTitleView {
NSString *title = @"Recents";
if (unreadCount) {