diff --git a/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m b/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m index 071a0ad7c..8bb09d3d2 100644 --- a/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m +++ b/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m @@ -9,6 +9,7 @@ #import "NSTimer+OWS.h" #import "NotificationsProtocol.h" #import "OWSBackgroundTask.h" +#import "OWSDevicesService.h" #import "OWSError.h" #import "OWSMessageManager.h" #import "OWSMessageReceiver.h" @@ -297,6 +298,10 @@ NSString *const kNSNotification_OWSWebSocketStateDidChange = @"kNSNotification_O selector:@selector(isCensorshipCircumventionActiveDidChange:) name:kNSNotificationName_IsCensorshipCircumventionActiveDidChange object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(deviceListUpdateModifiedDeviceList:) + name:NSNotificationName_DeviceListUpdateModifiedDeviceList + object:nil]; } #pragma mark - Manage Socket @@ -1134,6 +1139,15 @@ NSString *const kNSNotification_OWSWebSocketStateDidChange = @"kNSNotification_O [self applyDesiredSocketState]; } +- (void)deviceListUpdateModifiedDeviceList:(NSNotification *)notification +{ + OWSAssertIsOnMainThread(); + + if (self.webSocketType == OWSWebSocketTypeDefault) { + [self cycleSocket]; + } +} + @end NS_ASSUME_NONNULL_END