Merge branch 'charlesmchen/signalRecipientReloads' into release/2.31.0

pull/1/head
Matthew Chen 7 years ago
commit 4c98a200df

@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertDebug(devices.count > 0);
OWSLogDebug(@"removing devices: %@, from registered recipient: %@", devices, self);
[self reloadWithTransaction:transaction];
[self reloadWithTransaction:transaction ignoreMissing:YES];
[self removeDevices:devices];
[self saveWithTransaction_internal:transaction];
}

@ -94,8 +94,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Assign the latest persisted values from the database.
*/
- (void)reloadWithTransaction:(YapDatabaseReadTransaction *)transaction;
- (void)reload;
- (void)reloadWithTransaction:(YapDatabaseReadTransaction *)transaction;
- (void)reloadWithTransaction:(YapDatabaseReadTransaction *)transaction ignoreMissing:(BOOL)ignoreMissing;
/**
* Saves the object with the shared readWrite connection - does not block.

@ -226,10 +226,17 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)reloadWithTransaction:(YapDatabaseReadTransaction *)transaction
{
[self reloadWithTransaction:transaction ignoreMissing:NO];
}
- (void)reloadWithTransaction:(YapDatabaseReadTransaction *)transaction ignoreMissing:(BOOL)ignoreMissing
{
TSYapDatabaseObject *latest = [[self class] fetchObjectWithUniqueID:self.uniqueId transaction:transaction];
if (!latest) {
OWSFailDebug(@"`latest` was unexpectedly nil");
if (!ignoreMissing) {
OWSFailDebug(@"`latest` was unexpectedly nil");
}
return;
}

Loading…
Cancel
Save