From d00c8921587a94631c0e36ca260dc49f324bdc9a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 31 Mar 2017 18:36:30 -0400 Subject: [PATCH] Apply assert to ensure singletons are only created once. // FREEBIE --- Podfile | 4 ++-- Podfile.lock | 9 +++------ Signal/src/network/PushManager.h | 2 ++ Signal/src/network/PushManager.m | 2 ++ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Podfile b/Podfile index 52b196b6c..8d8b3f33d 100644 --- a/Podfile +++ b/Podfile @@ -5,8 +5,8 @@ target 'Signal' do pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git' pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' #pod 'AxolotlKit', path: '../SignalProtocolKit' - pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' - #pod 'SignalServiceKit', path: '../SignalServiceKit' + #pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' + pod 'SignalServiceKit', path: '../SignalServiceKit' pod 'OpenSSL' pod 'SCWaveformView', '~> 1.0' pod 'JSQMessagesViewController' diff --git a/Podfile.lock b/Podfile.lock index 6fa28f32d..4b8703c08 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -116,14 +116,14 @@ DEPENDENCIES: - OpenSSL - PureLayout - SCWaveformView (~> 1.0) - - SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`) + - SignalServiceKit (from `../SignalServiceKit`) - SocketRocket (from `https://github.com/facebook/SocketRocket.git`) EXTERNAL SOURCES: AxolotlKit: :git: https://github.com/WhisperSystems/SignalProtocolKit.git SignalServiceKit: - :git: https://github.com/WhisperSystems/SignalServiceKit.git + :path: ../SignalServiceKit SocketRocket: :git: https://github.com/facebook/SocketRocket.git @@ -131,9 +131,6 @@ CHECKOUT OPTIONS: AxolotlKit: :commit: cbf2f47d59dd54d6d720fe787f835bd767443bb6 :git: https://github.com/WhisperSystems/SignalProtocolKit.git - SignalServiceKit: - :commit: 8b5f82eb6d8393074987697cea6986b55fec800e - :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf :git: https://github.com/facebook/SocketRocket.git @@ -161,6 +158,6 @@ SPEC CHECKSUMS: UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f -PODFILE CHECKSUM: a060377074cb361576f346a58d1503b3bd708440 +PODFILE CHECKSUM: cb02bca5a68f5b03df77200dae4ce1235a007807 COCOAPODS: 1.2.0 diff --git a/Signal/src/network/PushManager.h b/Signal/src/network/PushManager.h index a2849c877..97039713a 100644 --- a/Signal/src/network/PushManager.h +++ b/Signal/src/network/PushManager.h @@ -39,6 +39,8 @@ typedef void (^pushTokensSuccessBlock)(NSString *pushToken, NSString *voipToken) @interface PushManager : NSObject +- (instancetype)init NS_UNAVAILABLE; + + (PushManager *)sharedManager; /** diff --git a/Signal/src/network/PushManager.m b/Signal/src/network/PushManager.m index 5fff2fdfb..420fab28e 100644 --- a/Signal/src/network/PushManager.m +++ b/Signal/src/network/PushManager.m @@ -77,6 +77,8 @@ _callBackgroundTask = UIBackgroundTaskInvalid; _currentNotifications = [NSMutableArray array]; + OWSSingletonAssert(); + return self; }