Fix issue where structured contact name syncing was delayed.

This commit is contained in:
Greyson Parrelli 2024-04-22 11:55:20 -04:00 committed by Cody Henthorne
parent f3669a5865
commit a64a02fa0c

View file

@ -11,10 +11,12 @@ import org.signal.core.util.Stopwatch
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.BuildConfig
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery
import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.jobmanager.Job
import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
import org.thoughtcrime.securesms.storage.StorageSyncHelper
import java.lang.Exception
/**
@ -71,6 +73,11 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
)
stopwatch.split("add-links")
// Adding links changes how certain structured name records are stored, so we need to re-sync to make sure we get the latest structured name
ContactDiscovery.syncRecipientInfoWithSystemContacts(context)
StorageSyncHelper.scheduleSyncForDataChange()
stopwatch.split("sync-contact-info")
stopwatch.stop(TAG)
} catch (e: RemoteException) {
Log.w(TAG, "[addSystemContactLinks] Failed to add links to contacts.", e)