Key backup: avoid to refresh the home room list on every backup state change

A possible mitigation for #2265
This commit is contained in:
manuroe 2019-02-18 18:25:50 +01:00
parent b2cd3c9fdd
commit 7ff02a0e5e
2 changed files with 19 additions and 7 deletions

View file

@ -1,9 +1,12 @@
Changes in 0.8.1 (2019-02-) Changes in 0.8.1 (2019-02-)
=============================================== ===============================================
Improvements:
* Key backup: avoid to refresh the home room list on every backup state change (#2265).
Bug fix: Bug fix:
* Fix text color in room preview (PR #2261) * Fix text color in room preview (PR #2261).
* Fix navigation bar background after accepting an invite (PR #2261) * Fix navigation bar background after accepting an invite (PR #2261).
Changes in 0.8.0 (2019-02-15) Changes in 0.8.0 (2019-02-15)
=============================================== ===============================================

View file

@ -165,10 +165,13 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void)keyBackupStateDidChangeNotification:(NSNotification*)notification - (void)keyBackupStateDidChangeNotification:(NSNotification*)notification
{ {
[self forceRefresh]; if ([self updateKeyBackupBanner])
{
[self forceRefresh];
}
} }
- (void)updateKeyBackupBanner - (BOOL)updateKeyBackupBanner
{ {
KeyBackupBanner keyBackupBanner = KeyBackupBannerNone; KeyBackupBanner keyBackupBanner = KeyBackupBannerNone;
@ -207,8 +210,12 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
break; break;
} }
} }
BOOL updated = (self.keyBackupBanner != keyBackupBanner);
self.keyBackupBanner = keyBackupBanner; self.keyBackupBanner = keyBackupBanner;
return updated;
} }
- (void)hideKeyBackupBanner:(KeyBackupBanner)keyBackupBanner - (void)hideKeyBackupBanner:(KeyBackupBanner)keyBackupBanner
@ -1227,6 +1234,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void)refreshRoomsSections - (void)refreshRoomsSections
{ {
NSDate *startDate = [NSDate date];
[invitesCellDataArray removeAllObjects]; [invitesCellDataArray removeAllObjects];
[favoriteCellDataArray removeAllObjects]; [favoriteCellDataArray removeAllObjects];
[peopleCellDataArray removeAllObjects]; [peopleCellDataArray removeAllObjects];
@ -1240,8 +1249,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
keyBackupBannerSection = directorySection = favoritesSection = peopleSection = conversationSection = lowPrioritySection = serverNoticeSection = invitesSection = -1; keyBackupBannerSection = directorySection = favoritesSection = peopleSection = conversationSection = lowPrioritySection = serverNoticeSection = invitesSection = -1;
[self updateKeyBackupBanner];
if (displayedRecentsDataSourceArray.count > 0) if (displayedRecentsDataSourceArray.count > 0)
{ {
// FIXME manage multi accounts // FIXME manage multi accounts
@ -1485,6 +1492,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}]; }];
} }
} }
NSLog(@"[RecentsDataSource] refreshRoomsSections: Done in %.0fms", [[NSDate date] timeIntervalSinceDate:startDate] * 1000);
} }
- (void)dataSource:(MXKDataSource*)dataSource didCellChange:(id)changes - (void)dataSource:(MXKDataSource*)dataSource didCellChange:(id)changes