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
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Objective-C
		
	
| //
 | |
| //  Copyright (c) 2017 Open Whisper Systems. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import "TextSecureKitEnv.h"
 | |
| #import "AppContext.h"
 | |
| 
 | |
| NS_ASSUME_NONNULL_BEGIN
 | |
| 
 | |
| static TextSecureKitEnv *sharedTextSecureKitEnv;
 | |
| 
 | |
| @interface TextSecureKitEnv ()
 | |
| 
 | |
| @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 -
 | |
| 
 | |
| @implementation TextSecureKitEnv
 | |
| 
 | |
| - (instancetype)initWithCallMessageHandler:(id<OWSCallMessageHandler>)callMessageHandler
 | |
|                            contactsManager:(id<ContactsManagerProtocol>)contactsManager
 | |
|                              messageSender:(OWSMessageSender *)messageSender
 | |
|                       notificationsManager:(id<NotificationsProtocol>)notificationsManager
 | |
|                             profileManager:(id<ProfileManagerProtocol>)profileManager
 | |
| {
 | |
|     self = [super init];
 | |
|     if (!self) {
 | |
|         return self;
 | |
|     }
 | |
| 
 | |
|     OWSAssert(callMessageHandler);
 | |
|     OWSAssert(contactsManager);
 | |
|     OWSAssert(messageSender);
 | |
|     OWSAssert(notificationsManager);
 | |
|     OWSAssert(profileManager);
 | |
| 
 | |
|     _callMessageHandler = callMessageHandler;
 | |
|     _contactsManager = contactsManager;
 | |
|     _messageSender = messageSender;
 | |
|     _notificationsManager = notificationsManager;
 | |
|     _profileManager = profileManager;
 | |
| 
 | |
|     return self;
 | |
| }
 | |
| 
 | |
| + (instancetype)sharedEnv
 | |
| {
 | |
|     OWSAssert(sharedTextSecureKitEnv);
 | |
| 
 | |
|     return sharedTextSecureKitEnv;
 | |
| }
 | |
| 
 | |
| + (void)setSharedEnv:(TextSecureKitEnv *)env
 | |
| {
 | |
|     OWSAssert(env);
 | |
|     OWSAssert(!sharedTextSecureKitEnv || !CurrentAppContext().isMainApp);
 | |
| 
 | |
|     sharedTextSecureKitEnv = env;
 | |
| }
 | |
| 
 | |
| @end
 | |
| 
 | |
| NS_ASSUME_NONNULL_END
 |