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; - (BOOL)mayHaveLinkedDevices:(YapDatabaseConnection *)dbConnection;
- (void)setMayHaveLinkedDevices; - (void)setMayHaveLinkedDevices;
- (void)clearMayHaveLinkedDevicesIfNotSet; - (void)clearMayHaveLinkedDevices;
- (BOOL)hasReceivedSyncMessageInLastSeconds:(NSTimeInterval)intervalSeconds; - (BOOL)hasReceivedSyncMessageInLastSeconds:(NSTimeInterval)intervalSeconds;
- (void)setHasReceivedSyncMessage; - (void)setHasReceivedSyncMessage;

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

Loading…
Cancel
Save