mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/udWebSocket'
This commit is contained in:
commit
b60fa3cc92
17 changed files with 1297 additions and 1090 deletions
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit e523ff4816a27bf7b990011df50c162255cfda79
|
||||
Subproject commit 4a4deef84f38ba83f7d2057839d62ced256e7aed
|
|
@ -595,7 +595,7 @@ static NSTimeInterval launchStartedAt;
|
|||
// Unregistered user should have no unread messages. e.g. if you delete your account.
|
||||
[SignalApp clearAllNotifications];
|
||||
|
||||
[TSSocketManager requestSocketOpen];
|
||||
[TSSocketManager.shared requestSocketOpen];
|
||||
|
||||
UITapGestureRecognizer *gesture =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:[Pastelog class] action:@selector(submitLogs)];
|
||||
|
@ -609,7 +609,7 @@ static NSTimeInterval launchStartedAt;
|
|||
// At this point, potentially lengthy DB locking migrations could be running.
|
||||
// Avoid blocking app launch by putting all further possible DB access in async block
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TSSocketManager requestSocketOpen];
|
||||
[TSSocketManager.shared requestSocketOpen];
|
||||
[Environment.shared.contactsManager fetchSystemContactsOnceIfAlreadyAuthorized];
|
||||
// This will fetch new messages, if we're using domain fronting.
|
||||
[[PushManager sharedManager] applicationDidBecomeActive];
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MessageFetcherJob: NSObject {
|
|||
|
||||
guard signalService.isCensorshipCircumventionActive else {
|
||||
Logger.debug("delegating message fetching to SocketManager since we're using normal transport.")
|
||||
TSSocketManager.requestSocketOpen()
|
||||
TSSocketManager.shared.requestSocketOpen()
|
||||
return Promise(value: ())
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(socketStateDidChange)
|
||||
name:kNSNotification_SocketManagerStateDidChange
|
||||
name:kNSNotification_OWSWebSocketStateDidChange
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(reachabilityChanged)
|
||||
|
@ -128,12 +128,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSTableSection *censorshipSection = [OWSTableSection new];
|
||||
censorshipSection.headerTitle = NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION_HEADER",
|
||||
@"Table header for the 'censorship circumvention' section.");
|
||||
BOOL isAnySocketOpen = TSSocketManager.shared.highestSocketState == OWSWebSocketStateOpen;
|
||||
if (OWSSignalService.sharedInstance.hasCensoredPhoneNumber) {
|
||||
censorshipSection.footerTitle
|
||||
= NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION_FOOTER_AUTO_ENABLED",
|
||||
@"Table footer for the 'censorship circumvention' section shown when censorship circumvention has been "
|
||||
@"auto-enabled based on local phone number.");
|
||||
} else if ([TSSocketManager sharedManager].state == SocketManagerStateOpen) {
|
||||
} else if (isAnySocketOpen) {
|
||||
censorshipSection.footerTitle
|
||||
= NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION_FOOTER_WEBSOCKET_CONNECTED",
|
||||
@"Table footer for the 'censorship circumvention' section shown when the app is connected to the "
|
||||
|
@ -162,8 +163,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
// internet connection.
|
||||
BOOL isManualCensorshipCircumventionOnEnabled
|
||||
= (OWSSignalService.sharedInstance.isCensorshipCircumventionManuallyActivated
|
||||
|| (!OWSSignalService.sharedInstance.hasCensoredPhoneNumber &&
|
||||
[TSSocketManager sharedManager].state != SocketManagerStateOpen
|
||||
|| (!OWSSignalService.sharedInstance.hasCensoredPhoneNumber && !isAnySocketOpen
|
||||
&& weakSelf.reachability.isReachable));
|
||||
BOOL isCensorshipCircumventionOn = NO;
|
||||
if (OWSSignalService.sharedInstance.hasCensoredPhoneNumber) {
|
||||
|
|
|
@ -148,16 +148,16 @@
|
|||
@"Error indicating that this device is no longer registered.");
|
||||
accessoryLabel.textColor = [UIColor ows_redColor];
|
||||
} else {
|
||||
switch ([TSSocketManager sharedManager].state) {
|
||||
case SocketManagerStateClosed:
|
||||
switch (TSSocketManager.shared.highestSocketState) {
|
||||
case OWSWebSocketStateClosed:
|
||||
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_OFFLINE", @"");
|
||||
accessoryLabel.textColor = [UIColor ows_redColor];
|
||||
break;
|
||||
case SocketManagerStateConnecting:
|
||||
case OWSWebSocketStateConnecting:
|
||||
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTING", @"");
|
||||
accessoryLabel.textColor = [UIColor ows_yellowColor];
|
||||
break;
|
||||
case SocketManagerStateOpen:
|
||||
case OWSWebSocketStateOpen:
|
||||
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTED", @"");
|
||||
accessoryLabel.textColor = [UIColor ows_greenColor];
|
||||
break;
|
||||
|
@ -473,7 +473,7 @@
|
|||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(socketStateDidChange)
|
||||
name:kNSNotification_SocketManagerStateDidChange
|
||||
name:kNSNotification_OWSWebSocketStateDidChange
|
||||
object:nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
// The service implementation of the socket connection caches the linked device state,
|
||||
// so all sync message sends will fail on the socket until it is cycled.
|
||||
[TSSocketManager.sharedManager cycleSocket];
|
||||
[TSSocketManager.shared cycleSocket];
|
||||
});
|
||||
}
|
||||
failure:^(NSError *error) {
|
||||
|
|
|
@ -54,8 +54,8 @@ static double const STALLED_PROGRESS = 0.9;
|
|||
|
||||
- (void)initializeObserver {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(socketManagerStateDidChange)
|
||||
name:kNSNotification_SocketManagerStateDidChange
|
||||
selector:@selector(OWSWebSocketStateDidChange)
|
||||
name:kNSNotification_OWSWebSocketStateDidChange
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(isCensorshipCircumventionActiveDidChange:)
|
||||
|
@ -70,7 +70,8 @@ static double const STALLED_PROGRESS = 0.9;
|
|||
[self updateSocketStatusView];
|
||||
}
|
||||
|
||||
- (void)socketManagerStateDidChange {
|
||||
- (void)OWSWebSocketStateDidChange
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
[self updateSocketStatusView];
|
||||
|
@ -86,8 +87,8 @@ static double const STALLED_PROGRESS = 0.9;
|
|||
return;
|
||||
}
|
||||
|
||||
switch ([TSSocketManager sharedManager].state) {
|
||||
case SocketManagerStateClosed:
|
||||
switch (TSSocketManager.shared.highestSocketState) {
|
||||
case OWSWebSocketStateClosed:
|
||||
if (_socketStatusView == nil) {
|
||||
[self initializeSocketStatusBar];
|
||||
[_updateStatusTimer invalidate];
|
||||
|
@ -101,10 +102,10 @@ static double const STALLED_PROGRESS = 0.9;
|
|||
[_updateStatusTimer invalidate];
|
||||
}
|
||||
break;
|
||||
case SocketManagerStateConnecting:
|
||||
case OWSWebSocketStateConnecting:
|
||||
// Do nothing.
|
||||
break;
|
||||
case SocketManagerStateOpen:
|
||||
case OWSWebSocketStateOpen:
|
||||
[_updateStatusTimer invalidate];
|
||||
[_socketStatusView removeFromSuperview];
|
||||
_socketStatusView = nil;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#import <SignalServiceKit/OWSMessageReceiver.h>
|
||||
#import <SignalServiceKit/OWSStorage.h>
|
||||
#import <SignalServiceKit/SSKEnvironment.h>
|
||||
#import <SignalServiceKit/TSSocketManager.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
@ -62,6 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSBatchMessageProcessor *batchMessageProcessor =
|
||||
[[OWSBatchMessageProcessor alloc] initWithPrimaryStorage:primaryStorage];
|
||||
OWSMessageReceiver *messageReceiver = [[OWSMessageReceiver alloc] initWithPrimaryStorage:primaryStorage];
|
||||
TSSocketManager *socketManager = [[TSSocketManager alloc] init];
|
||||
|
||||
[Environment setShared:[[Environment alloc] initWithPreferences:preferences]];
|
||||
|
||||
|
@ -77,7 +79,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
udManager:udManager
|
||||
messageDecrypter:messageDecrypter
|
||||
batchMessageProcessor:batchMessageProcessor
|
||||
messageReceiver:messageReceiver]];
|
||||
messageReceiver:messageReceiver
|
||||
socketManager:socketManager]];
|
||||
|
||||
appSpecificSingletonBlock();
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ProfileFetcherJob: NSObject {
|
|||
}
|
||||
|
||||
private var socketManager: TSSocketManager {
|
||||
return TSSocketManager.shared()
|
||||
return TSSocketManager.shared
|
||||
}
|
||||
|
||||
private var primaryStorage: OWSPrimaryStorage {
|
||||
|
@ -48,6 +48,14 @@ public class ProfileFetcherJob: NSObject {
|
|||
return SSKEnvironment.shared.udManager
|
||||
}
|
||||
|
||||
private var profileManager: OWSProfileManager {
|
||||
return OWSProfileManager.shared()
|
||||
}
|
||||
|
||||
private var identityManager: OWSIdentityManager {
|
||||
return SSKEnvironment.shared.identityManager
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
public func run(recipientIds: [String]) {
|
||||
|
@ -126,8 +134,10 @@ public class ProfileFetcherJob: NSObject {
|
|||
|
||||
let (promise, fulfill, reject) = Promise<SignalServiceProfile>.pending()
|
||||
|
||||
if TSSocketManager.canMakeRequests() {
|
||||
// TODO: Use UD socket for some profile gets.
|
||||
if socketManager.canMakeRequests(of: .default) {
|
||||
self.socketManager.make(request,
|
||||
webSocketType: .default,
|
||||
success: { (responseObject: Any?) -> Void in
|
||||
do {
|
||||
let profile = try SignalServiceProfile(recipientId: recipientId, responseObject: responseObject)
|
||||
|
@ -165,7 +175,7 @@ public class ProfileFetcherJob: NSObject {
|
|||
private func updateProfile(signalServiceProfile: SignalServiceProfile) {
|
||||
verifyIdentityUpToDateAsync(recipientId: signalServiceProfile.recipientId, latestIdentityKey: signalServiceProfile.identityKey)
|
||||
|
||||
OWSProfileManager.shared().updateProfile(forRecipientId: signalServiceProfile.recipientId,
|
||||
profileManager.updateProfile(forRecipientId: signalServiceProfile.recipientId,
|
||||
profileNameEncrypted: signalServiceProfile.profileNameEncrypted,
|
||||
avatarUrlPath: signalServiceProfile.avatarUrlPath)
|
||||
|
||||
|
@ -179,7 +189,7 @@ public class ProfileFetcherJob: NSObject {
|
|||
|
||||
private func verifyIdentityUpToDateAsync(recipientId: String, latestIdentityKey: Data) {
|
||||
primaryStorage.newDatabaseConnection().asyncReadWrite { (transaction) in
|
||||
if OWSIdentityManager.shared().saveRemoteIdentity(latestIdentityKey, recipientId: recipientId, protocolContext: transaction) {
|
||||
if self.identityManager.saveRemoteIdentity(latestIdentityKey, recipientId: recipientId, protocolContext: transaction) {
|
||||
Logger.info("updated identity key with fetched profile for recipient: \(recipientId)")
|
||||
self.primaryStorage.archiveAllSessions(forContact: recipientId, protocolContext: transaction)
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,8 @@ NSError *SSKEnsureError(NSError *_Nullable error, OWSErrorCode fallbackCode, NSS
|
|||
if (error) {
|
||||
return error;
|
||||
}
|
||||
OWSFailDebug(@"Using fallback error.") return OWSErrorWithCodeDescription(fallbackCode, fallbackErrorDescription);
|
||||
OWSCFailDebug(@"Using fallback error.");
|
||||
return OWSErrorWithCodeDescription(fallbackCode, fallbackErrorDescription);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -1004,9 +1005,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
[request useUDAuth:messageSend.udAccessKey];
|
||||
}
|
||||
|
||||
// TODO: UD sends over websocket.
|
||||
if (!messageSend.hasWebsocketSendFailed && TSSocketManager.canMakeRequests && !messageSend.isUDSend) {
|
||||
[TSSocketManager.sharedManager makeRequest:request
|
||||
OWSWebSocketType webSocketType = (messageSend.isUDSend ? OWSWebSocketTypeUD : OWSWebSocketTypeDefault);
|
||||
BOOL canMakeWebsocketRequests = ([TSSocketManager.shared canMakeRequestsOfType:webSocketType] &&
|
||||
!messageSend.hasWebsocketSendFailed);
|
||||
if (canMakeWebsocketRequests) {
|
||||
[TSSocketManager.shared makeRequest:request
|
||||
webSocketType:webSocketType
|
||||
success:^(id _Nullable responseObject) {
|
||||
[self messageSendDidSucceed:messageSend deviceMessages:deviceMessages];
|
||||
}
|
||||
|
|
59
SignalServiceKit/src/Network/WebSockets/OWSWebSocket.h
Normal file
59
SignalServiceKit/src/Network/WebSockets/OWSWebSocket.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static void *OWSWebSocketStateObservationContext = &OWSWebSocketStateObservationContext;
|
||||
|
||||
extern NSString *const kNSNotification_OWSWebSocketStateDidChange;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, OWSWebSocketType) {
|
||||
OWSWebSocketTypeDefault,
|
||||
OWSWebSocketTypeUD,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, OWSWebSocketState) {
|
||||
OWSWebSocketStateClosed,
|
||||
OWSWebSocketStateConnecting,
|
||||
OWSWebSocketStateOpen,
|
||||
};
|
||||
|
||||
typedef void (^TSSocketMessageSuccess)(id _Nullable responseObject);
|
||||
// statusCode is zero by default, if request never made or failed.
|
||||
typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable responseData, NSError *error);
|
||||
|
||||
@class TSRequest;
|
||||
|
||||
@interface OWSWebSocket : NSObject
|
||||
|
||||
@property (nonatomic, readonly) OWSWebSocketState state;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithWebSocketType:(OWSWebSocketType)webSocketType NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// If the app is in the foreground, we'll try to open the socket unless it's already
|
||||
// open or connecting.
|
||||
//
|
||||
// If the app is in the background, we'll try to open the socket unless it's already
|
||||
// open or connecting _and_ keep it open for at least N seconds.
|
||||
// If the app is in the background and the socket is already open or connecting this
|
||||
// might prolong how long we keep the socket open.
|
||||
//
|
||||
// This method can be called from any thread.
|
||||
- (void)requestSocketOpen;
|
||||
|
||||
// This can be used to force the socket to close and re-open, if it is open.
|
||||
- (void)cycleSocket;
|
||||
|
||||
#pragma mark - Message Sending
|
||||
|
||||
@property (atomic, readonly) BOOL canMakeRequests;
|
||||
|
||||
- (void)makeRequest:(TSRequest *)request
|
||||
success:(TSSocketMessageSuccess)success
|
||||
failure:(TSSocketMessageFailure)failure;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
1129
SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m
Normal file
1129
SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,33 +2,26 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <SocketRocket/SRWebSocket.h>
|
||||
#import "OWSWebSocket.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static void *SocketManagerStateObservationContext = &SocketManagerStateObservationContext;
|
||||
|
||||
extern NSString *const kNSNotification_SocketManagerStateDidChange;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SocketManagerState) {
|
||||
SocketManagerStateClosed,
|
||||
SocketManagerStateConnecting,
|
||||
SocketManagerStateOpen,
|
||||
};
|
||||
|
||||
typedef void (^TSSocketMessageSuccess)(id _Nullable responseObject);
|
||||
// statusCode is zero by default, if request never made or failed.
|
||||
typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable responseData, NSError *error);
|
||||
|
||||
@class TSRequest;
|
||||
|
||||
@interface TSSocketManager : NSObject <SRWebSocketDelegate>
|
||||
@interface TSSocketManager : NSObject
|
||||
|
||||
@property (nonatomic, readonly) SocketManagerState state;
|
||||
@property (class, readonly, nonatomic) TSSocketManager *shared;
|
||||
|
||||
+ (instancetype)sharedManager;
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
// Returns the "best" state of any of the sockets.
|
||||
//
|
||||
// We surface the socket state in various places in the UI.
|
||||
// We generally are trying to indicate/help resolve network
|
||||
// connectivity issues. We want to show the "best" or "highest"
|
||||
// socket state of the sockets. e.g. the UI should reflect
|
||||
// "open" if any of the sockets is open.
|
||||
- (OWSWebSocketState)highestSocketState;
|
||||
|
||||
// If the app is in the foreground, we'll try to open the socket unless it's already
|
||||
// open or connecting.
|
||||
|
@ -39,16 +32,17 @@ typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable r
|
|||
// might prolong how long we keep the socket open.
|
||||
//
|
||||
// This method can be called from any thread.
|
||||
+ (void)requestSocketOpen;
|
||||
- (void)requestSocketOpen;
|
||||
|
||||
// This can be used to force the socket to close and re-open, if it is open.
|
||||
- (void)cycleSocket;
|
||||
|
||||
#pragma mark - Message Sending
|
||||
|
||||
+ (BOOL)canMakeRequests;
|
||||
- (BOOL)canMakeRequestsOfType:(OWSWebSocketType)webSocketType;
|
||||
|
||||
- (void)makeRequest:(TSRequest *)request
|
||||
webSocketType:(OWSWebSocketType)webSocketType
|
||||
success:(TSSocketMessageSuccess)success
|
||||
failure:(TSSocketMessageFailure)failure;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@class OWSMessageSender;
|
||||
@class OWSPrimaryStorage;
|
||||
@class TSNetworkManager;
|
||||
@class TSSocketManager;
|
||||
@class YapDatabaseConnection;
|
||||
|
||||
@protocol ContactsManagerProtocol;
|
||||
|
@ -33,10 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
messageManager:(OWSMessageManager *)messageManager
|
||||
blockingManager:(OWSBlockingManager *)blockingManager
|
||||
identityManager:(OWSIdentityManager *)identityManager
|
||||
udManager:(id<OWSUDManager>)udManager
|
||||
udManager:(id<OWSUDManager>)udManager
|
||||
messageDecrypter:(OWSMessageDecrypter *)messageDecrypter
|
||||
batchMessageProcessor:(OWSBatchMessageProcessor *)batchMessageProcessor
|
||||
messageReceiver:(OWSMessageReceiver *)messageReceiver NS_DESIGNATED_INITIALIZER;
|
||||
messageReceiver:(OWSMessageReceiver *)messageReceiver
|
||||
socketManager:(TSSocketManager *)socketManager NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
|
@ -62,6 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, readonly) OWSMessageDecrypter *messageDecrypter;
|
||||
@property (nonatomic, readonly) OWSBatchMessageProcessor *batchMessageProcessor;
|
||||
@property (nonatomic, readonly) OWSMessageReceiver *messageReceiver;
|
||||
@property (nonatomic, readonly) TSSocketManager *socketManager;
|
||||
|
||||
// This property is configured after Environment is created.
|
||||
@property (atomic, nullable) id<OWSCallMessageHandler> callMessageHandler;
|
||||
|
|
|
@ -25,6 +25,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
|||
@property (nonatomic) OWSMessageDecrypter *messageDecrypter;
|
||||
@property (nonatomic) OWSBatchMessageProcessor *batchMessageProcessor;
|
||||
@property (nonatomic) OWSMessageReceiver *messageReceiver;
|
||||
@property (nonatomic) TSSocketManager *socketManager;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -49,6 +50,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
|||
messageDecrypter:(OWSMessageDecrypter *)messageDecrypter
|
||||
batchMessageProcessor:(OWSBatchMessageProcessor *)batchMessageProcessor
|
||||
messageReceiver:(OWSMessageReceiver *)messageReceiver
|
||||
socketManager:(TSSocketManager *)socketManager
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
|
@ -68,6 +70,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
|||
OWSAssertDebug(messageDecrypter);
|
||||
OWSAssertDebug(batchMessageProcessor);
|
||||
OWSAssertDebug(messageReceiver);
|
||||
OWSAssertDebug(socketManager);
|
||||
|
||||
_contactsManager = contactsManager;
|
||||
_messageSender = messageSender;
|
||||
|
@ -82,6 +85,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
|||
_messageDecrypter = messageDecrypter;
|
||||
_batchMessageProcessor = batchMessageProcessor;
|
||||
_messageReceiver = messageReceiver;
|
||||
_socketManager = socketManager;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#import "OWSMessageManager.h"
|
||||
#import "OWSMessageReceiver.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "TSSocketManager.h"
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
@ -56,6 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSBatchMessageProcessor *batchMessageProcessor =
|
||||
[[OWSBatchMessageProcessor alloc] initWithPrimaryStorage:primaryStorage];
|
||||
OWSMessageReceiver *messageReceiver = [[OWSMessageReceiver alloc] initWithPrimaryStorage:primaryStorage];
|
||||
TSSocketManager *socketManager = [[TSSocketManager alloc] init];
|
||||
|
||||
self = [super initWithContactsManager:contactsManager
|
||||
messageSender:messageSender
|
||||
|
@ -69,7 +71,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
udManager:udManager
|
||||
messageDecrypter:messageDecrypter
|
||||
batchMessageProcessor:batchMessageProcessor
|
||||
messageReceiver:messageReceiver];
|
||||
messageReceiver:messageReceiver
|
||||
socketManager:socketManager];
|
||||
if (!self) {
|
||||
return nil;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue