|
|
@ -35,47 +35,26 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic) NSMutableArray *currentNotifications;
|
|
|
|
@property (nonatomic) NSMutableArray *currentNotifications;
|
|
|
|
@property (nonatomic) UIBackgroundTaskIdentifier callBackgroundTask;
|
|
|
|
@property (nonatomic) UIBackgroundTaskIdentifier callBackgroundTask;
|
|
|
|
@property (nonatomic, readonly) OWSMessageSender *messageSender;
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) OWSMessageFetcherJob *messageFetcherJob;
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) NotificationsManager *notificationsManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation PushManager
|
|
|
|
@implementation PushManager
|
|
|
|
|
|
|
|
|
|
|
|
+ (instancetype)sharedManager {
|
|
|
|
+ (instancetype)sharedManager {
|
|
|
|
static PushManager *sharedManager = nil;
|
|
|
|
OWSAssertDebug(AppEnvironment.shared.pushManager);
|
|
|
|
static dispatch_once_t onceToken;
|
|
|
|
|
|
|
|
dispatch_once(&onceToken, ^{
|
|
|
|
|
|
|
|
sharedManager = [[self alloc] initDefault];
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return sharedManager;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initDefault
|
|
|
|
return AppEnvironment.shared.pushManager;
|
|
|
|
{
|
|
|
|
|
|
|
|
return [self initWithMessageFetcherJob:AppEnvironment.shared.messageFetcherJob
|
|
|
|
|
|
|
|
primaryStorage:[OWSPrimaryStorage sharedManager]
|
|
|
|
|
|
|
|
messageSender:SSKEnvironment.shared.messageSender
|
|
|
|
|
|
|
|
notificationsManager:AppEnvironment.shared.notificationsManager];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithMessageFetcherJob:(OWSMessageFetcherJob *)messageFetcherJob
|
|
|
|
- (instancetype)init {
|
|
|
|
primaryStorage:(OWSPrimaryStorage *)primaryStorage
|
|
|
|
|
|
|
|
messageSender:(OWSMessageSender *)messageSender
|
|
|
|
|
|
|
|
notificationsManager:(NotificationsManager *)notificationsManager
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
self = [super init];
|
|
|
|
self = [super init];
|
|
|
|
if (!self) {
|
|
|
|
if (!self) {
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_messageSender = messageSender;
|
|
|
|
|
|
|
|
_messageFetcherJob = messageFetcherJob;
|
|
|
|
|
|
|
|
_callBackgroundTask = UIBackgroundTaskInvalid;
|
|
|
|
_callBackgroundTask = UIBackgroundTaskInvalid;
|
|
|
|
// TODO: consolidate notification tracking with NotificationsManager, which also maintains a list of notifications.
|
|
|
|
// TODO: consolidate notification tracking with NotificationsManager, which also maintains a list of notifications.
|
|
|
|
_currentNotifications = [NSMutableArray array];
|
|
|
|
_currentNotifications = [NSMutableArray array];
|
|
|
|
_notificationsManager = notificationsManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OWSSingletonAssert();
|
|
|
|
OWSSingletonAssert();
|
|
|
|
|
|
|
|
|
|
|
@ -87,6 +66,22 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (OWSMessageSender *)messageSender {
|
|
|
|
|
|
|
|
return SSKEnvironment.shared.messageSender;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (OWSMessageFetcherJob *)messageFetcherJob {
|
|
|
|
|
|
|
|
return AppEnvironment.shared.messageFetcherJob;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (id<NotificationsProtocol>)notificationsManager {
|
|
|
|
|
|
|
|
return SSKEnvironment.shared.notificationsManager;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
|
|
|
|
- (CallUIAdapter *)callUIAdapter
|
|
|
|
- (CallUIAdapter *)callUIAdapter
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return AppEnvironment.shared.callService.callUIAdapter;
|
|
|
|
return AppEnvironment.shared.callService.callUIAdapter;
|
|
|
|