Don't show new-user notification for first time contact syncs

This commit is contained in:
Michael Kirk 2019-06-14 11:36:23 -05:00
parent ddbdfd8fbd
commit 4a4f8a5e06

View File

@ -345,9 +345,22 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
if (isRegularlyScheduledRun) {
NSMutableSet<SignalRecipient *> *newSignalRecipients = [registeredRecipients mutableCopy];
[newSignalRecipients minusSet:existingRegisteredRecipients];
// Not for first time users
if (existingRegisteredRecipients.count > 0 && newSignalRecipients.count > 0) {
[OWSNewAccountDiscovery.shared discoveredNewRecipients:newSignalRecipients];
if (newSignalRecipients.count == 0) {
OWSLogInfo(@"No new recipients.");
} else {
__block NSSet<NSString *> *_Nullable lastKnownContactPhoneNumbers;
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
lastKnownContactPhoneNumbers =
[transaction objectForKey:OWSContactsManagerKeyLastKnownContactPhoneNumbers
inCollection:OWSContactsManagerCollection];
}];
if (lastKnownContactPhoneNumbers != nil && lastKnownContactPhoneNumbers.count > 0) {
[OWSNewAccountDiscovery.shared discoveredNewRecipients:newSignalRecipients];
} else {
OWSLogInfo(@"skipping new recipient notification for first successful contact sync.");
}
}
}