mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
Matlab
70 lines
1.8 KiB
Matlab
9 years ago
|
//
|
||
7 years ago
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||
9 years ago
|
//
|
||
10 years ago
|
|
||
7 years ago
|
#import "SSKEnvironment.h"
|
||
8 years ago
|
#import "AppContext.h"
|
||
10 years ago
|
|
||
9 years ago
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
7 years ago
|
static SSKEnvironment *sharedSSKEnvironment;
|
||
9 years ago
|
|
||
7 years ago
|
@interface SSKEnvironment ()
|
||
8 years ago
|
|
||
|
@property (nonatomic) id<OWSCallMessageHandler> callMessageHandler;
|
||
|
@property (nonatomic) id<ContactsManagerProtocol> contactsManager;
|
||
|
@property (nonatomic) OWSMessageSender *messageSender;
|
||
|
@property (nonatomic) id<NotificationsProtocol> notificationsManager;
|
||
|
@property (nonatomic) id<ProfileManagerProtocol> profileManager;
|
||
|
|
||
|
@end
|
||
|
|
||
|
#pragma mark -
|
||
10 years ago
|
|
||
7 years ago
|
@implementation SSKEnvironment
|
||
9 years ago
|
|
||
|
- (instancetype)initWithCallMessageHandler:(id<OWSCallMessageHandler>)callMessageHandler
|
||
|
contactsManager:(id<ContactsManagerProtocol>)contactsManager
|
||
9 years ago
|
messageSender:(OWSMessageSender *)messageSender
|
||
9 years ago
|
notificationsManager:(id<NotificationsProtocol>)notificationsManager
|
||
8 years ago
|
profileManager:(id<ProfileManagerProtocol>)profileManager
|
||
9 years ago
|
{
|
||
|
self = [super init];
|
||
|
if (!self) {
|
||
|
return self;
|
||
|
}
|
||
|
|
||
7 years ago
|
OWSAssertDebug(callMessageHandler);
|
||
|
OWSAssertDebug(contactsManager);
|
||
|
OWSAssertDebug(messageSender);
|
||
|
OWSAssertDebug(notificationsManager);
|
||
|
OWSAssertDebug(profileManager);
|
||
8 years ago
|
|
||
9 years ago
|
_callMessageHandler = callMessageHandler;
|
||
|
_contactsManager = contactsManager;
|
||
9 years ago
|
_messageSender = messageSender;
|
||
9 years ago
|
_notificationsManager = notificationsManager;
|
||
8 years ago
|
_profileManager = profileManager;
|
||
9 years ago
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
+ (instancetype)sharedEnv
|
||
|
{
|
||
7 years ago
|
OWSAssertDebug(sharedSSKEnvironment);
|
||
10 years ago
|
|
||
7 years ago
|
return sharedSSKEnvironment;
|
||
9 years ago
|
}
|
||
9 years ago
|
|
||
7 years ago
|
+ (void)setSharedEnv:(SSKEnvironment *)env
|
||
9 years ago
|
{
|
||
7 years ago
|
OWSAssertDebug(env);
|
||
7 years ago
|
OWSAssertDebug(!sharedSSKEnvironment || CurrentAppContext().isRunningTests);
|
||
9 years ago
|
|
||
7 years ago
|
sharedSSKEnvironment = env;
|
||
8 years ago
|
}
|
||
|
|
||
10 years ago
|
@end
|
||
9 years ago
|
|
||
|
NS_ASSUME_NONNULL_END
|