2014-05-06 19:41:08 +02:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import "Logging.h"
|
|
|
|
#import "PropertyListPreferences.h"
|
|
|
|
#import "PacketHandler.h"
|
|
|
|
#import "SecureEndPoint.h"
|
2015-01-16 15:28:41 +01:00
|
|
|
#import "TSGroupModel.h"
|
2015-08-23 00:00:39 +02:00
|
|
|
#import "TSStorageHeaders.h"
|
|
|
|
|
2015-09-01 19:22:08 +02:00
|
|
|
static NSString* const kCallSegue = @"2.0_6.0_Call_Segue";
|
|
|
|
|
2014-05-06 19:41:08 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Environment is a data and data accessor class.
|
|
|
|
* It handles application-level component wiring in order to support mocks for testing.
|
|
|
|
* It also handles network configuration for testing/deployment server configurations.
|
2014-07-30 08:05:36 +02:00
|
|
|
*
|
2014-05-06 19:41:08 +02:00
|
|
|
**/
|
|
|
|
|
|
|
|
#define SAMPLE_RATE 8000
|
|
|
|
|
|
|
|
#define ENVIRONMENT_TESTING_OPTION_LOSE_CONF_ACK_ON_PURPOSE @"LoseConfAck"
|
|
|
|
#define ENVIRONMENT_TESTING_OPTION_ALLOW_NETWORK_STREAM_TO_NON_SECURE_END_POINTS @"AllowTcpWithoutTls"
|
|
|
|
#define ENVIRONMENT_LEGACY_OPTION_RTP_PADDING_BIT_IMPLIES_EXTENSION_BIT_AND_TWELVE_EXTRA_ZERO_BYTES_IN_HEADER @"LegacyAndroidInterop_1"
|
2014-08-31 23:05:13 +02:00
|
|
|
#define TESTING_OPTION_USE_DH_FOR_HANDSHAKE @"DhKeyAgreementOnly"
|
2014-05-06 19:41:08 +02:00
|
|
|
|
|
|
|
@class RecentCallManager;
|
|
|
|
@class ContactsManager;
|
|
|
|
@class PhoneManager;
|
|
|
|
@class PhoneNumberDirectoryFilterManager;
|
2014-11-26 20:29:45 +01:00
|
|
|
@class SignalsViewController;
|
2014-05-06 19:41:08 +02:00
|
|
|
|
|
|
|
@interface Environment : NSObject
|
|
|
|
@property (nonatomic, readonly) in_port_t serverPort;
|
|
|
|
@property (nonatomic, readonly) id<Logging> logging;
|
|
|
|
@property (nonatomic, readonly) SecureEndPoint* masterServerSecureEndPoint;
|
|
|
|
@property (nonatomic, readonly) NSString* defaultRelayName;
|
|
|
|
@property (nonatomic, readonly) Certificate* certificate;
|
|
|
|
@property (nonatomic, readonly) NSString* relayServerHostNameSuffix;
|
|
|
|
@property (nonatomic, readonly) NSArray* keyAgreementProtocolsInDescendingPriority;
|
|
|
|
@property (nonatomic, readonly) ErrorHandlerBlock errorNoter;
|
|
|
|
@property (nonatomic, readonly) NSString* currentRegionCodeForPhoneNumbers;
|
|
|
|
@property (nonatomic, readonly) PhoneManager* phoneManager;
|
|
|
|
@property (nonatomic, readonly) RecentCallManager *recentCallManager;
|
|
|
|
@property (nonatomic, readonly) NSArray* testingAndLegacyOptions;
|
|
|
|
@property (nonatomic, readonly) NSData* zrtpClientId;
|
|
|
|
@property (nonatomic, readonly) NSData* zrtpVersionId;
|
|
|
|
@property (nonatomic, readonly) ContactsManager *contactsManager;
|
|
|
|
@property (nonatomic, readonly) PhoneNumberDirectoryFilterManager* phoneDirectoryManager;
|
|
|
|
|
2014-11-26 20:29:45 +01:00
|
|
|
@property (nonatomic, readonly) SignalsViewController *signalsViewController;
|
2014-12-05 11:34:45 +01:00
|
|
|
@property (nonatomic, readonly, weak) UINavigationController *signUpFlowNavigationController;
|
2014-11-26 20:29:45 +01:00
|
|
|
|
2014-05-06 19:41:08 +02:00
|
|
|
+(SecureEndPoint*) getMasterServerSecureEndPoint;
|
|
|
|
+(SecureEndPoint*) getSecureEndPointToDefaultRelayServer;
|
|
|
|
+(SecureEndPoint*) getSecureEndPointToSignalingServerNamed:(NSString*)name;
|
|
|
|
|
2014-07-30 08:05:36 +02:00
|
|
|
+(Environment*) environmentWithLogging:(id<Logging>)logging
|
|
|
|
andErrorNoter:(ErrorHandlerBlock)errorNoter
|
|
|
|
andServerPort:(in_port_t)serverPort
|
|
|
|
andMasterServerHostName:(NSString*)masterServerHostName
|
|
|
|
andDefaultRelayName:(NSString*)defaultRelayName
|
|
|
|
andRelayServerHostNameSuffix:(NSString*)relayServerHostNameSuffix
|
|
|
|
andCertificate:(Certificate*)certificate
|
|
|
|
andCurrentRegionCodeForPhoneNumbers:(NSString*)currentRegionCodeForPhoneNumbers
|
|
|
|
andSupportedKeyAgreementProtocols:(NSArray*)keyAgreementProtocolsInDescendingPriority
|
|
|
|
andPhoneManager:(PhoneManager*)phoneManager
|
|
|
|
andRecentCallManager:(RecentCallManager *)recentCallManager
|
|
|
|
andTestingAndLegacyOptions:(NSArray*)testingAndLegacyOptions
|
|
|
|
andZrtpClientId:(NSData*)zrtpClientId
|
|
|
|
andZrtpVersionId:(NSData*)zrtpVersionId
|
|
|
|
andContactsManager:(ContactsManager *)contactsManager
|
|
|
|
andPhoneDirectoryManager:(PhoneNumberDirectoryFilterManager*)phoneDirectoryManager;
|
2014-05-06 19:41:08 +02:00
|
|
|
|
|
|
|
+(Environment*) getCurrent;
|
|
|
|
+(void) setCurrent:(Environment*)curEnvironment;
|
|
|
|
+(id<Logging>) logging;
|
|
|
|
+(NSString*) relayServerNameToHostName:(NSString*)name;
|
|
|
|
+(ErrorHandlerBlock) errorNoter;
|
|
|
|
+(NSString*) currentRegionCodeForPhoneNumbers;
|
|
|
|
+(bool) hasEnabledTestingOrLegacyOption:(NSString*)flag;
|
|
|
|
+(PhoneManager*) phoneManager;
|
|
|
|
|
2014-08-01 07:53:58 +02:00
|
|
|
+(PropertyListPreferences*)preferences;
|
2014-07-30 08:05:36 +02:00
|
|
|
|
2014-11-21 11:35:53 +01:00
|
|
|
+(BOOL)isRedPhoneRegistered;
|
2014-07-11 00:33:51 +02:00
|
|
|
+(void)resetAppData;
|
2015-03-22 12:38:15 +01:00
|
|
|
|
|
|
|
- (void)initCallListener;
|
2014-11-26 20:29:45 +01:00
|
|
|
- (void)setSignalsViewController:(SignalsViewController *)signalsViewController;
|
2014-12-05 11:34:45 +01:00
|
|
|
- (void)setSignUpFlowNavigationController:(UINavigationController *)signUpFlowNavigationController;
|
2014-11-26 20:29:45 +01:00
|
|
|
|
2015-04-14 21:49:00 +02:00
|
|
|
+ (void)messageThreadId:(NSString*)threadId;
|
|
|
|
+ (void)messageIdentifier:(NSString*)identifier withCompose:(BOOL)compose;
|
|
|
|
+ (void)messageGroupModel:(TSGroupModel*)model withCompose:(BOOL)compose;
|
2014-05-06 19:41:08 +02:00
|
|
|
@end
|