"Hoist" database storage to SSKEnvironment.
This commit is contained in:
parent
d1e3fe7c38
commit
7180ab4261
@ -90,6 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
id<OWSTypingIndicators> typingIndicators = [[OWSTypingIndicatorsImpl alloc] init];
|
||||
OWSAttachmentDownloads *attachmentDownloads = [[OWSAttachmentDownloads alloc] init];
|
||||
StickerManager *stickerManager = [[StickerManager alloc] init];
|
||||
SDSDatabaseStorage *databaseStorage = [[SDSDatabaseStorage alloc] init];
|
||||
|
||||
OWSAudioSession *audioSession = [OWSAudioSession new];
|
||||
OWSSounds *sounds = [[OWSSounds alloc] initWithPrimaryStorage:primaryStorage];
|
||||
@ -128,7 +129,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
syncManager:syncManager
|
||||
typingIndicators:typingIndicators
|
||||
attachmentDownloads:attachmentDownloads
|
||||
stickerManager:stickerManager]];
|
||||
stickerManager:stickerManager
|
||||
databaseStorage:databaseStorage]];
|
||||
|
||||
appSpecificSingletonBlock();
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class OWSOutgoingReceiptManager;
|
||||
@class OWSPrimaryStorage;
|
||||
@class OWSReadReceiptManager;
|
||||
@class SDSDatabaseStorage;
|
||||
@class StickerManager;
|
||||
@class TSAccountManager;
|
||||
@class TSNetworkManager;
|
||||
@ -66,7 +67,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
syncManager:(id<OWSSyncManagerProtocol>)syncManager
|
||||
typingIndicators:(id<OWSTypingIndicators>)typingIndicators
|
||||
attachmentDownloads:(OWSAttachmentDownloads *)attachmentDownloads
|
||||
stickerManager:(StickerManager *)stickerManager NS_DESIGNATED_INITIALIZER;
|
||||
stickerManager:(StickerManager *)stickerManager
|
||||
databaseStorage:(SDSDatabaseStorage *)databaseStorage NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@ -106,6 +108,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readonly) id<OWSTypingIndicators> typingIndicators;
|
||||
@property (nonatomic, readonly) OWSAttachmentDownloads *attachmentDownloads;
|
||||
@property (nonatomic, readonly) StickerManager *stickerManager;
|
||||
@property (nonatomic, readonly) SDSDatabaseStorage *databaseStorage;
|
||||
|
||||
// This property is configured after Environment is created.
|
||||
@property (atomic, nullable) id<OWSCallMessageHandler> callMessageHandler;
|
||||
|
||||
@ -37,6 +37,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||
@property (nonatomic) id<OWSTypingIndicators> typingIndicators;
|
||||
@property (nonatomic) OWSAttachmentDownloads *attachmentDownloads;
|
||||
@property (nonatomic) StickerManager *stickerManager;
|
||||
@property (nonatomic) SDSDatabaseStorage *databaseStorage;
|
||||
|
||||
@end
|
||||
|
||||
@ -78,6 +79,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||
typingIndicators:(id<OWSTypingIndicators>)typingIndicators
|
||||
attachmentDownloads:(OWSAttachmentDownloads *)attachmentDownloads
|
||||
stickerManager:(StickerManager *)stickerManager
|
||||
databaseStorage:(SDSDatabaseStorage *)databaseStorage
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
@ -111,6 +113,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||
OWSAssertDebug(typingIndicators);
|
||||
OWSAssertDebug(attachmentDownloads);
|
||||
OWSAssertDebug(stickerManager);
|
||||
OWSAssertDebug(databaseStorage);
|
||||
|
||||
_contactsManager = contactsManager;
|
||||
_linkPreviewManager = linkPreviewManager;
|
||||
@ -139,6 +142,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||
_typingIndicators = typingIndicators;
|
||||
_attachmentDownloads = attachmentDownloads;
|
||||
_stickerManager = stickerManager;
|
||||
_databaseStorage = databaseStorage;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -8,9 +8,10 @@ import GRDBCipher
|
||||
@objc
|
||||
public class SDSDatabaseStorage: NSObject {
|
||||
|
||||
// TODO hoist to environment
|
||||
@objc
|
||||
public static let shared: SDSDatabaseStorage = SDSDatabaseStorage()
|
||||
public static var shared: SDSDatabaseStorage {
|
||||
return SSKEnvironment.shared.databaseStorage
|
||||
}
|
||||
|
||||
static public var shouldLogDBQueries: Bool = false
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SSKEnvironment.h"
|
||||
@ -32,6 +32,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic) ContactDiscoveryService *contactDiscoveryService;
|
||||
@property (nonatomic) OWSReadReceiptManager *readReceiptManager;
|
||||
@property (nonatomic) OWSOutgoingReceiptManager *outgoingReceiptManager;
|
||||
@property (nonatomic) id<OWSSyncManagerProtocol> syncManager;
|
||||
@property (nonatomic) id<SSKReachabilityManager> reachabilityManager;
|
||||
@property (nonatomic) id<OWSTypingIndicators> typingIndicators;
|
||||
@property (nonatomic) OWSAttachmentDownloads *attachmentDownloads;
|
||||
@property (nonatomic) StickerManager *stickerManager;
|
||||
@property (nonatomic) SDSDatabaseStorage *databaseStorage;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -78,6 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
id<OWSTypingIndicators> typingIndicators = [[OWSTypingIndicatorsImpl alloc] init];
|
||||
OWSAttachmentDownloads *attachmentDownloads = [[OWSAttachmentDownloads alloc] init];
|
||||
StickerManager *stickerManager = [[StickerManager alloc] init];
|
||||
SDSDatabaseStorage *databaseStorage = [[SDSDatabaseStorage alloc] init];
|
||||
|
||||
self = [super initWithContactsManager:contactsManager
|
||||
linkPreviewManager:linkPreviewManager
|
||||
@ -105,7 +106,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
syncManager:syncManager
|
||||
typingIndicators:typingIndicators
|
||||
attachmentDownloads:attachmentDownloads
|
||||
stickerManager:stickerManager];
|
||||
stickerManager:stickerManager
|
||||
databaseStorage:databaseStorage];
|
||||
|
||||
if (!self) {
|
||||
return nil;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user