Merge branch 'charlesmchen/singletonAssert'

This commit is contained in:
Matthew Chen 2017-04-03 14:53:55 -04:00
commit eb68746b6d
9 changed files with 29 additions and 3 deletions

View file

@ -132,7 +132,7 @@ CHECKOUT OPTIONS:
:commit: cbf2f47d59dd54d6d720fe787f835bd767443bb6 :commit: cbf2f47d59dd54d6d720fe787f835bd767443bb6
:git: https://github.com/WhisperSystems/SignalProtocolKit.git :git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit: SignalServiceKit:
:commit: 8b5f82eb6d8393074987697cea6986b55fec800e :commit: e4ec7298441e82c8c5cd0678ea165dc3e12b2986
:git: https://github.com/WhisperSystems/SignalServiceKit.git :git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket: SocketRocket:
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf

View file

@ -21,7 +21,7 @@ class CallNotificationsAdapter: NSObject {
// if #available(iOS 10.0, *) { // if #available(iOS 10.0, *) {
// adaptee = UserNotificationsAdaptee() // adaptee = UserNotificationsAdaptee()
// } else { // } else {
adaptee = NotificationsManager() adaptee = Environment.getCurrent().notificationsManager
// } // }
} }

View file

@ -41,6 +41,8 @@ NSString *const OWSContactsManagerSignalRecipientsDidChangeNotification =
_latestContactsById = @{}; _latestContactsById = @{};
_avatarCache = [NSCache new]; _avatarCache = [NSCache new];
OWSSingletonAssert();
return self; return self;
} }

View file

@ -52,6 +52,8 @@ static Environment *environment = nil;
_networkManager = networkManager; _networkManager = networkManager;
_messageSender = messageSender; _messageSender = messageSender;
OWSSingletonAssert();
return self; return self;
} }

View file

@ -17,12 +17,14 @@
@interface NotificationsManager () @interface NotificationsManager ()
@property SystemSoundID newMessageSound; @property (nonatomic) SystemSoundID newMessageSound;
@property (nonatomic, readonly) NSMutableDictionary<NSString *, UILocalNotification *> *currentNotifications; @property (nonatomic, readonly) NSMutableDictionary<NSString *, UILocalNotification *> *currentNotifications;
@property (nonatomic, readonly) NotificationType notificationPreviewType; @property (nonatomic, readonly) NotificationType notificationPreviewType;
@end @end
#pragma mark -
@implementation NotificationsManager @implementation NotificationsManager
- (instancetype)init - (instancetype)init
@ -37,6 +39,8 @@
NSURL *newMessageURL = [[NSBundle mainBundle] URLForResource:@"NewMessage" withExtension:@"aifc"]; NSURL *newMessageURL = [[NSBundle mainBundle] URLForResource:@"NewMessage" withExtension:@"aifc"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)newMessageURL, &_newMessageSound); AudioServicesCreateSystemSoundID((__bridge CFURLRef)newMessageURL, &_newMessageSound);
OWSSingletonAssert();
return self; return self;
} }

View file

@ -29,6 +29,18 @@ NSString *const PropertyListPreferencesKeyHasDeclinedNoContactsView = @"hasDecli
@implementation PropertyListPreferences @implementation PropertyListPreferences
- (instancetype)init
{
self = [super init];
if (!self) {
return self;
}
OWSSingletonAssert();
return self;
}
#pragma mark - Helpers #pragma mark - Helpers
- (void)clear { - (void)clear {

View file

@ -39,6 +39,8 @@ typedef void (^pushTokensSuccessBlock)(NSString *pushToken, NSString *voipToken)
@interface PushManager : NSObject <PKPushRegistryDelegate> @interface PushManager : NSObject <PKPushRegistryDelegate>
- (instancetype)init NS_UNAVAILABLE;
+ (PushManager *)sharedManager; + (PushManager *)sharedManager;
/** /**

View file

@ -77,6 +77,8 @@
_callBackgroundTask = UIBackgroundTaskInvalid; _callBackgroundTask = UIBackgroundTaskInvalid;
_currentNotifications = [NSMutableArray array]; _currentNotifications = [NSMutableArray array];
OWSSingletonAssert();
return self; return self;
} }

View file

@ -103,6 +103,8 @@
-(instancetype)init { -(instancetype)init {
if (self = [super init]) { if (self = [super init]) {
self.responseData = [NSMutableData data]; self.responseData = [NSMutableData data];
OWSSingletonAssert();
} }
return self; return self;
} }