|
|
@ -108,6 +108,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
OWSAssert(blockingManager);
|
|
|
|
OWSAssert(blockingManager);
|
|
|
|
OWSAssert(maxRangeSize > 0);
|
|
|
|
OWSAssert(maxRangeSize > 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *localNumber = [TSAccountManager localNumber];
|
|
|
|
|
|
|
|
OWSAssert(localNumber.length > 0);
|
|
|
|
|
|
|
|
|
|
|
|
ThreadDynamicInteractions *result = [ThreadDynamicInteractions new];
|
|
|
|
ThreadDynamicInteractions *result = [ThreadDynamicInteractions new];
|
|
|
|
|
|
|
|
|
|
|
|
[storageManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
|
[storageManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
@ -279,6 +282,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
NSString *recipientId = ((TSContactThread *)thread).contactIdentifier;
|
|
|
|
NSString *recipientId = ((TSContactThread *)thread).contactIdentifier;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ([recipientId isEqualToString:localNumber]) {
|
|
|
|
|
|
|
|
// Don't add self to contacts.
|
|
|
|
|
|
|
|
shouldHaveAddToContactsOffer = NO;
|
|
|
|
|
|
|
|
// Don't bother to block self.
|
|
|
|
|
|
|
|
shouldHaveBlockOffer = NO;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if ([[blockingManager blockedPhoneNumbers] containsObject:recipientId]) {
|
|
|
|
if ([[blockingManager blockedPhoneNumbers] containsObject:recipientId]) {
|
|
|
|
// Only create "add to contacts" offers for users which are not already blocked.
|
|
|
|
// Only create "add to contacts" offers for users which are not already blocked.
|
|
|
|
shouldHaveAddToContactsOffer = NO;
|
|
|
|
shouldHaveAddToContactsOffer = NO;
|
|
|
@ -294,6 +303,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
shouldHaveBlockOffer = NO;
|
|
|
|
shouldHaveBlockOffer = NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!firstMessage) {
|
|
|
|
if (!firstMessage) {
|
|
|
|
shouldHaveAddToContactsOffer = NO;
|
|
|
|
shouldHaveAddToContactsOffer = NO;
|
|
|
|