Merge branch 'charlesmchen/clearMayHaveLinkedDevices' into release/2.31.0

pull/1/head
Matthew Chen 7 years ago
commit 16aec33e24

@ -17,7 +17,7 @@ extern uint32_t const OWSDevicePrimaryDeviceId;
- (BOOL)mayHaveLinkedDevices:(YapDatabaseConnection *)dbConnection;
- (void)setMayHaveLinkedDevices;
- (void)clearMayHaveLinkedDevicesIfNotSet;
- (void)clearMayHaveLinkedDevices;
- (BOOL)hasReceivedSyncMessageInLastSeconds:(NSTimeInterval)intervalSeconds;
- (void)setHasReceivedSyncMessage;

@ -62,17 +62,14 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
// to avoid unnecessary message sends for sync messages until we learn
// of a linked device (e.g. through the device linking UI or by receiving
// a sync message, etc.).
- (void)clearMayHaveLinkedDevicesIfNotSet
- (void)clearMayHaveLinkedDevices
{
// Note that we write async to avoid opening transactions within transactions.
[OWSPrimaryStorage.sharedManager.newDatabaseConnection
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
if (![transaction objectForKey:kOWSPrimaryStorage_MayHaveLinkedDevices
inCollection:kOWSPrimaryStorage_OWSDeviceCollection]) {
[transaction setObject:@(NO)
forKey:kOWSPrimaryStorage_MayHaveLinkedDevices
inCollection:kOWSPrimaryStorage_OWSDeviceCollection];
}
}];
}

@ -1156,7 +1156,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// to avoid unnecessary message sends for sync messages until we learn
// of a linked device (e.g. through the device linking UI or by receiving
// a sync message, etc.).
[OWSDeviceManager.sharedManager clearMayHaveLinkedDevicesIfNotSet];
[OWSDeviceManager.sharedManager clearMayHaveLinkedDevices];
}
dispatch_async([OWSDispatch sendingQueue], ^{

Loading…
Cancel
Save