mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 03:58:48 +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()
|
.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
|
return readableDatabase
|
||||||
.select(E164)
|
.select(E164)
|
||||||
.from(TABLE_NAME)
|
.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()
|
.run()
|
||||||
.readToSet { cursor ->
|
.readToSet { cursor ->
|
||||||
cursor.requireNonNullString(E164)
|
cursor.requireNonNullString(E164)
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
|||||||
|
|
||||||
val stopwatch = Stopwatch("contact-links")
|
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.")
|
Log.w(TAG, "No registeredE164s. Skipping.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
|||||||
SystemContactsRepository.addMessageAndCallLinksToContacts(
|
SystemContactsRepository.addMessageAndCallLinksToContacts(
|
||||||
context = context,
|
context = context,
|
||||||
config = buildContactLinkConfiguration(context, account),
|
config = buildContactLinkConfiguration(context, account),
|
||||||
targetE164s = registeredE164s,
|
targetE164s = e164sForLinking,
|
||||||
removeIfMissing = true
|
removeIfMissing = true
|
||||||
)
|
)
|
||||||
stopwatch.split("add-links")
|
stopwatch.split("add-links")
|
||||||
|
|||||||
Reference in New Issue
Block a user