Compare commits

...

1 Commits

Author SHA1 Message Date
Matthew Chen
ce76425b0f Fix broken tests.
// FREEBIE
2017-06-22 17:07:07 -04:00
4 changed files with 20 additions and 4 deletions

View File

@ -84,6 +84,10 @@ extern NSString *const kNSNotificationName_LocalNumberDidChange;
+ (void)unregisterTextSecureWithSuccess:(void (^)())success failure:(void (^)(NSError *error))failureBlock;
#ifdef DEBUG
- (BOOL)isMockForTests;
#endif
@end
NS_ASSUME_NONNULL_END

View File

@ -42,7 +42,12 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
_networkManager = networkManager;
_storageManager = storageManager;
OWSSingletonAssert();
#ifdef DEBUG
if (![self isMockForTests]) {
OWSSingletonAssert();
}
#endif
return self;
}
@ -59,6 +64,13 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
return sharedInstance;
}
#ifdef DEBUG
- (BOOL)isMockForTests
{
return NO;
}
#endif
- (void)setPhoneNumberAwaitingVerification:(NSString *_Nullable)phoneNumberAwaitingVerification
{
_phoneNumberAwaitingVerification = phoneNumberAwaitingVerification;

View File

@ -30,7 +30,7 @@ extern NSString *const TSNetworkManagerDomain;
- (instancetype)init NS_UNAVAILABLE;
+ (id)sharedManager;
+ (instancetype)sharedManager;
- (void)makeRequest:(TSRequest *)request
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success

View File

@ -22,7 +22,8 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
#pragma mark Singleton implementation
+ (id)sharedManager {
+ (instancetype)sharedManager
{
static TSNetworkManager *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@ -31,7 +32,6 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
return sharedMyManager;
}
- (instancetype)initDefault
{
self = [super init];