Jitsi widget: Show/hide the widget presence in RoomVC at runtime

This commit is contained in:
manuroe
2017-08-09 17:31:15 +02:00
parent ba6cc63207
commit adac54d2b3
4 changed files with 59 additions and 5 deletions
+35 -2
View File
@@ -165,6 +165,9 @@
id kMXCallStateDidChangeObserver;
id kMXCallManagerConferenceStartedObserver;
id kMXCallManagerConferenceFinishedObserver;
// Observers to manage widgets
id kMXKWidgetManagerDidUpdateWidgetObserver;
// Observer kMXRoomSummaryDidChangeNotification to keep updated the missed discussion count
id mxRoomSummaryDidChangeObserver;
@@ -451,6 +454,7 @@
[self listenTypingNotifications];
[self listenCallNotifications];
[self listenWidgetNotifications];
if (self.showExpandedHeader)
{
@@ -498,7 +502,8 @@
}
[self removeCallNotificationsListeners];
[self removeWidgetNotificationsListeners];
// Re-enable the read marker display, and disable its update.
self.roomDataSource.showReadMarker = YES;
self.updateRoomReadMarker = NO;
@@ -1060,7 +1065,8 @@
}
[self removeCallNotificationsListeners];
[self removeWidgetNotificationsListeners];
if (previewHeader || (self.expandedHeaderContainer.isHidden == NO))
{
// Here [destroy] is called before [viewWillDisappear:]
@@ -3265,6 +3271,33 @@
}];
}
#pragma mark - Widget notifications management
- (void)removeWidgetNotificationsListeners
{
if (kMXKWidgetManagerDidUpdateWidgetObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kMXKWidgetManagerDidUpdateWidgetObserver];
kMXKWidgetManagerDidUpdateWidgetObserver = nil;
}
}
- (void)listenWidgetNotifications
{
kMXKWidgetManagerDidUpdateWidgetObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKWidgetManagerDidUpdateWidgetNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
Widget *widget = notif.object;
if (widget.mxSession == self.roomDataSource.mxSession
&& [widget.roomId isEqualToString:customizedRoomDataSource.roomId])
{
// Jitsi conference widget existence is shown in the bottom bar
// Update the bar
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
}
}];
}
#pragma mark - Unreachable Network Handling
- (void)refreshActivitiesViewDisplay