Fix performance issues with Spaces on very large accounts #4898

- Listen to `MXSpaceNotificationCounter` to update the notification badge
This commit is contained in:
Gil Eluard
2021-10-06 22:06:00 +02:00
parent 17bf93e9e7
commit f4317e9b0d
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -64,6 +64,8 @@
// Custom title view of the navigation bar
MainTitleView *titleView;
id spaceNotificationCounterDidUpdateNotificationCountObserver;
}
@property(nonatomic,getter=isHidden) BOOL hidden;
@@ -122,7 +124,7 @@
childViewControllers = [NSMutableArray array];
MXWeakify(self);
[[NSNotificationCenter defaultCenter] addObserverForName:MXSpaceService.didBuildSpaceGraph object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
spaceNotificationCounterDidUpdateNotificationCountObserver = [[NSNotificationCenter defaultCenter] addObserverForName:MXSpaceNotificationCounter.didUpdateNotificationCount object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
MXStrongifyAndReturnIfNil(self);
[self updateSideMenuNotifcationIcon];
}];
@@ -272,6 +274,12 @@
kThemeServiceDidChangeThemeNotificationObserver = nil;
}
if (spaceNotificationCounterDidUpdateNotificationCountObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:spaceNotificationCounterDidUpdateNotificationCountObserver];
spaceNotificationCounterDidUpdateNotificationCountObserver = nil;
}
childViewControllers = nil;
}