|
|
@ -1,5 +1,5 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import "OWSSyncManager.h"
|
|
|
|
#import "OWSSyncManager.h"
|
|
|
@ -127,10 +127,16 @@ NSString *const kSyncManagerLastContactSyncKey = @"kTSStorageManagerOWSSyncManag
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
|
|
|
|
- (YapDatabaseConnection *)editingDatabaseConnection {
|
|
|
|
- (YapDatabaseConnection *)editingDatabaseConnection
|
|
|
|
|
|
|
|
{
|
|
|
|
return OWSPrimaryStorage.sharedManager.dbReadWriteConnection;
|
|
|
|
return OWSPrimaryStorage.sharedManager.dbReadWriteConnection;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (YapDatabaseConnection *)readDatabaseConnection
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return OWSPrimaryStorage.sharedManager.dbReadConnection;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Methods
|
|
|
|
#pragma mark - Methods
|
|
|
|
|
|
|
|
|
|
|
|
- (void)sendSyncContactsMessageIfNecessary {
|
|
|
|
- (void)sendSyncContactsMessageIfNecessary {
|
|
|
@ -155,7 +161,7 @@ NSString *const kSyncManagerLastContactSyncKey = @"kTSStorageManagerOWSSyncManag
|
|
|
|
|
|
|
|
|
|
|
|
__block NSData *_Nullable messageData;
|
|
|
|
__block NSData *_Nullable messageData;
|
|
|
|
__block NSData *_Nullable lastMessageData;
|
|
|
|
__block NSData *_Nullable lastMessageData;
|
|
|
|
[self.editingDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
[self.readDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
messageData = [syncContactsMessage buildPlainTextAttachmentDataWithTransaction:transaction];
|
|
|
|
messageData = [syncContactsMessage buildPlainTextAttachmentDataWithTransaction:transaction];
|
|
|
|
lastMessageData = [transaction objectForKey:kSyncManagerLastContactSyncKey
|
|
|
|
lastMessageData = [transaction objectForKey:kSyncManagerLastContactSyncKey
|
|
|
|
inCollection:kSyncManagerCollection];
|
|
|
|
inCollection:kSyncManagerCollection];
|
|
|
@ -267,7 +273,7 @@ NSString *const kSyncManagerLastContactSyncKey = @"kTSStorageManagerOWSSyncManag
|
|
|
|
identityManager:self.identityManager
|
|
|
|
identityManager:self.identityManager
|
|
|
|
profileManager:self.profileManager];
|
|
|
|
profileManager:self.profileManager];
|
|
|
|
__block DataSource *dataSource;
|
|
|
|
__block DataSource *dataSource;
|
|
|
|
[self.editingDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
[self.readDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
dataSource = [DataSourceValue
|
|
|
|
dataSource = [DataSourceValue
|
|
|
|
dataSourceWithSyncMessageData:[syncContactsMessage
|
|
|
|
dataSourceWithSyncMessageData:[syncContactsMessage
|
|
|
|
buildPlainTextAttachmentDataWithTransaction:transaction]];
|
|
|
|
buildPlainTextAttachmentDataWithTransaction:transaction]];
|
|
|
|