commit
8e891eb357
|
@ -134,7 +134,7 @@ CHECKOUT OPTIONS:
|
|||
:commit: 521686c112bbae7a762f85d52b1e41eeb1760772
|
||||
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
|
||||
SignalServiceKit:
|
||||
:commit: 8714a8f37c494f7af8bcfa530c5e63b8a28f7029
|
||||
:commit: 72e893d5f7153ad477293d489ea910d0956e7ad4
|
||||
:git: https://github.com/WhisperSystems/SignalServiceKit.git
|
||||
SocketRocket:
|
||||
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{
|
||||
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB",
|
||||
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++2D5CBAE",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
|
||||
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++72E8629" : 9223372036854775807,
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : 0,
|
||||
"01DE8628B025BC69C8C7D8B4612D57BE2C08B62C+++6A1C9FC" : 0,
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : 0,
|
||||
"ABB939127996C66F7E852A780552ADEEF03C6B13+++69179A3" : 0,
|
||||
"90530B99EB0008E7A50951FDFBE02169118FA649+++EF2C0B3" : 0,
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : 0,
|
||||
"D74FB800F048CB516BB4BC70047F7CC676D291B9+++375B249" : 0,
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++692B8E4" : 9223372036854775807,
|
||||
"37054CE35CE656680D6FFFA9EE19249E0D149C5E+++901E7D4" : 0,
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++2D5CBAE" : 0,
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++E19D6E3" : 9223372036854775807,
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++03D0758" : 0,
|
||||
"37054CE35CE656680D6FFFA9EE19249E0D149C5E+++3F8B703" : 9223372036854775807,
|
||||
|
@ -21,13 +23,15 @@
|
|||
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "D0F297E7-A82D-4657-A941-96B268F80ABC",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++72E8629" : "Signal-iOS-2\/Carthage\/",
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : "Signal-iOS-2\/",
|
||||
"01DE8628B025BC69C8C7D8B4612D57BE2C08B62C+++6A1C9FC" : "SignalProtocolKit\/",
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : "Signal-iOS-2\/",
|
||||
"ABB939127996C66F7E852A780552ADEEF03C6B13+++69179A3" : "SocketRocket\/",
|
||||
"90530B99EB0008E7A50951FDFBE02169118FA649+++EF2C0B3" : "JSQMessagesViewController\/",
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : "Signal-iOS\/",
|
||||
"D74FB800F048CB516BB4BC70047F7CC676D291B9+++375B249" : "Signal-iOS\/Pods\/",
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++692B8E4" : "Signal-iOS-4\/Carthage\/",
|
||||
"37054CE35CE656680D6FFFA9EE19249E0D149C5E+++901E7D4" : "SignalServiceKit\/",
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++2D5CBAE" : "Signal-iOS-4\/",
|
||||
"8176314449001F06FB0E5B588C62133EAA2FE911+++E19D6E3" : "Signal-iOS\/Carthage\/",
|
||||
"5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++03D0758" : "Signal-iOS-5\/",
|
||||
"37054CE35CE656680D6FFFA9EE19249E0D149C5E+++3F8B703" : "SignalServiceKit-2\/",
|
||||
|
@ -68,6 +72,11 @@
|
|||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:WhisperSystems\/Signal-iOS.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++2D5CBAE"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:WhisperSystems\/Signal-iOS.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
|
@ -78,6 +87,11 @@
|
|||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "8176314449001F06FB0E5B588C62133EAA2FE911+++31C7255"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/WhisperSystems\/Signal-Carthage.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "8176314449001F06FB0E5B588C62133EAA2FE911+++692B8E4"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/WhisperSystems\/Signal-Carthage.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.13.2</string>
|
||||
<string>2.13.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
@ -55,7 +55,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.13.2.0</string>
|
||||
<string>2.13.3.0</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LOGS_EMAIL</key>
|
||||
|
|
|
@ -136,53 +136,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
|
||||
[self prepareScreenProtection];
|
||||
|
||||
// At this point, potentially lengthy DB locking migrations could be running.
|
||||
// Avoid blocking app launch by putting all further possible DB access in async thread.
|
||||
[[TSAccountManager sharedInstance]
|
||||
ifRegistered:YES
|
||||
runAsync:^{
|
||||
DDLogInfo(
|
||||
@"%@ running post launch block for registered user: %@", self.tag, [TSAccountManager localNumber]);
|
||||
|
||||
[TSSocketManager requestSocketOpen];
|
||||
|
||||
RTCInitializeSSL();
|
||||
|
||||
[OWSSyncPushTokensJob runWithPushManager:[PushManager sharedManager]
|
||||
accountManager:[Environment getCurrent].accountManager
|
||||
preferences:[Environment preferences]
|
||||
showAlerts:NO];
|
||||
|
||||
// Clean up any messages that expired since last launch immediately
|
||||
// and continue cleaning in the background.
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
|
||||
// Mark all "attempting out" messages as "unsent", i.e. any messages that were not successfully
|
||||
// sent before the app exited should be marked as failures.
|
||||
[[[OWSFailedMessagesJob alloc] initWithStorageManager:[TSStorageManager sharedManager]] run];
|
||||
[[[OWSFailedAttachmentDownloadsJob alloc] initWithStorageManager:[TSStorageManager sharedManager]] run];
|
||||
|
||||
[AppStoreRating setupRatingLibrary];
|
||||
}];
|
||||
|
||||
[[TSAccountManager sharedInstance]
|
||||
ifRegistered:NO
|
||||
runAsync:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Unregistered user should have no unread messages. e.g. if you delete your account.
|
||||
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
|
||||
|
||||
DDLogInfo(@"%@ running post launch block for unregistered user.", self.tag);
|
||||
[TSSocketManager requestSocketOpen];
|
||||
|
||||
UITapGestureRecognizer *gesture =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:[Pastelog class] action:@selector(submitLogs)];
|
||||
gesture.numberOfTapsRequired = 8;
|
||||
[self.window addGestureRecognizer:gesture];
|
||||
});
|
||||
RTCInitializeSSL();
|
||||
}];
|
||||
|
||||
self.contactsSyncing = [[OWSContactsSyncing alloc] initWithContactsManager:[Environment getCurrent].contactsManager
|
||||
identityManager:[OWSIdentityManager sharedManager]
|
||||
messageSender:[Environment getCurrent].messageSender];
|
||||
|
@ -483,23 +436,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
if (getenv("runningTests_dontStartApp")) {
|
||||
return;
|
||||
}
|
||||
|
||||
[[TSAccountManager sharedInstance] ifRegistered:YES
|
||||
runAsync:^{
|
||||
// We're double checking that the app is active, to be sure since we
|
||||
// can't verify in production env due to code
|
||||
// signing.
|
||||
[TSSocketManager requestSocketOpen];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[Environment getCurrent]
|
||||
.contactsManager fetchSystemContactsIfAlreadyAuthorized];
|
||||
});
|
||||
|
||||
// This will fetch new messages, if we're using domain
|
||||
// fronting.
|
||||
[[PushManager sharedManager] applicationDidBecomeActive];
|
||||
}];
|
||||
|
||||
[self removeScreenProtection];
|
||||
|
||||
|
@ -508,6 +444,73 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
// Always check prekeys after app launches, and sometimes check on app activation.
|
||||
[TSPreKeyManager checkPreKeysIfNecessary];
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
|
||||
// At this point, potentially lengthy DB locking migrations could be running.
|
||||
// Avoid blocking app launch by putting all further possible DB access in async thread.
|
||||
[[TSAccountManager sharedInstance]
|
||||
ifRegistered:YES
|
||||
runAsync:^{
|
||||
DDLogInfo(@"%@ running post launch block for registered user: %@",
|
||||
self.tag,
|
||||
[TSAccountManager localNumber]);
|
||||
|
||||
RTCInitializeSSL();
|
||||
|
||||
[OWSSyncPushTokensJob runWithPushManager:[PushManager sharedManager]
|
||||
accountManager:[Environment getCurrent].accountManager
|
||||
preferences:[Environment preferences]
|
||||
showAlerts:NO];
|
||||
|
||||
// Clean up any messages that expired since last launch immediately
|
||||
// and continue cleaning in the background.
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
|
||||
// Mark all "attempting out" messages as "unsent", i.e. any messages that were not successfully
|
||||
// sent before the app exited should be marked as failures.
|
||||
[[[OWSFailedMessagesJob alloc] initWithStorageManager:[TSStorageManager sharedManager]] run];
|
||||
[[[OWSFailedAttachmentDownloadsJob alloc] initWithStorageManager:[TSStorageManager sharedManager]]
|
||||
run];
|
||||
|
||||
[AppStoreRating setupRatingLibrary];
|
||||
}];
|
||||
|
||||
[[TSAccountManager sharedInstance]
|
||||
ifRegistered:NO
|
||||
runAsync:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
DDLogInfo(@"%@ running post launch block for unregistered user.", self.tag);
|
||||
|
||||
// Unregistered user should have no unread messages. e.g. if you delete your account.
|
||||
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
|
||||
|
||||
[TSSocketManager requestSocketOpen];
|
||||
|
||||
UITapGestureRecognizer *gesture =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:[Pastelog class]
|
||||
action:@selector(submitLogs)];
|
||||
gesture.numberOfTapsRequired = 8;
|
||||
[self.window addGestureRecognizer:gesture];
|
||||
});
|
||||
RTCInitializeSSL();
|
||||
}];
|
||||
});
|
||||
|
||||
[[TSAccountManager sharedInstance]
|
||||
ifRegistered:YES
|
||||
runAsync:^{
|
||||
[TSSocketManager requestSocketOpen];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[Environment getCurrent].contactsManager fetchSystemContactsIfAlreadyAuthorized];
|
||||
});
|
||||
|
||||
// This will fetch new messages, if we're using domain
|
||||
// fronting.
|
||||
[[PushManager sharedManager] applicationDidBecomeActive];
|
||||
}];
|
||||
|
||||
DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.tag);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#ifdef DEBUG
|
||||
__block NSUInteger threadCount;
|
||||
__block NSUInteger messageCount;
|
||||
[TSStorageManager.sharedManager.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
[TSStorageManager.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
threadCount = [[transaction ext:TSThreadDatabaseViewExtensionName] numberOfItemsInAllGroups];
|
||||
messageCount = [[transaction ext:TSMessageDatabaseViewExtensionName] numberOfItemsInAllGroups];
|
||||
}];
|
||||
|
|
|
@ -278,7 +278,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
if (!_nonSignalContacts) {
|
||||
NSMutableSet<Contact *> *nonSignalContacts = [NSMutableSet new];
|
||||
[[TSStorageManager sharedManager].dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
[[TSStorageManager sharedManager].dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
for (Contact *contact in self.contactsManager.allContactsMap.allValues) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = [contact signalRecipientsWithTransaction:transaction];
|
||||
if (signalRecipients.count < 1) {
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DebugSettingsTableViewController.h"
|
||||
#import "UIFont+OWS.h"
|
||||
#import <SignalServiceKit/TSDatabaseView.h>
|
||||
#import <SignalServiceKit/TSStorageManager.h>
|
||||
|
||||
@implementation DebugSettingsTableViewController
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
self.tableViewStyle = UITableViewStylePlain;
|
||||
[super loadView];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
|
||||
self.title = @"Debugging";
|
||||
|
||||
[self updateTableContents];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
[self updateTableContents];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark - Table Contents
|
||||
|
||||
- (void)updateTableContents
|
||||
{
|
||||
OWSTableContents *contents = [OWSTableContents new];
|
||||
OWSTableSection *section = [OWSTableSection new];
|
||||
|
||||
__block NSUInteger threadCount;
|
||||
__block NSUInteger messageCount;
|
||||
[TSStorageManager.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
threadCount = [[transaction ext:TSThreadDatabaseViewExtensionName] numberOfItemsInAllGroups];
|
||||
messageCount = [[transaction ext:TSMessageDatabaseViewExtensionName] numberOfItemsInAllGroups];
|
||||
}];
|
||||
|
||||
[section addItem:[OWSTableItem labelItemWithText:[NSString stringWithFormat:@"Threads: %zd", threadCount]]];
|
||||
[section addItem:[OWSTableItem labelItemWithText:[NSString stringWithFormat:@"Messages: %zd", messageCount]]];
|
||||
|
||||
[contents addSection:section];
|
||||
|
||||
self.contents = contents;
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
@end
|
|
@ -581,7 +581,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSMutableArray<TSInteraction *> *result = [NSMutableArray new];
|
||||
|
||||
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection readWriteWithBlock:^(
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
|
||||
if ([thread isKindOfClass:[TSContactThread class]]) {
|
||||
TSContactThread *contactThread = (TSContactThread *)thread;
|
||||
|
@ -722,11 +723,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(thread);
|
||||
|
||||
NSArray<TSInteraction *> *messages = [self unsavedSystemMessagesInThread:thread];
|
||||
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
for (TSInteraction *message in messages) {
|
||||
[message saveWithTransaction:transaction];
|
||||
}
|
||||
}];
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
for (TSInteraction *message in messages) {
|
||||
[message saveWithTransaction:transaction];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)createSystemMessageInThread:(TSThread *)thread
|
||||
|
@ -735,9 +737,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSArray<TSInteraction *> *messages = [self unsavedSystemMessagesInThread:thread];
|
||||
TSInteraction *message = messages[(NSUInteger)arc4random_uniform((uint32_t)messages.count)];
|
||||
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[message saveWithTransaction:transaction];
|
||||
}];
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[message saveWithTransaction:transaction];
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)sendTextAndSystemMessages:(int)counter thread:(TSThread *)thread
|
||||
|
@ -796,7 +799,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (void)createFakeUnreadMessages:(int)counter thread:(TSThread *)thread
|
||||
{
|
||||
[TSStorageManager.sharedManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[TSStorageManager.sharedManager.dbReadWriteConnection readWriteWithBlock:^(
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
for (int i = 0; i < counter; i++) {
|
||||
NSString *randomText = [self randomText];
|
||||
TSIncomingMessage *message = [[TSIncomingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||
|
@ -811,7 +815,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (void)sendFakeMessages:(int)counter thread:(TSThread *)thread
|
||||
{
|
||||
[TSStorageManager.sharedManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[TSStorageManager.sharedManager.dbReadWriteConnection readWriteWithBlock:^(
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
for (int i = 0; i < counter; i++) {
|
||||
NSString *randomText = [self randomText];
|
||||
switch (arc4random_uniform(4)) {
|
||||
|
|
|
@ -444,7 +444,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
|
|||
TSGroupModel *model = [self makeGroup];
|
||||
|
||||
__block TSGroupThread *thread;
|
||||
[[TSStorageManager sharedManager].dbConnection
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
thread = [TSGroupThread getOrCreateThreadWithGroupModel:model transaction:transaction];
|
||||
}];
|
||||
|
|
|
@ -215,9 +215,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
|
||||
__block TSThread *thread = nil;
|
||||
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
thread = [TSContactThread getOrCreateThreadWithContactId:signalAccount.recipientId transaction:transaction];
|
||||
}];
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
thread = [TSContactThread getOrCreateThreadWithContactId:signalAccount.recipientId transaction:transaction];
|
||||
}];
|
||||
OWSAssert(thread);
|
||||
|
||||
[self.delegate threadWasSelected:thread];
|
||||
|
|
|
@ -172,7 +172,7 @@ NSString *const kTSStorageManager_AccountLastNames = @"kTSStorageManager_Account
|
|||
// in order to avoid database deadlock.
|
||||
NSMutableDictionary<NSString *, NSArray<SignalRecipient *> *> *contactIdToSignalRecipientsMap =
|
||||
[NSMutableDictionary new];
|
||||
[[TSStorageManager sharedManager].dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
[[TSStorageManager sharedManager].dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
for (Contact *contact in contacts) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = [contact signalRecipientsWithTransaction:transaction];
|
||||
contactIdToSignalRecipientsMap[contact.uniqueId] = signalRecipients;
|
||||
|
|
|
@ -209,11 +209,11 @@ static Environment *environment = nil;
|
|||
Environment *env = [self getCurrent];
|
||||
SignalsViewController *vc = env.signalsViewController;
|
||||
|
||||
[[TSStorageManager sharedManager]
|
||||
.dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
TSThread *thread = [TSContactThread getOrCreateThreadWithContactId:identifier transaction:transaction];
|
||||
[vc presentThread:thread keyboardOnViewAppearing:YES callOnViewAppearing:NO];
|
||||
}];
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
TSThread *thread = [TSContactThread getOrCreateThreadWithContactId:identifier transaction:transaction];
|
||||
[vc presentThread:thread keyboardOnViewAppearing:YES callOnViewAppearing:NO];
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)callUserWithIdentifier:(NSString *)identifier
|
||||
|
@ -221,7 +221,7 @@ static Environment *environment = nil;
|
|||
Environment *env = [self getCurrent];
|
||||
SignalsViewController *vc = env.signalsViewController;
|
||||
|
||||
[[TSStorageManager sharedManager].dbConnection
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
TSThread *thread = [TSContactThread getOrCreateThreadWithContactId:identifier transaction:transaction];
|
||||
[vc presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:YES];
|
||||
|
|
|
@ -27,7 +27,8 @@ static NSString *const OWS104CreateRecipientIdentitiesMigrationId = @"104";
|
|||
// Overriding runUp instead of runUpWithTransaction in order to implement a blocking migration.
|
||||
- (void)runUp
|
||||
{
|
||||
[[OWSRecipientIdentity dbConnection] readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[[OWSRecipientIdentity dbReadWriteConnection] readWriteWithBlock:^(
|
||||
YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
NSMutableDictionary<NSString *, NSData *> *identityKeys = [NSMutableDictionary new];
|
||||
|
||||
[transaction
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[[OWS100RemoveTSRecipientsMigration alloc] initWithStorageManager:self.storageManager],
|
||||
[[OWS102MoveLoggingPreferenceToUserDefaults alloc] initWithStorageManager:self.storageManager],
|
||||
[[OWS103EnableVideoCalling alloc] initWithStorageManager:self.storageManager],
|
||||
[[OWS104CreateRecipientIdentities alloc] initWithStorageManager:self.storageManager],
|
||||
// OWS104CreateRecipientIdentities is run separately. See runSafeBlockingMigrations.
|
||||
[[OWS105AttachmentFilePaths alloc] initWithStorageManager:self.storageManager]
|
||||
];
|
||||
}
|
||||
|
@ -46,6 +46,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (void)runSafeBlockingMigrations
|
||||
{
|
||||
// This should only include migrations which:
|
||||
//
|
||||
// a) Do read/write database transactions and therefore would block on the async database
|
||||
// view registration.
|
||||
// b) Will not affect any of the data used by the async database views.
|
||||
[self runMigrations:@[
|
||||
[[OWS104CreateRecipientIdentities alloc] initWithStorageManager:self.storageManager],
|
||||
]];
|
||||
|
|
|
@ -200,10 +200,10 @@
|
|||
NSError *deleteError;
|
||||
if ([fm removeItemAtPath:bloomFilterPath error:&deleteError]) {
|
||||
DDLogInfo(@"Successfully removed bloom filter cache.");
|
||||
[[TSStorageManager sharedManager]
|
||||
.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[transaction removeAllObjectsInCollection:@"TSRecipient"];
|
||||
}];
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[transaction removeAllObjectsInCollection:@"TSRecipient"];
|
||||
}];
|
||||
DDLogInfo(@"Removed all TSRecipient records - will be replaced by SignalRecipients at next address sync.");
|
||||
} else {
|
||||
DDLogError(@"Failed to remove bloom filter cache with error: %@", deleteError.localizedDescription);
|
||||
|
|
|
@ -227,7 +227,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
|
|||
NSString *threadId = userInfo[Signal_Thread_UserInfo_Key];
|
||||
|
||||
TSThread *thread = [TSThread fetchObjectWithUniqueID:threadId];
|
||||
[[TSStorageManager sharedManager].dbConnection
|
||||
[[TSStorageManager sharedManager].dbReadWriteConnection
|
||||
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
// TODO: I suspect we only want to mark the message in
|
||||
// question as read.
|
||||
|
|
Loading…
Reference in New Issue