mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 12:08:34 +00:00
Remove system contact links from undiscoverable contacts.
This commit is contained in:
@@ -3124,11 +3124,12 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||
.readToSingleBoolean()
|
||||
}
|
||||
|
||||
fun getRegisteredE164s(): Set<String> {
|
||||
/** All e164's that are eligible for having a signal link added to their system contact entry. */
|
||||
fun getE164sForSystemContactLinks(): Set<String> {
|
||||
return readableDatabase
|
||||
.select(E164)
|
||||
.from(TABLE_NAME)
|
||||
.where("$REGISTERED = ? and $HIDDEN = ? AND $E164 NOT NULL", RegisteredState.REGISTERED.id, Recipient.HiddenState.NOT_HIDDEN.serialize())
|
||||
.where("$REGISTERED = ? and $HIDDEN = ? AND $E164 NOT NULL AND $PHONE_NUMBER_DISCOVERABLE != ?", RegisteredState.REGISTERED.id, Recipient.HiddenState.NOT_HIDDEN.serialize(), PhoneNumberDiscoverableState.NOT_DISCOVERABLE)
|
||||
.run()
|
||||
.readToSet { cursor ->
|
||||
cursor.requireNonNullString(E164)
|
||||
|
||||
@@ -44,9 +44,9 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
||||
|
||||
val stopwatch = Stopwatch("contact-links")
|
||||
|
||||
val registeredE164s: Set<String> = SignalDatabase.recipients.getRegisteredE164s()
|
||||
val e164sForLinking: Set<String> = SignalDatabase.recipients.getE164sForSystemContactLinks()
|
||||
|
||||
if (registeredE164s.isEmpty()) {
|
||||
if (e164sForLinking.isEmpty()) {
|
||||
Log.w(TAG, "No registeredE164s. Skipping.")
|
||||
return
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
||||
SystemContactsRepository.addMessageAndCallLinksToContacts(
|
||||
context = context,
|
||||
config = buildContactLinkConfiguration(context, account),
|
||||
targetE164s = registeredE164s,
|
||||
targetE164s = e164sForLinking,
|
||||
removeIfMissing = true
|
||||
)
|
||||
stopwatch.split("add-links")
|
||||
|
||||
Reference in New Issue
Block a user